diff mbox

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

Message ID 04890aa9-5cee-85c5-8127-f5b9987e0a08@gyani.pro
State Superseded
Headers show

Commit Message

Gyan Doshi April 20, 2019, 9:31 a.m. UTC
Old patch that was never applied. Rebased.

Gyan
From 80c0524adf53c95801afcf9b92b0baa519bf983e Mon Sep 17 00:00:00 2001
From: Gyan Doshi <gyandoshi@gmail.com>
Date: Tue, 20 Feb 2018 20:42:21 +0530
Subject: [PATCH] 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 | 5 +++++
 1 file changed, 5 insertions(+)

Comments

Gyan Doshi April 22, 2019, 4:36 a.m. UTC | #1
On 20-04-2019 03:01 PM, Gyan wrote:
>
> Old patch that was never applied. Rebased.

Plan to push tonight if no changes.

Thanks,
Gyan
Carl Eugen Hoyos April 22, 2019, 7 a.m. UTC | #2
> 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.

Wasn’t there another comment (not by me): “Why can’t .codec_tag be used?”

Carl Eugen
Gyan Doshi April 22, 2019, 7:45 a.m. UTC | #3
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.

Gyan
diff mbox

Patch

diff --git a/libavformat/mpegenc.c b/libavformat/mpegenc.c
index 1389288b7f..ed54a4f79b 100644
--- a/libavformat/mpegenc.c
+++ b/libavformat/mpegenc.c
@@ -407,6 +407,11 @@  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_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++;
             }