[FFmpeg-devel] [PATCH 5/5] avformat/ffmdec: remove last use of st->codec
Michael Niedermayer
michael at niedermayer.cc
Sat Dec 3 01:52:58 EET 2016
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
---
libavformat/ffmdec.c | 32 +++++++++++++++++++++-----------
1 file changed, 21 insertions(+), 11 deletions(-)
diff --git a/libavformat/ffmdec.c b/libavformat/ffmdec.c
index f3497e2b24..9b9373eae5 100644
--- a/libavformat/ffmdec.c
+++ b/libavformat/ffmdec.c
@@ -276,7 +276,7 @@ static int ffm_append_recommended_configuration(AVStream *st, char **conf)
#define VALIDATE_PARAMETER(parameter, name, check) { \
if (check) { \
- av_log(codec, AV_LOG_ERROR, "Invalid " name " %d\n", codecpar->parameter); \
+ av_log(s, AV_LOG_ERROR, "Invalid " name " %d\n", codecpar->parameter); \
ret = AVERROR_INVALIDDATA; \
goto fail; \
} \
@@ -287,7 +287,7 @@ static int ffm2_read_header(AVFormatContext *s)
FFMContext *ffm = s->priv_data;
AVStream *st;
AVIOContext *pb = s->pb;
- AVCodecContext *codec, *dummy_codec = NULL;
+ AVCodecContext *dummy_codec = NULL;
AVCodecParameters *codecpar;
const AVCodecDescriptor *codec_desc;
int ret, i;
@@ -319,6 +319,7 @@ static int ffm2_read_header(AVFormatContext *s)
unsigned size = avio_rb32(pb);
int64_t next = avio_tell(pb) + size;
char rc_eq_buf[128];
+ int flags;
if(!id)
break;
@@ -342,7 +343,6 @@ static int ffm2_read_header(AVFormatContext *s)
avpriv_set_pts_info(st, 64, 1, 1000000);
- codec = st->codec;
codecpar = st->codecpar;
/* generic info */
codecpar->codec_id = avio_rb32(pb);
@@ -364,14 +364,19 @@ static int ffm2_read_header(AVFormatContext *s)
}
codecpar->bit_rate = avio_rb32(pb);
if (codecpar->bit_rate < 0) {
- av_log(codec, AV_LOG_ERROR, "Invalid bit rate %"PRId64"\n", codecpar->bit_rate);
+ av_log(s, AV_LOG_ERROR, "Invalid bit rate %"PRId64"\n", codecpar->bit_rate);
ret = AVERROR_INVALIDDATA;
goto fail;
}
- codec->flags = avio_rb32(pb);
+ flags = avio_rb32(pb);
+#if FF_API_LAVF_AVCTX
+FF_DISABLE_DEPRECATION_WARNINGS
+ st->codec->flags = flags;
+FF_ENABLE_DEPRECATION_WARNINGS
+#endif
avio_rb32(pb);
avio_rb32(pb);
- if (codec->flags & AV_CODEC_FLAG_GLOBAL_HEADER) {
+ if (flags & AV_CODEC_FLAG_GLOBAL_HEADER) {
int size = avio_rb32(pb);
if (size < 0 || size >= FF_MAX_EXTRADATA_SIZE) {
av_log(s, AV_LOG_ERROR, "Invalid extradata size %d\n", size);
@@ -536,7 +541,7 @@ static int ffm_read_header(AVFormatContext *s)
FFMContext *ffm = s->priv_data;
AVStream *st;
AVIOContext *pb = s->pb;
- AVCodecContext *codec, *dummy_codec = NULL;
+ AVCodecContext *dummy_codec = NULL;
AVCodecParameters *codecpar;
const AVCodecDescriptor *codec_desc;
int i, nb_streams, ret;
@@ -567,6 +572,7 @@ static int ffm_read_header(AVFormatContext *s)
/* read each stream */
for(i=0;i<nb_streams;i++) {
char rc_eq_buf[128];
+ int flags;
st = avformat_new_stream(s, NULL);
if (!st)
@@ -574,7 +580,6 @@ static int ffm_read_header(AVFormatContext *s)
avpriv_set_pts_info(st, 64, 1, 1000000);
- codec = st->codec;
/* generic info */
codecpar->codec_id = avio_rb32(pb);
codec_desc = avcodec_descriptor_get(codecpar->codec_id);
@@ -593,10 +598,15 @@ static int ffm_read_header(AVFormatContext *s)
}
codecpar->bit_rate = avio_rb32(pb);
if (codecpar->bit_rate < 0) {
- av_log(codec, AV_LOG_WARNING, "Invalid bit rate %"PRId64"\n", codecpar->bit_rate);
+ av_log(s, AV_LOG_WARNING, "Invalid bit rate %"PRId64"\n", codecpar->bit_rate);
goto fail;
}
- codec->flags = avio_rb32(pb);
+ flags = avio_rb32(pb);
+#if FF_API_LAVF_AVCTX
+FF_DISABLE_DEPRECATION_WARNINGS
+ st->codec->flags = flags;
+FF_ENABLE_DEPRECATION_WARNINGS
+#endif
avio_rb32(pb);
avio_rb32(pb);
/* specific info */
@@ -665,7 +675,7 @@ static int ffm_read_header(AVFormatContext *s)
default:
goto fail;
}
- if (codec->flags & AV_CODEC_FLAG_GLOBAL_HEADER) {
+ if (flags & AV_CODEC_FLAG_GLOBAL_HEADER) {
int size = avio_rb32(pb);
if (size < 0 || size >= FF_MAX_EXTRADATA_SIZE) {
av_log(s, AV_LOG_ERROR, "Invalid extradata size %d\n", size);
--
2.11.0
More information about the ffmpeg-devel
mailing list