X-Git-Url: http://research.m1stereo.tv/gitweb?a=blobdiff_plain;f=mlt%2Fsrc%2Fmodules%2Fdv%2Fproducer_libdv.c;h=c2921e3de955c792ae4d12cfdd93db3563f27ab7;hb=9390e8b584f3f717f0a326893c0e37cf187a0a51;hp=2972d8a0de9f4298e3f57d84bad18c34592b2d58;hpb=f2892649fc37814798758ad2da2bee85b17e2366;p=melted diff --git a/mlt/src/modules/dv/producer_libdv.c b/mlt/src/modules/dv/producer_libdv.c index 2972d8a..c2921e3 100644 --- a/mlt/src/modules/dv/producer_libdv.c +++ b/mlt/src/modules/dv/producer_libdv.c @@ -51,9 +51,10 @@ mlt_producer producer_libdv_init( char *filename ) { producer_libdv this = calloc( sizeof( struct producer_libdv_s ), 1 ); - if ( this != NULL && mlt_producer_init( &this->parent, this ) == 0 ) + if ( filename != NULL && this != NULL && mlt_producer_init( &this->parent, this ) == 0 ) { mlt_producer producer = &this->parent; + mlt_properties properties = mlt_producer_properties( producer ); // Register transport implementation with the producer producer->close = producer_close; @@ -68,11 +69,11 @@ mlt_producer producer_libdv_init( char *filename ) dv_set_audio_correction( this->dv_decoder, DV_AUDIO_CORRECT_AVERAGE ); // Open the file if specified - if ( filename != NULL ) - { - this->fd = open( filename, O_RDONLY ); - producer_collect_info( this ); - } + this->fd = open( filename, O_RDONLY ); + producer_collect_info( this ); + + // Set the resource property (required for all producers) + mlt_properties_set( properties, "resource", filename ); // Return the producer return producer; @@ -131,7 +132,6 @@ static int producer_collect_info( producer_libdv this ) double fps = this->is_pal ? 25 : 30000 / 1001; mlt_timecode length = ( mlt_timecode )( this->frames_in_file ) / fps; mlt_properties_set_double( properties, "fps", fps ); - mlt_properties_set_timecode( properties, "playtime", length ); mlt_properties_set_timecode( properties, "length", length ); mlt_properties_set_timecode( properties, "in", 0.0 ); mlt_properties_set_timecode( properties, "out", length ); @@ -164,9 +164,6 @@ static int producer_get_image( mlt_frame this, uint8_t **buffer, mlt_image_forma *width = mlt_properties_get_int( properties, "width" ); *height = mlt_properties_get_int( properties, "height" ); - // Parse the header - dv_parse_header( decoder, dv_data ); - // Extract an image of the format requested if ( *format == mlt_image_yuv422 ) { @@ -219,9 +216,6 @@ static int producer_get_audio( mlt_frame this, int16_t **buffer, mlt_audio_forma // Get the dv data uint8_t *dv_data = mlt_properties_get_data( properties, "dv_data", NULL ); - // Parse the header for meta info - dv_parse_header( decoder, dv_data ); - // Obtain required values *frequency = decoder->audio->frequency; *samples = decoder->audio->samples_this_frame; @@ -284,6 +278,12 @@ static int producer_get_frame( mlt_producer producer, mlt_frame_ptr frame, int i // Update other info on the frame mlt_properties_set_int( properties, "width", 720 ); mlt_properties_set_int( properties, "height", this->is_pal ? 576 : 480 ); + mlt_properties_set_int( properties, "top_field_first", 0 ); + + // Parse the header for meta info + dv_parse_header( this->dv_decoder, data ); + mlt_properties_set_int( properties, "progressive", dv_is_progressive( this->dv_decoder ) ); + mlt_properties_set_double( properties, "display_aspect", dv_format_wide( this->dv_decoder ) ? 16.0/9.0 : 4.0/3.0 ); // Hmm - register audio callback ( *frame )->get_audio = producer_get_audio;