]> git.sesse.net Git - mlt/blobdiff - src/modules/kino/filehandler.cc
Fix bug parsing rect string with %.
[mlt] / src / modules / kino / filehandler.cc
index 3c8146d66df1a84c154324ba73584d00d9d14470..697c7e6c15a780b41f7e0882b45eb5cdd57bccf7 100644 (file)
@@ -23,7 +23,7 @@ extern "C" {
 #include <framework/mlt_frame.h>
 }
 
-#include <string>
+#include <cstring>
 #include <iostream>
 #include <sstream>
 #include <iomanip>
@@ -42,6 +42,7 @@ using std::setfill;
 #include <time.h>
 #include <sys/time.h>
 #include <string.h>
+#include <stdlib.h>
 
 // libdv header files
 #ifdef HAVE_LIBDV
@@ -116,6 +117,10 @@ FileHandler::FileHandler() : done( false ), autoSplit( false ), maxFrameCount( 9
                framesWritten( 0 ), filename( "" )
 {
        /* empty body */
+       timeStamp = 0;
+       everyNthFrame = 0;
+       framesToSkip = 0;
+       maxFileSize = 0;
 }
 
 
@@ -337,6 +342,7 @@ bool FileHandler::WriteFrame( const Frame& frame )
 RawHandler::RawHandler() : fd( -1 )
 {
        extension = ".dv";
+       numBlocks = 0;
 }
 
 
@@ -405,7 +411,8 @@ bool RawHandler::Open( const char *s )
                return false;
        if ( read( fd, data, 4 ) < 0 )
                return false;
-       lseek( fd, 0, SEEK_SET );
+       if ( lseek( fd, 0, SEEK_SET ) < 0 )
+               return false;
        numBlocks = ( ( data[ 3 ] & 0x80 ) == 0 ) ? 250 : 300;
        filename = s;
        return true;
@@ -437,6 +444,7 @@ AVIHandler::AVIHandler( int format ) : avi( NULL ), aviFormat( format ), isOpenD
        extension = ".avi";
        for ( int c = 0; c < 4; c++ )
                audioChannels[ c ] = NULL;
+       memset( &dvinfo, 0, sizeof( dvinfo ) );
 }
 
 
@@ -504,14 +512,14 @@ bool AVIHandler::Create( const string& filename )
 
        case AVI_DV1_FORMAT:
                fail_null( avi = new AVI1File );
-               if ( avi->Create( filename.c_str() ) == false )
+               if ( !avi || avi->Create( filename.c_str() ) == false )
                        return false;
                //avi->Init( videoInfo.isPAL ? AVI_PAL : AVI_NTSC, audioInfo.frequency, AVI_LARGE_INDEX );
                break;
 
        case AVI_DV2_FORMAT:
                fail_null( avi = new AVI2File );
-               if ( avi->Create( filename.c_str() ) == false )
+               if ( !avi || avi->Create( filename.c_str() ) == false )
                        return false;
                //if ( GetOpenDML() )
                        //avi->Init( videoInfo.isPAL ? AVI_PAL : AVI_NTSC, audioInfo.frequency,
@@ -872,7 +880,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 );