mlt_producer producer_libdv_init( mlt_profile profile, mlt_service_type type, const char *id, char *filename )
{
- producer_libdv this = calloc( sizeof( struct producer_libdv_s ), 1 );
+ producer_libdv this = calloc( 1, sizeof( struct producer_libdv_s ) );
if ( filename != NULL && this != NULL && mlt_producer_init( &this->parent, this ) == 0 )
{
// If it looks like a valid frame, the get stats
if ( valid )
{
+ double aspect_ratio;
+
// Get the properties
mlt_properties properties = MLT_PRODUCER_PROPERTIES( &this->parent );
// Parse the header for meta info
dv_parse_header( dv_decoder, dv_data );
- mlt_properties_set_double( properties, "aspect_ratio",
- dv_format_wide( dv_decoder ) ? ( this->is_pal ? 118.0/81.0 : 40.0/33.0 ) : ( this->is_pal ? 59.0/54.0 : 10.0/11.0 ) );
- mlt_properties_set_double( properties, "source_fps", this->is_pal ? 25 : ( 30000.0 / 1001.0 ) );
+ if ( this->is_pal )
+ {
+ if ( dv_format_wide( dv_decoder ) )
+ aspect_ratio = 64.0 / 45.0;
+ else
+ aspect_ratio = 16.0 / 15.0;
+ }
+ else
+ {
+ if ( dv_format_wide( dv_decoder ) )
+ aspect_ratio = 32.0 / 27.0;
+ else
+ aspect_ratio = 8 / 9;
+ }
+ mlt_properties_set_double( properties, "aspect_ratio", aspect_ratio);
mlt_properties_set_int( properties, "meta.media.nb_streams", 2 );
mlt_properties_set_int( properties, "video_index", 0 );
mlt_properties_set( properties, "meta.media.0.stream.type", "video" );
mlt_properties_set( properties, "meta.media.1.stream.type", "audio" );
mlt_properties_set( properties, "meta.media.1.codec.name", "pcm_s16le" );
mlt_properties_set( properties, "meta.media.1.codec.long_name", "signed 16-bit little-endian PCM" );
+ mlt_properties_set_int( properties, "meta.media.width", 720 );
+ mlt_properties_set_int( properties, "meta.media.height", this->is_pal ? 576 : 480 );
+ mlt_properties_set_int( properties, "meta.media.frame_rate_num", this->is_pal? 25 : 30000 );
+ mlt_properties_set_int( properties, "meta.media.frame_rate_den", this->is_pal? 1 : 1001 );
// Return the decoder
dv_decoder_return( dv_decoder );
*height = dv_data[ 3 ] & 0x80 ? 576 : 480;
// Extract an image of the format requested
- if ( *format == mlt_image_yuv422 || *format == mlt_image_yuv420p )
+ if ( *format != mlt_image_rgb24 )
{
// Allocate an image
uint8_t *image = mlt_pool_alloc( *width * ( *height + 1 ) * 2 );
// 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, "real_width", 720 );
- mlt_properties_set_int( properties, "real_height", this->is_pal ? 576 : 480 );
mlt_properties_set_int( properties, "top_field_first", !this->is_pal ? 0 : ( data[ 5 ] & 0x07 ) == 0 ? 0 : 1 );
mlt_properties_set_int( properties, "colorspace", 601 );
dv_format_wide( dv_decoder ) ? ( this->is_pal ? 118.0/81.0 : 40.0/33.0 ) : ( this->is_pal ? 59.0/54.0 : 10.0/11.0 ) );
- mlt_properties_set_int( properties, "frequency", dv_decoder->audio->frequency );
- mlt_properties_set_int( properties, "channels", dv_decoder->audio->num_channels );
+ mlt_properties_set_int( properties, "audio_frequency", dv_decoder->audio->frequency );
+ mlt_properties_set_int( properties, "audio_channels", dv_decoder->audio->num_channels );
// Register audio callback
if ( mlt_properties_get_int( MLT_PRODUCER_PROPERTIES( producer ), "audio_index" ) > 0 )
}
// Update timecode on the frame we're creating
- mlt_frame_set_position( *frame, mlt_producer_position( producer ) );
+ if ( *frame != NULL )
+ mlt_frame_set_position( *frame, mlt_producer_position( producer ) );
// Calculate the next timecode
mlt_producer_prepare_next( producer );