diff mbox

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

Message ID 4c270812-c742-84ff-186d-448559e3f33e@gmail.com
State Superseded
Headers show

Commit Message

Gyan Jan. 29, 2018, 7:13 a.m. UTC
From 800aa096357c5dfa822157f349a0f0d23fea8c84 Mon Sep 17 00:00:00 2001
From: Gyan Doshi <gyandoshi@gmail.com>
Date: Mon, 29 Jan 2018 12:26:00 +0530
Subject: [PATCH 4/4] 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 Jan. 29, 2018, 10:18 a.m. UTC | #1
2018-01-29 8:13 GMT+01:00 Gyan Doshi <gyandoshi@gmail.com>:

The error message you print does not reflect patch 3/4 afaict.

Carl Eugen
Gyan Jan. 29, 2018, 1:34 p.m. UTC | #2
On 1/29/2018 3:48 PM, Carl Eugen Hoyos wrote:
> 
> The error message you print does not reflect patch 3/4 afaict.

Does it need to?

There's no PCM_DVD encoder. PCM headers are written within the muxer, so 
a user reading that message gets no actionable insight from seeing 
pcm_dvd in the list but can supply any of the other listed codecs to 
encode a supported stream.

Regards,
Gyan
Michael Niedermayer Jan. 30, 2018, 3:16 a.m. UTC | #3
On Mon, Jan 29, 2018 at 12:43:16PM +0530, Gyan Doshi wrote:
>  mpegenc.c |    4 ++++
>  1 file changed, 4 insertions(+)
> b173bdf76e80d3c378118ef452dd49b3aefdd5a3  0004-avformat-mpegenc-reject-unsupported-audio-streams.patch
> From 800aa096357c5dfa822157f349a0f0d23fea8c84 Mon Sep 17 00:00:00 2001
> From: Gyan Doshi <gyandoshi@gmail.com>
> Date: Mon, 29 Jan 2018 12:26:00 +0530
> Subject: [PATCH 4/4] 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 7a79b614ec..f3005d9518 100644
> --- a/libavformat/mpegenc.c
> +++ b/libavformat/mpegenc.c
> @@ -388,6 +388,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) {

MP1 should work too

i dont know if others are missing


[...]
diff mbox

Patch

diff --git a/libavformat/mpegenc.c b/libavformat/mpegenc.c
index 7a79b614ec..f3005d9518 100644
--- a/libavformat/mpegenc.c
+++ b/libavformat/mpegenc.c
@@ -388,6 +388,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");
+                       return AVERROR(EINVAL);
             } else {
                 stream->id = mpa_id++;
             }