[FFmpeg-cvslog] ffmpeg: call pre_process_video_frame() only if decoding is needed

Stefano Sabatini git at videolan.org
Thu Apr 21 12:24:50 CEST 2011


ffmpeg | branch: master | Stefano Sabatini <stefano.sabatini-lala at poste.it> | Wed Apr 20 13:13:09 2011 +0200| [7046b63e69a5a49a8f575d89d8f0fc6680975382] | committer: Stefano Sabatini

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 at poste.it>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=7046b63e69a5a49a8f575d89d8f0fc6680975382
---

 ffmpeg.c |   10 +++-------
 1 files changed, 3 insertions(+), 7 deletions(-)

diff --git a/ffmpeg.c b/ffmpeg.c
index b91e9d3..d223285 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -1489,7 +1489,7 @@ static int output_packet(AVInputStream *ist, int ist_index,
     int ret, i;
     int got_picture;
     AVFrame picture;
-    void *buffer_to_free;
+    void *buffer_to_free = NULL;
     static unsigned int samples_size= 0;
     AVSubtitle subtitle, *subtitle_to_free;
     int64_t pkt_pts = AV_NOPTS_VALUE;
@@ -1590,6 +1590,8 @@ static int output_packet(AVInputStream *ist, int ist_index,
                             ist->st->codec->time_base.den;
                     }
                     avpkt.size = 0;
+                    buffer_to_free = NULL;
+                    pre_process_video_frame(ist, (AVPicture *)&picture, &buffer_to_free);
                     break;
             case AVMEDIA_TYPE_SUBTITLE:
                 ret = avcodec_decode_subtitle2(ist->st->codec,
@@ -1624,12 +1626,6 @@ static int output_packet(AVInputStream *ist, int ist_index,
             avpkt.size = 0;
         }
 
-        buffer_to_free = NULL;
-        if (ist->st->codec->codec_type == AVMEDIA_TYPE_VIDEO) {
-            pre_process_video_frame(ist, (AVPicture *)&picture,
-                                    &buffer_to_free);
-        }
-
 #if CONFIG_AVFILTER
         if(ist->st->codec->codec_type == AVMEDIA_TYPE_VIDEO){
             for(i=0;i<nb_ostreams;i++) {



More information about the ffmpeg-cvslog mailing list