[FFmpeg-devel] [PATCH 1/2] ffmpeg: factor weak_map_score() out

Michael Niedermayer michaelni at gmx.at
Sun Feb 3 01:31:57 CET 2013


Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
---
 ffmpeg_opt.c |   14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/ffmpeg_opt.c b/ffmpeg_opt.c
index a418e86..79a53ec 100644
--- a/ffmpeg_opt.c
+++ b/ffmpeg_opt.c
@@ -1426,6 +1426,15 @@ static int configure_complex_filters(void)
     return 0;
 }
 
+static int weak_map_score(InputStream *ist, unsigned qcr, int score)
+{
+    if((qcr!=MKTAG('A', 'P', 'I', 'C')) && (ist->st->disposition & AV_DISPOSITION_ATTACHED_PIC))
+        return 1;
+    if((qcr==MKTAG('A', 'P', 'I', 'C')) && !(ist->st->disposition & AV_DISPOSITION_ATTACHED_PIC))
+        return 0;
+    return score;
+}
+
 static int open_output_file(OptionsContext *o, const char *filename)
 {
     AVFormatContext *oc;
@@ -1510,12 +1519,9 @@ static int open_output_file(OptionsContext *o, const char *filename)
                 int new_area;
                 ist = input_streams[i];
                 new_area = ist->st->codec->width * ist->st->codec->height;
-                if((qcr!=MKTAG('A', 'P', 'I', 'C')) && (ist->st->disposition & AV_DISPOSITION_ATTACHED_PIC))
-                    new_area = 1;
+                new_area = weak_map_score(ist, qcr, new_area);
                 if (ist->st->codec->codec_type == AVMEDIA_TYPE_VIDEO &&
                     new_area > area) {
-                    if((qcr==MKTAG('A', 'P', 'I', 'C')) && !(ist->st->disposition & AV_DISPOSITION_ATTACHED_PIC))
-                        continue;
                     area = new_area;
                     idx = i;
                 }
-- 
1.7.9.5



More information about the ffmpeg-devel mailing list