Skip to main content
babichfx
Inspiring
October 26, 2022
Answered

Is that a good way to get arb data via sterams?

  • October 26, 2022
  • 1 reply
  • 195 views

AEGP_StreamValue2 streamVal;
AEGP_EffectRefH effectH = NULL;
AEGP_StreamRefH streamH = NULL;
A_Time timeCompForCurrentFrame = {0,1};

 

//get effect, stream and value
ERR(suites.PFInterfaceSuite1()->AEGP_GetNewEffectForEffect(G_my_plugin_id, in_data->effect_ref, &effectH));
ERR(suites.StreamSuite5()->AEGP_GetNewEffectStreamByIndex(G_my_plugin_id, effectH, PARM_ARB, &streamH));
ERR(suites.StreamSuite5()->AEGP_GetNewStreamValue(G_my_plugin_id, streamH, AEGP_LTimeMode_CompTime, &timeCompForCurrentFrame, TRUE, &streamVal));

 

//now I have a handle to arb data

//is the way below good or not for get an arb data from handle?

PF_Handle arbH = reinterpret_cast<PF_Handle>(streamVal.val.arbH);
arbData *arbP = reinterpret_cast<arbDataP>(suites.HandleSuite1()->host_lock_handle(arbH));

 

suites.StreamSuite5()->AEGP_DisposeStreamValue(&streamVal);

if (streamH) suites.StreamSuite2()->AEGP_DisposeStream(streamH);
if (effectH) suites.EffectSuite2()->AEGP_DisposeEffect(effectH);

 

So the question is about a part where I took the arbData from stream.val.arbH. Is it a good way?

Do we have any other ways, maybe some suites to extract instead to reinterpret it?

The purpos of my question just to do it in a better and safer way.

This topic has been closed for replies.
Correct answer shachar carmi

yes, that is the correct way. just make sure to either be done with the data before you release the stream value, or copy it before releasing. otherwise you're dealing with a pointer that might be invalidated during use.

1 reply

shachar carmiCommunity ExpertCorrect answer
Community Expert
October 26, 2022

yes, that is the correct way. just make sure to either be done with the data before you release the stream value, or copy it before releasing. otherwise you're dealing with a pointer that might be invalidated during use.