Commit 4059cd39 authored by Michael Niedermayer's avatar Michael Niedermayer

avformat/ffmenc: Remove the last use of st->codec

Signed-off-by: 's avatarMichael Niedermayer <michael@niedermayer.cc>
parent 78519a00
...@@ -148,11 +148,11 @@ static int ffm_write_header_codec_ctx(AVIOContext *pb, AVCodecParameters *ctxpar ...@@ -148,11 +148,11 @@ static int ffm_write_header_codec_ctx(AVIOContext *pb, AVCodecParameters *ctxpar
#undef ENC #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) const char *configuration)
{ {
int ret; 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; AVIOContext *tmp;
AVDictionaryEntry *t = NULL; AVDictionaryEntry *t = NULL;
AVDictionary *all = NULL, *comm = NULL, *prv = NULL; AVDictionary *all = NULL, *comm = NULL, *prv = NULL;
...@@ -207,7 +207,6 @@ static int ffm_write_header(AVFormatContext *s) ...@@ -207,7 +207,6 @@ static int ffm_write_header(AVFormatContext *s)
FFMContext *ffm = s->priv_data; FFMContext *ffm = s->priv_data;
AVStream *st; AVStream *st;
AVIOContext *pb = s->pb; AVIOContext *pb = s->pb;
AVCodecContext *codec;
AVCodecParameters *codecpar; AVCodecParameters *codecpar;
int bit_rate, i, ret; int bit_rate, i, ret;
...@@ -242,7 +241,6 @@ static int ffm_write_header(AVFormatContext *s) ...@@ -242,7 +241,6 @@ static int ffm_write_header(AVFormatContext *s)
if(avio_open_dyn_buf(&pb) < 0) if(avio_open_dyn_buf(&pb) < 0)
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
codec = st->codec;
codecpar = st->codecpar; codecpar = st->codecpar;
/* generic info */ /* generic info */
avio_wb32(pb, codecpar->codec_id); avio_wb32(pb, codecpar->codec_id);
...@@ -271,7 +269,7 @@ static int ffm_write_header(AVFormatContext *s) ...@@ -271,7 +269,7 @@ static int ffm_write_header(AVFormatContext *s)
if (st->recommended_encoder_configuration) { if (st->recommended_encoder_configuration) {
av_log(NULL, AV_LOG_DEBUG, "writing recommended configuration: %s\n", av_log(NULL, AV_LOG_DEBUG, "writing recommended configuration: %s\n",
st->recommended_encoder_configuration); 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) st->recommended_encoder_configuration)) < 0)
return ret; return ret;
} else if ((ret = ffm_write_header_codec_ctx(s->pb, codecpar, MKBETAG('S', '2', 'V', 'I'), AV_OPT_FLAG_VIDEO_PARAM)) < 0) } 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) ...@@ -281,7 +279,7 @@ static int ffm_write_header(AVFormatContext *s)
if (st->recommended_encoder_configuration) { if (st->recommended_encoder_configuration) {
av_log(NULL, AV_LOG_DEBUG, "writing recommended configuration: %s\n", av_log(NULL, AV_LOG_DEBUG, "writing recommended configuration: %s\n",
st->recommended_encoder_configuration); 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) st->recommended_encoder_configuration)) < 0)
return ret; return ret;
} else if ((ret = ffm_write_header_codec_ctx(s->pb, codecpar, MKBETAG('S', '2', 'A', 'U'), AV_OPT_FLAG_AUDIO_PARAM)) < 0) } else if ((ret = ffm_write_header_codec_ctx(s->pb, codecpar, MKBETAG('S', '2', 'A', 'U'), AV_OPT_FLAG_AUDIO_PARAM)) < 0)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment