Hi,
I use BodyReader to get video frames and wrote the code to test:
Code:
VideoDataHandler *pHandler = new VideoDataHandler(BodySID);
BodyReaderPtr BodyParser = new BodyReader(theFile);
BodyParser->MakeGCReader(BodySID);
GCReaderPtr ThisReader = BodyParser->GetGCReader(BodySID);
ThisReader->SetDataHandler(TrackNumber_v, pHandler);// I've got the video track number
for(;;)
{
cout<<"BodyParser->Tell(): "<<BodyParser->Tell()<<endl;
bool Result = BodyParser->ReadFromFile();
if(!Result)
{
if( BodyParser->Eof())
{
cout<<"End of file."<<endl;
break;
}
BodyParser->ReSync();
}
}
The HandleData() is simple:
Code:
bool VideoDataHandler::HandleData(GCReaderPtr Caller, KLVObjectPtr Object)
{
cout<<"In VideoDataHandler::HandleData"<<endl;
return true;
}
The problem is:
Using BodyParser->ReadFromFile() all video frame would be parsed.
Using BodyParser->ReadFromFile(true) the HandleData() will be called only once. Than "End of file."
Who can tell me why? Was the ReadFromFile(true) wrongly used here?