X-Git-Url: http://research.m1stereo.tv/gitweb?a=blobdiff_plain;f=src%2Fmodules%2Fdv%2Fproducer_libdv.c;h=5f9e9623933da885d76bddfd857535bd8b8050b1;hb=6159bd78fa8e72c784747776a2c4c63d9c461ff5;hp=3da5de384233f65f65540053a4540547c15251ab;hpb=978543a20e47302b82bc29007852bff8180031c2;p=melted diff --git a/src/modules/dv/producer_libdv.c b/src/modules/dv/producer_libdv.c index 3da5de3..5f9e962 100644 --- a/src/modules/dv/producer_libdv.c +++ b/src/modules/dv/producer_libdv.c @@ -70,10 +70,19 @@ mlt_producer producer_libdv_init( char *filename ) // Open the file if specified this->fd = open( filename, O_RDONLY ); - producer_collect_info( this ); - // Set the resource property (required for all producers) - mlt_properties_set( properties, "resource", filename ); + // Collect info + if ( this->fd != -1 && producer_collect_info( this ) ) + { + // Set the resource property (required for all producers) + mlt_properties_set( properties, "resource", filename ); + } + else + { + // Reject this file + mlt_producer_close( producer ); + producer = NULL; + } // Return the producer return producer; @@ -130,10 +139,16 @@ static int producer_collect_info( producer_libdv this ) // Calculate default in/out points double fps = this->is_pal ? 25 : 30000.0 / 1001.0; - mlt_properties_set_double( properties, "fps", fps ); - mlt_properties_set_position( properties, "length", this->frames_in_file ); - mlt_properties_set_position( properties, "in", 0 ); - mlt_properties_set_position( properties, "out", this->frames_in_file - 1 ); + if ( mlt_properties_get_double( properties, "fps" ) == fps ) + { + mlt_properties_set_position( properties, "length", this->frames_in_file ); + mlt_properties_set_position( properties, "in", 0 ); + mlt_properties_set_position( properties, "out", this->frames_in_file - 1 ); + } + else + { + valid = 0; + } // Parse the header for meta info dv_parse_header( this->dv_decoder, dv_data ); @@ -321,7 +336,7 @@ static void producer_close( mlt_producer parent ) //dv_decoder_free( this->dv_decoder ); // Close the file - if ( this->fd != 0 ) + if ( this->fd > 0 ) close( this->fd ); // Close the parent