Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
The option is intended for cases where features are needed that cannot be
specified to @command{ffserver} but can be to @command{ffmpeg}.
The option is intended for cases where features are needed that cannot be
specified to @command{ffserver} but can be to @command{ffmpeg}.
+@item -discard (@emph{input})
+Allows discarding specific streams or frames of streams at the demuxer.
+Not all demuxers support this.
+
+@table @option
+@item none
+Discard no frame.
+
+@item default
+Default, which discards no frames.
+
+@item noref
+Discard all non-reference frames.
+
+@item bidir
+Discard all bidirectional frames.
+
+@item nokey
+Discard all frames excepts keyframes.
+
+@item all
+Discard all frames.
+@end table
+
@end table
As a special exception, you can use a bitmap subtitle stream as input: it
@end table
As a special exception, you can use a bitmap subtitle stream as input: it
int nb_guess_layout_max;
SpecifierOpt *apad;
int nb_apad;
int nb_guess_layout_max;
SpecifierOpt *apad;
int nb_apad;
+ SpecifierOpt *discard;
+ int nb_discard;
} OptionsContext;
typedef struct InputFilter {
} OptionsContext;
typedef struct InputFilter {
int file_index;
AVStream *st;
int discard; /* true if stream data should be discarded */
int file_index;
AVStream *st;
int discard; /* true if stream data should be discarded */
int decoding_needed; /* true if the packets must be decoded in 'raw_fifo' */
AVCodecContext *dec_ctx;
AVCodec *dec;
int decoding_needed; /* true if the packets must be decoded in 'raw_fifo' */
AVCodecContext *dec_ctx;
AVCodec *dec;
char *framerate = NULL, *hwaccel = NULL, *hwaccel_device = NULL;
char *codec_tag = NULL;
char *next;
char *framerate = NULL, *hwaccel = NULL, *hwaccel_device = NULL;
char *codec_tag = NULL;
char *next;
+ char *discard_str = NULL;
+ const AVOption *discard_opt = av_opt_find(dec, "skip_frame", NULL, 0, 0);
if (!ist)
exit_program(1);
if (!ist)
exit_program(1);
ist->reinit_filters = -1;
MATCH_PER_STREAM_OPT(reinit_filters, i, ist->reinit_filters, ic, st);
ist->reinit_filters = -1;
MATCH_PER_STREAM_OPT(reinit_filters, i, ist->reinit_filters, ic, st);
+ MATCH_PER_STREAM_OPT(discard, str, discard_str, ic, st);
+ ist->user_set_discard = AVDISCARD_NONE;
+ if (discard_str && av_opt_eval_int(dec, discard_opt, discard_str, &ist->user_set_discard) < 0) {
+ av_log(NULL, AV_LOG_ERROR, "Error parsing discard %s.\n",
+ discard_str);
+ exit_program(1);
+ }
+
ist->filter_in_rescale_delta_last = AV_NOPTS_VALUE;
ist->dec_ctx = avcodec_alloc_context3(ist->dec);
ist->filter_in_rescale_delta_last = AV_NOPTS_VALUE;
ist->dec_ctx = avcodec_alloc_context3(ist->dec);
if (source_index >= 0) {
ost->sync_ist = input_streams[source_index];
input_streams[source_index]->discard = 0;
if (source_index >= 0) {
ost->sync_ist = input_streams[source_index];
input_streams[source_index]->discard = 0;
- input_streams[source_index]->st->discard = AVDISCARD_NONE;
+ input_streams[source_index]->st->discard = input_streams[source_index]->user_set_discard;
}
ost->last_mux_dts = AV_NOPTS_VALUE;
}
ost->last_mux_dts = AV_NOPTS_VALUE;
if(ost->st->codec->codec_type == AVMEDIA_TYPE_AUDIO) ost->avfilter = av_strdup("anull");
if(ost->st->codec->codec_type == AVMEDIA_TYPE_VIDEO) ost->avfilter = av_strdup("null");
ist->discard = 0;
if(ost->st->codec->codec_type == AVMEDIA_TYPE_AUDIO) ost->avfilter = av_strdup("anull");
if(ost->st->codec->codec_type == AVMEDIA_TYPE_VIDEO) ost->avfilter = av_strdup("null");
ist->discard = 0;
- ist->st->discard = AVDISCARD_NONE;
+ ist->st->discard = ist->user_set_discard;
"print timestamp debugging info" },
{ "max_error_rate", HAS_ARG | OPT_FLOAT, { &max_error_rate },
"maximum error rate", "ratio of errors (0.0: no errors, 1.0: 100% errors) above which ffmpeg returns an error instead of success." },
"print timestamp debugging info" },
{ "max_error_rate", HAS_ARG | OPT_FLOAT, { &max_error_rate },
"maximum error rate", "ratio of errors (0.0: no errors, 1.0: 100% errors) above which ffmpeg returns an error instead of success." },
+ { "discard", OPT_STRING | HAS_ARG | OPT_SPEC |
+ OPT_INPUT, { .off = OFFSET(discard) },
+ "discard", "" },
/* video options */
{ "vframes", OPT_VIDEO | HAS_ARG | OPT_PERFILE | OPT_OUTPUT, { .func_arg = opt_video_frames },
/* video options */
{ "vframes", OPT_VIDEO | HAS_ARG | OPT_PERFILE | OPT_OUTPUT, { .func_arg = opt_video_frames },