Merge ../mlt
[melted] / src / modules / kino / filehandler.cc
index dc57a30..e5e552c 100644 (file)
@@ -41,6 +41,8 @@ using std::setfill;
 #include <assert.h>
 #include <time.h>
 #include <sys/time.h>
+#include <string.h>
+#include <stdlib.h>
 
 // libdv header files
 #ifdef HAVE_LIBDV
@@ -697,6 +699,19 @@ bool AVIHandler::GetOpenDML() const
 #define DV_AUDIO_MAX_SAMPLES 1944
 #endif
 
+// Missing fourcc's in libquicktime (allows compilation)
+#ifndef QUICKTIME_DV_AVID
+#define QUICKTIME_DV_AVID "AVdv"
+#endif
+
+#ifndef QUICKTIME_DV_AVID_A
+#define QUICKTIME_DV_AVID_A "dvcp"
+#endif
+
+#ifndef QUICKTIME_DVCPRO
+#define QUICKTIME_DVCPRO "dvpp"
+#endif
+
 QtHandler::QtHandler() : fd( NULL )
 {
        extension = ".mov";
@@ -843,7 +858,7 @@ int QtHandler::Close()
 off_t QtHandler::GetFileSize()
 {
        struct stat file_status;
-       fstat( fileno( fd->stream ), &file_status );
+       stat( filename.c_str(), &file_status );
        return file_status.st_size;
 }
 
@@ -858,7 +873,7 @@ bool QtHandler::Open( const char *s )
 {
        Init();
 
-       fd = quicktime_open( ( char * ) s, 1, 0 );
+       fd = quicktime_open( s, 1, 0 );
        if ( fd == NULL )
        {
                fprintf( stderr, "Error opening: %s\n", s );
@@ -875,7 +890,8 @@ bool QtHandler::Open( const char *s )
        char * fcc = quicktime_video_compressor( fd, 0 );
        if ( strncmp( fcc, QUICKTIME_DV, 4 ) != 0 &&
             strncmp( fcc, QUICKTIME_DV_AVID, 4 ) != 0 &&
-            strncmp( fcc, QUICKTIME_DV_AVID_A, 4 ) != 0 )
+            strncmp( fcc, QUICKTIME_DV_AVID_A, 4 ) != 0 && 
+            strncmp( fcc, QUICKTIME_DVCPRO, 4 ) != 0 )
        {
                Close();
                return false;