diff mbox series

[FFmpeg-devel,v2,1/2] avformat/mpegtsenc: add registration descriptor for AC-3 and EAC3

Message ID 1598272899-24222-1-git-send-email-lance.lmwang@gmail.com
State Accepted
Headers show
Series [FFmpeg-devel,v2,1/2] avformat/mpegtsenc: add registration descriptor for AC-3 and EAC3 | expand

Checks

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

Commit Message

Limin Wang Aug. 24, 2020, 12:41 p.m. UTC
From: Limin Wang <lance.lmwang@gmail.com>

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

Comments

Marton Balint Aug. 24, 2020, 9:02 p.m. UTC | #1
On Mon, 24 Aug 2020, lance.lmwang@gmail.com wrote:

> From: Limin Wang <lance.lmwang@gmail.com>

Explain the reason in the commit message, e.g:

Some DVB and ATSC captures are using the official MPEG2 registration 
descriptor in addition to using the correct stream type and the 
AC-3_audio_stream_descriptor/AC3_descriptor. So let's add it even if it is 
not strictly needed for DVB/ATSC.

>
> Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
> ---
> libavformat/mpegtsenc.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/libavformat/mpegtsenc.c b/libavformat/mpegtsenc.c
> index 61fdd09..5a9e6fd 100644
> --- a/libavformat/mpegtsenc.c
> +++ b/libavformat/mpegtsenc.c
> @@ -487,6 +487,10 @@ static int mpegts_write_pmt(AVFormatContext *s, MpegTSService *service)
>         /* write optional descriptors here */
>         switch (st->codecpar->codec_type) {
>         case AVMEDIA_TYPE_AUDIO:
> +            if (codec_id == AV_CODEC_ID_AC3)
> +                put_registration_descriptor(&q, MKTAG('A', 'C', '-', '3'));
> +            else if (codec_id == AV_CODEC_ID_EAC3)

"else" is not really needed, I'd rather avoid it for consistency with 
similar code below.

> +                put_registration_descriptor(&q, MKTAG('E', 'A', 'C', '3'));

Otherwise LGTM.

Thanks,
Marton
Limin Wang Aug. 24, 2020, 11:38 p.m. UTC | #2
On Mon, Aug 24, 2020 at 11:02:22PM +0200, Marton Balint wrote:
> 
> 
> On Mon, 24 Aug 2020, lance.lmwang@gmail.com wrote:
> 
> > From: Limin Wang <lance.lmwang@gmail.com>
> 
> Explain the reason in the commit message, e.g:
> 
> Some DVB and ATSC captures are using the official MPEG2 registration
> descriptor in addition to using the correct stream type and the
> AC-3_audio_stream_descriptor/AC3_descriptor. So let's add it even if it is
> not strictly needed for DVB/ATSC.

It looks good tome, will update with these commit message.

> 
> > 
> > Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
> > ---
> > libavformat/mpegtsenc.c | 4 ++++
> > 1 file changed, 4 insertions(+)
> > 
> > diff --git a/libavformat/mpegtsenc.c b/libavformat/mpegtsenc.c
> > index 61fdd09..5a9e6fd 100644
> > --- a/libavformat/mpegtsenc.c
> > +++ b/libavformat/mpegtsenc.c
> > @@ -487,6 +487,10 @@ static int mpegts_write_pmt(AVFormatContext *s, MpegTSService *service)
> >         /* write optional descriptors here */
> >         switch (st->codecpar->codec_type) {
> >         case AVMEDIA_TYPE_AUDIO:
> > +            if (codec_id == AV_CODEC_ID_AC3)
> > +                put_registration_descriptor(&q, MKTAG('A', 'C', '-', '3'));
> > +            else if (codec_id == AV_CODEC_ID_EAC3)
> 
> "else" is not really needed, I'd rather avoid it for consistency with
> similar code below.

will remove else.

> 
> > +                put_registration_descriptor(&q, MKTAG('E', 'A', 'C', '3'));
> 
> Otherwise LGTM.
> 
> Thanks,
> Marton
> _______________________________________________
> 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".
diff mbox series

Patch

diff --git a/libavformat/mpegtsenc.c b/libavformat/mpegtsenc.c
index 61fdd09..5a9e6fd 100644
--- a/libavformat/mpegtsenc.c
+++ b/libavformat/mpegtsenc.c
@@ -487,6 +487,10 @@  static int mpegts_write_pmt(AVFormatContext *s, MpegTSService *service)
         /* write optional descriptors here */
         switch (st->codecpar->codec_type) {
         case AVMEDIA_TYPE_AUDIO:
+            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 (ts->flags & MPEGTS_FLAG_SYSTEM_B) {
                 if (codec_id == AV_CODEC_ID_AC3) {
                     DVBAC3Descriptor *dvb_ac3_desc = ts_st->dvb_ac3_desc;