diff mbox series

[FFmpeg-devel,7/8] avformat/mpegtsenc: add registration descriptor for AC-3 and EAC3

Message ID 1595431659-664-7-git-send-email-lance.lmwang@gmail.com
State New
Headers show
Series [FFmpeg-devel,1/8] avformat/mpegts: add dvb ac3 descriptor metadata
Related show

Checks

Context Check Description
andriy/default pending
andriy/make success Make finished
andriy/make_fate success Make fate finished

Commit Message

Limin Wang July 22, 2020, 3:27 p.m. UTC
From: Limin Wang <lance.lmwang@gmail.com>

copy the atsc ac3 audio in ts like below:
./ffmpeg -i atsc_audio.ts -c:v copy -c:a copy out.ts
Stream #0:6[0x64](eng): Audio: ac3 (AC-3 / 0x332D4341), 48000 Hz, stereo, fltp, 192 kb/s

./ffmpeg -i out.ts
Before:
Stream #0:1[0x101](eng): Audio: ac3 ([129][0][0][0] / 0x0081), 48000 Hz, stereo, fltp, 192 kb/s

After applied patch:
Stream #0:1[0x101](eng): Audio: ac3 (AC-3 / 0x332D4341), 48000 Hz, stereo, fltp, 192 kb/s

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
---
 libavformat/mpegtsenc.c | 5 +++++
 1 file changed, 5 insertions(+)
diff mbox series

Patch

diff --git a/libavformat/mpegtsenc.c b/libavformat/mpegtsenc.c
index a5b45fb..f060ea6 100644
--- a/libavformat/mpegtsenc.c
+++ b/libavformat/mpegtsenc.c
@@ -535,6 +535,11 @@  static int mpegts_write_pmt(AVFormatContext *s, MpegTSService *service)
                     *q++=1; // 1 byte, all flags sets to 0
                     *q++=0; // omit all fields...
                 }
+            } else {
+                if (codec_id == AV_CODEC_ID_AC3)
+                    put_registration_descriptor(&q, MKTAG('A', 'C', '-', '3'));
+                else if (codec_id == AV_CODEC_ID_EAC3)
+                    put_registration_descriptor(&q, MKTAG('E', 'A', 'C', '3'));
             }
             if (codec_id == AV_CODEC_ID_S302M)
                 put_registration_descriptor(&q, MKTAG('B', 'S', 'S', 'D'));