Copy link to clipboard
Copied
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Copy link to clipboard
Copied
I have the following code, and it fails all the time:
AEGP_StreamVal2 stream_valP;
AEFX_CLR_STRUCT(stream_valP);
A_Time inPoint = {0,0}, layerDuration = {0,0};
ERR( suites.LayerSuite7()->AEGP_GetLayerInPoint(layerH, AEGP_LTimeMode_CompTime, &inPoint) );
ERR( suites.LayerSuite7()->AEGP_GetLayerDuration(layerH, AEGP_LTimeMode_CompTime, &layerDuration) );
AEGP_CompH comp = NULL;
ERR( suites.LayerSuite7()->AEGP_GetLayerParentComp(layerH, &comp) );
A_FpLong fps = 0.0;
ERR( suites.CompSuite8()->AEGP_GetCompFramerate(comp, &fps) );
A_u_long interval = static_cast< A_u_long >(static_cast< A_FpLong >(layerDuration.scale) / fps);
for (A_Time timeT = inPoint; stream_valP.text_documentH == NULL || *stream_valP.text_documentH == NULL || inPoint.value * layerDuration.scale == layerDuration.value * inPoint.scale; timeT.value += interval) {
AEGP_StreamType stream_type = AEGP_StreamType_TEXT_DOCUMENT;
AEGP_MemHandle unicodePH = NULL;
A_u_short *stringValue = NULL;
AEFX_CLR_STRUCT(stream_valP);
ERR(suites.StreamSuite4()->AEGP_GetLayerStreamValue(layerH,
AEGP_LayerStream_SOURCE_TEXT,
AEGP_LTimeMode_CompTime,
&timeT,
TRUE,
&stream_valP,
&stream_type));
};
if (stream_valP.text_documentH != NULL && *stream_valP.text_documentH != NULL) {
AEGP_MemHandle my_cool_textH = NULL;
ERR(suites.TextDocumentSuite1()->AEGP_GetNewText(pluginId, stream_valP.text_documentH, &my_cool_textH));
wchar_t *ch = NULL;
ERR(suites.MemorySuite1()->AEGP_LockMemHandle(my_cool_textH, (void **)&ch));
std::wstring tmp = ch;
ERR(suites.MemorySuite1()->AEGP_UnlockMemHandle(my_cool_textH));
ERR(suites.MemorySuite1()->AEGP_FreeMemHandle(my_cool_textH));
}
Edit:
I get: Unhandled exception at 0x00000000060C6342 (U.dll) in AfterFX.exe: 0xC0000005: Access violation reading location 0xFFFFFFFFFFFFFFFF, and that happens on the line:
ERR(suites.TextDocumentSuite1()->AEGP_GetNewText(pluginId, stream_valP.text_documentH, &my_cool_textH));
Copy link to clipboard
Copied
wchar_t* res16B;
ERR(suites.TextDocumentSuite1()->AEGP_GetNewText(S_my_id, val.val.text_documentH, &memH));
ERR(suites.MemorySuite1()->AEGP_LockMemHandle( memH, reinterpret_cast<void**>(&res16B)));
....
ERR(suites.MemorySuite1()->AEGP_UnlockMemHandle(memH));
ERR(suites.MemorySuite1()->AEGP_FreeMemHandle(memH));
Found here,
Solved: Convert A_UTF16Char to Standard String - Adobe Support Community - 10539987