freeMXF.org
http://freemxf.org/forum/

Sony MPEG4 decoder / mxflib conflict
http://freemxf.org/forum/viewtopic.php?f=2&t=165
Page 1 of 1

Author:  paulpopa [ Mon Nov 10, 2008 9:41 pm ]
Post subject:  Sony MPEG4 decoder / mxflib conflict

Hi,

I'm trying to use both libraries in the same project, but sonymvd4.dll seems to interfere with mxflib.

My application crashes when it calls MXFFile::Open() which calls ReadRunIn() which calls Seek(0).

If I don't instantiate the TFileAccess class or I include the mxflib.h in a .cpp file instead of a .h file, then everything works fine.

Does anyone know anything about an incompatibility between these two libraries?

Thanks,
Paul

Author:  Matt Beard [ Wed Nov 19, 2008 7:36 pm ]
Post subject: 

This is a very interesting error.

This could possibly be due to an incompatibility between the different file-io systems available. By default MXFLib uses low-level I/O rather than the more normal stream I/O when compiled with Visual Studio. This is because it has support for > 4GByte files in earlier versions of the compiler.

Try adding the following section to system.h (roughly line 234) in place of the normal versions:

Code:
#ifndef MXFLIB_NO_FILE_IO
   typedef FILE *FileHandle;
   inline int FileSeek(FileHandle file, UInt64 offset) { return _fseeki64(file, offset, SEEK_SET); }
   inline int FileSeekEnd(FileHandle file) { return _fseeki64(file, 0, SEEK_END); }
   inline size_t FileRead(FileHandle file, unsigned char *dest, size_t size) { return fread(dest, 1, size, file); }
   inline size_t FileWrite(FileHandle file, const unsigned char *source, size_t size) { return fwrite(source, 1, size, file); }
   inline int FileGetc(FileHandle file) { UInt8 c; return (FileRead(file, &c, 1) == 1) ? (int)c : EOF; }
   inline FileHandle FileOpen(const char *filename) { return fopen(filename, "r+b" ); }
   inline FileHandle FileOpenRead(const char *filename) { return fopen(filename, "rb" ); }
   inline FileHandle FileOpenNew(const char *filename) { return fopen(filename, "w+b"); }
   inline bool FileValid(FileHandle file) { return (file != NULL); }
   inline bool FileEof(FileHandle file) { return feof(file) ? true : false; }
   inline UInt64 FileTell(FileHandle file) { return _ftelli64(file); }
   inline void FileClose(FileHandle file) { fclose(file); }
   inline bool FileExists(const char *filename) { struct stat buf; return stat(filename, &buf) == 0; }
#endif //MXFLIB_NO_FILE_IO

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/