diff mbox

[FFmpeg-devel,V1,2/3] ffmpeg_opt: Respect default disposition when select audio/video

Message ID 1561006234-21948-2-git-send-email-mypopydev@gmail.com
State Accepted
Commit 11d3b03fcb2baae4324aac9481b9bd4a171d4345
Headers show

Commit Message

Jun Zhao June 20, 2019, 4:50 a.m. UTC
From: Jun Zhao <barryjzhao@tencent.com>

Respect default disposition when select audio/video

Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
---
 fftools/ffmpeg_opt.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

Comments

Michael Niedermayer June 21, 2019, 2:36 p.m. UTC | #1
On Thu, Jun 20, 2019 at 12:50:33PM +0800, Jun Zhao wrote:
> From: Jun Zhao <barryjzhao@tencent.com>
> 
> Respect default disposition when select audio/video
> 
> Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
> ---
>  fftools/ffmpeg_opt.c |    6 ++++--
>  1 files changed, 4 insertions(+), 2 deletions(-)

this is probably ok

some testcase in fate would probably be good

[...]
mypopy@gmail.com June 25, 2019, 1:19 a.m. UTC | #2
On Fri, Jun 21, 2019 at 10:36 PM Michael Niedermayer
<michael@niedermayer.cc> wrote:
>
> On Thu, Jun 20, 2019 at 12:50:33PM +0800, Jun Zhao wrote:
> > From: Jun Zhao <barryjzhao@tencent.com>
> >
> > Respect default disposition when select audio/video
> >
> > Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
> > ---
> >  fftools/ffmpeg_opt.c |    6 ++++--
> >  1 files changed, 4 insertions(+), 2 deletions(-)
>
> this is probably ok
>
> some testcase in fate would probably be good
>
Will add some FATE test case, tks
diff mbox

Patch

diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c
index 53d688b..f5ca18a 100644
--- a/fftools/ffmpeg_opt.c
+++ b/fftools/ffmpeg_opt.c
@@ -2198,7 +2198,8 @@  static int open_output_file(OptionsContext *o, const char *filename)
             for (i = 0; i < nb_input_streams; i++) {
                 int new_area;
                 ist = input_streams[i];
-                new_area = ist->st->codecpar->width * ist->st->codecpar->height + 100000000*!!ist->st->codec_info_nb_frames;
+                new_area = ist->st->codecpar->width * ist->st->codecpar->height + 100000000*!!ist->st->codec_info_nb_frames
+                           + 5000000*!!(ist->st->disposition & AV_DISPOSITION_DEFAULT);
                 if (ist->user_set_discard == AVDISCARD_ALL)
                     continue;
                 if((qcr!=MKTAG('A', 'P', 'I', 'C')) && (ist->st->disposition & AV_DISPOSITION_ATTACHED_PIC))
@@ -2221,7 +2222,8 @@  static int open_output_file(OptionsContext *o, const char *filename)
             for (i = 0; i < nb_input_streams; i++) {
                 int score;
                 ist = input_streams[i];
-                score = ist->st->codecpar->channels + 100000000*!!ist->st->codec_info_nb_frames;
+                score = ist->st->codecpar->channels + 100000000*!!ist->st->codec_info_nb_frames
+                        + 5000000*!!(ist->st->disposition & AV_DISPOSITION_DEFAULT);
                 if (ist->user_set_discard == AVDISCARD_ALL)
                     continue;
                 if (ist->st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO &&