Skip navigation
|
|
|
Using a buffer instead of a file name
InitializationFor each buffer stream, you must initialize MediaInfo:MediaInfo::Open_Buffer_Init() Send dataWhen you have data to send to MediaInfo:MediaInfo::Open_Buffer_Continue(***The pointer to the buffer***, ***The buffer size***) Result:
FinalizeWhen you don't want to provide anymore data to MediaInfo, you must inform MediaInfo:MediaInfo::Open_Buffer_Finalize() Note: You must not do it if the buffer stream is not seekable. MediaInfo will do it itself. If the buffer stream is not seakableBy default, MediaInfo thinks that you can provide a seekable buffer stream. If you can't provide a seekable buffer stream, you must inform MediaInfo first:MediaInfo::Options("File_IsSeekable", "0") Note: In this case, you don't have to "Finalize" the parsing, MediaInfo thinks that the buffer stream is unlimitated and finalyze it as soon it has enough buffer. Basic exampleParse a buffer, provided by the user with 1316 byte chunks.//Preparing to fill MediaInfo with a buffer
MediaInfo MI;
MI.Open_Buffer_Init();
//The parsing loop
size_t From_Buffer_Size;
do
{
//Reading data somewhere, do what you want for this.
From_Buffer_Size=From.Read(From_Buffer, 1316);
//Sending the buffer to MediaInfo
if ((MI.Open_Buffer_Continue(From_Buffer, From_Buffer_Size)&0x02)==1) //Test bit 1 from the result
{
int64u File_GoTo=MI.(); //Retrieving where MediaInfo want we go into the stream.
... //The user must seek the stream.
}
}
while (From_Buffer_Size>0);
//Info
MI.Open_Buffer_Finalize();
MediaInfoLib::String Text=MI.Inform();
If the buffer stream is not seakableParse a buffer, provided by the user with 1316 byte chunks, and is non-seakable.//Setting MediaInfo as parsing a non seakable file
MediaInfo MI;
MI.Options(_T("File_IsSeekable"), _T("0"));
//Preparing to fill MediaInfo with a buffer
MI.Open_Buffer_Init();
//The parsing loop
size_t From_Buffer_Size;
do
{
//Reading data somewhere, do what you want for this.
From_Buffer_Size=From.Read(From_Buffer, 1316);
//Sending the buffer to MediaInfo
if (MI.Open_Buffer_Continue(From_Buffer, From_Buffer_Size)==0)
From_Buffer_Size=0; //Get out of the loop, no more data is needed by the parser
}
while (From_Buffer_Size>0);
//Info
MediaInfoLib::String Text=MI.Inform();
|
|||||||||||||||||||||||||||||||||||||||
| This page has not yet been translated, if you are interested to translate this page, please contact me | ||||||||||||||||||||||||||||||||||||||||
|
|
|