From patchwork Thu Dec 1 16:37:39 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 1637 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.103.65.86 with SMTP id o83csp1032903vsa; Thu, 1 Dec 2016 08:38:30 -0800 (PST) X-Received: by 10.194.78.195 with SMTP id d3mr33575678wjx.96.1480610310471; Thu, 01 Dec 2016 08:38:30 -0800 (PST) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id o184si12690080wma.89.2016.12.01.08.38.30; Thu, 01 Dec 2016 08:38:30 -0800 (PST) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id A9DF1689F15; Thu, 1 Dec 2016 18:37:44 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from vie01a-qmta-pe01-3.mx.upcmail.net (vie01a-qmta-pe01-3.mx.upcmail.net [62.179.121.180]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id AEFB0689E13 for ; Thu, 1 Dec 2016 18:37:43 +0200 (EET) Received: from [172.31.218.34] (helo=vie01a-dmta-pe02-1.mx.upcmail.net) by vie01a-pqmta-pe01.mx.upcmail.net with esmtp (Exim 4.87) (envelope-from ) id 1cCUMp-0007ol-If for ffmpeg-devel@ffmpeg.org; Thu, 01 Dec 2016 17:37:51 +0100 Received: from [172.31.216.43] (helo=vie01a-pemc-psmtp-pe01) by vie01a-dmta-pe02.mx.upcmail.net with esmtp (Exim 4.87) (envelope-from ) id 1cCUMk-0003Zb-7y for ffmpeg-devel@ffmpeg.org; Thu, 01 Dec 2016 17:37:46 +0100 Received: from localhost ([213.47.41.20]) by vie01a-pemc-psmtp-pe01 with SMTP @ mailcloud.upcmail.net id Egdl1u00N0S5wYM01gdm00; Thu, 01 Dec 2016 17:37:46 +0100 X-SourceIP: 213.47.41.20 From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Thu, 1 Dec 2016 17:37:39 +0100 Message-Id: <20161201163739.23548-6-michael@niedermayer.cc> X-Mailer: git-send-email 2.10.2 In-Reply-To: <20161201163739.23548-1-michael@niedermayer.cc> References: <20161201163739.23548-1-michael@niedermayer.cc> Subject: [FFmpeg-devel] [PATCH 6/6] avformat/ffmenc: Remove the last use of st->codec 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 MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Signed-off-by: Michael Niedermayer --- libavformat/ffmenc.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/libavformat/ffmenc.c b/libavformat/ffmenc.c index caf278f..ef7dc3a 100644 --- a/libavformat/ffmenc.c +++ b/libavformat/ffmenc.c @@ -148,11 +148,11 @@ static int ffm_write_header_codec_ctx(AVIOContext *pb, AVCodecParameters *ctxpar #undef ENC } -static int ffm_write_recommended_config(AVIOContext *pb, AVCodecContext *ctx, unsigned tag, +static int ffm_write_recommended_config(AVIOContext *pb, AVCodecParameters *codecpar, unsigned tag, const char *configuration) { int ret; - const AVCodec *enc = ctx->codec ? ctx->codec : avcodec_find_encoder(ctx->codec_id); + const AVCodec *enc = avcodec_find_encoder(codecpar->codec_id); AVIOContext *tmp; AVDictionaryEntry *t = NULL; AVDictionary *all = NULL, *comm = NULL, *prv = NULL; @@ -207,7 +207,6 @@ static int ffm_write_header(AVFormatContext *s) FFMContext *ffm = s->priv_data; AVStream *st; AVIOContext *pb = s->pb; - AVCodecContext *codec; AVCodecParameters *codecpar; int bit_rate, i, ret; @@ -242,7 +241,6 @@ static int ffm_write_header(AVFormatContext *s) if(avio_open_dyn_buf(&pb) < 0) return AVERROR(ENOMEM); - codec = st->codec; codecpar = st->codecpar; /* generic info */ avio_wb32(pb, codecpar->codec_id); @@ -271,7 +269,7 @@ static int ffm_write_header(AVFormatContext *s) if (st->recommended_encoder_configuration) { av_log(NULL, AV_LOG_DEBUG, "writing recommended configuration: %s\n", st->recommended_encoder_configuration); - if ((ret = ffm_write_recommended_config(s->pb, codec, MKBETAG('S', '2', 'V', 'I'), + if ((ret = ffm_write_recommended_config(s->pb, codecpar, MKBETAG('S', '2', 'V', 'I'), st->recommended_encoder_configuration)) < 0) return ret; } else if ((ret = ffm_write_header_codec_ctx(s->pb, codecpar, MKBETAG('S', '2', 'V', 'I'), AV_OPT_FLAG_VIDEO_PARAM)) < 0) @@ -281,7 +279,7 @@ static int ffm_write_header(AVFormatContext *s) if (st->recommended_encoder_configuration) { av_log(NULL, AV_LOG_DEBUG, "writing recommended configuration: %s\n", st->recommended_encoder_configuration); - if ((ret = ffm_write_recommended_config(s->pb, codec, MKBETAG('S', '2', 'A', 'U'), + if ((ret = ffm_write_recommended_config(s->pb, codecpar, MKBETAG('S', '2', 'A', 'U'), st->recommended_encoder_configuration)) < 0) return ret; } else if ((ret = ffm_write_header_codec_ctx(s->pb, codecpar, MKBETAG('S', '2', 'A', 'U'), AV_OPT_FLAG_AUDIO_PARAM)) < 0)