Browse code

ffmpeg: call pre_process_video_frame() only if decoding is needed

In output_packet(), move the pre_process_video_frame() call inside the
if (ist->decoding_needed) { } block. This way
pre_process_video_frame() is not called when stream-copy has been
selected.

Also simplify.

Signed-off-by: Stefano Sabatini <stefano.sabatini-lala@poste.it>

Stefano Sabatini authored on 2011/04/20 20:13:09
Showing 1 changed files
... ...
@@ -1489,7 +1489,7 @@ static int output_packet(AVInputStream *ist, int ist_index,
1489 1489
     int ret, i;
1490 1490
     int got_picture;
1491 1491
     AVFrame picture;
1492
-    void *buffer_to_free;
1492
+    void *buffer_to_free = NULL;
1493 1493
     static unsigned int samples_size= 0;
1494 1494
     AVSubtitle subtitle, *subtitle_to_free;
1495 1495
     int64_t pkt_pts = AV_NOPTS_VALUE;
... ...
@@ -1590,6 +1590,8 @@ static int output_packet(AVInputStream *ist, int ist_index,
1590 1590
                             ist->st->codec->time_base.den;
1591 1591
                     }
1592 1592
                     avpkt.size = 0;
1593
+                    buffer_to_free = NULL;
1594
+                    pre_process_video_frame(ist, (AVPicture *)&picture, &buffer_to_free);
1593 1595
                     break;
1594 1596
             case AVMEDIA_TYPE_SUBTITLE:
1595 1597
                 ret = avcodec_decode_subtitle2(ist->st->codec,
... ...
@@ -1624,12 +1626,6 @@ static int output_packet(AVInputStream *ist, int ist_index,
1624 1624
             avpkt.size = 0;
1625 1625
         }
1626 1626
 
1627
-        buffer_to_free = NULL;
1628
-        if (ist->st->codec->codec_type == AVMEDIA_TYPE_VIDEO) {
1629
-            pre_process_video_frame(ist, (AVPicture *)&picture,
1630
-                                    &buffer_to_free);
1631
-        }
1632
-
1633 1627
 #if CONFIG_AVFILTER
1634 1628
         if(ist->st->codec->codec_type == AVMEDIA_TYPE_VIDEO){
1635 1629
             for(i=0;i<nb_ostreams;i++) {