VideoPlayer.LoadFromMemorySyncForEAX method |
|
Remarks
Loads a video clip stored inside a memory buffer converting the audio track to Mono for use with EAX effects. In order to avoid a temporary freeze of the container application user interface, the loading is performed inside a secondary thread so, when this call will return, the video will not be still available: it's recommended triggering the SoundSyncLoaded event before making further calls for starting playback or for obtaining information about the loaded video.
Video loading and rendering is performed through DirectShow so, in order to load a certain video format (like MPEG, MP4, AVI, etc.) the specific codec must be available on the target system or calls to this method would fail. One of the best packages containing most audio and video codecs for DirectShow is K-Lite Codec Pack and can be downloaded for free from the following link.
IMPORTANT NOTE ABOUT CODECS AND WINDOWS 7: When dealing with Windows 7, also if you have installed K-Lite and configured ffdshow to manage a specific format (for example the MPEG-2 format or the H.264 format used in some MP4 video clip), DirectShow will continue using the default decoder named "Microsoft DTV-DVD Video Decoder": the quality of this decoder is quite poor and doesn't support the VMR-9 video renderer used for mixing/blending video clips so a call to this method could return back an error when the involved player has been added to a video mixer through the VideoPlayer.AttachToVideoMixer method; inside Appendix B you will find a few guidelines that could be of help in order to manage DirectShow configuration through K-Lite provided tools. |
A successful call to this method will fire the SoundLoaded event.
When using a media format different from MEMORY_MEDIA_FORMAT_UNKNOWN, it's very important that the memory buffer containing the video clip is not deallocated and/or moved until the video clip is not closed through the VideoPlayer.Close method: deallocating and/or moving the memory buffer during playback could crash the container application. When using the MEMORY_MEDIA_FORMAT_UNKNOWN media format, also if the memory buffer is copied into a temporary file, you should in any case wait for the SoundLoaded event before deallocating the buffer.
For further details about the use of the embedded video player see the VideoPlayer class section.
For details about video clips rendering refer to the How to play video files through DirectShow tutorial.
Syntax
[Visual Basic] Public Function LoadFromMemorySyncForEAX ( nPlayerIndex as Int16, pBuffer() as Byte, nBufferLength as Int32, nMediaFormat as enumMemoryMediaFormats ) as enumErrorCodes |
[C#] public enumErrorCodes LoadFromMemorySyncForEAX ( Int16 nPlayerIndex, byte[] pBuffer, Int32 nBufferLength, enumMemoryMediaFormats nMediaFormat ); |
[C++] public: enumErrorCodes LoadFromMemorySyncForEAX ( Int16 nPlayerIndex, unsigned char __gc[] pBuffer, Int32 nBufferLength, enumMemoryMediaFormats nMediaFormat ); |
Parameter |
Description |
|||||||||||||||
|
|
|||||||||||||||
nPlayerIndex |
Number representing the zero-based index of the player that will load the memory sound |
|||||||||||||||
pBuffer |
Buffer containing sound data |
|||||||||||||||
nBufferLen |
Length in bytes of the given buffer |
|||||||||||||||
nMediaFormat |
Media format of the video clip stored inside the memory buffer. Supported values are the following:
|
Return value
Value |
Meaning |
|
|
Negative value |
An error occurred (see the LastError property for further error details) |
enumErrorCodes.NOERROR (0) |
The method call was successful. |