[FFmpeg-devel] ffmpeg-opt: mark stream disable options as output-only

Submitted by Gyan on Dec. 8, 2018, 1:26 p.m.

Details

Message ID ca2b2282-cc28-15be-4e88-0684298c4901@gmail.com
State New
Headers show

Commit Message

Gyan Dec. 8, 2018, 1:26 p.m.
I see users with these options set in front of input.

Stream disabling for input requires -discard though one packet tends to 
get smuggled across. But that's for another patch.

Gyan
From f0e78555d6ea5510922e2d543c9b69dff7d480b5 Mon Sep 17 00:00:00 2001
From: Gyan Doshi <ffmpeg@gyani.pro>
Date: Sat, 8 Dec 2018 18:49:34 +0530
Subject: [PATCH] ffmpeg-opt: mark stream disable options as output-only

-vn/an/sn/dn are only checked by open_output_file()
---
 fftools/ffmpeg_opt.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Comments

Michael Niedermayer Dec. 9, 2018, 6:02 p.m.
On Sat, Dec 08, 2018 at 06:56:10PM +0530, Gyan Doshi wrote:
> I see users with these options set in front of input.
> 
> Stream disabling for input requires -discard though one packet tends to get
> smuggled across. But that's for another patch.
> 
> Gyan

>  ffmpeg_opt.c |    8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 5c75ce498cd80cd36b868e1401c3700bb7363b94  0001-ffmpeg-opt-mark-stream-disable-options-as-output-onl.patch
> From f0e78555d6ea5510922e2d543c9b69dff7d480b5 Mon Sep 17 00:00:00 2001
> From: Gyan Doshi <ffmpeg@gyani.pro>
> Date: Sat, 8 Dec 2018 18:49:34 +0530
> Subject: [PATCH] ffmpeg-opt: mark stream disable options as output-only
> 
> -vn/an/sn/dn are only checked by open_output_file()

why not fix it so it works for input too ?
I thought it worked in the past but apparently not for the version i tried
but its a intuitiv thing to use to discard a stream at demuxer/parser stage

[...]
Gyan Dec. 9, 2018, 6:33 p.m.
On 09-12-2018 11:32 PM, Michael Niedermayer wrote:
> On Sat, Dec 08, 2018 at 06:56:10PM +0530, Gyan Doshi wrote:
>> I see users with these options set in front of input.
>>
>> Stream disabling for input requires -discard though one packet tends to get
>> smuggled across. But that's for another patch.
>>
>> Gyan
>>   ffmpeg_opt.c |    8 ++++----
>>   1 file changed, 4 insertions(+), 4 deletions(-)
>> 5c75ce498cd80cd36b868e1401c3700bb7363b94  0001-ffmpeg-opt-mark-stream-disable-options-as-output-onl.patch
>>  From f0e78555d6ea5510922e2d543c9b69dff7d480b5 Mon Sep 17 00:00:00 2001
>> From: Gyan Doshi <ffmpeg@gyani.pro>
>> Date: Sat, 8 Dec 2018 18:49:34 +0530
>> Subject: [PATCH] ffmpeg-opt: mark stream disable options as output-only
>>
>> -vn/an/sn/dn are only checked by open_output_file()
> why not fix it so it works for input too ?
> I thought it worked in the past but apparently not for the version i tried
> but its a intuitiv thing to use to discard a stream at demuxer/parser stage

ok, will look into it.

Gyan

Patch hide | download patch | download mbox

diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c
index d4851a2cd8..d3b11cfb44 100644
--- a/fftools/ffmpeg_opt.c
+++ b/fftools/ffmpeg_opt.c
@@ -3522,7 +3522,7 @@  const OptionDef options[] = {
         "set the number of bits per raw sample", "number" },
     { "intra",        OPT_VIDEO | OPT_BOOL | OPT_EXPERT,                         { &intra_only },
         "deprecated use -g 1" },
-    { "vn",           OPT_VIDEO | OPT_BOOL  | OPT_OFFSET | OPT_INPUT | OPT_OUTPUT,{ .off = OFFSET(video_disable) },
+    { "vn",           OPT_VIDEO | OPT_BOOL  | OPT_OFFSET | OPT_OUTPUT,           { .off = OFFSET(video_disable) },
         "disable video" },
     { "rc_override",  OPT_VIDEO | HAS_ARG | OPT_EXPERT  | OPT_STRING | OPT_SPEC |
                       OPT_OUTPUT,                                                { .off = OFFSET(rc_overrides) },
@@ -3612,7 +3612,7 @@  const OptionDef options[] = {
     { "ac",             OPT_AUDIO | HAS_ARG  | OPT_INT | OPT_SPEC |
                         OPT_INPUT | OPT_OUTPUT,                                    { .off = OFFSET(audio_channels) },
         "set number of audio channels", "channels" },
-    { "an",             OPT_AUDIO | OPT_BOOL | OPT_OFFSET | OPT_INPUT | OPT_OUTPUT,{ .off = OFFSET(audio_disable) },
+    { "an",             OPT_AUDIO | OPT_BOOL | OPT_OFFSET | OPT_OUTPUT,            { .off = OFFSET(audio_disable) },
         "disable audio" },
     { "acodec",         OPT_AUDIO | HAS_ARG  | OPT_PERFILE |
                         OPT_INPUT | OPT_OUTPUT,                                    { .func_arg = opt_audio_codec },
@@ -3634,7 +3634,7 @@  const OptionDef options[] = {
       "set the maximum number of channels to try to guess the channel layout" },
 
     /* subtitle options */
-    { "sn",     OPT_SUBTITLE | OPT_BOOL | OPT_OFFSET | OPT_INPUT | OPT_OUTPUT, { .off = OFFSET(subtitle_disable) },
+    { "sn",     OPT_SUBTITLE | OPT_BOOL | OPT_OFFSET | OPT_OUTPUT,              { .off = OFFSET(subtitle_disable) },
         "disable subtitle" },
     { "scodec", OPT_SUBTITLE | HAS_ARG  | OPT_PERFILE | OPT_INPUT | OPT_OUTPUT, { .func_arg = opt_subtitle_codec },
         "force subtitle codec ('copy' to copy stream)", "codec" },
@@ -3690,7 +3690,7 @@  const OptionDef options[] = {
     /* data codec support */
     { "dcodec", HAS_ARG | OPT_DATA | OPT_PERFILE | OPT_EXPERT | OPT_INPUT | OPT_OUTPUT, { .func_arg = opt_data_codec },
         "force data codec ('copy' to copy stream)", "codec" },
-    { "dn", OPT_BOOL | OPT_VIDEO | OPT_OFFSET | OPT_INPUT | OPT_OUTPUT, { .off = OFFSET(data_disable) },
+    { "dn", OPT_BOOL | OPT_VIDEO | OPT_OFFSET | OPT_OUTPUT,                  { .off = OFFSET(data_disable) },
         "disable data" },
 
 #if CONFIG_VAAPI