[FFmpeg-cvslog] avformat/ffmenc: Drop ffm_write_header_codec_private_ctx()
Michael Niedermayer
git at videolan.org
Fri Dec 2 20:42:07 EET 2016
ffmpeg | branch: master | Michael Niedermayer <michael at niedermayer.cc> | Thu Dec 1 16:07:35 2016 +0100| [c06d4f2cedb76f2a38732ff45d12b584d2900c19] | committer: Michael Niedermayer
avformat/ffmenc: Drop ffm_write_header_codec_private_ctx()
This accesses the private encoder context, it should not be used by
the current ffserver it may affect old ffserver versions but i believe
there is consens that accessing the private encoder context from the muxer
is completely wrong.
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=c06d4f2cedb76f2a38732ff45d12b584d2900c19
---
libavformat/ffmenc.c | 35 ++---------------------------------
tests/ref/lavf/ffm | 2 +-
2 files changed, 3 insertions(+), 34 deletions(-)
diff --git a/libavformat/ffmenc.c b/libavformat/ffmenc.c
index c89b9b3..221f0a2 100644
--- a/libavformat/ffmenc.c
+++ b/libavformat/ffmenc.c
@@ -95,35 +95,6 @@ static void write_header_chunk(AVIOContext *pb, AVIOContext *dpb, unsigned id)
av_free(dyn_buf);
}
-static int ffm_write_header_codec_private_ctx(AVFormatContext *s, AVCodecContext *ctx, int type)
-{
- AVIOContext *pb = s->pb;
- AVIOContext *tmp;
- char *buf = NULL;
- int ret;
- const AVCodec *enc = ctx->codec ? ctx->codec : avcodec_find_encoder(ctx->codec_id);
-
- if (!enc) {
- av_log(s, AV_LOG_WARNING, "Stream codec is not found. Codec private options are not stored.\n");
- return 0;
- }
- if (ctx->priv_data && enc->priv_class && enc->priv_data_size) {
- if ((ret = av_opt_serialize(ctx->priv_data, AV_OPT_FLAG_ENCODING_PARAM | type,
- AV_OPT_SERIALIZE_SKIP_DEFAULTS, &buf, '=', ',')) < 0)
- return ret;
- if (buf && strlen(buf)) {
- if (avio_open_dyn_buf(&tmp) < 0) {
- av_free(buf);
- return AVERROR(ENOMEM);
- }
- avio_put_str(tmp, buf);
- write_header_chunk(pb, tmp, MKBETAG('C', 'P', 'R', 'V'));
- }
- av_free(buf);
- }
- return 0;
-}
-
static int ffm_write_header_codec_ctx(AVIOContext *pb, AVCodecContext *ctx, unsigned tag, int type)
{
AVIOContext *tmp;
@@ -280,8 +251,7 @@ static int ffm_write_header(AVFormatContext *s)
if ((ret = ffm_write_recommended_config(s->pb, codec, MKBETAG('S', '2', 'V', 'I'),
st->recommended_encoder_configuration)) < 0)
return ret;
- } else if ((ret = ffm_write_header_codec_ctx(s->pb, codec, MKBETAG('S', '2', 'V', 'I'), AV_OPT_FLAG_VIDEO_PARAM)) < 0 ||
- (ret = ffm_write_header_codec_private_ctx(s, codec, AV_OPT_FLAG_VIDEO_PARAM)) < 0)
+ } else if ((ret = ffm_write_header_codec_ctx(s->pb, codec, MKBETAG('S', '2', 'V', 'I'), AV_OPT_FLAG_VIDEO_PARAM)) < 0)
return ret;
break;
case AVMEDIA_TYPE_AUDIO:
@@ -291,8 +261,7 @@ static int ffm_write_header(AVFormatContext *s)
if ((ret = ffm_write_recommended_config(s->pb, codec, MKBETAG('S', '2', 'A', 'U'),
st->recommended_encoder_configuration)) < 0)
return ret;
- } else if ((ret = ffm_write_header_codec_ctx(s->pb, codec, MKBETAG('S', '2', 'A', 'U'), AV_OPT_FLAG_AUDIO_PARAM)) < 0 ||
- (ret = ffm_write_header_codec_private_ctx(s, codec, AV_OPT_FLAG_AUDIO_PARAM)) < 0)
+ } else if ((ret = ffm_write_header_codec_ctx(s->pb, codec, MKBETAG('S', '2', 'A', 'U'), AV_OPT_FLAG_AUDIO_PARAM)) < 0)
return ret;
break;
default:
diff --git a/tests/ref/lavf/ffm b/tests/ref/lavf/ffm
index c4d7e1f..9d9d07f 100644
--- a/tests/ref/lavf/ffm
+++ b/tests/ref/lavf/ffm
@@ -1,3 +1,3 @@
-e63c16b5f0ad5015304fc4009fdb33ca *./tests/data/lavf/lavf.ffm
+15a9929d1cb7129dcaffeccf3cb2fda9 *./tests/data/lavf/lavf.ffm
376832 ./tests/data/lavf/lavf.ffm
./tests/data/lavf/lavf.ffm CRC=0x000e23ae
More information about the ffmpeg-cvslog
mailing list