Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion. Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules. |
![]() |
#4281 | Link | |
Registered User
Join Date: Sep 2006
Posts: 1,426
|
Quote:
Code:
collected messages -> dummy vs filter -> inside dummy vs filter -> logMessage() |
|
![]() |
![]() |
![]() |
#4282 | Link |
I'm Siri
Join Date: Oct 2012
Location: Providence, RI
Posts: 2,509
|
yes,,,
__________________
If I got new ideas, will post here: https://github.com/IFeelBloated |
![]() |
![]() |
![]() |
#4284 | Link |
I'm Siri
Join Date: Oct 2012
Location: Providence, RI
Posts: 2,509
|
@Myrsloik
should I release *frameData instantly if an exception is thrown from the arAllFramesReady branch? or should I just leave it unhandled and expect it gets deleted when getFrame() is invoked again with arError? basically, this Code:
try { if (auto& ResourceHandle = reinterpret_cast<ResourceType*&>(*frameData); activationReason == arInitial) ResourceHandle = new auto{ FilterInstance->AcquireResources(...) }; else if (activationReason == arAllFramesReady) { auto ManagedResourceHandle = std::unique_ptr<ResourceType>{ ResourceHandle }; auto GeneratedFrame = FilterInstance->DrawFrame(*ManagedResourceHandle, ...); // if DrawFrame() throws an exception, *ResourceHandle is instantly released // by the destructor of std::unique_ptr return GeneratedFrame.ReleaseOwnership(); } else if (activationReason == arError) delete ResourceHandle; // possible double-free here? return nullptr; } catch (RuntimeError& ErrorMessage) { FrameContext.RaiseError(ErrorMessage); return nullptr; } Code:
try { if (auto& ResourceHandle = reinterpret_cast<ResourceType*&>(*frameData); activationReason == arInitial) ResourceHandle = new auto{ FilterInstance->AcquireResources(...) }; else if (activationReason == arAllFramesReady) { auto GeneratedFrame = FilterInstance->DrawFrame(*ResourceHandle, ...); // no leak if DrawFrame() throws an exception // *ResourceHandle will be released later from the arError branch delete ResourceHandle; return GeneratedFrame.ReleaseOwnership(); } else if (activationReason == arError) delete ResourceHandle; return nullptr; } catch (RuntimeError& ErrorMessage) { FrameContext.RaiseError(ErrorMessage); return nullptr; }
__________________
If I got new ideas, will post here: https://github.com/IFeelBloated |
![]() |
![]() |
![]() |
#4285 | Link |
Professional Code Monkey
Join Date: Jun 2003
Location: Ikea Chair
Posts: 2,279
|
You can't get an "exception" or error in arAllFramesReady. All frames are already successfully produced so I'm not sure what you're asking. And if there is an error arAllFramesReady won't be called, only arError, so obviously you should free the frameData there.
__________________
VapourSynth - proving that scripting languages and video processing isn't dead yet |
![]() |
![]() |
![]() |
#4286 | Link |
I'm Siri
Join Date: Oct 2012
Location: Providence, RI
Posts: 2,509
|
the exception is thrown from the user defined function DrawFrame() when for instance, a required frame property is missing from the input (basically any situation that involves setFilterError() in a C plugin).
__________________
If I got new ideas, will post here: https://github.com/IFeelBloated |
![]() |
![]() |
![]() |
#4287 | Link |
I'm Siri
Join Date: Oct 2012
Location: Providence, RI
Posts: 2,509
|
oh I see, I think I kinda get it now, so arError indicates error getting an input frame, not error in an attempt to generate an output frame, is that right?
__________________
If I got new ideas, will post here: https://github.com/IFeelBloated |
![]() |
![]() |
![]() |
#4288 | Link |
Professional Code Monkey
Join Date: Jun 2003
Location: Ikea Chair
Posts: 2,279
|
Exactly!
__________________
VapourSynth - proving that scripting languages and video processing isn't dead yet |
![]() |
![]() |
![]() |
#4289 | Link |
Registered User
Join Date: Sep 2006
Posts: 1,426
|
I have created a dummy filter and passed in a list from the script to the filter, but I couldn't figure out the right syntax to retrieve it in C.
script Code:
core.vsedit.Logger(["message 1", "message 2"]) Code:
static void VS_CC logger(VSMap* in, VSMap* out, void *userData, VSCore* core, const VSAPI* vsapi) { char messages[] = vsapi->propGetData(in, "name", 0, NULL); int i = 0; while (messages[i]) { vsapi->logMessage("WARNING", messages[i]); i++; } } VS_EXTERNAL_API(void) VapourSynthPluginInit(VSConfigPlugin configFunc, VSRegisterFunction registerFunc, VSPlugin* plugin) { configFunc("com.vsedit.logger", "vsedit", "VapourSynth Logger", VAPOURSYNTH_API_VERSION, 1, plugin); registerFunc("Logger", "name:data[]", &logger, 0, plugin); } |
![]() |
![]() |
![]() |
#4290 | Link |
I'm Siri
Join Date: Oct 2012
Location: Providence, RI
Posts: 2,509
|
Code:
auto logger(auto in, auto, auto, auto, auto vsapi) { for (auto x : Range{ vsapi->propNumElements(in, "name") }) vsapi->logMessage(VSMessageType::mtWarning, vsapi->propGetData(in, "name", x, nullptr)); }
__________________
If I got new ideas, will post here: https://github.com/IFeelBloated |
![]() |
![]() |
![]() |
#4291 | Link | |
I'm Siri
Join Date: Oct 2012
Location: Providence, RI
Posts: 2,509
|
Quote:
__________________
If I got new ideas, will post here: https://github.com/IFeelBloated |
|
![]() |
![]() |
![]() |
#4292 | Link | |
Registered User
Join Date: Sep 2006
Posts: 1,426
|
Quote:
|
|
![]() |
![]() |
![]() |
#4293 | Link |
Registered User
Join Date: Sep 2006
Posts: 1,426
|
I got the dummy filter printing messages now, but for some reason the logging module is not catching warnings on evaluation
Code:
import logging class MessageAbsorber(logging.Handler): def __init__(self, message_container): logging.Handler.__init__(self) self.messageContainer = message_container def emit(self, message_record): self.messageContainer += [message_record.getMessage()] WarningMessages = [] logging.captureWarnings(True) logging.getLogger('py.warnings').addHandler(MessageAbsorber(WarningMessages)) def get_warnings(): return WarningMessages import vapoursynth as vs core = vs.get_core() core2 = vs.get_core() core3 = vs.get_core() clip = core.dgdecodenv.DGSource(r'video.dgi') clip.set_output() core.vsedit.Logger(get_warnings()) Update: I think the reason for this is because vs disabled the warnings so they aren't even logged. Last edited by lansing; 12th February 2021 at 01:41. Reason: update |
![]() |
![]() |
![]() |
#4294 | Link |
I'm Siri
Join Date: Oct 2012
Location: Providence, RI
Posts: 2,509
|
@Myrsloik
Does the flags field of the VSVideoInfo object passed to setVideoInfo() partially determine the cache mode of the output node (along with the flags argument passed to createFilter()), or is it simply ignored?
__________________
If I got new ideas, will post here: https://github.com/IFeelBloated |
![]() |
![]() |
![]() |
#4295 | Link |
Professional Code Monkey
Join Date: Jun 2003
Location: Ikea Chair
Posts: 2,279
|
It's simply ignored and is filled out with the flags passed to createFilter()
__________________
VapourSynth - proving that scripting languages and video processing isn't dead yet |
![]() |
![]() |
![]() |
#4296 | Link |
Registered User
Join Date: Sep 2006
Posts: 1,426
|
What is the correct scenario for use of setting max cache size? I have a 1080i source with QTGMC(Preset='Medium'), setting max cache size to 4000 MB will give me a "script exceeded memory limit" warning, raising it to 12,000 MB will clear the warning, but there is no difference in speed on benchmark at 41 fps.
|
![]() |
![]() |
![]() |
#4297 | Link | |
I'm Siri
Join Date: Oct 2012
Location: Providence, RI
Posts: 2,509
|
Quote:
Code:
import logging import warnings class MessageAbsorber(logging.Handler): def __init__(self, MessageContainer): logging.Handler.__init__(self) self.MessageContainer = MessageContainer def emit(self, MessageRecord): self.MessageContainer += [MessageRecord.getMessage()] WarningMessages = [] warnings.simplefilter('always') logging.captureWarnings(True) logging.getLogger('py.warnings').addHandler(MessageAbsorber(WarningMessages)) # user script goes here core.vsedit.PrintWarnings(WarningMessages)
__________________
If I got new ideas, will post here: https://github.com/IFeelBloated |
|
![]() |
![]() |
![]() |
#4298 | Link |
I'm Siri
Join Date: Oct 2012
Location: Providence, RI
Posts: 2,509
|
@Myrsloik
could you add Code:
const char* getPluginName(VSPlugin*); const char* getPluginNamespace(VSPlugin*); const char* getPluginIdentifier(VSPlugin*); const char* getPluginFunctionArguments(VSPlugin*, const char* functionName);
__________________
If I got new ideas, will post here: https://github.com/IFeelBloated |
![]() |
![]() |
![]() |
Tags |
speed, vaporware, vapoursynth |
Thread Tools | Search this Thread |
Display Modes | |
|
|