diff mbox

[FFmpeg-devel] avformat/mpegenc - reject unsupported audio streams

Message ID c0582cb9-dc73-0520-4af9-23b12ae9f3fc@gyani.pro
State Accepted
Commit 6829c3cbe480501725250c62cd1b920a75a44ec7
Headers show

Commit Message

Gyan Doshi April 22, 2019, 11 a.m. UTC
On 22-04-2019 01:15 PM, Gyan wrote:
>
>
> On 22-04-2019 12:30 PM, Carl Eugen Hoyos wrote:
>>
>>> Am 20.04.2019 um 11:31 schrieb Gyan <ffmpeg@gyani.pro>:
>>>
>>>
>>> Old patch that was never applied. Rebased.
>> Please return patch_welcome for mlp and truehd.
> Will do.
>> Wasn’t there another comment (not by me): “Why can’t .codec_tag be 
>> used?”
>
> There's no codec_tag member set. This patch is just to disallow an 
> invalid muxing to proceed.

Revised.

Gyan
From 608bf79e2aed04cd34dca733c778b7e630f31a46 Mon Sep 17 00:00:00 2001
From: Gyan Doshi <gyandoshi@gmail.com>
Date: Tue, 20 Feb 2018 20:42:21 +0530
Subject: [PATCH v2] avformat/mpegenc - reject unsupported audio streams

Only MP1, MP2, MP3, 16-bit PCM_DVD, PCM S16BE,
AC3 and DTS audio codecs are supported by the muxer.
---
 libavformat/mpegenc.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

Comments

Gyan Doshi April 22, 2019, 4:04 p.m. UTC | #1
On 22-04-2019 04:30 PM, Gyan wrote:
>
>
> On 22-04-2019 01:15 PM, Gyan wrote:
>>
>>
>> On 22-04-2019 12:30 PM, Carl Eugen Hoyos wrote:
>>>
>>>> Am 20.04.2019 um 11:31 schrieb Gyan <ffmpeg@gyani.pro>:
>>>>
>>>>
>>>> Old patch that was never applied. Rebased.
>>> Please return patch_welcome for mlp and truehd.
>> Will do.
>>> Wasn’t there another comment (not by me): “Why can’t .codec_tag be 
>>> used?”
>>
>> There's no codec_tag member set. This patch is just to disallow an 
>> invalid muxing to proceed.
>
> Revised.

Pushed as 6829c3cbe480501725250c62cd1b920a75a44ec7

Gyan
Carl Eugen Hoyos April 23, 2019, 10 p.m. UTC | #2
2019-04-22 13:00 GMT+02:00, Gyan <ffmpeg@gyani.pro>:
>
> On 22-04-2019 01:15 PM, Gyan wrote:
>>
>>
>> On 22-04-2019 12:30 PM, Carl Eugen Hoyos wrote:
>>>
>>>> Am 20.04.2019 um 11:31 schrieb Gyan <ffmpeg@gyani.pro>:
>>>>
>>>>
>>>> Old patch that was never applied. Rebased.
>>> Please return patch_welcome for mlp and truehd.
>> Will do.
>>> Wasn’t there another comment (not by me): “Why
>>> can’t .codec_tag be used?”
>>
>> There's no codec_tag member set. This patch is just
>> to disallow an invalid muxing to proceed.

Wasn't the argument that this is possible with codec_tag?

> Revised.

What about aac?

And can't you wait more than a few hours for a review?

Carl Eugen
Gyan Doshi April 24, 2019, 4:29 a.m. UTC | #3
On 24-04-2019 03:30 AM, Carl Eugen Hoyos wrote:
> 2019-04-22 13:00 GMT+02:00, Gyan <ffmpeg@gyani.pro>:
>> On 22-04-2019 01:15 PM, Gyan wrote:
>>>
>>> On 22-04-2019 12:30 PM, Carl Eugen Hoyos wrote:
>>>>> Am 20.04.2019 um 11:31 schrieb Gyan <ffmpeg@gyani.pro>:
>>>>>
>>>>>
>>>>> Old patch that was never applied. Rebased.
>>>> Please return patch_welcome for mlp and truehd.
>>> Will do.
>>>> Wasn’t there another comment (not by me): “Why
>>>> can’t .codec_tag be used?”
>>> There's no codec_tag member set. This patch is just
>>> to disallow an invalid muxing to proceed.
> Wasn't the argument that this is possible with codec_tag?

