From 6269c02322276247410e28545a1a4e07af6e5e5b Mon Sep 17 00:00:00 2001 From: lilo_booter Date: Tue, 3 Oct 2006 21:16:00 +0000 Subject: [PATCH] + Correction to previous patch - fixes pause behaviour with rawvideo git-svn-id: https://mlt.svn.sourceforge.net/svnroot/mlt/trunk/mlt@932 d19143bc-622f-0410-bfdd-b5b2a6649095 --- src/modules/avformat/producer_avformat.c | 19 +++++++++++-------- 1 files changed, 11 insertions(+), 8 deletions(-) diff --git a/src/modules/avformat/producer_avformat.c b/src/modules/avformat/producer_avformat.c index ef1b871..d0ff408 100644 --- a/src/modules/avformat/producer_avformat.c +++ b/src/modules/avformat/producer_avformat.c @@ -467,7 +467,7 @@ static int producer_get_image( mlt_frame frame, uint8_t **buffer, mlt_image_form // Seek if necessary if ( position != expected ) { - if ( position + 1 == expected ) + if ( av_frame != NULL && position + 1 == expected ) { // We're paused - use last image paused = 1; @@ -490,9 +490,8 @@ static int producer_get_image( mlt_frame frame, uint8_t **buffer, mlt_image_form } } - // Duplicate the last image if necessary - if ( av_frame != NULL && ( paused || mlt_properties_get_double( properties, "_current_time" ) >= real_timecode ) && - av_bypass == 0 ) + // Duplicate the last image if necessary (see comment on rawvideo below) + if ( av_frame != NULL && ( paused || mlt_properties_get_double( properties, "_current_time" ) >= real_timecode ) && av_bypass == 0 ) { // Duplicate it convert_image( av_frame, *buffer, codec_context->pix_fmt, *format, *width, *height ); @@ -507,7 +506,7 @@ static int producer_get_image( mlt_frame frame, uint8_t **buffer, mlt_image_form int must_decode = 1; // Temporary hack to improve intra frame only - if ( !strcmp( codec_context->codec->name, "mjpeg" ) ) + if ( !strcmp( codec_context->codec->name, "mjpeg" ) || !strcmp( codec_context->codec->name, "rawvideo" ) ) must_decode = 0; av_init_packet( &pkt ); @@ -582,10 +581,14 @@ static int producer_get_image( mlt_frame frame, uint8_t **buffer, mlt_image_form av_free_packet( &pkt ); } } - + + // Very untidy - for rawvideo, the packet contains the frame, hence the free packet + // above will break the pause behaviour - so we wipe the frame now + if ( !strcmp( codec_context->codec->name, "rawvideo" ) ) + mlt_properties_set_data( properties, "av_frame", NULL, 0, NULL, NULL ); + // Set the field order property for this frame - mlt_properties_set_int( frame_properties, "top_field_first", - mlt_properties_get_int( properties, "top_field_first" ) ); + mlt_properties_set_int( frame_properties, "top_field_first", mlt_properties_get_int( properties, "top_field_first" ) ); // Regardless of speed, we expect to get the next frame (cos we ain't too bright) mlt_properties_set_position( properties, "_video_expected", position + 1 ); -- 1.7.4.4