Copy link to clipboard
Dear community teams, I would be very appreciated for your suggestion in AE plugin implementation. I'm develop my custom plugin with some number of controls (popups and checkboxes). In corresponding to state and value selected by user in these controls, inside of my plugin should be cretaed C++ class for create interface to algorithm module for frame sequence processing. If the control element changed by user (for example check-box unselected or selected other element in the popup) the previous C++ algorithm interface should be deleted (destructor should be called for avoid memory leaks) and new interface object should be created. Unfortunately I don't clearly understood how to implement it. Because on call of the PF_Cmd_SEQUENCE_SETUP API - when the handle of the Sequence Data may allocated and initialized and attached to the out_data structure, the parameters array PF_ParamDef *params has zero pointer and values from control elements can't be acquired in this function. From other side the control elements may be easy acquired on PF_Cmd_USER_CHANGED_PARAM, but I'm not sure about allocation/initialization of the sequence data allowed in this command selector. Unfortunately the AE SDK examples doesn't show this case with C++ object construction and destroying in corresponding to the filter controls values.
Copy link to clipboard
i had a hard time following the description...
what exactly is your "algorithm interface"?
is it a class?
when is it used? (i.e. for rendering or for custom UI?)
should it be stored for the duration of the session, or with the project file?
Thank you for reply. Yes, probably my description unclear. I'm speaking about Filter - image/video processing.
Yes, this is C++ class, actually instance of the one class from bunch of possible type of classes.
For example, I have number of possible C++ objects (classes) - Algo1, Algo2, Algo3, ... AlgoN. What kind of "Algo" type should be created is defined by user setting, by Plugin controls - checkboxes and pop-ups. When user apply this filter to the video sequence the C++ object should be created in coreesponding to the Plugin control setting and "associated" with ths sequence. Let's say the user aplly my filter and Algo1 object was created and "associated" with the sequence. When the user change the setting, select other item inside of popup, the previous object (Algo1) should be destrcuted, and new (for example Algo2) should be created and associated with the sequence. Render should using correct C++ object - Algo2.
My problem is following: I don't known how to detect when destruct this C++ class (Algo1) for avoid resource leaks? I payed attention, from reason non understandable by me the PF_Cmd_SEQUENCE_SETDOWN called twice on one switch of the control param and on second call I got an exception because object already destroyed. And additional: unfortunately, on call of the PF_Cmd_SEQUENCE_SETUP event API - the param array has zero pointer and I can't acquire the user setting in this event.
quick addendum - "possible C++ objects" - meaning number of the processing parameters variants
take a look at tobias fleischer's guide to sequence data. if the problem persists after implementing his reccomendataions, we'll try to figure out what's going wrong.
Thank you a lot for sharing the DOC.
Interesting - what happens if the same Effect/Filter will be applyed twice to same video sequence? Is same sequenceData will be used for first and for second instance of the Filter, or separate?
Exist any way on Renedring stage at time of frame processing detect what kind of instance used - first or second?
each instance has it's own independent sequence data, even when applied to the same layer. that instance-specific data follows the instance wherever it goes, regardless of it's index in the layer's effect stack.
if you need to tell during render time whether your effect is first or second of the same effect on a layer, you can scan the layer for it's applied effects to check for instances of your effect, and also get your effect's index by:
1. get the first params AEGP_StreamRef.
2. get that stream's parent stream with AEGP_GetNewParentStreamRef. that would be the effect's stream ref.
3. get the effect's stream index with AEGP_GetStreamIndexInParent. that's the specific instance's index in the layer effect stack.