]> git.sesse.net Git - mlt/commitdiff
+ Correction to previous patch - fixes pause behaviour with rawvideo
authorlilo_booter <lilo_booter@d19143bc-622f-0410-bfdd-b5b2a6649095>
Tue, 3 Oct 2006 21:16:00 +0000 (21:16 +0000)
committerlilo_booter <lilo_booter@d19143bc-622f-0410-bfdd-b5b2a6649095>
Tue, 3 Oct 2006 21:16:00 +0000 (21:16 +0000)
git-svn-id: https://mlt.svn.sourceforge.net/svnroot/mlt/trunk/mlt@932 d19143bc-622f-0410-bfdd-b5b2a6649095

src/modules/avformat/producer_avformat.c

index ef1b871c923728e3ac3a8f7a28bfa65033088f0f..d0ff408caec8298d38152e0f3ce1b72bedbdbbcd 100644 (file)
@@ -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 );