diff mbox

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

Message ID cd1f6bc7-4655-d0e3-4327-30f25f697143@gmail.com
State Superseded
Headers show

Commit Message

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

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

Comments

Carl Eugen Hoyos Feb. 20, 2018, 9:33 p.m. UTC | #1
2018-02-20 16:17 GMT+01:00 Gyan Doshi <gyandoshi@gmail.com>:

Please also mention LPCM.

Thank you, Carl Eugen
Gyan Feb. 21, 2018, 6:05 a.m. UTC | #2
On 2/21/2018 3:03 AM, Carl Eugen Hoyos wrote:
> 2018-02-20 16:17 GMT+01:00 Gyan Doshi <gyandoshi@gmail.com>:
> 
> Please also mention LPCM.

Only 16-bit LPCM BE can be muxed, which is mentioned.

Regards,
Gyan
Michael Niedermayer Feb. 21, 2018, 7:38 p.m. UTC | #3
On Tue, Feb 20, 2018 at 08:47:47PM +0530, Gyan Doshi wrote:
>  mpegenc.c |    4 ++++
>  1 file changed, 4 insertions(+)
> 15777746f15d202546d69494e49a1a90a7668be9  0002-avformat-mpegenc-reject-unsupported-audio-streams.patch
> From f0aabc7b9f959dc94084fb6d9b644104fc203566 Mon Sep 17 00:00:00 2001
> From: Gyan Doshi <gyandoshi@gmail.com>
> Date: Tue, 20 Feb 2018 20:42:21 +0530
> Subject: [PATCH 2/2] avformat/mpegenc - reject unsupported audio streams
> 
> Only MP2, MP3, PCM S16BE, AC3 and DTS audio codecs
> are supported by the muxer.
> ---
>  libavformat/mpegenc.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/libavformat/mpegenc.c b/libavformat/mpegenc.c
> index 4c6fa67fb8..59e3f8c83f 100644
> --- a/libavformat/mpegenc.c
> +++ b/libavformat/mpegenc.c
> @@ -392,6 +392,10 @@ static av_cold int mpeg_mux_init(AVFormatContext *ctx)
>                  stream->lpcm_header[1] = (st->codecpar->channels - 1) | (j << 4);
>                  stream->lpcm_header[2] = 0x80;
>                  stream->lpcm_align     = st->codecpar->channels * 2;
> +            } else if (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 mp2, mp3, pcm_s16be, ac3 or dts.\n");
> +                       goto fail;

this looks like its missing AV_CODEC_ID_MP1 at least

[...]
Carl Eugen Hoyos Feb. 22, 2018, 10:20 p.m. UTC | #4
2018-02-21 7:05 GMT+01:00 Gyan Doshi <gyandoshi@gmail.com>:
>
>
> On 2/21/2018 3:03 AM, Carl Eugen Hoyos wrote:
>>
>> 2018-02-20 16:17 GMT+01:00 Gyan Doshi <gyandoshi@gmail.com>:
>>
>> Please also mention LPCM.
>
> Only 16-bit LPCM BE can be muxed, which is mentioned.

Sorry, above comment was not helpful.

Please also mention "mp1" and "pcm_dvd" in the log message.

Thank you, Carl Eugen
diff mbox

Patch

diff --git a/libavformat/mpegenc.c b/libavformat/mpegenc.c
index 4c6fa67fb8..59e3f8c83f 100644
--- a/libavformat/mpegenc.c
+++ b/libavformat/mpegenc.c
@@ -392,6 +392,10 @@  static av_cold int mpeg_mux_init(AVFormatContext *ctx)
                 stream->lpcm_header[1] = (st->codecpar->channels - 1) | (j << 4);
                 stream->lpcm_header[2] = 0x80;
                 stream->lpcm_align     = st->codecpar->channels * 2;
+            } else if (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 mp2, mp3, pcm_s16be, ac3 or dts.\n");
+                       goto fail;
             } else {
                 stream->id = mpa_id++;
             }