[FFmpeg-devel] [PATCH] avformat/mpegts: add skip_unknown_pids option

Aman Gupta aman at tmm1.net
Wed May 9 04:40:01 EEST 2018


On Tue, May 8, 2018 at 12:54 PM, Aman Gupta <ffmpeg at tmm1.net> wrote:

> From: Aman Gupta <aman at tmm1.net>
>
> Allows the user to skip streams that are not advertised in the PMT.
>

Disregard this patch. It combines two different things (skip pmt, skip
streams without pmt) into one badly named option.

Aman


> ---
>  libavformat/mpegts.c | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c
> index 629631f60a..5464f48a8d 100644
> --- a/libavformat/mpegts.c
> +++ b/libavformat/mpegts.c
> @@ -143,6 +143,7 @@ struct MpegTSContext {
>
>      int skip_changes;
>      int skip_clear;
> +    int skip_unknown_pids;
>
>      int scan_all_pmts;
>
> @@ -176,6 +177,8 @@ static const AVOption options[] = {
>       {.i64 = 0}, 0, 1, 0 },
>      {"skip_clear", "skip clearing programs", offsetof(MpegTSContext,
> skip_clear), AV_OPT_TYPE_BOOL,
>       {.i64 = 0}, 0, 1, 0 },
> +    {"skip_unknown_pids", "skip streams not advertised in PMT",
> offsetof(MpegTSContext, skip_unknown_pids), AV_OPT_TYPE_BOOL,
> +     {.i64 = 0}, 0, 1, 0 },
>      { NULL },
>  };
>
> @@ -1058,7 +1061,7 @@ static int mpegts_push_data(MpegTSFilter *filter,
>
>                      /* stream not present in PMT */
>                      if (!pes->st) {
> -                        if (ts->skip_changes)
> +                        if (ts->skip_changes || ts->skip_unknown_pids)
>                              goto skip;
>
>                          pes->st = avformat_new_stream(ts->stream, NULL);
> @@ -2011,6 +2014,8 @@ static void pmt_cb(MpegTSFilter *filter, const
> uint8_t *section, int section_len
>      if (!ts->scan_all_pmts && ts->skip_changes)
>          return;
>
> +    if (ts->skip_unknown_pids && !get_program(ts, h->id))
> +        return;
>      if (!ts->skip_clear)
>          clear_program(ts, h->id);
>
> --
> 2.14.2
>
>


More information about the ffmpeg-devel mailing list