How to recover a media info from Media Index?
-
I am coding a plugin for windows that essentially reproduce a movie file or an audio file with control on output channels. (This feature is not yet available natively on Isadora on Windows, I am using free external libraries for this, libsndfile, ffmpeg and portaudio for the sound processing)
For this I need at some moment to recover the MediaInfo struct from the media index in media window that is the first user input. I think I should use the GetMediaObjectInfo_ function as follows
info->isMovie=GetMediaObjectInfo_(ip,inControlInfo,kMediaTypeMovie,info->mSoundNumber,info->outName,true,info->outImage,NULL)
info->isAudio=GetMediaObjectInfo_(ip,inControlInfo,kMediaTypeAudio,info->mSoundNumber,info->outName,false,info->outImage,NULL)where info is of the type PluginInfo, mSoundNumber is of type integer and represents index number into the Media Window, isMovie, isAudio are booleans, outImage is an ImageBufferPtr that will be send to the output if IsMovie is true.
But I can't figure out what is the parameter inControlInfo, more precisely, is it already defined somewhere, at least partially? Can I get some default ControlInfo from somewhere just in order to use the GetMediaObjectInfo function? Should I define a function called GetControlInfo_() or a cast somewhere? In the ControlInfo struct definition there is a lot of required fields but none of them is written in the DemoPlugin, so I am a bit lost and any help is welcome.
[Edit] Also, I would like to know if outName will be the whole path to the file or just the name of the file.
[Edit] Ok, I think I figured this out, I can recover the info about the media with the ExecuteMediaCommand_() function by passing command kMediaGetName to obtain the name of the file I want to play the sound with an external library, and command kMediaGetImageBuffer to obtain its imagebuffer to pass on. Like this
ExecuteMediaCommand_(ip,inActorInfo,inActorInfo->mID,kMediaGetName,kMediaTypeAudio,info->mSoundNumber,p1,256);
ExecuteMediaCommand_(ip,inActorInfo,inActorInfo->mID,kMediaGetName,kMediaTypeAudio,info->mSoundNumber,p1,256);