Hello everyone,
I need a help. In fact, I beg you for helping me.
I spent all week trying to read data from file with bodyReaderPtr->ReadFromFile() function but it doesn't work.
I have to get JPEG2000 files from MXF file.
Could you help me, please?
I presented my code below. Maybe should I do it in another way?
I built mainProcess function:
Code:
int MXFManager ::mainProcess() {
MyGCReadHandler* myGCReadHandlerPtr = new MyGCReadHandler();
BodyReaderPtr bodyReaderPtr = new BodyReader(inFilePtr);
for( ; ; ) { // till readResult breaks the loop
UInt32 bodySID = bodyReaderPtr->GetBodySID();
cout << "bodySID: " << bodySID << endl;
cout << "MakeGCReader(bodySID): " << bodyReaderPtr->MakeGCReader(bodySID) << endl;
GCReaderPtr gcReaderPtr = bodyReaderPtr->GetGCReader(bodySID);
gcReaderPtr->SetDataHandler(bodySID);
cout << "Tell(): " << bodyReaderPtr->Tell() << endl;
inFilePtr->Seek(bodyReaderPtr->Tell());
bool readResult= bodyReaderPtr->ReadFromFile(); // CRASH!!!
cout << "readResult: " << readResult << endl;
if (!readResult) {
break;
}
bodyReaderPtr->ReSync();
}
return 0;
}
My HandleData is shown below.
Code:
// class MyGCReadHandler : GCReadHandler_Base
bool MyGCReadHandler ::HandleData(mxflib::GCReaderPtr Caller, mxflib::KLVObjectPtr Object){
cout << "MyGCReadHandler ::HandleData" << endl ;
return true;
}
Problems.
1. Program is crashed in line with:
bool readResult= gcReaderPtr->ReadFromFile();
2. I've read Ly's posts
http://www.freemxf.org/freemxf_board/vi ... 8420633da0I tried to do it the same he does. I called:
gcReaderPtr->SetDataHandler(bodySID,myGCReadHandlerPtr);
but compiler returns: "error C2243: 'type cast' : conversion from 'MyGCReadHandler *' to 'mxflib::IRefCount<T> *' exists, but is inaccessible".
So I call
3. I've read Matt's chapter in the MXF Book. I don't understand something.
On page 328 there are two examples with two for_each loops.
Code:
BodyReaderPtr BodyParser = new BodyReader(InFile);
for_each(BodySID) {
BodyParser->MakeGCReader(BodySID, DefaultHandler[BodySID]);
GCReaderPtr ThisReader = BodyParser->GetGCReader(BodySID);
for_each(TrackNumber in BodySID) {
ThisReader->SetDataHandler(TrackNumber, Handler[BodySID][TrackNumber]);
}
}
- "TrackNumber in BodySID" - I don't understand it. BodySID is UInt32 not table or list, isn't it? How to get BodySID and TrackNumber?
- How should I create DefaultHandler and Handler tables?
I don't know what it's wrong.
I'll be really grateful for explain me it.
Bernard