X-Git-Url: http://research.m1stereo.tv/gitweb?a=blobdiff_plain;f=src%2Fmodules%2Fffmpeg%2Ffilter_ffmpeg_dub.c;h=c46dcd859951cde2caecb242076cb75506751725;hb=bd208d01a2a792e698a9b4884b43602b2f245a8f;hp=652354bb47a6a7d48b4c7d42884d21202591c959;hpb=0cf7dff156fe3c541eb5d668e317cc73b008c7b0;p=melted diff --git a/src/modules/ffmpeg/filter_ffmpeg_dub.c b/src/modules/ffmpeg/filter_ffmpeg_dub.c index 652354b..c46dcd8 100644 --- a/src/modules/ffmpeg/filter_ffmpeg_dub.c +++ b/src/modules/ffmpeg/filter_ffmpeg_dub.c @@ -47,7 +47,7 @@ static int filter_get_audio( mlt_frame frame, int16_t **buffer, mlt_audio_format if ( !mlt_properties_get_int( producer_properties, "end_of_clip" ) ) { // Get the position - double position = mlt_properties_get_double( producer_properties, "dub_position" ); + mlt_position position = mlt_properties_get_position( producer_properties, "dub_position" ); // We need a frame from the producer mlt_frame producer_frame; @@ -56,7 +56,7 @@ static int filter_get_audio( mlt_frame frame, int16_t **buffer, mlt_audio_format mlt_properties_set_double( producer_properties, "fps", mlt_properties_get_double( frame_properties, "fps" ) ); // Seek to the position - mlt_producer_seek_frame( producer, ( int64_t )position ); + mlt_producer_seek( producer, position ); // Get the next frame producer->get_frame( producer, &producer_frame, 0 ); @@ -70,7 +70,7 @@ static int filter_get_audio( mlt_frame frame, int16_t **buffer, mlt_audio_format mlt_properties_set_data( frame_properties, "ffmpeg_dub_frame", producer_frame, 0, ( mlt_destructor )mlt_frame_close, NULL ); // Incrment the position - mlt_properties_set_double( producer_properties, "dub_position", position + 1 ); + mlt_properties_set_position( producer_properties, "dub_position", position + 1 ); } } @@ -117,25 +117,27 @@ static mlt_frame filter_process( mlt_filter this, mlt_frame frame ) mlt_filter filter_ffmpeg_dub_init( char *file ) { // Create the filter object - mlt_filter this = calloc( sizeof( struct mlt_filter_s ), 1 ); + mlt_filter this = mlt_filter_new( ); // Initialise it - mlt_filter_init( this, NULL ); - - // Overide the filter process method - this->process = filter_process; + if ( this != NULL ) + { + // Obtain the properties + mlt_properties properties = mlt_filter_properties( this ); - // Obtain the properties - mlt_properties properties = mlt_filter_properties( this ); + // Create an ffmpeg producer + // TODO: THIS SHOULD NOT BE HERE.... + mlt_producer producer = mlt_factory_producer( "ffmpeg", file ); - // Create an ffmpeg producer - mlt_producer producer = mlt_factory_producer( "ffmpeg", file ); + // Overide the filter process method + this->process = filter_process; - // Pass the producer - mlt_properties_set_data( properties, "producer", producer, 0, ( mlt_destructor )mlt_producer_close, NULL ); + // Pass the producer + mlt_properties_set_data( properties, "producer", producer, 0, ( mlt_destructor )mlt_producer_close, NULL ); - // Initialise the audio frame position - mlt_properties_set_double( properties, "dub_position", 0 ); + // Initialise the audio frame position + mlt_properties_set_position( properties, "dub_position", 0 ); + } return this; }