freeMXF.org

Open discussion about freeMXF.org tools and MXF in general
It is currently Thu Mar 28, 2024 9:32 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 Oct 22, 2007 1:43 pm
Posts: 9

Post Posted: Mon Oct 22, 2007 2:16 pm 
Top  
Hi,

I’m currently working on a project where I should write a dll that allows us to extract metadata from an MXF file. This dll should be accessed by an application written in c#.
I’ve written a wrapper around mxflib in c++ to retrieve the requested information and I’ve also provided a function that can be accessed from the c# application.
To test the library I’ve written a small application in c++ that calls this function and dumps the output to stdout. This application works as expected.
When I try to do the same from within c# I receive an error:

System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.


I’ve traced it down ( it occurs in the ScanRIP() function) to the line

mxffile.h line 395

Code:
template<class TP, class T> /*inline*/ TP mxflib::MXFFile__ReadObjectBase(MXFFilePtr This, PrimerPtr UsePrimer /*=NULL*/)
{
   TP Ret;

   UInt64 Location = This->Tell();
   ULPtr Key = This->ReadKey();

   // If we couldn't read the key then bug out
   if(!Key) return Ret;

   // Build the object (it may come back as an "unknown")
395:   Ret = new T(Key);


Where T is a Partition. So it happens during the contruction of a Partition Object.

My code (simplified) is:

Code:
extern "C" __declspec(dllexport) _mxfdata Getmxfdata(char* filepath)
{
   MXFFilePtr mxfFile = new MXFFile();
   mxfdata_t mxfData;
   
#ifdef COMPILED_DICT
   LoadDictionary(DictData);
#else
   LoadDictionary("dict.xml");
#endif
   

   if (!mxfFile->Open(filepath, true))
   {
      perror(filepath);
      error("Unable to open file\n");
      exit(1);
   }

   mxfFile->GetRIP();

   …

   return mxfData;
}


Has anyone else tried the same?
Does someone have an idea on what could be the culprit of my problem?


Thanks,
P.

 Profile  

Offline
Board User

Joined: Mon Oct 22, 2007 1:43 pm
Posts: 9

Post Posted: Mon Oct 22, 2007 3:19 pm 
Top  
I found the answer to my problem (took me the better part of a day to find it due to the clear error description :( ).
I retraced my steps an I found I forgot to copy the dict.xml file to my application directory.
My dll works like a charm now. :D
Thanks for providing us with this wonderfull library.

 Profile  

Offline
Rookie

Joined: Thu Jul 28, 2011 12:03 pm
Posts: 1

Post Posted: Thu Jul 28, 2011 12:32 pm 
Top  
Dear Sir,

Is it possible to receive your DLL and source code. :idea:

I want to do an MXF project but I don't know c++ :shock:

Many thanks,

 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 74 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
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group :: Style based on FI Subice by phpBBservice.nl :: All times are UTC