From patchwork Sat Apr 20 09:31:30 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gyan Doshi X-Patchwork-Id: 12844 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id 108FF447EBB for ; Sat, 20 Apr 2019 12:31:54 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id E07A96899E4; Sat, 20 Apr 2019 12:31:53 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mx1.mailbox.org (mx1.mailbox.org [80.241.60.212]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 2FCD96804F8 for ; Sat, 20 Apr 2019 12:31:45 +0300 (EEST) Received: from smtp2.mailbox.org (smtp2.mailbox.org [80.241.60.241]) (using TLSv1.2 with cipher ECDHE-RSA-CHACHA20-POLY1305 (256/256 bits)) (No client certificate requested) by mx1.mailbox.org (Postfix) with ESMTPS id 3EAA44C6B1 for ; Sat, 20 Apr 2019 11:31:45 +0200 (CEST) X-Virus-Scanned: amavisd-new at heinlein-support.de Received: from smtp2.mailbox.org ([80.241.60.241]) by gerste.heinlein-support.de (gerste.heinlein-support.de [91.198.250.173]) (amavisd-new, port 10030) with ESMTP id of_t3MNbC5Sk for ; Sat, 20 Apr 2019 11:31:41 +0200 (CEST) To: FFmpeg development discussions and patches From: Gyan Message-ID: <04890aa9-5cee-85c5-8127-f5b9987e0a08@gyani.pro> Date: Sat, 20 Apr 2019 15:01:30 +0530 MIME-Version: 1.0 Content-Language: en-US Subject: [FFmpeg-devel] [PATCH] avformat/mpegenc - reject unsupported audio streams X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Old patch that was never applied. Rebased. Gyan From 80c0524adf53c95801afcf9b92b0baa519bf983e Mon Sep 17 00:00:00 2001 From: Gyan Doshi 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(+) 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++; }