X-Git-Url: http://research.m1stereo.tv/gitweb?a=blobdiff_plain;f=src%2Fmodules%2Favformat%2Fproducer_avformat.c;h=3186007c86e03ca56874014e30309d760d9777e8;hb=6159bd78fa8e72c784747776a2c4c63d9c461ff5;hp=943b8476d12f8722c04ad40d6c0c3159d34f1107;hpb=19d5d8f23b0930d8d10b0c9075830415cd5fec4d;p=melted diff --git a/src/modules/avformat/producer_avformat.c b/src/modules/avformat/producer_avformat.c index 943b847..3186007 100644 --- a/src/modules/avformat/producer_avformat.c +++ b/src/modules/avformat/producer_avformat.c @@ -92,7 +92,7 @@ mlt_producer producer_avformat_init( char *file ) /** Find the default streams. */ -void find_default_streams( AVFormatContext *context, int *audio_index, int *video_index ) +static void find_default_streams( AVFormatContext *context, int *audio_index, int *video_index ) { int i; @@ -122,7 +122,7 @@ void find_default_streams( AVFormatContext *context, int *audio_index, int *vide /** Producer file destructor. */ -void producer_file_close( void *context ) +static void producer_file_close( void *context ) { if ( context != NULL ) { @@ -140,7 +140,7 @@ void producer_file_close( void *context ) /** Producer file destructor. */ -void producer_codec_close( void *codec ) +static void producer_codec_close( void *codec ) { if ( codec != NULL ) { @@ -204,8 +204,8 @@ static int producer_open( mlt_producer this, char *file ) { // This isn't going to be accurate for all formats mlt_position frames = ( mlt_position )( ( ( double )context->duration / ( double )AV_TIME_BASE ) * fps ); - mlt_properties_set_position( properties, "out", frames - 1 ); - mlt_properties_set_position( properties, "length", frames ); + mlt_properties_set_position( properties, "out", frames - 2 ); + mlt_properties_set_position( properties, "length", frames - 1 ); } // Find default audio and video streams @@ -469,14 +469,14 @@ static void producer_set_up_video( mlt_producer this, mlt_frame frame ) // Get the video_index int index = mlt_properties_get_int( properties, "video_index" ); + // Get the frame properties + mlt_properties frame_properties = mlt_frame_properties( frame ); + // Lock the mutex now pthread_mutex_lock( &avformat_mutex ); if ( context != NULL && index != -1 ) { - // Get the frame properties - mlt_properties frame_properties = mlt_frame_properties( frame ); - // Get the video stream AVStream *stream = context->streams[ index ]; @@ -527,6 +527,14 @@ static void producer_set_up_video( mlt_producer this, mlt_frame frame ) mlt_frame_push_get_image( frame, producer_get_image ); mlt_properties_set_data( frame_properties, "avformat_producer", this, 0, NULL, NULL ); } + else + { + mlt_properties_set_int( frame_properties, "test_image", 1 ); + } + } + else + { + mlt_properties_set_int( frame_properties, "test_image", 1 ); } // Unlock the mutex now @@ -699,6 +707,7 @@ static int producer_get_audio( mlt_frame frame, int16_t **buffer, mlt_audio_form } // Now handle the audio if we have enough + if ( audio_used >= *samples ) { *buffer = malloc( *samples * *channels * sizeof( int16_t ) );