X-Git-Url: http://research.m1stereo.tv/gitweb?a=blobdiff_plain;f=src%2Fmodules%2Fdv%2Fproducer_libdv.c;h=7a0c16bc1e258efc7145997f822471a9ebccd4b6;hb=4c96cb2b639338d6308dd473983b9b4cbb9e27c9;hp=f356ffae111e087640ef53d8ff005712f0aef6ca;hpb=c287a51b7a4c2cc437256c178a5eb2e7775d34fa;p=melted diff --git a/src/modules/dv/producer_libdv.c b/src/modules/dv/producer_libdv.c index f356ffa..7a0c16b 100644 --- a/src/modules/dv/producer_libdv.c +++ b/src/modules/dv/producer_libdv.c @@ -139,7 +139,7 @@ mlt_producer producer_libdv_init( char *filename ) mlt_properties properties = mlt_producer_properties( producer ); // Register transport implementation with the producer - producer->close = producer_close; + producer->close = ( mlt_destructor )producer_close; // Register our get_frame implementation with the producer producer->get_frame = producer_get_frame; @@ -169,15 +169,15 @@ mlt_producer producer_libdv_init( char *filename ) static int read_frame( int fd, uint8_t* frame_buf, int *isPAL ) { - int result = read( fd, frame_buf, frame_size_525_60 ) == frame_size_525_60; + int result = read( fd, frame_buf, FRAME_SIZE_525_60 ) == FRAME_SIZE_525_60; if ( result ) { *isPAL = ( frame_buf[3] & 0x80 ); if ( *isPAL ) { - int diff = frame_size_625_50 - frame_size_525_60; - result = read( fd, frame_buf + frame_size_525_60, diff ) == diff; + int diff = FRAME_SIZE_625_50 - FRAME_SIZE_525_60; + result = read( fd, frame_buf + FRAME_SIZE_525_60, diff ) == diff; } } @@ -188,7 +188,7 @@ static int producer_collect_info( producer_libdv this ) { int valid = 0; - uint8_t *dv_data = mlt_pool_alloc( frame_size_625_50 ); + uint8_t *dv_data = mlt_pool_alloc( FRAME_SIZE_625_50 ); if ( dv_data != NULL ) { @@ -212,7 +212,7 @@ static int producer_collect_info( producer_libdv this ) this->file_size = buf.st_size; // Determine the frame size - this->frame_size = this->is_pal ? frame_size_625_50 : frame_size_525_60; + this->frame_size = this->is_pal ? FRAME_SIZE_625_50 : FRAME_SIZE_525_60; // Determine the number of frames in the file this->frames_in_file = this->file_size / this->frame_size; @@ -221,9 +221,12 @@ static int producer_collect_info( producer_libdv this ) double fps = this->is_pal ? 25 : 30000.0 / 1001.0; 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 ); + if ( this->frames_in_file > 0 ) + { + 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 { @@ -384,7 +387,7 @@ static int producer_get_audio( mlt_frame this, int16_t **buffer, mlt_audio_forma static int producer_get_frame( mlt_producer producer, mlt_frame_ptr frame, int index ) { producer_libdv this = producer->child; - uint8_t *data = mlt_pool_alloc( frame_size_625_50 ); + uint8_t *data = mlt_pool_alloc( FRAME_SIZE_625_50 ); // Obtain the current frame number uint64_t position = mlt_producer_frame( producer ); @@ -407,7 +410,7 @@ static int producer_get_frame( mlt_producer producer, mlt_frame_ptr frame, int i dv_decoder_t *dv_decoder = dv_decoder_alloc( ); // Pass the dv data - mlt_properties_set_data( properties, "dv_data", data, frame_size_625_50, ( mlt_destructor )mlt_pool_release, NULL ); + mlt_properties_set_data( properties, "dv_data", data, FRAME_SIZE_625_50, ( mlt_destructor )mlt_pool_release, NULL ); // Update other info on the frame mlt_properties_set_int( properties, "width", 720 );