From: TADANO Tokumei <aimingoff@pc.nifty.jp> To: "FFmpeg development discussions and patches" <ffmpeg-devel@ffmpeg.org>, "Jan Ekström" <jeebjp@gmail.com> Subject: Re: [FFmpeg-devel] [PATCH] avformat/mpegts: set data broadcast streams as such Date: Tue, 5 Apr 2022 01:04:17 +0900 Message-ID: <a49af579-1fc4-3548-d65c-3de878a51a25@pc.nifty.jp> (raw) In-Reply-To: <20220404095312.21140-1-jeebjp@gmail.com> As I posted a patch on Apr. 3rd, you should use "desc_end" rather than "p_end" for get16() or get8() to parse each descriptor. On 2022/04/04 18:53, Jan Ekström wrote: > From: Jan Ekström <jan.ekstrom@24i.com> > > Additionally, they should not be probed, as this is essentially > various types of binary data. > > Signed-off-by: Jan Ekström <jan.ekstrom@24i.com> > --- > libavformat/mpegts.c | 48 +++++++++++++++++++++ > tests/fate/mpegts.mak | 3 ++ > tests/ref/fate/mpegts-probe-sdt-data-stream | 14 ++++++ > 3 files changed, 65 insertions(+) > create mode 100644 tests/ref/fate/mpegts-probe-sdt-data-stream > > diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c > index da77b50669..3788faf848 100644 > --- a/libavformat/mpegts.c > +++ b/libavformat/mpegts.c > @@ -2512,6 +2512,13 @@ static void pmt_cb(MpegTSFilter *filter, const uint8_t *section, int section_len > } > } > p = desc_list_end; > + > + if (!ts->pkt && (stream_type >= 0x80 && stream_type <= 0xFF) && > + st->codecpar->codec_id == AV_CODEC_ID_NONE) > + // if we are reading headers, and still have a user private stream > + // with no proper codec set, do not stop reading at PMT. Data > + // streams are marked within SDT. > + ts->stop_parse = 0; > } > > if (!ts->pids[pcr_pid]) > @@ -2691,6 +2698,7 @@ static void sdt_cb(MpegTSFilter *filter, const uint8_t *section, int section_len > if (val < 0) > return; > for (;;) { > + struct Program *program = NULL; > sid = get16(&p, p_end); > if (sid < 0) > break; > @@ -2704,6 +2712,15 @@ static void sdt_cb(MpegTSFilter *filter, const uint8_t *section, int section_len > desc_list_end = p + desc_list_len; > if (desc_list_end > p_end) > break; > + > + program = get_program(ts, sid); > + > + if (!ts->pkt && program && program->pmt_found) > + // if during header reading we have already received a PMT for > + // this program and now have received an SDT for it, stop further > + // reading at this point. > + ts->stop_parse = 2; > + > for (;;) { > desc_tag = get8(&p, desc_list_end); > if (desc_tag < 0) > @@ -2736,6 +2753,37 @@ static void sdt_cb(MpegTSFilter *filter, const uint8_t *section, int section_len > av_free(name); > av_free(provider_name); > break; > + case 0x64: /* ETSI data broadcast descriptor; EN 300 468 6.2.11 */ > + { > + AVStream *st = NULL; > + FFStream *sti = NULL; > + > + uint16_t data_broadcast_id = get16(&p, p_end); // TS 101 162 s/p_end/desc_end/ > + uint8_t component_tag = get8(&p, p_end); s/p_end/desc_end/ > + if (!component_tag) > + // no stream mapping according to component_tag > + break; > + > + av_log(ts->stream, AV_LOG_TRACE, > + "data broadcast id: %d, component tag: %d\n", > + data_broadcast_id, component_tag); > + > + if (!program) > + break; > + > + st = find_matching_stream(ts, 0, sid, component_tag + 1, 0, > + program); > + if (!st) > + break; > + > + sti = ffstream(st); > + > + st->codecpar->codec_type = AVMEDIA_TYPE_DATA; > + st->codecpar->codec_id = AV_CODEC_ID_BIN_DATA; > + sti->request_probe = sti->need_parsing = 0; > + sti->need_context_update = 1; > + break; > + } > default: > break; > } > diff --git a/tests/fate/mpegts.mak b/tests/fate/mpegts.mak > index bbcbfc47b2..ae21ee87d0 100644 > --- a/tests/fate/mpegts.mak > +++ b/tests/fate/mpegts.mak > @@ -19,6 +19,9 @@ FATE_MPEGTS_PROBE-$(call DEMDEC, MPEGTS) += fate-mpegts-probe-pmt-merge > fate-mpegts-probe-pmt-merge: SRC = $(TARGET_SAMPLES)/mpegts/pmtchange.ts > fate-mpegts-probe-pmt-merge: CMD = run $(PROBE_CODEC_NAME_COMMAND) -merge_pmt_versions 1 -i "$(SRC)" > > +FATE_MPEGTS_PROBE-$(call DEMDEC, MPEGTS, MP2) += fate-mpegts-probe-sdt-data-stream > +fate-mpegts-probe-sdt-data-stream: SRC = $(TARGET_SAMPLES)/mpegts/mpegts_sdt_data_stream.ts > +fate-mpegts-probe-sdt-data-stream: CMD = run $(PROBE_CODEC_NAME_COMMAND) -i "$(SRC)" > > FATE_SAMPLES_FFPROBE += $(FATE_MPEGTS_PROBE-yes) > > diff --git a/tests/ref/fate/mpegts-probe-sdt-data-stream b/tests/ref/fate/mpegts-probe-sdt-data-stream > new file mode 100644 > index 0000000000..0b8e90962f > --- /dev/null > +++ b/tests/ref/fate/mpegts-probe-sdt-data-stream > @@ -0,0 +1,14 @@ > +[PROGRAM] > +[STREAM] > +codec_name=mp2 > +[/STREAM] > +[STREAM] > +codec_name=bin_data > +[/STREAM] > +[/PROGRAM] > +[STREAM] > +codec_name=mp2 > +[/STREAM] > +[STREAM] > +codec_name=bin_data > +[/STREAM] _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
next prev parent reply other threads:[~2022-04-04 16:04 UTC|newest] Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-04-04 9:53 Jan Ekström 2022-04-04 9:56 ` Jan Ekström 2022-04-04 16:04 ` TADANO Tokumei [this message] 2022-04-04 16:16 ` TADANO Tokumei 2022-04-04 16:31 ` TADANO Tokumei 2022-04-04 21:35 ` Jan Ekström 2022-04-04 21:24 ` Jan Ekström
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=a49af579-1fc4-3548-d65c-3de878a51a25@pc.nifty.jp \ --to=aimingoff@pc.nifty.jp \ --cc=ffmpeg-devel@ffmpeg.org \ --cc=jeebjp@gmail.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel This inbox may be cloned and mirrored by anyone: git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git # If you have public-inbox 1.1+ installed, you may # initialize and index your mirror using the following commands: public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \ ffmpegdev@gitmailbox.com public-inbox-index ffmpegdev Example config snippet for mirrors. AGPL code for this site: git clone https://public-inbox.org/public-inbox.git