Not in the present state. If you want to add a codec_tag, that's a 
separate patch.

>> Revised.
> What about aac?

There's no provision to mux AAC, at present. On demux, the stream is 
detected as mp2.

> And can't you wait more than a few hours for a review?
This patch is 14 months old, except for the one change you requested. 
And all the patch does is enforce the existing limitations.

Gyan
Ali KIZIL April 25, 2019, 7:53 a.m. UTC | #4
Gyan <ffmpeg@gyani.pro>, 24 Nis 2019 Çar, 07:30 tarihinde şunu yazdı:

>
>
> On 24-04-2019 03:30 AM, Carl Eugen Hoyos wrote:
> > 2019-04-22 13:00 GMT+02:00, Gyan <ffmpeg@gyani.pro>:
> >> On 22-04-2019 01:15 PM, Gyan wrote:
> >>>
> >>> On 22-04-2019 12:30 PM, Carl Eugen Hoyos wrote:
> >>>>> Am 20.04.2019 um 11:31 schrieb Gyan <ffmpeg@gyani.pro>:
> >>>>>
> >>>>>
> >>>>> Old patch that was never applied. Rebased.
> >>>> Please return patch_welcome for mlp and truehd.
> >>> Will do.
> >>>> Wasn’t there another comment (not by me): “Why
> >>>> can’t .codec_tag be used?”
> >>> There's no codec_tag member set. This patch is just
> >>> to disallow an invalid muxing to proceed.
> > Wasn't the argument that this is possible with codec_tag?
>
> Not in the present state. If you want to add a codec_tag, that's a
> separate patch.
>
> >> Revised.
> > What about aac?
>
> There's no provision to mux AAC, at present. On demux, the stream is
> detected as mp2.
>
> > And can't you wait more than a few hours for a review?
> This patch is 14 months old, except for the one change you requested.
> And all the patch does is enforce the existing limitations.
>
> Gyan
> _______________________________________________
>

There are also Dolby Codecs (ac3 & eac3). Will it also throw error for
these codecs ?
Gyan Doshi April 25, 2019, 8:18 a.m. UTC | #5
On 25-04-2019 01:23 PM, Ali KIZIL wrote:
>
> There are also Dolby Codecs (ac3 & eac3). Will it also throw error for
> these codecs ?

AC3   is      supported before and after this patch.
EAC3 is unsupported before and after this patch.

But it's sent to the same decoder, so support could be added. I'll check.

Gyan
diff mbox

Patch

diff --git a/libavformat/mpegenc.c b/libavformat/mpegenc.c
index 1389288b7f..43ebc46e0e 100644
--- a/libavformat/mpegenc.c
+++ b/libavformat/mpegenc.c
@@ -407,6 +407,16 @@  static av_cold int mpeg_mux_init(AVFormatContext *ctx)
                 stream->lpcm_header[2] = 0x80;
                 stream->id = lpcm_id++;
                 stream->lpcm_align = st->codecpar->channels * st->codecpar->bits_per_coded_sample / 8;
+            } else if (st->codecpar->codec_id == AV_CODEC_ID_MLP ||
+                       st->codecpar->codec_id == AV_CODEC_ID_TRUEHD) {
+                       av_log(ctx, AV_LOG_ERROR, "Support for muxing audio codec %s not implemented.\n",
+                              avcodec_get_name(st->codecpar->codec_id));
+                       return AVERROR_PATCHWELCOME;
+            } else if (st->codecpar->codec_id != AV_CODEC_ID_MP1 &&
+                       st->codecpar->codec_id != AV_CODEC_ID_MP2 &&
+                       st->codecpar->codec_id != AV_CODEC_ID_MP3) {
+                       av_log(ctx, AV_LOG_ERROR, "Unsupported audio codec. Must be one of mp1, mp2, mp3, 16-bit pcm_dvd, pcm_s16be, ac3 or dts.\n");
+                       goto fail;
             } else {
                 stream->id = mpa_id++;
             }