freeMXF.org

Open discussion about freeMXF.org tools and MXF in general
It is currently Thu Mar 28, 2024 5:37 pm
Board index » MXF Categories » freeMXF.org Tools



Post new topic Reply to topic  [ 3 posts ] 
Author
Search for:
Message

Offline
Board User

Joined: Mon Sep 10, 2007 1:46 pm
Posts: 12

Post Posted: Thu Oct 04, 2007 2:41 pm 
Top  
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?


Last edited by LY on Fri Oct 05, 2007 10:22 am, edited 1 time in total.
 Profile  

Offline
Board User

Joined: Mon Sep 10, 2007 1:46 pm
Posts: 12

Post Posted: Thu Oct 04, 2007 2:44 pm 
Top  
I use ReadFromFile(true) because I want to stop the process after a certain video frame has been found.

Using ReadFromFile() all KLVs in a partition will be parsed, how can I stop it after the wanted video frame has been found?

 Profile  

Offline
Board User

Joined: Mon Sep 10, 2007 1:46 pm
Posts: 12

Post Posted: Fri Oct 05, 2007 10:21 am 
Top  
I made it.
Just add Caller->StopReading() into VideoDataHandler::HandleData() than the process can be stopped.

 Profile  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

Jump to:  


Who is online

Users browsing this forum: No registered users and 70 guests

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group :: Style based on FI Subice by phpBBservice.nl :: All times are UTC