From 838ed296df913dde55a573ccfae5b0a4ef934cfa Mon Sep 17 00:00:00 2001 From: Justin Ruggles Date: Tue, 27 Nov 2012 16:41:11 -0500 Subject: [PATCH 1/6] nuv: use the stream indices generated by avformat_new_stream() --- libavformat/nuv.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/libavformat/nuv.c b/libavformat/nuv.c index 7d6802dcc3..50309b5e96 100644 --- a/libavformat/nuv.c +++ b/libavformat/nuv.c @@ -152,7 +152,6 @@ static int nuv_header(AVFormatContext *s) char id_string[12]; double aspect, fps; int is_mythtv, width, height, v_packs, a_packs; - int stream_nr = 0; AVStream *vst = NULL, *ast = NULL; avio_read(pb, id_string, 12); @@ -178,10 +177,11 @@ static int nuv_header(AVFormatContext *s) avio_rl32(pb); // keyframe distance (?) if (v_packs) { - ctx->v_id = stream_nr++; - vst = avformat_new_stream(s, NULL); + vst = avformat_new_stream(s, NULL); if (!vst) return AVERROR(ENOMEM); + ctx->v_id = vst->index; + vst->codec->codec_type = AVMEDIA_TYPE_VIDEO; vst->codec->codec_id = AV_CODEC_ID_NUV; vst->codec->width = width; @@ -198,10 +198,11 @@ static int nuv_header(AVFormatContext *s) ctx->v_id = -1; if (a_packs) { - ctx->a_id = stream_nr++; - ast = avformat_new_stream(s, NULL); + ast = avformat_new_stream(s, NULL); if (!ast) return AVERROR(ENOMEM); + ctx->a_id = ast->index; + ast->codec->codec_type = AVMEDIA_TYPE_AUDIO; ast->codec->codec_id = AV_CODEC_ID_PCM_S16LE; ast->codec->channels = 2; From ab87d9b6677c5757d467f532e681b056d3e77e6b Mon Sep 17 00:00:00 2001 From: Justin Ruggles Date: Tue, 27 Nov 2012 17:47:19 -0500 Subject: [PATCH 2/6] nuv: check for malloc failure when allocating extradata Also make sure extradata is freed in the case where multiple NUV_EXTRADATA frame types are found. This may not happen in practice, but it could happen in a malformed stream, which would lead to a memleak if not handled. --- libavformat/nuv.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/libavformat/nuv.c b/libavformat/nuv.c index 50309b5e96..5e9666f68a 100644 --- a/libavformat/nuv.c +++ b/libavformat/nuv.c @@ -63,7 +63,7 @@ static int nuv_probe(AVProbeData *p) * @param vst video stream of which to change parameters * @param ast video stream of which to change parameters * @param myth set if this is a MythTVVideo format file - * @return 1 if all required codec data was found + * @return 0 or AVERROR code */ static int get_codec_data(AVIOContext *pb, AVStream *vst, AVStream *ast, int myth) @@ -82,12 +82,18 @@ static int get_codec_data(AVIOContext *pb, AVStream *vst, avio_skip(pb, 6); size = PKTSIZE(avio_rl32(pb)); if (vst && subtype == 'R') { + if (vst->codec->extradata) { + av_freep(&vst->codec->extradata); + vst->codec->extradata_size = 0; + } + vst->codec->extradata = av_malloc(size); + if (!vst->codec->extradata) + return AVERROR(ENOMEM); vst->codec->extradata_size = size; - vst->codec->extradata = av_malloc(size); avio_read(pb, vst->codec->extradata, size); size = 0; if (!myth) - return 1; + return 0; } break; case NUV_MYTHEXT: @@ -130,7 +136,7 @@ static int get_codec_data(AVIOContext *pb, AVStream *vst, size -= 6 * 4; avio_skip(pb, size); - return 1; + return 0; case NUV_SEEKP: size = 11; break; @@ -151,7 +157,7 @@ static int nuv_header(AVFormatContext *s) AVIOContext *pb = s->pb; char id_string[12]; double aspect, fps; - int is_mythtv, width, height, v_packs, a_packs; + int is_mythtv, width, height, v_packs, a_packs, ret; AVStream *vst = NULL, *ast = NULL; avio_read(pb, id_string, 12); @@ -215,7 +221,9 @@ static int nuv_header(AVFormatContext *s) } else ctx->a_id = -1; - get_codec_data(pb, vst, ast, is_mythtv); + if ((ret = get_codec_data(pb, vst, ast, is_mythtv)) < 0) + return ret; + ctx->rtjpg_video = vst && vst->codec->codec_id == AV_CODEC_ID_NUV; return 0; From 2c4593dd132ee765aaedc553ab5f13ed9afd497b Mon Sep 17 00:00:00 2001 From: Diego Biurrun Date: Wed, 28 Nov 2012 16:23:23 +0100 Subject: [PATCH 3/6] rtpenc_chain: Remove unused variable --- libavformat/rtpenc_chain.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/rtpenc_chain.c b/libavformat/rtpenc_chain.c index adc432aa00..3c297eb97b 100644 --- a/libavformat/rtpenc_chain.c +++ b/libavformat/rtpenc_chain.c @@ -31,7 +31,7 @@ int ff_rtp_chain_mux_open(AVFormatContext **out, AVFormatContext *s, int idx) { AVFormatContext *rtpctx = NULL; - int ret, pt; + int ret; AVOutputFormat *rtp_format = av_guess_format("rtp", NULL, NULL); uint8_t *rtpflags; AVDictionary *opts = NULL; From 47e7fb88158416460a45f54f9dfbcd716cd7a3b0 Mon Sep 17 00:00:00 2001 From: Diego Biurrun Date: Wed, 28 Nov 2012 16:59:13 +0100 Subject: [PATCH 4/6] fate: Do not unconditionally run libavutil tests Now that libavutil can be disabled, this should be conditional. --- tests/Makefile | 1 - tests/fate/libavutil.mak | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/Makefile b/tests/Makefile index 64ad6ad8ae..4e4eb897c0 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -98,7 +98,6 @@ FATE_SAMPLES-$(CONFIG_AVCONV) += $(FATE_SAMPLES_AVCONV) FATE_SAMPLES += $(FATE_SAMPLES-yes) FATE += $(FATE-yes) -FATE += $(FATE_LIBAVUTIL) $(FATE_AVCONV) $(FATE_SAMPLES_AVCONV): avconv$(EXESUF) diff --git a/tests/fate/libavutil.mak b/tests/fate/libavutil.mak index 54f5da3f4f..9e5716200c 100644 --- a/tests/fate/libavutil.mak +++ b/tests/fate/libavutil.mak @@ -53,4 +53,5 @@ FATE_LIBAVUTIL += fate-xtea fate-xtea: libavutil/xtea-test$(EXESUF) fate-xtea: CMD = run libavutil/xtea-test +FATE-$(CONFIG_AVUTIL) += $(FATE_LIBAVUTIL) fate-libavutil: $(FATE_LIBAVUTIL) From d2f576bd499194dd2607c9407fcb8ffdc7953f75 Mon Sep 17 00:00:00 2001 From: Diego Biurrun Date: Wed, 28 Nov 2012 17:16:34 +0100 Subject: [PATCH 5/6] fate: ea: Add dependencies --- tests/fate/ea.mak | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/tests/fate/ea.mak b/tests/fate/ea.mak index 59745fa29e..f4a1a45051 100644 --- a/tests/fate/ea.mak +++ b/tests/fate/ea.mak @@ -1,20 +1,23 @@ -FATE_SAMPLES_AVCONV += fate-ea-cdata +FATE_SAMPLES_AVCONV-$(call DEMDEC, EA_CDATA, ADPCM_EA_XAS) += fate-ea-cdata fate-ea-cdata: CMD = md5 -i $(SAMPLES)/ea-cdata/166b084d.46410f77.0009b440.24be960c.cdata -f s16le -FATE_SAMPLES_AVCONV += fate-ea-cmv +FATE_SAMPLES_AVCONV-$(call DEMDEC, EA, EACMV) += fate-ea-cmv fate-ea-cmv: CMD = framecrc -i $(SAMPLES)/ea-cmv/TITLE.CMV -pix_fmt rgb24 -FATE_SAMPLES_AVCONV += fate-ea-tgq +FATE_SAMPLES_AVCONV-$(call DEMDEC, EA, EATGQ) += fate-ea-tgq fate-ea-tgq: CMD = framecrc -i $(SAMPLES)/ea-tgq/v27.tgq -an -FATE_SAMPLES_AVCONV += fate-ea-tqi +FATE_SAMPLES_AVCONV-$(call DEMDEC, EA, EATQI) += fate-ea-tqi fate-ea-tqi: CMD = framecrc -i $(SAMPLES)/ea-wve/networkBackbone-partial.wve -frames:v 26 -an -FATE_SAMPLES_AVCONV += fate-ea-mad +FATE_SAMPLES_AVCONV-$(call DEMDEC, EA, EAMAD) += fate-ea-mad fate-ea-mad: CMD = framecrc -i $(SAMPLES)/ea-mad/NFS6LogoE.mad -an -FATE_SAMPLES_AVCONV += fate-ea-tgv-1 +FATE_EA_TGV += fate-ea-tgv-1 fate-ea-tgv-1: CMD = framecrc -i $(SAMPLES)/ea-tgv/INTRO8K-partial.TGV -pix_fmt rgb24 -an -FATE_SAMPLES_AVCONV += fate-ea-tgv-2 +FATE_EA_TGV += fate-ea-tgv-2 fate-ea-tgv-2: CMD = framecrc -i $(SAMPLES)/ea-tgv/INTEL_S.TGV -pix_fmt rgb24 -an + +FATE_SAMPLES_AVCONV-$(call DEMDEC, EA, EATGV) += $(FATE_EA_TGV) +fate-ea-tgv: $(FATE_EA_TGV) From e4d349b4014ee2a03f521027e0bd1ace4a9e60bd Mon Sep 17 00:00:00 2001 From: Diego Biurrun Date: Wed, 28 Nov 2012 17:53:47 +0100 Subject: [PATCH 6/6] fate: h264: Add dependencies --- tests/fate/h264.mak | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/tests/fate/h264.mak b/tests/fate/h264.mak index 8f27995f4f..cc8d03a367 100644 --- a/tests/fate/h264.mak +++ b/tests/fate/h264.mak @@ -172,13 +172,15 @@ FATE_H264 = aud_mw_e \ sva_nl2_e \ FATE_H264 := $(FATE_H264:%=fate-h264-conformance-%) \ - fate-h264-interlace-crop \ fate-h264-lossless \ fate-h264-extreme-plane-pred \ - fate-h264-bsf-mp4toannexb \ -FATE_SAMPLES_AVCONV += $(FATE_H264) -fate-h264: $(FATE_H264) +FATE_H264-$(call DEMDEC, H264, H264) += $(FATE_H264) +FATE_H264-$(call DEMDEC, MOV, H264) += fate-h264-interlace-crop +FATE_H264-$(call ALLYES, MOV_DEMUXER H264_MP4TOANNEXB_BSF) += fate-h264-bsf-mp4toannexb + +FATE_SAMPLES_AVCONV += $(FATE_H264-yes) +fate-h264: $(FATE_H264-yes) fate-h264-conformance-aud_mw_e: CMD = framecrc -i $(SAMPLES)/h264-conformance/AUD_MW_E.264 fate-h264-conformance-ba1_ft_c: CMD = framecrc -i $(SAMPLES)/h264-conformance/BA1_FT_C.264