Re: [libav-devel] [PATCH] mmvideo: init all variables in mm_decode_intra
On Sun, 27 Oct 2013 01:54:47 +0200, Vittorio Giovara vittorio.giov...@gmail.com wrote: --- libavcodec/mmvideo.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libavcodec/mmvideo.c b/libavcodec/mmvideo.c index 1da104c..edf602b 100644 --- a/libavcodec/mmvideo.c +++ b/libavcodec/mmvideo.c @@ -126,7 +126,8 @@ static int mm_decode_intra(MmContext * s, int half_horiz, int half_vert) */ static int mm_decode_inter(MmContext * s, int half_horiz, int half_vert) { -int data_off = bytestream2_get_le16(s-gb), y; +int data_off = bytestream2_get_le16(s-gb); +int y = 0; GetByteContext data_ptr; if (bytestream2_get_bytes_left(s-gb) data_off) -- 1.8.4 Patch ok, queueing. The commit message should be more specific though - something like 'fix uninitialized variable use'. I'll change it myself when pushing, but keep it in mind for the future. Also interesting that FATE doesn't test this, we should probably add a new test that does. -- Anton Khirnov ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH] dcadec: use request_channel_layout instead of request_channels
On Sun, 27 Oct 2013 01:24:57 +0200, Vittorio Giovara vittorio.giov...@gmail.com wrote: --- libavcodec/dcadec.c | 15 --- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/libavcodec/dcadec.c b/libavcodec/dcadec.c index c80bd81..7b5b4cf 100644 --- a/libavcodec/dcadec.c +++ b/libavcodec/dcadec.c @@ -1288,7 +1288,7 @@ static int dca_filter_channels(DCAContext *s, int block_index) } /* Down mixing */ -if (s-avctx-request_channels == 2 s-prim_channels 2) { +if (s-avctx-request_channel_layout == 2 s-prim_channels 2) { dca_downmix(s-samples_chanptr, s-amode, s-downmix_coef, s-channel_order_tab); } @@ -1803,8 +1803,8 @@ static int dca_decode_frame(AVCodecContext *avctx, void *data, if (s-amode 16) { avctx-channel_layout = dca_core_channel_layout[s-amode]; -if (s-xch_present (!avctx-request_channels || - avctx-request_channels num_core_channels + !!s-lfe)) { +if (s-xch_present (!avctx-request_channel_layout || + avctx-request_channel_layout num_core_channels + !!s-lfe)) { avctx-channel_layout |= AV_CH_BACK_CENTER; if (s-lfe) { avctx-channel_layout |= AV_CH_LOW_FREQUENCY; @@ -1826,7 +1826,7 @@ static int dca_decode_frame(AVCodecContext *avctx, void *data, s-channel_order_tab[channels - 1 - !!s-lfe] 0) return AVERROR_INVALIDDATA; -if (avctx-request_channels == 2 s-prim_channels 2) { +if (avctx-request_channel_layout == 2 s-prim_channels 2) { channels = 2; s-output = DCA_STEREO; avctx-channel_layout = AV_CH_LAYOUT_STEREO; @@ -1922,9 +1922,10 @@ static av_cold int dca_decode_init(AVCodecContext *avctx) avctx-sample_fmt = AV_SAMPLE_FMT_FLTP; /* allow downmixing to stereo */ -if (avctx-channels 0 avctx-request_channels avctx-channels -avctx-request_channels == 2) { -avctx-channels = avctx-request_channels; +if (avctx-channels 0 +avctx-request_channel_layout avctx-channels +avctx-request_channel_layout == 2) { +avctx-channels = avctx-request_channel_layout; } return 0; -- 1.8.4 *stab* This is simply wrong, you cannot just s/request_channels/request_channel_layout/. The real solution is a bit more complicated, which is why nobody did it yet. Please, do try to investigate the problems you don't understand more thoroughly. -- Anton Khirnov ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH] avfilter: drop const from avfilter_next
On Sun, 27 Oct 2013 00:54:18 +0200, Vittorio Giovara vittorio.giov...@gmail.com wrote: avfilter_next is used by avfilter_get_by_name which drops const anyway --- OCD count = -3 warnings Vittorio libavfilter/avfilter.c | 4 ++-- libavfilter/avfilter.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c index 88e39bf..203e485 100644 --- a/libavfilter/avfilter.c +++ b/libavfilter/avfilter.c @@ -279,7 +279,7 @@ AVFilter *avfilter_get_by_name(const char *name) if (!name) return NULL; -while ((f = avfilter_next(f))) +while ((f = avfilter_next((const AVFilter *)f))) if (!strcmp(f-name, name)) return f; @@ -296,7 +296,7 @@ int avfilter_register(AVFilter *filter) return 0; } -const AVFilter *avfilter_next(const AVFilter *prev) +AVFilter *avfilter_next(const AVFilter *prev) { return prev ? prev-next : first_filter; } diff --git a/libavfilter/avfilter.h b/libavfilter/avfilter.h index ca11be9..fd3f9a2 100644 --- a/libavfilter/avfilter.h +++ b/libavfilter/avfilter.h @@ -771,7 +771,7 @@ AVFilter *avfilter_get_by_name(const char *name); * @return If prev is non-NULL, next registered filter after prev or NULL if * prev is the last filter. If prev is NULL, return the first registered filter. */ -const AVFilter *avfilter_next(const AVFilter *prev); +AVFilter *avfilter_next(const AVFilter *prev); #if FF_API_OLD_FILTER_REGISTER /** -- 1.8.4 You can add const without breaking API, but you cannot remove it. Removing it is IMO wrong anyway. Why don't you fix avfilter_get_by_name instead? -- Anton Khirnov ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
[libav-devel] [PATCH] avconv: drop a now useless variable
--- avconv.c |2 -- 1 file changed, 2 deletions(-) diff --git a/avconv.c b/avconv.c index 7351b77..0c0f3bf 100644 --- a/avconv.c +++ b/avconv.c @@ -1142,7 +1142,6 @@ static int decode_audio(InputStream *ist, AVPacket *pkt, int *got_output) static int decode_video(InputStream *ist, AVPacket *pkt, int *got_output) { AVFrame *decoded_frame, *f; -void *buffer_to_free = NULL; int i, ret = 0, err = 0, resample_changed; if (!ist-decoded_frame !(ist-decoded_frame = av_frame_alloc())) @@ -1210,7 +1209,6 @@ static int decode_video(InputStream *ist, AVPacket *pkt, int *got_output) av_frame_unref(ist-filter_frame); av_frame_unref(decoded_frame); -av_free(buffer_to_free); return err 0 ? err : ret; } -- 1.7.10.4 ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
[libav-devel] [PATCH 2/3] lavc: change all decoders to behave consistently with AV_EF_CRCCHECK.
Just crccheck prints a warning, crccheck+explode returns an error. Also document this behavior. --- libavcodec/ac3dec.c |3 ++- libavcodec/alsdec.c |2 ++ libavcodec/avcodec.h |7 +++ libavcodec/takdec.c |6 -- libavcodec/tta.c |6 -- libavcodec/wavpack.c |8 +--- 6 files changed, 24 insertions(+), 8 deletions(-) diff --git a/libavcodec/ac3dec.c b/libavcodec/ac3dec.c index fd0bf33..80a1391 100644 --- a/libavcodec/ac3dec.c +++ b/libavcodec/ac3dec.c @@ -1330,7 +1330,8 @@ static int ac3_decode_frame(AVCodecContext * avctx, void *data, if (av_crc(av_crc_get_table(AV_CRC_16_ANSI), 0, buf[2], s-frame_size - 2)) { av_log(avctx, AV_LOG_ERROR, frame CRC mismatch\n); -err = AAC_AC3_PARSE_ERROR_CRC; +if (avctx-err_recognition AV_EF_EXPLODE) +err = AAC_AC3_PARSE_ERROR_CRC; } } } diff --git a/libavcodec/alsdec.c b/libavcodec/alsdec.c index d4f103b..782a1b8 100644 --- a/libavcodec/alsdec.c +++ b/libavcodec/alsdec.c @@ -1545,6 +1545,8 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame_ptr, if (ctx-cur_frame_length != sconf-frame_length ctx-crc_org != ctx-crc) { av_log(avctx, AV_LOG_ERROR, CRC error.\n); +if (avctx-err_recognition AV_EF_EXPLODE) +return AVERROR_INVALIDDATA; } } diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index 84bfccb..ad45d97 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h @@ -2332,6 +2332,13 @@ typedef struct AVCodecContext { * - decoding: Set by user. */ int err_recognition; + +/** + * Verify checksums embedded in the bitstream (could be of either encoded or + * decoded data, depending on the codec) and print an error message on mismatch. + * If AV_EF_EXPLODE is also set, a mismatching checksum will result in the + * decoder returning an error. + */ #define AV_EF_CRCCHECK (10) #define AV_EF_BITSTREAM (11) #define AV_EF_BUFFER(12) diff --git a/libavcodec/takdec.c b/libavcodec/takdec.c index 8b39661..0d2dcbb 100644 --- a/libavcodec/takdec.c +++ b/libavcodec/takdec.c @@ -693,7 +693,8 @@ static int tak_decode_frame(AVCodecContext *avctx, void *data, if (avctx-err_recognition AV_EF_CRCCHECK) { if (ff_tak_check_crc(pkt-data, hsize)) { av_log(avctx, AV_LOG_ERROR, CRC error\n); -return AVERROR_INVALIDDATA; +if (avctx-err_recognition AV_EF_EXPLODE) +return AVERROR_INVALIDDATA; } } @@ -867,7 +868,8 @@ static int tak_decode_frame(AVCodecContext *avctx, void *data, if (ff_tak_check_crc(pkt-data + hsize, get_bits_count(gb) / 8 - hsize)) { av_log(avctx, AV_LOG_ERROR, CRC error\n); -return AVERROR_INVALIDDATA; +if (avctx-err_recognition AV_EF_EXPLODE) +return AVERROR_INVALIDDATA; } } diff --git a/libavcodec/tta.c b/libavcodec/tta.c index 53c8aca..4d2e2a0 100644 --- a/libavcodec/tta.c +++ b/libavcodec/tta.c @@ -275,7 +275,8 @@ static av_cold int tta_decode_init(AVCodecContext * avctx) avctx-extradata_size - 26 total_frames * 4) av_log(avctx, AV_LOG_WARNING, Seek table missing or too small\n); else if (avctx-err_recognition AV_EF_CRCCHECK) { -if (tta_check_crc(s, avctx-extradata + 22, total_frames * 4)) +int ret = tta_check_crc(s, avctx-extradata + 22, total_frames * 4); +if (ret 0 avctx-err_recognition AV_EF_EXPLODE) return AVERROR_INVALIDDATA; } skip_bits_long(s-gb, 32 * total_frames); @@ -316,7 +317,8 @@ static int tta_decode_frame(AVCodecContext *avctx, void *data, int32_t *p; if (avctx-err_recognition AV_EF_CRCCHECK) { -if (buf_size 4 || tta_check_crc(s, buf, buf_size - 4)) +if (buf_size 4 || +(tta_check_crc(s, buf, buf_size - 4) avctx-err_recognition AV_EF_EXPLODE)) return AVERROR_INVALIDDATA; } diff --git a/libavcodec/wavpack.c b/libavcodec/wavpack.c index bdc2a81..cbc5b04 100644 --- a/libavcodec/wavpack.c +++ b/libavcodec/wavpack.c @@ -699,9 +699,11 @@ static inline int wv_unpack_mono(WavpackFrameContext *s, GetBitContext *gb, } while (!last count s-samples); wv_reset_saved_context(s); -if ((s-avctx-err_recognition AV_EF_CRCCHECK) -wv_check_crc(s, crc, crc_extra_bits)) -return AVERROR_INVALIDDATA; +if (s-avctx-err_recognition AV_EF_CRCCHECK) { +int ret = wv_check_crc(s, crc, crc_extra_bits); +if (ret 0 s-avctx-err_recognition AV_EF_EXPLODE) +return ret; +} return 0; } -- 1.7.10.4 ___ libav-devel mailing list libav-devel@libav.org
[libav-devel] [PATCH 3/3] lavc: disable CRC checking by default
--- libavcodec/options_table.h |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/options_table.h b/libavcodec/options_table.h index 5e9d484..0706f9a 100644 --- a/libavcodec/options_table.h +++ b/libavcodec/options_table.h @@ -139,7 +139,7 @@ static const AVOption avcodec_options[] = { {unofficial, allow unofficial extensions, 0, AV_OPT_TYPE_CONST, {.i64 = FF_COMPLIANCE_UNOFFICIAL }, INT_MIN, INT_MAX, V|D|E, strict}, {experimental, allow non-standardized experimental things, 0, AV_OPT_TYPE_CONST, {.i64 = FF_COMPLIANCE_EXPERIMENTAL }, INT_MIN, INT_MAX, V|D|E, strict}, {b_qoffset, QP offset between P- and B-frames, OFFSET(b_quant_offset), AV_OPT_TYPE_FLOAT, {.dbl = 1.25 }, -FLT_MAX, FLT_MAX, V|E}, -{err_detect, set error detection flags, OFFSET(err_recognition), AV_OPT_TYPE_FLAGS, {.i64 = AV_EF_CRCCHECK }, INT_MIN, INT_MAX, A|V|D, err_detect}, +{err_detect, set error detection flags, OFFSET(err_recognition), AV_OPT_TYPE_FLAGS, {.i64 = 0}, INT_MIN, INT_MAX, A|V|D, err_detect}, {crccheck, verify embedded CRCs, 0, AV_OPT_TYPE_CONST, {.i64 = AV_EF_CRCCHECK }, INT_MIN, INT_MAX, V|D, err_detect}, {bitstream, detect bitstream specification deviations, 0, AV_OPT_TYPE_CONST, {.i64 = AV_EF_BITSTREAM }, INT_MIN, INT_MAX, V|D, err_detect}, {buffer, detect improper bitstream length, 0, AV_OPT_TYPE_CONST, {.i64 = AV_EF_BUFFER }, INT_MIN, INT_MAX, V|D, err_detect}, -- 1.7.10.4 ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
[libav-devel] [PATCH 1/3] error resilience: check error_concealment, not err_recognition.
err_recognition is supposed to trigger detecting and reporting errors, not trying to fix them. --- Those patches are not really related to HEVC, so splitting them off into a separate set --- libavcodec/error_resilience.c |6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libavcodec/error_resilience.c b/libavcodec/error_resilience.c index a07787a..1769d2b 100644 --- a/libavcodec/error_resilience.c +++ b/libavcodec/error_resilience.c @@ -726,7 +726,7 @@ static int is_intra_more_likely(ERContext *s) void ff_er_frame_start(ERContext *s) { -if (!s-avctx-err_recognition) +if (!s-avctx-error_concealment) return; memset(s-error_status_table, ER_MB_ERROR | VP_START | ER_MB_END, @@ -760,7 +760,7 @@ void ff_er_add_slice(ERContext *s, int startx, int starty, return; } -if (!s-avctx-err_recognition) +if (!s-avctx-error_concealment) return; mask = ~VP_START; @@ -822,7 +822,7 @@ void ff_er_frame_end(ERContext *s) /* We do not support ER of field pictures yet, * though it should not crash if enabled. */ -if (!s-avctx-err_recognition || s-error_count == 0 || +if (!s-avctx-error_concealment || s-error_count == 0|| s-avctx-hwaccel || !s-cur_pic || s-cur_pic-field_picture || s-error_count == 3 * s-mb_width * -- 1.7.10.4 ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH 1/3] error resilience: check error_concealment, not err_recognition.
On 27/10/13 09:16, Anton Khirnov wrote: err_recognition is supposed to trigger detecting and reporting errors, not trying to fix them. --- Those patches are not really related to HEVC, so splitting them off into a separate set --- libavcodec/error_resilience.c |6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) Ok. ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH 2/3] lavc: change all decoders to behave consistently with AV_EF_CRCCHECK.
On 27/10/13 09:16, Anton Khirnov wrote: Just crccheck prints a warning, crccheck+explode returns an error. Also document this behavior. --- libavcodec/ac3dec.c |3 ++- libavcodec/alsdec.c |2 ++ libavcodec/avcodec.h |7 +++ libavcodec/takdec.c |6 -- libavcodec/tta.c |6 -- libavcodec/wavpack.c |8 +--- 6 files changed, 24 insertions(+), 8 deletions(-) Looks ok. lu ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH 3/3] lavc: disable CRC checking by default
On 27/10/13 09:16, Anton Khirnov wrote: --- libavcodec/options_table.h |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/options_table.h b/libavcodec/options_table.h index 5e9d484..0706f9a 100644 --- a/libavcodec/options_table.h +++ b/libavcodec/options_table.h @@ -139,7 +139,7 @@ static const AVOption avcodec_options[] = { {unofficial, allow unofficial extensions, 0, AV_OPT_TYPE_CONST, {.i64 = FF_COMPLIANCE_UNOFFICIAL }, INT_MIN, INT_MAX, V|D|E, strict}, {experimental, allow non-standardized experimental things, 0, AV_OPT_TYPE_CONST, {.i64 = FF_COMPLIANCE_EXPERIMENTAL }, INT_MIN, INT_MAX, V|D|E, strict}, {b_qoffset, QP offset between P- and B-frames, OFFSET(b_quant_offset), AV_OPT_TYPE_FLOAT, {.dbl = 1.25 }, -FLT_MAX, FLT_MAX, V|E}, -{err_detect, set error detection flags, OFFSET(err_recognition), AV_OPT_TYPE_FLAGS, {.i64 = AV_EF_CRCCHECK }, INT_MIN, INT_MAX, A|V|D, err_detect}, +{err_detect, set error detection flags, OFFSET(err_recognition), AV_OPT_TYPE_FLAGS, {.i64 = 0}, INT_MIN, INT_MAX, A|V|D, err_detect}, {crccheck, verify embedded CRCs, 0, AV_OPT_TYPE_CONST, {.i64 = AV_EF_CRCCHECK }, INT_MIN, INT_MAX, V|D, err_detect}, {bitstream, detect bitstream specification deviations, 0, AV_OPT_TYPE_CONST, {.i64 = AV_EF_BITSTREAM }, INT_MIN, INT_MAX, V|D, err_detect}, {buffer, detect improper bitstream length, 0, AV_OPT_TYPE_CONST, {.i64 = AV_EF_BUFFER }, INT_MIN, INT_MAX, V|D, err_detect}, Ok. lu ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH] fate: add ffv1.0 test
I was trying to read myself into FATE, in order to be able to add additional tests for FFV1. I've already read the documentation about FATE [1], and I've already managed to add new testing rules for FFV1 (in tests/fate/vcodec.mak). btw: The FATE docs [1] only describe how to run the existing tests, but I didn't find information about how to create new ones. So far so good, but now I have some questions: 1) How do I add the reference files, required for tests to be able to diff? 2) How do I get a LCOV HTML report locally? I'd like to cover more lines of FFV1's code, and therefore would like to be able to view the LCOV - code coverage report [2] from my local tests. I assumed that running the fate.sh script for submitting FATE results would create those HTML pages. I've created a fate_config.sh file, based on doc/fate_config.sh.template and ran the tests. Now I've got the $workdir with the compile.log, configure.log, report, etc. Any suggestions how I could have a local LCOV view? Thanks and regards, Pb == References: [1] http://www.libav.org/fate.html [2] http://coverage.ffmpeg.org/ffmpeg/libavcodec/ffv1enc.c.gcov.html ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH] avformat: AviSynth demuxer rewrite
On Sun, Oct 27, 2013 at 12:40 AM, Stephen Hutchinson qyo...@gmail.com wrote: All that considered, I could also just make the comment more verbose about AvxSynth's dim prospects of ever being run on Windows. Or I could nest the if/else that uses those functions in another if/else that gets used only if it detects AviSynth 2.6. I'd have to test. I ended up making the comment more verbose, since trying to control it by a version check only results in implicit declaration errors. I've also changed most of the // comments to /* */ for consistency and removed the {} from the LOAD_AVS_FUNC portion. The updated patch will be submitted shortly. ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
[libav-devel] [PATCH] avformat: AviSynth demuxer rewrite
From: d s avxsynth.test...@gmail.com Directly loads AviSynth through LoadLibrary instead of relying on Video for Windows, and supports using AvxSynth (via dlopen) to open scripts on Linux and OS X. Error messages from AviSynth/AvxSynth are now reported through av_log and exit, rather than the traditional behavior of generating an error video that the user would need to watch to diagnose. The main rewrite was authored by d s avxsynth.test...@gmail.com from the AvxSynth team, with additional contributions by Oka Motofumi chikuzen...@gmail.com Stephen Hutchinson qyo...@gmail.com --- configure | 4 +- libavformat/avisynth.c | 801 +++-- 2 files changed, 638 insertions(+), 167 deletions(-) diff --git a/configure b/configure index f542995..067b918 100755 --- a/configure +++ b/configure @@ -3778,7 +3778,9 @@ for func in $MATH_FUNCS; do done # these are off by default, so fail if requested and not available -enabled avisynth require2 vfw32 windows.h vfw.h AVIFileInit -lavifil32 +enabled avisynth { { check_header avisynth/avisynth_c.h check_lib2 windows.h LoadLibrary; } || + { check_header avxsynth/avxsynth_c.h check_lib2 dlfcn.h dlopen -ldl; } || + die ERROR: LoadLibrary/dlopen not found for avisynth; } enabled frei0r { check_header frei0r.h || die ERROR: frei0r.h header not found; } enabled gnutls require_pkg_config gnutls gnutls/gnutls.h gnutls_global_init enabled libfaacrequire2 libfaac stdint.h faac.h faacEncGetVersion -lfaac diff --git a/libavformat/avisynth.c b/libavformat/avisynth.c index e411d35..24aeea9 100644 --- a/libavformat/avisynth.c +++ b/libavformat/avisynth.c @@ -1,6 +1,6 @@ /* - * AviSynth support - * Copyright (c) 2006 DivX, Inc. + * Avi/AvxSynth support + * Copyright (c) 2012 AvxSynth Team. * * This file is part of Libav. * @@ -19,211 +19,680 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#include windows.h -#include vfw.h - #include libavutil/internal.h +#include libavcodec/internal.h #include avformat.h #include internal.h -#include riff.h - -typedef struct { -PAVISTREAM handle; -AVISTREAMINFO info; -DWORD read; -LONG chunck_size; -LONG chunck_samples; -} AviSynthStream; - -typedef struct { -PAVIFILE file; -AviSynthStream *streams; -int nb_streams; -int next_stream; + +/* Enable function pointer definitions for runtime loading. */ +#define AVSC_NO_DECLSPEC + +/* Platform-specific directives for AviSynth vs AvxSynth. */ +#ifdef _WIN32 + #include windows.h + #undef EXTERN_C + #include avisynth/avisynth_c.h + #define AVISYNTH_LIB avisynth +#else + #include dlfcn.h + #include avxsynth/avxsynth_c.h +#if defined (__APPLE__) + #define AVISYNTH_LIB libavxsynth.dylib +#else + #define AVISYNTH_LIB libavxsynth.so +#endif + + #define LoadLibrary(x) dlopen(x, RTLD_NOW | RTLD_GLOBAL) + #define GetProcAddress dlsym + #define FreeLibrary dlclose +#endif + +/* AvxSynth doesn't have these colorspace-related functions, + * so disable them forcibly if we're compiling on an OS + * that's not Windows. If they aren't disabled when using + * AvxSynth, it results implicit declaration errors. It is + * unlikely that AvxSynth will ever be re-ported to run on + * Windows (and even if it was, it'd be at the same level + * as AviSynth 2.5, which libav doesn't support). */ +#ifndef _WIN32 +#define avs_is_yv24(vi) 0 +#define avs_is_yv16(vi) 0 +#define avs_is_yv411(vi) 0 +#define avs_is_y8(vi) 0 +#endif + +typedef struct AviSynthLibrary { +void *library; +#define AVSC_DECLARE_FUNC(name) name ## _func name +AVSC_DECLARE_FUNC(avs_bit_blt); +AVSC_DECLARE_FUNC(avs_clip_get_error); +AVSC_DECLARE_FUNC(avs_create_script_environment); +AVSC_DECLARE_FUNC(avs_delete_script_environment); +AVSC_DECLARE_FUNC(avs_get_audio); +AVSC_DECLARE_FUNC(avs_get_error); +AVSC_DECLARE_FUNC(avs_get_frame); +AVSC_DECLARE_FUNC(avs_get_version); +AVSC_DECLARE_FUNC(avs_get_video_info); +AVSC_DECLARE_FUNC(avs_invoke); +AVSC_DECLARE_FUNC(avs_release_clip); +AVSC_DECLARE_FUNC(avs_release_value); +AVSC_DECLARE_FUNC(avs_release_video_frame); +AVSC_DECLARE_FUNC(avs_take_clip); +#undef AVSC_DECLARE_FUNC +} AviSynthLibrary; + +typedef struct AviSynthContext { +AVS_ScriptEnvironment *env; +AVS_Clip *clip; +const AVS_VideoInfo *vi; + +/* avisynth_read_packet_video() iterates over this. */ +int n_planes; +const int *planes; + +int curr_stream; +int curr_frame; +int64_t curr_sample; + +int error; + +/* Linked list pointers. */ +struct AviSynthContext *next; } AviSynthContext; -static int avisynth_read_header(AVFormatContext *s) +static const int avs_planes_packed[1] = { 0 }; +static const int avs_planes_grey[1] = { AVS_PLANAR_Y }; +static
[libav-devel] [PATCH 02/50] lavc: add error checking to apply_param_change.
--- libavcodec/utils.c | 51 +-- 1 file changed, 37 insertions(+), 14 deletions(-) diff --git a/libavcodec/utils.c b/libavcodec/utils.c index 9ef477f..d14d4f4 100644 --- a/libavcodec/utils.c +++ b/libavcodec/utils.c @@ -1321,46 +1321,59 @@ int avcodec_encode_subtitle(AVCodecContext *avctx, uint8_t *buf, int buf_size, return ret; } -static void apply_param_change(AVCodecContext *avctx, AVPacket *avpkt) +static int apply_param_change(AVCodecContext *avctx, AVPacket *avpkt) { int size = 0; const uint8_t *data; uint32_t flags; -if (!(avctx-codec-capabilities CODEC_CAP_PARAM_CHANGE)) -return; - data = av_packet_get_side_data(avpkt, AV_PKT_DATA_PARAM_CHANGE, size); -if (!data || size 4) -return; +if (!data) +return 0; + +if (!(avctx-codec-capabilities CODEC_CAP_PARAM_CHANGE)) { +av_log(avctx, AV_LOG_ERROR, This decoder does not support parameter + changes, but PARAM_CHANGE side data was sent to it.\n); +return AVERROR(EINVAL); +} + +if (size 4) +goto fail; + flags = bytestream_get_le32(data); size -= 4; -if (size 4) /* Required for any of the changes */ -return; + if (flags AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_COUNT) { +if (size 4) +goto fail; avctx-channels = bytestream_get_le32(data); size -= 4; } if (flags AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_LAYOUT) { if (size 8) -return; +goto fail; avctx-channel_layout = bytestream_get_le64(data); size -= 8; } -if (size 4) -return; if (flags AV_SIDE_DATA_PARAM_CHANGE_SAMPLE_RATE) { +if (size 4) +goto fail; avctx-sample_rate = bytestream_get_le32(data); size -= 4; } if (flags AV_SIDE_DATA_PARAM_CHANGE_DIMENSIONS) { if (size 8) -return; +goto fail; avctx-width = bytestream_get_le32(data); avctx-height = bytestream_get_le32(data); avcodec_set_dimensions(avctx, avctx-width, avctx-height); size -= 8; } + +return 0; +fail: +av_log(avctx, AV_LOG_ERROR, PARAM_CHANGE side data too small.\n); +return AVERROR_INVALIDDATA; } int attribute_align_arg avcodec_decode_video2(AVCodecContext *avctx, AVFrame *picture, @@ -1375,7 +1388,12 @@ int attribute_align_arg avcodec_decode_video2(AVCodecContext *avctx, AVFrame *pi return -1; avctx-pkt = avpkt; -apply_param_change(avctx, avpkt); +ret = apply_param_change(avctx, avpkt); +if (ret 0) { +av_log(avctx, AV_LOG_ERROR, Error applying parameter changes.\n); +if (avctx-err_recognition AV_EF_EXPLODE) +return ret; +} avcodec_get_frame_defaults(picture); @@ -1441,7 +1459,12 @@ int attribute_align_arg avcodec_decode_audio4(AVCodecContext *avctx, return AVERROR(EINVAL); } -apply_param_change(avctx, avpkt); +ret = apply_param_change(avctx, avpkt); +if (ret 0) { +av_log(avctx, AV_LOG_ERROR, Error applying parameter changes.\n); +if (avctx-err_recognition AV_EF_EXPLODE) +return ret; +} avcodec_get_frame_defaults(frame); -- 1.7.10.4 ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
[libav-devel] [PATCH 15/50] dvdec: stop using deprecated avcodec_set_dimensions
--- libavcodec/dvdec.c |8 ++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/libavcodec/dvdec.c b/libavcodec/dvdec.c index 4b7dfee..aee4053 100644 --- a/libavcodec/dvdec.c +++ b/libavcodec/dvdec.c @@ -318,7 +318,7 @@ static int dvvideo_decode_frame(AVCodecContext *avctx, int buf_size = avpkt-size; DVVideoContext *s = avctx-priv_data; const uint8_t* vsc_pack; -int apt, is16_9; +int apt, is16_9, ret; s-sys = avpriv_dv_frame_profile(s-sys, buf, buf_size); if (!s-sys || buf_size s-sys-frame_size || ff_dv_init_dynamic_tables(s-sys)) { @@ -330,7 +330,11 @@ static int dvvideo_decode_frame(AVCodecContext *avctx, s-picture.pict_type = AV_PICTURE_TYPE_I; avctx-pix_fmt = s-sys-pix_fmt; avctx-time_base = s-sys-time_base; -avcodec_set_dimensions(avctx, s-sys-width, s-sys-height); + +ret = ff_set_dimensions(avctx, s-sys-width, s-sys-height); +if (ret 0) +return ret; + if (ff_get_buffer(avctx, s-picture, 0) 0) { av_log(avctx, AV_LOG_ERROR, get_buffer() failed\n); return -1; -- 1.7.10.4 ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
[libav-devel] [PATCH 05/50] oggparsetheora: check av_mallocz result
--- libavformat/oggparsetheora.c |2 ++ 1 file changed, 2 insertions(+) diff --git a/libavformat/oggparsetheora.c b/libavformat/oggparsetheora.c index ce4a462..f4f4453 100644 --- a/libavformat/oggparsetheora.c +++ b/libavformat/oggparsetheora.c @@ -50,6 +50,8 @@ static int theora_header(AVFormatContext * s, int idx) if (!thp) { thp = av_mallocz(sizeof(*thp)); +if (!thp) +return AVERROR(ENOMEM); os-private = thp; } -- 1.7.10.4 ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
[libav-devel] [PATCH 42/50] svq1dec: stop using deprecated avcodec_set_dimensions
--- libavcodec/svq1dec.c |5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libavcodec/svq1dec.c b/libavcodec/svq1dec.c index 7d3ef50..3b1a275 100644 --- a/libavcodec/svq1dec.c +++ b/libavcodec/svq1dec.c @@ -638,7 +638,10 @@ static int svq1_decode_frame(AVCodecContext *avctx, void *data, av_dlog(avctx, Error in svq1_decode_frame_header %i\n, result); return result; } -avcodec_set_dimensions(avctx, s-width, s-height); + +result = ff_set_dimensions(avctx, s-width, s-height); +if (result 0) +return result; if ((avctx-skip_frame = AVDISCARD_NONREF s-nonref) || (avctx-skip_frame = AVDISCARD_NONKEY -- 1.7.10.4 ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
[libav-devel] [PATCH 41/50] sunrast: stop using deprecated avcodec_set_dimensions
--- libavcodec/sunrast.c | 10 -- 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/libavcodec/sunrast.c b/libavcodec/sunrast.c index 4147cf0..ffa685c 100644 --- a/libavcodec/sunrast.c +++ b/libavcodec/sunrast.c @@ -61,10 +61,6 @@ static int sunrast_decode_frame(AVCodecContext *avctx, void *data, av_log(avctx, AV_LOG_ERROR, invalid (compression) type\n); return AVERROR_INVALIDDATA; } -if (av_image_check_size(w, h, 0, avctx)) { -av_log(avctx, AV_LOG_ERROR, invalid image size\n); -return AVERROR_INVALIDDATA; -} if (maptype == RMT_RAW) { avpriv_request_sample(avctx, Unknown colormap type); return AVERROR_PATCHWELCOME; @@ -90,8 +86,10 @@ static int sunrast_decode_frame(AVCodecContext *avctx, void *data, return AVERROR_INVALIDDATA; } -if (w != avctx-width || h != avctx-height) -avcodec_set_dimensions(avctx, w, h); +ret = ff_set_dimensions(avctx, w, h); +if (ret 0) +return ret; + if ((ret = ff_get_buffer(avctx, p, 0)) 0) { av_log(avctx, AV_LOG_ERROR, get_buffer() failed\n); return ret; -- 1.7.10.4 ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
[libav-devel] [PATCH 03/50] oggparsetheora: cosmetics, reformat
Also typedef the private data struct and make its name consistent with the rest of Libav. --- libavformat/oggparsetheora.c | 55 +- 1 file changed, 28 insertions(+), 27 deletions(-) diff --git a/libavformat/oggparsetheora.c b/libavformat/oggparsetheora.c index 25210ab..614cc29 100644 --- a/libavformat/oggparsetheora.c +++ b/libavformat/oggparsetheora.c @@ -29,26 +29,26 @@ #include internal.h #include oggdec.h -struct theora_params { +typedef struct TheoraParams { int gpshift; int gpmask; unsigned version; -}; +} TheoraParams; -static int -theora_header (AVFormatContext * s, int idx) +static int theora_header(AVFormatContext * s, int idx) { -struct ogg *ogg = s-priv_data; +struct ogg *ogg = s-priv_data; struct ogg_stream *os = ogg-streams + idx; -AVStream *st = s-streams[idx]; -struct theora_params *thp = os-private; -int cds = st-codec-extradata_size + os-psize + 2, err; +AVStream *st = s-streams[idx]; +TheoraParams *thp = os-private; +int cds = st-codec-extradata_size + os-psize + 2; +int err; uint8_t *cdp; -if(!(os-buf[os-pstart] 0x80)) +if (!(os-buf[os-pstart] 0x80)) return 0; -if(!thp){ +if (!thp) { thp = av_mallocz(sizeof(*thp)); os-private = thp; } @@ -59,15 +59,15 @@ theora_header (AVFormatContext * s, int idx) int width, height; AVRational timebase; -init_get_bits(gb, os-buf + os-pstart, os-psize*8); +init_get_bits(gb, os-buf + os-pstart, os-psize * 8); -skip_bits_long(gb, 7*8); /* 0x80theora */ +/* 0x80theora */ +skip_bits_long(gb, 7 * 8); thp-version = get_bits_long(gb, 24); -if (thp-version 0x030100) -{ +if (thp-version 0x030100) { av_log(s, AV_LOG_ERROR, -Too old or unsupported Theora (%x)\n, thp-version); + Too old or unsupported Theora (%x)\n, thp-version); return -1; } @@ -81,12 +81,13 @@ theora_header (AVFormatContext * s, int idx) if (thp-version = 0x030200) { width = get_bits_long(gb, 24); height = get_bits_long(gb, 24); -if ( width = st-codec-width width st-codec-width-16 - height = st-codec-height height st-codec-height-16) +if (width = st-codec-width width st-codec-width - 16 +height = st-codec-height height st-codec-height - 16) avcodec_set_dimensions(st-codec, width, height); skip_bits(gb, 16); } + timebase.den = get_bits_long(gb, 32); timebase.num = get_bits_long(gb, 32); if (!(timebase.num 0 timebase.den 0)) { @@ -105,11 +106,11 @@ theora_header (AVFormatContext * s, int idx) skip_bits(gb, 2); thp-gpshift = get_bits(gb, 5); -thp-gpmask = (1 thp-gpshift) - 1; +thp-gpmask = (1 thp-gpshift) - 1; st-codec-codec_type = AVMEDIA_TYPE_VIDEO; -st-codec-codec_id = AV_CODEC_ID_THEORA; -st-need_parsing = AVSTREAM_PARSE_HEADERS; +st-codec-codec_id = AV_CODEC_ID_THEORA; +st-need_parsing = AVSTREAM_PARSE_HEADERS; } break; @@ -128,21 +129,21 @@ theora_header (AVFormatContext * s, int idx) st-codec-extradata_size = 0; return err; } -cdp = st-codec-extradata + st-codec-extradata_size; +cdp= st-codec-extradata + st-codec-extradata_size; *cdp++ = os-psize 8; *cdp++ = os-psize 0xff; -memcpy (cdp, os-buf + os-pstart, os-psize); +memcpy(cdp, os-buf + os-pstart, os-psize); st-codec-extradata_size = cds; return 1; } -static uint64_t -theora_gptopts(AVFormatContext *ctx, int idx, uint64_t gp, int64_t *dts) +static uint64_t theora_gptopts(AVFormatContext *ctx, int idx, uint64_t gp, + int64_t *dts) { -struct ogg *ogg = ctx-priv_data; +struct ogg *ogg = ctx-priv_data; struct ogg_stream *os = ogg-streams + idx; -struct theora_params *thp = os-private; +TheoraParams *thp = os-private; uint64_t iframe, pframe; if (!thp) @@ -154,7 +155,7 @@ theora_gptopts(AVFormatContext *ctx, int idx, uint64_t gp, int64_t *dts) if (thp-version 0x030201) iframe++; -if(!pframe) +if (!pframe) os-pflags |= AV_PKT_FLAG_KEY; if (dts) -- 1.7.10.4 ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
[libav-devel] [PATCH 11/50] cdxl: stop using deprecated avcodec_set_dimensions
--- libavcodec/cdxl.c |5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/libavcodec/cdxl.c b/libavcodec/cdxl.c index b198c4c..e0dcd1d 100644 --- a/libavcodec/cdxl.c +++ b/libavcodec/cdxl.c @@ -237,10 +237,9 @@ static int cdxl_decode_frame(AVCodecContext *avctx, void *data, return AVERROR_PATCHWELCOME; } -if ((ret = av_image_check_size(w, h, 0, avctx)) 0) +ret = ff_set_dimensions(avctx, w, h); +if (ret 0) return ret; -if (w != avctx-width || h != avctx-height) -avcodec_set_dimensions(avctx, w, h); aligned_width = FFALIGN(c-avctx-width, 16); c-padded_bits = aligned_width - c-avctx-width; -- 1.7.10.4 ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
[libav-devel] [PATCH 07/50] oggparsetheora: stop using deprecated avcodec_set_dimensions
--- libavformat/oggparsetheora.c | 16 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/libavformat/oggparsetheora.c b/libavformat/oggparsetheora.c index f4f4453..c683044 100644 --- a/libavformat/oggparsetheora.c +++ b/libavformat/oggparsetheora.c @@ -58,7 +58,6 @@ static int theora_header(AVFormatContext * s, int idx) switch (os-buf[os-pstart]) { case 0x80: { GetBitContext gb; -int width, height; AVRational timebase; init_get_bits(gb, os-buf + os-pstart, os-psize * 8); @@ -73,19 +72,20 @@ static int theora_header(AVFormatContext * s, int idx) return AVERROR(ENOSYS); } -width = get_bits(gb, 16) 4; -height = get_bits(gb, 16) 4; -avcodec_set_dimensions(st-codec, width, height); +st-codec-width = get_bits(gb, 16) 4; +st-codec-height = get_bits(gb, 16) 4; if (thp-version = 0x030400) skip_bits(gb, 100); if (thp-version = 0x030200) { -width = get_bits_long(gb, 24); -height = get_bits_long(gb, 24); +int width = get_bits_long(gb, 24); +int height = get_bits_long(gb, 24); if (width = st-codec-width width st-codec-width - 16 -height = st-codec-height height st-codec-height - 16) -avcodec_set_dimensions(st-codec, width, height); +height = st-codec-height height st-codec-height - 16) { +st-codec-width = width; +st-codec-height = height; +} skip_bits(gb, 16); } -- 1.7.10.4 ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
[libav-devel] [PATCH 23/50] gifdec: stop using deprecated avcodec_set_dimensions
--- libavcodec/gifdec.c |5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/libavcodec/gifdec.c b/libavcodec/gifdec.c index a233797..4814230 100644 --- a/libavcodec/gifdec.c +++ b/libavcodec/gifdec.c @@ -292,9 +292,10 @@ static int gif_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, return ret; avctx-pix_fmt = AV_PIX_FMT_PAL8; -if ((ret = av_image_check_size(s-screen_width, s-screen_height, 0, avctx)) 0) + +ret = ff_set_dimensions(avctx, s-screen_width, s-screen_height); +if (ret 0) return ret; -avcodec_set_dimensions(avctx, s-screen_width, s-screen_height); if ((ret = ff_get_buffer(avctx, picture, 0)) 0) { av_log(avctx, AV_LOG_ERROR, get_buffer() failed\n); -- 1.7.10.4 ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
[libav-devel] [PATCH 04/50] oggparsetheora: return meaningful error codes
--- libavformat/oggparsetheora.c |6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libavformat/oggparsetheora.c b/libavformat/oggparsetheora.c index 614cc29..ce4a462 100644 --- a/libavformat/oggparsetheora.c +++ b/libavformat/oggparsetheora.c @@ -68,7 +68,7 @@ static int theora_header(AVFormatContext * s, int idx) if (thp-version 0x030100) { av_log(s, AV_LOG_ERROR, Too old or unsupported Theora (%x)\n, thp-version); -return -1; +return AVERROR(ENOSYS); } width = get_bits(gb, 16) 4; @@ -118,10 +118,10 @@ static int theora_header(AVFormatContext * s, int idx) ff_vorbis_comment(s, st-metadata, os-buf + os-pstart + 7, os-psize - 7); case 0x82: if (!thp-version) -return -1; +return AVERROR_INVALIDDATA; break; default: -return -1; +return AVERROR_INVALIDDATA; } if ((err = av_reallocp(st-codec-extradata, -- 1.7.10.4 ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
[libav-devel] [PATCH 12/50] dirac: stop using deprecated avcodec_set_dimensions
--- libavcodec/dirac.c |6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libavcodec/dirac.c b/libavcodec/dirac.c index e11fea7..f0fb85d 100644 --- a/libavcodec/dirac.c +++ b/libavcodec/dirac.c @@ -29,6 +29,7 @@ #include dirac.h #include avcodec.h #include golomb.h +#include internal.h #include mpeg12data.h // defaults for source parameters @@ -311,11 +312,10 @@ int avpriv_dirac_parse_sequence_header(AVCodecContext *avctx, GetBitContext *gb, if (ret = parse_source_parameters(avctx, gb, source)) return ret; -if (ret = av_image_check_size(source-width, source-height, 0, avctx)) +ret = ff_set_dimensions(avctx, source-width, source-height); +if (ret 0) return ret; -avcodec_set_dimensions(avctx, source-width, source-height); - /* [DIRAC_STD] picture_coding_mode shall be 0 for fields and 1 for frames * currently only used to signal field coding */ picture_coding_mode = svq3_get_ue_golomb(gb); -- 1.7.10.4 ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
[libav-devel] [PATCH 06/50] lavc: replace avcodec_set_dimensions with ff_set_dimensions
avcodec_set_dimensions() is supposed to be an internal utility function, there is no reason whatsoever for it to be public. Therefore deprecate it. --- libavcodec/avcodec.h |6 ++ libavcodec/internal.h |6 ++ libavcodec/utils.c| 19 +++ libavcodec/version.h |3 +++ 4 files changed, 30 insertions(+), 4 deletions(-) diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index 84bfccb..856eda5 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h @@ -4019,7 +4019,13 @@ enum AVPixelFormat avcodec_default_get_format(struct AVCodecContext *s, const en * @} */ +#if FF_API_SET_DIMENSIONS +/** + * @deprecated this function is not supposed to be used from outside of lavc + */ +attribute_deprecated void avcodec_set_dimensions(AVCodecContext *s, int width, int height); +#endif /** * Put a string representing the codec tag codec_tag in buf. diff --git a/libavcodec/internal.h b/libavcodec/internal.h index f57bedc..2133137 100644 --- a/libavcodec/internal.h +++ b/libavcodec/internal.h @@ -166,4 +166,10 @@ const uint8_t *avpriv_find_start_code(const uint8_t *restrict p, const uint8_t *end, uint32_t *restrict state); +/** + * Check that the provided frame dimensions are valid and set them on the codec + * context. + */ +int ff_set_dimensions(AVCodecContext *s, int width, int height); + #endif /* AVCODEC_INTERNAL_H */ diff --git a/libavcodec/utils.c b/libavcodec/utils.c index d14d4f4..1e0026d 100644 --- a/libavcodec/utils.c +++ b/libavcodec/utils.c @@ -152,12 +152,23 @@ unsigned avcodec_get_edge_width(void) return EDGE_WIDTH; } +#if FF_API_SET_DIMENSIONS void avcodec_set_dimensions(AVCodecContext *s, int width, int height) { -s-coded_width = width; -s-coded_height = height; -s-width= width; -s-height = height; +ff_set_dimensions(s, width, height); +} +#endif + +int ff_set_dimensions(AVCodecContext *s, int width, int height) +{ +int ret = av_image_check_size(width, height, 0, s); + +if (ret 0) +width = height = 0; +s-width = s-coded_width = width; +s-height = s-coded_height = height; + +return ret; } #if HAVE_NEON || ARCH_PPC || HAVE_MMX diff --git a/libavcodec/version.h b/libavcodec/version.h index e394c76..321c7ef 100644 --- a/libavcodec/version.h +++ b/libavcodec/version.h @@ -73,5 +73,8 @@ #ifndef FF_API_VOXWARE #define FF_API_VOXWARE (LIBAVCODEC_VERSION_MAJOR 56) #endif +#ifndef FF_API_SET_DIMENSIONS +#define FF_API_SET_DIMENSIONS(LIBAVCODEC_VERSION_MAJOR 56) +#endif #endif /* AVCODEC_VERSION_H */ -- 1.7.10.4 ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
[libav-devel] [PATCH 21/50] eatqi: stop using deprecated avcodec_set_dimensions
--- libavcodec/eatqi.c |5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/libavcodec/eatqi.c b/libavcodec/eatqi.c index 9f7ec4d..2345cc7 100644 --- a/libavcodec/eatqi.c +++ b/libavcodec/eatqi.c @@ -111,8 +111,9 @@ static int tqi_decode_frame(AVCodecContext *avctx, tqi_calculate_qtable(s, buf[4]); buf += 8; -if (s-avctx-width!=s-width || s-avctx-height!=s-height) -avcodec_set_dimensions(s-avctx, s-width, s-height); +ret = ff_set_dimensions(s-avctx, s-width, s-height); +if (ret 0) +return ret; if ((ret = ff_get_buffer(avctx, frame, 0)) 0) { av_log(avctx, AV_LOG_ERROR, get_buffer() failed\n); -- 1.7.10.4 ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
[libav-devel] [PATCH 40/50] sgidec: stop using deprecated avcodec_set_dimensions
--- libavcodec/sgidec.c |6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libavcodec/sgidec.c b/libavcodec/sgidec.c index 476311d..928806f 100644 --- a/libavcodec/sgidec.c +++ b/libavcodec/sgidec.c @@ -200,9 +200,9 @@ static int decode_frame(AVCodecContext *avctx, return -1; } -if (av_image_check_size(s-width, s-height, 0, avctx)) -return -1; -avcodec_set_dimensions(avctx, s-width, s-height); +ret = ff_set_dimensions(avctx, s-width, s-height); +if (ret 0) +return ret; if (ff_get_buffer(avctx, p, 0) 0) { av_log(avctx, AV_LOG_ERROR, get_buffer() failed.\n); -- 1.7.10.4 ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
[libav-devel] [PATCH 16/50] dvdsubdec: stop using deprecated avcodec_set_dimensions
--- libavcodec/dvdsubdec.c | 10 +++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/libavcodec/dvdsubdec.c b/libavcodec/dvdsubdec.c index 3cc9022..c5e864d 100644 --- a/libavcodec/dvdsubdec.c +++ b/libavcodec/dvdsubdec.c @@ -21,6 +21,8 @@ #include avcodec.h #include get_bits.h #include dsputil.h +#include internal.h + #include libavutil/attributes.h #include libavutil/colorspace.h #include libavutil/imgutils.h @@ -527,9 +529,11 @@ static av_cold int dvdsub_init(AVCodecContext *avctx) } } else if (!strncmp(size:, cur, 5)) { int w, h; -if (sscanf(cur + 5, %dx%d, w, h) == 2 -av_image_check_size(w, h, 0, avctx) = 0) -avcodec_set_dimensions(avctx, w, h); +if (sscanf(cur + 5, %dx%d, w, h) == 2) { + int ret = ff_set_dimensions(avctx, w, h); + if (ret 0) + return ret; +} } cur += strcspn(cur, \n\r); cur += strspn(cur, \n\r); -- 1.7.10.4 ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
[libav-devel] [PATCH 29/50] libvpxdec: stop using deprecated avcodec_set_dimensions
--- libavcodec/libvpxdec.c |6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libavcodec/libvpxdec.c b/libavcodec/libvpxdec.c index d19dd6f..d65f7f9 100644 --- a/libavcodec/libvpxdec.c +++ b/libavcodec/libvpxdec.c @@ -90,9 +90,9 @@ static int vp8_decode(AVCodecContext *avctx, if ((int) img-d_w != avctx-width || (int) img-d_h != avctx-height) { av_log(avctx, AV_LOG_INFO, dimension change! %dx%d - %dx%d\n, avctx-width, avctx-height, img-d_w, img-d_h); -if (av_image_check_size(img-d_w, img-d_h, 0, avctx)) -return AVERROR_INVALIDDATA; -avcodec_set_dimensions(avctx, img-d_w, img-d_h); +ret = ff_set_dimensions(avctx, img-d_w, img-d_h); +if (ret 0) +return ret; } if ((ret = ff_get_buffer(avctx, picture, 0)) 0) return ret; -- 1.7.10.4 ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
[libav-devel] [PATCH 34/50] pcx: stop using deprecated avcodec_set_dimensions
--- libavcodec/pcx.c |6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libavcodec/pcx.c b/libavcodec/pcx.c index ad92d75..6c51f6c 100644 --- a/libavcodec/pcx.c +++ b/libavcodec/pcx.c @@ -135,10 +135,10 @@ static int pcx_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, buf += 128; -if ((ret = av_image_check_size(w, h, 0, avctx)) 0) +ret = ff_set_dimensions(avctx, w, h); +if (ret 0) return ret; -if (w != avctx-width || h != avctx-height) -avcodec_set_dimensions(avctx, w, h); + if ((ret = ff_get_buffer(avctx, p, 0)) 0) { av_log(avctx, AV_LOG_ERROR, get_buffer() failed\n); return ret; -- 1.7.10.4 ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
[libav-devel] [PATCH 49/50] vp8: stop using deprecated avcodec_set_dimensions
--- libavcodec/vp5.c |1 + libavcodec/vp6.c |1 + libavcodec/vp8.c |9 - 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/libavcodec/vp5.c b/libavcodec/vp5.c index 5cab9b6..b609282 100644 --- a/libavcodec/vp5.c +++ b/libavcodec/vp5.c @@ -28,6 +28,7 @@ #include avcodec.h #include get_bits.h +#include internal.h #include vp56.h #include vp56data.h diff --git a/libavcodec/vp6.c b/libavcodec/vp6.c index 07560d0..d10a640 100644 --- a/libavcodec/vp6.c +++ b/libavcodec/vp6.c @@ -32,6 +32,7 @@ #include avcodec.h #include get_bits.h #include huffman.h +#include internal.h #include vp56.h #include vp56data.h diff --git a/libavcodec/vp8.c b/libavcodec/vp8.c index 910ec20..b1b4f2d 100644 --- a/libavcodec/vp8.c +++ b/libavcodec/vp8.c @@ -114,16 +114,15 @@ static void vp8_decode_flush(AVCodecContext *avctx) static int update_dimensions(VP8Context *s, int width, int height) { AVCodecContext *avctx = s-avctx; -int i; +int i, ret; if (width != s-avctx-width || height != s-avctx-height) { -if (av_image_check_size(width, height, 0, s-avctx)) -return AVERROR_INVALIDDATA; - vp8_decode_flush_impl(s-avctx, 1); -avcodec_set_dimensions(s-avctx, width, height); +ret = ff_set_dimensions(s-avctx, width, height); +if (ret 0) +return ret; } s-mb_width = (s-avctx-coded_width +15) / 16; -- 1.7.10.4 ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
[libav-devel] [PATCH 24/50] h26[13]dec: stop using deprecated avcodec_set_dimensions
--- libavcodec/h261dec.c |5 - libavcodec/h263dec.c |4 +++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/libavcodec/h261dec.c b/libavcodec/h261dec.c index f88831f..10489e1 100644 --- a/libavcodec/h261dec.c +++ b/libavcodec/h261dec.c @@ -29,6 +29,7 @@ #include mpegvideo.h #include h263.h #include h261.h +#include internal.h #define H261_MBA_VLC_BITS 9 #define H261_MTYPE_VLC_BITS 6 @@ -608,7 +609,9 @@ retry: s-parse_context = pc; } if (!s-context_initialized) { -avcodec_set_dimensions(avctx, s-width, s-height); +ret = ff_set_dimensions(avctx, s-width, s-height); +if (ret 0) +return ret; goto retry; } diff --git a/libavcodec/h263dec.c b/libavcodec/h263dec.c index 6245068..503f8ea 100644 --- a/libavcodec/h263dec.c +++ b/libavcodec/h263dec.c @@ -590,7 +590,9 @@ int ff_h263_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, /* H.263 could change picture size any time */ s-context_reinit = 0; -avcodec_set_dimensions(avctx, s-width, s-height); +ret = ff_set_dimensions(avctx, s-width, s-height); +if (ret 0) +return ret; if ((ret = ff_MPV_common_frame_size_change(s))) return ret; -- 1.7.10.4 ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
[libav-devel] [PATCH 13/50] dnxhddec: stop using deprecated avcodec_set_dimensions
--- libavcodec/dnxhddec.c |6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libavcodec/dnxhddec.c b/libavcodec/dnxhddec.c index f7b8a22..5c29b3e 100644 --- a/libavcodec/dnxhddec.c +++ b/libavcodec/dnxhddec.c @@ -347,9 +347,9 @@ static int dnxhd_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, first_field = 1; } -if (av_image_check_size(ctx-width, ctx-height, 0, avctx)) -return -1; -avcodec_set_dimensions(avctx, ctx-width, ctx-height); +ret = ff_set_dimensions(avctx, ctx-width, ctx-height); +if (ret 0) +return ret; if (first_field) { if ((ret = ff_get_buffer(avctx, picture, 0)) 0) { -- 1.7.10.4 ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
[libav-devel] [PATCH 22/50] g2meet: stop using deprecated avcodec_set_dimensions
--- libavcodec/g2meet.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/g2meet.c b/libavcodec/g2meet.c index e7743e7..0b4a8b7 100644 --- a/libavcodec/g2meet.c +++ b/libavcodec/g2meet.c @@ -702,7 +702,7 @@ static int g2m_decode_frame(AVCodecContext *avctx, void *data, goto header_fail; } if (c-width != avctx-width || c-height != avctx-height) -avcodec_set_dimensions(avctx, c-width, c-height); +ff_set_dimensions(avctx, c-width, c-height); c-compression = bytestream2_get_be32(bc); if (c-compression != 2 c-compression != 3) { av_log(avctx, AV_LOG_ERROR, -- 1.7.10.4 ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
[libav-devel] [PATCH 36/50] pictordec: stop using deprecated avcodec_set_dimensions
--- libavcodec/pictordec.c |6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libavcodec/pictordec.c b/libavcodec/pictordec.c index 2d72977..33c4545 100644 --- a/libavcodec/pictordec.c +++ b/libavcodec/pictordec.c @@ -141,9 +141,9 @@ static int decode_frame(AVCodecContext *avctx, avctx-pix_fmt = AV_PIX_FMT_PAL8; if (s-width != avctx-width s-height != avctx-height) { -if (av_image_check_size(s-width, s-height, 0, avctx) 0) -return -1; -avcodec_set_dimensions(avctx, s-width, s-height); +ret = ff_set_dimensions(avctx, s-width, s-height); +if (ret 0) +return ret; } if ((ret = ff_get_buffer(avctx, frame, 0)) 0) { -- 1.7.10.4 ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
[libav-devel] [PATCH 37/50] ptx: stop using deprecated avcodec_set_dimensions
--- libavcodec/ptx.c |6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libavcodec/ptx.c b/libavcodec/ptx.c index 527e39a..9810e00 100644 --- a/libavcodec/ptx.c +++ b/libavcodec/ptx.c @@ -55,10 +55,10 @@ static int ptx_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, buf += offset; -if ((ret = av_image_check_size(w, h, 0, avctx)) 0) +ret = ff_set_dimensions(avctx, w, h); +if (ret 0) return ret; -if (w != avctx-width || h != avctx-height) -avcodec_set_dimensions(avctx, w, h); + if ((ret = ff_get_buffer(avctx, p, 0)) 0) { av_log(avctx, AV_LOG_ERROR, get_buffer() failed\n); return ret; -- 1.7.10.4 ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
[libav-devel] [PATCH 35/50] pgssubdec: stop using deprecated avcodec_set_dimensions
--- libavcodec/pgssubdec.c | 25 - 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/libavcodec/pgssubdec.c b/libavcodec/pgssubdec.c index 874493c..2102a51 100644 --- a/libavcodec/pgssubdec.c +++ b/libavcodec/pgssubdec.c @@ -27,6 +27,8 @@ #include avcodec.h #include dsputil.h #include bytestream.h +#include internal.h + #include libavutil/colorspace.h #include libavutil/imgutils.h @@ -272,13 +274,13 @@ static void parse_palette_segment(AVCodecContext *avctx, * @todo TODO: Implement cropping * @todo TODO: Implement forcing of subtitles */ -static void parse_presentation_segment(AVCodecContext *avctx, - const uint8_t *buf, int buf_size, - int64_t pts) +static int parse_presentation_segment(AVCodecContext *avctx, + const uint8_t *buf, int buf_size, + int64_t pts) { PGSSubContext *ctx = avctx-priv_data; -int x, y; +int x, y, ret; int w = bytestream_get_be16(buf); int h = bytestream_get_be16(buf); @@ -287,8 +289,9 @@ static void parse_presentation_segment(AVCodecContext *avctx, av_dlog(avctx, Video Dimensions %dx%d\n, w, h); -if (av_image_check_size(w, h, 0, avctx) = 0) -avcodec_set_dimensions(avctx, w, h); +ret = ff_set_dimensions(avctx, w, h); +if (ret 0) +return ret; /* Skip 1 bytes of unknown, frame rate? */ buf++; @@ -306,7 +309,7 @@ static void parse_presentation_segment(AVCodecContext *avctx, ctx-presentation.object_number = bytestream_get_byte(buf); ctx-presentation.composition_flag = 0; if (!ctx-presentation.object_number) -return; +return 0; /* * Skip 3 bytes of unknown: @@ -332,6 +335,8 @@ static void parse_presentation_segment(AVCodecContext *avctx, /* Fill in dimensions */ ctx-presentation.x = x; ctx-presentation.y = y; + +return 0; } /** @@ -413,7 +418,7 @@ static int decode(AVCodecContext *avctx, void *data, int *data_size, const uint8_t *buf_end; uint8_t segment_type; int segment_length; -int i; +int i, ret; av_dlog(avctx, PGS sub packet:\n); @@ -452,7 +457,9 @@ static int decode(AVCodecContext *avctx, void *data, int *data_size, parse_picture_segment(avctx, buf, segment_length); break; case PRESENTATION_SEGMENT: -parse_presentation_segment(avctx, buf, segment_length, avpkt-pts); +ret = parse_presentation_segment(avctx, buf, segment_length, avpkt-pts); +if (ret 0) +return ret; break; case WINDOW_SEGMENT: /* -- 1.7.10.4 ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
[libav-devel] [PATCH 18/50] eamad: stop using deprecated avcodec_set_dimensions
--- libavcodec/eamad.c |6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libavcodec/eamad.c b/libavcodec/eamad.c index 8d6aa62..f201861 100644 --- a/libavcodec/eamad.c +++ b/libavcodec/eamad.c @@ -250,10 +250,10 @@ static int decode_frame(AVCodecContext *avctx, buf += 16; if (avctx-width != width || avctx-height != height) { -if (av_image_check_size(width, height, 0, avctx) 0) -return -1; -avcodec_set_dimensions(avctx, width, height); av_frame_unref(s-last_frame); +ret = ff_set_dimensions(avctx, width, height); +if (ret 0) +return ret; } if ((ret = ff_get_buffer(avctx, frame, AV_GET_BUFFER_FLAG_REF)) 0) { -- 1.7.10.4 ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
[libav-devel] [PATCH 10/50] avs: stop using deprecated avcodec_set_dimensions
--- libavcodec/avs.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/avs.c b/libavcodec/avs.c index 6ff6d26..8e70a90 100644 --- a/libavcodec/avs.c +++ b/libavcodec/avs.c @@ -160,7 +160,7 @@ static av_cold int avs_decode_init(AVCodecContext * avctx) { AvsContext *s = avctx-priv_data; avctx-pix_fmt = AV_PIX_FMT_PAL8; -avcodec_set_dimensions(avctx, 318, 198); +ff_set_dimensions(avctx, 318, 198); avcodec_get_frame_defaults(s-picture); return 0; } -- 1.7.10.4 ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
[libav-devel] [PATCH 47/50] vp3: stop using deprecated avcodec_set_dimensions
--- libavcodec/vp3.c | 13 + 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/libavcodec/vp3.c b/libavcodec/vp3.c index 467dfd56..d596816 100644 --- a/libavcodec/vp3.c +++ b/libavcodec/vp3.c @@ -2166,6 +2166,7 @@ static int theora_decode_header(AVCodecContext *avctx, GetBitContext *gb) Vp3DecodeContext *s = avctx-priv_data; int visible_width, visible_height, colorspace; int offset_x = 0, offset_y = 0; +int ret; AVRational fps, aspect; s-theora = get_bits_long(gb, 24); @@ -2182,12 +2183,6 @@ static int theora_decode_header(AVCodecContext *avctx, GetBitContext *gb) visible_width = s-width = get_bits(gb, 16) 4; visible_height = s-height = get_bits(gb, 16) 4; -if(av_image_check_size(s-width, s-height, 0, avctx)){ -av_log(avctx, AV_LOG_ERROR, Invalid dimensions (%dx%d)\n, s-width, s-height); -s-width= s-height= 0; -return -1; -} - if (s-theora = 0x030200) { visible_width = get_bits_long(gb, 24); visible_height = get_bits_long(gb, 24); @@ -2234,9 +2229,11 @@ static int theora_decode_header(AVCodecContext *avctx, GetBitContext *gb) if ( visible_width = s-width visible_width s-width-16 visible_height = s-height visible_height s-height-16 !offset_x (offset_y == s-height - visible_height)) -avcodec_set_dimensions(avctx, visible_width, visible_height); +ret = ff_set_dimensions(avctx, visible_width, visible_height); else -avcodec_set_dimensions(avctx, s-width, s-height); +ret = ff_set_dimensions(avctx, s-width, s-height); +if (ret 0) +return ret; if (colorspace == 1) { avctx-color_primaries = AVCOL_PRI_BT470M; -- 1.7.10.4 ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
[libav-devel] [PATCH 30/50] mjpegdec: stop using deprecated avcodec_set_dimensions
--- libavcodec/mjpegdec.c |6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c index fdf7c87..dea195b 100644 --- a/libavcodec/mjpegdec.c +++ b/libavcodec/mjpegdec.c @@ -211,7 +211,7 @@ int ff_mjpeg_decode_dht(MJpegDecodeContext *s) int ff_mjpeg_decode_sof(MJpegDecodeContext *s) { -int len, nb_components, i, width, height, pix_fmt_id; +int len, nb_components, i, width, height, pix_fmt_id, ret; /* XXX: verify len field validity */ len = get_bits(s-gb, 16); @@ -309,7 +309,9 @@ int ff_mjpeg_decode_sof(MJpegDecodeContext *s) height *= 2; } -avcodec_set_dimensions(s-avctx, width, height); +ret = ff_set_dimensions(s-avctx, width, height); +if (ret 0) +return ret; s-first_picture = 0; } -- 1.7.10.4 ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
[libav-devel] [PATCH 31/50] mpeg12dec: stop using deprecated avcodec_set_dimensions
--- libavcodec/mpeg12dec.c |6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/libavcodec/mpeg12dec.c b/libavcodec/mpeg12dec.c index 9d1696c..53d1e0e 100644 --- a/libavcodec/mpeg12dec.c +++ b/libavcodec/mpeg12dec.c @@ -1141,6 +1141,7 @@ static int mpeg_decode_postinit(AVCodecContext *avctx) Mpeg1Context *s1 = avctx-priv_data; MpegEncContext *s = s1-mpeg_enc_ctx; uint8_t old_permutation[64]; +int ret; if ((s1-mpeg_enc_ctx_allocated == 0) || avctx-coded_width != s-width || @@ -1162,7 +1163,10 @@ static int mpeg_decode_postinit(AVCodecContext *avctx) if ((s-width == 0) || (s-height == 0)) return -2; -avcodec_set_dimensions(avctx, s-width, s-height); +ret = ff_set_dimensions(avctx, s-width, s-height); +if (ret 0) +return ret; + avctx-bit_rate = s-bit_rate; s1-save_aspect_info = s-aspect_ratio_info; s1-save_width = s-width; -- 1.7.10.4 ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
[libav-devel] [PATCH 09/50] ansi: stop using deprecated avcodec_set_dimensions
--- libavcodec/ansi.c |6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/libavcodec/ansi.c b/libavcodec/ansi.c index ae67f3c..3f30ae9 100644 --- a/libavcodec/ansi.c +++ b/libavcodec/ansi.c @@ -89,7 +89,7 @@ static av_cold int decode_init(AVCodecContext *avctx) s-bg = DEFAULT_BG_COLOR; if (!avctx-width || !avctx-height) -avcodec_set_dimensions(avctx, 803, 254); +ff_set_dimensions(avctx, 80 3, 25 4); return 0; } @@ -226,7 +226,9 @@ static int execute_code(AVCodecContext * avctx, int c) } if (width != avctx-width || height != avctx-height) { av_frame_unref(s-frame); -avcodec_set_dimensions(avctx, width, height); +ret = ff_set_dimensions(avctx, width, height); +if (ret 0) +return ret; ret = ff_get_buffer(avctx, s-frame, AV_GET_BUFFER_FLAG_REF); if (ret 0) { av_log(avctx, AV_LOG_ERROR, get_buffer() failed\n); -- 1.7.10.4 ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
[libav-devel] [PATCH 45/50] truemotion1: stop using deprecated avcodec_set_dimensions
--- libavcodec/truemotion1.c |8 +--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/libavcodec/truemotion1.c b/libavcodec/truemotion1.c index c1e0863..57b3d23 100644 --- a/libavcodec/truemotion1.c +++ b/libavcodec/truemotion1.c @@ -397,15 +397,17 @@ static int truemotion1_decode_header(TrueMotion1Context *s) new_pix_fmt = AV_PIX_FMT_RGB555; // RGB565 is supported as well s-w = width_shift; -if ((ret = av_image_check_size(s-w, s-h, 0, s-avctx)) 0) -return ret; if (s-w != s-avctx-width || s-h != s-avctx-height || new_pix_fmt != s-avctx-pix_fmt) { av_frame_unref(s-frame); s-avctx-sample_aspect_ratio = (AVRational){ 1 width_shift, 1 }; s-avctx-pix_fmt = new_pix_fmt; -avcodec_set_dimensions(s-avctx, s-w, s-h); + +ret = ff_set_dimensions(s-avctx, s-w, s-h); +if (ret 0) +return ret; + av_fast_malloc(s-vert_pred, s-vert_pred_size, s-avctx-width * sizeof(unsigned int)); } -- 1.7.10.4 ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
[libav-devel] [PATCH 25/50] indeo3: stop using deprecated avcodec_set_dimensions
--- libavcodec/indeo3.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/indeo3.c b/libavcodec/indeo3.c index 7cc870d..a9c02b2 100644 --- a/libavcodec/indeo3.c +++ b/libavcodec/indeo3.c @@ -944,7 +944,7 @@ static int decode_frame_headers(Indeo3DecodeContext *ctx, AVCodecContext *avctx, free_frame_buffers(ctx); if ((res = allocate_frame_buffers(ctx, avctx)) 0) return res; -avcodec_set_dimensions(avctx, width, height); +ff_set_dimensions(avctx, width, height); } y_offset = bytestream2_get_le32(gb); -- 1.7.10.4 ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
[libav-devel] [PATCH 39/50] rv34: stop using deprecated avcodec_set_dimensions
--- libavcodec/rv34.c |6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/libavcodec/rv34.c b/libavcodec/rv34.c index 7eb97e7..8038f8f 100644 --- a/libavcodec/rv34.c +++ b/libavcodec/rv34.c @@ -1667,7 +1667,11 @@ int ff_rv34_decode_frame(AVCodecContext *avctx, s-width = si.width; s-height = si.height; -avcodec_set_dimensions(s-avctx, s-width, s-height); + +err = ff_set_dimensions(s-avctx, s-width, s-height); +if (err 0) +return err; + if ((err = ff_MPV_common_frame_size_change(s)) 0) return err; if ((err = rv34_decoder_realloc(r)) 0) -- 1.7.10.4 ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
[libav-devel] [PATCH 50/50] webp: stop using deprecated avcodec_set_dimensions
--- libavcodec/webp.c |4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavcodec/webp.c b/libavcodec/webp.c index 8ad24f8..cf431fe 100644 --- a/libavcodec/webp.c +++ b/libavcodec/webp.c @@ -1085,10 +1085,10 @@ static int vp8_lossless_decode_frame(AVCodecContext *avctx, AVFrame *p, s-width, w); } s-height = h; -ret = av_image_check_size(s-width, s-height, 0, avctx); + +ret = ff_set_dimensions(avctx, s-width, s-height); if (ret 0) return ret; -avcodec_set_dimensions(avctx, s-width, s-height); s-has_alpha = get_bits1(s-gb); -- 1.7.10.4 ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
[libav-devel] [PATCH 33/50] mpegvideo_parser: stop using deprecated avcodec_set_dimensions
--- libavcodec/mpegvideo_parser.c |4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavcodec/mpegvideo_parser.c b/libavcodec/mpegvideo_parser.c index 3219c10..bec1b36 100644 --- a/libavcodec/mpegvideo_parser.c +++ b/libavcodec/mpegvideo_parser.c @@ -62,7 +62,7 @@ static void mpegvideo_extract_headers(AVCodecParserContext *s, pc-width = (buf[0] 4) | (buf[1] 4); pc-height = ((buf[1] 0x0f) 8) | buf[2]; if(!avctx-width || !avctx-height || !avctx-coded_width || !avctx-coded_height){ -avcodec_set_dimensions(avctx, pc-width, pc-height); +ff_set_dimensions(avctx, pc-width, pc-height); did_set_size=1; } frame_rate_index = buf[3] 0xf; @@ -90,7 +90,7 @@ static void mpegvideo_extract_headers(AVCodecParserContext *s, pc-height |=( vert_size_ext 12); avctx-bit_rate += (bit_rate_ext 18) * 400; if(did_set_size) -avcodec_set_dimensions(avctx, pc-width, pc-height); +ff_set_dimensions(avctx, pc-width, pc-height); avctx-time_base.den = pc-frame_rate.den * (frame_rate_ext_n + 1) * 2; avctx-time_base.num = pc-frame_rate.num * (frame_rate_ext_d + 1); avctx-codec_id = AV_CODEC_ID_MPEG2VIDEO; -- 1.7.10.4 ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
[libav-devel] [PATCH 43/50] targa: stop using deprecated avcodec_set_dimensions
--- libavcodec/targa.c |6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libavcodec/targa.c b/libavcodec/targa.c index 9f0b286..4b736c9 100644 --- a/libavcodec/targa.c +++ b/libavcodec/targa.c @@ -142,10 +142,10 @@ static int decode_frame(AVCodecContext *avctx, return AVERROR_INVALIDDATA; } -if ((ret = av_image_check_size(w, h, 0, avctx)) 0) +ret = ff_set_dimensions(avctx, w, h); +if (ret 0) return ret; -if(w != avctx-width || h != avctx-height) -avcodec_set_dimensions(avctx, w, h); + if ((ret = ff_get_buffer(avctx, p, 0)) 0){ av_log(avctx, AV_LOG_ERROR, get_buffer() failed\n); return ret; -- 1.7.10.4 ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
[libav-devel] [PATCH 08/50] lavc/utils: stop using deprecated avcodec_set_dimensions
--- libavcodec/utils.c | 14 +- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/libavcodec/utils.c b/libavcodec/utils.c index 1e0026d..262f081 100644 --- a/libavcodec/utils.c +++ b/libavcodec/utils.c @@ -934,15 +934,17 @@ int attribute_align_arg avcodec_open2(AVCodecContext *avctx, const AVCodec *code goto free_and_end; if (avctx-coded_width avctx-coded_height !avctx-width !avctx-height) -avcodec_set_dimensions(avctx, avctx-coded_width, avctx-coded_height); +ret = ff_set_dimensions(avctx, avctx-coded_width, avctx-coded_height); else if (avctx-width avctx-height) -avcodec_set_dimensions(avctx, avctx-width, avctx-height); +ret = ff_set_dimensions(avctx, avctx-width, avctx-height); +if (ret 0) +goto free_and_end; if ((avctx-coded_width || avctx-coded_height || avctx-width || avctx-height) ( av_image_check_size(avctx-coded_width, avctx-coded_height, 0, avctx) 0 || av_image_check_size(avctx-width, avctx-height, 0, avctx) 0)) { av_log(avctx, AV_LOG_WARNING, ignoring invalid width/height values\n); -avcodec_set_dimensions(avctx, 0, 0); +ff_set_dimensions(avctx, 0, 0); } /* if the decoder init function was already called previously, @@ -1334,7 +1336,7 @@ int avcodec_encode_subtitle(AVCodecContext *avctx, uint8_t *buf, int buf_size, static int apply_param_change(AVCodecContext *avctx, AVPacket *avpkt) { -int size = 0; +int size = 0, ret; const uint8_t *data; uint32_t flags; @@ -1377,8 +1379,10 @@ static int apply_param_change(AVCodecContext *avctx, AVPacket *avpkt) goto fail; avctx-width = bytestream_get_le32(data); avctx-height = bytestream_get_le32(data); -avcodec_set_dimensions(avctx, avctx-width, avctx-height); size -= 8; +ret = ff_set_dimensions(avctx, avctx-width, avctx-height); +if (ret 0) +return ret; } return 0; -- 1.7.10.4 ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
[libav-devel] [PATCH 32/50] mpeg4video_parser: stop using deprecated avcodec_set_dimensions
--- libavcodec/mpeg4video_parser.c |5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libavcodec/mpeg4video_parser.c b/libavcodec/mpeg4video_parser.c index e291262..dfba84c 100644 --- a/libavcodec/mpeg4video_parser.c +++ b/libavcodec/mpeg4video_parser.c @@ -20,6 +20,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ +#include internal.h #include parser.h #include mpegvideo.h #include mpeg4video.h @@ -89,7 +90,9 @@ static int av_mpeg4_decode_header(AVCodecParserContext *s1, init_get_bits(gb, buf, 8 * buf_size); ret = ff_mpeg4_decode_picture_header(s, gb); if (s-width (!avctx-width || !avctx-height || !avctx-coded_width || !avctx-coded_height)) { -avcodec_set_dimensions(avctx, s-width, s-height); +ret = ff_set_dimensions(avctx, s-width, s-height); +if (ret 0) +return ret; } s1-pict_type= s-pict_type; pc-first_picture = 0; -- 1.7.10.4 ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
[libav-devel] [PATCH 28/50] libopenjpegdec: stop using deprecated avcodec_set_dimensions
--- libavcodec/libopenjpegdec.c | 11 --- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/libavcodec/libopenjpegdec.c b/libavcodec/libopenjpegdec.c index 0062701..77a37e9 100644 --- a/libavcodec/libopenjpegdec.c +++ b/libavcodec/libopenjpegdec.c @@ -33,6 +33,7 @@ #include libavutil/pixfmt.h #include libavutil/opt.h #include avcodec.h +#include internal.h #include thread.h #define JP2_SIG_TYPE0x6A502020 @@ -315,13 +316,9 @@ static int libopenjpeg_decode_frame(AVCodecContext *avctx, height = (height + (1 ctx-lowres) - 1) ctx-lowres; } -if ((ret = av_image_check_size(width, height, 0, avctx)) 0) { -av_log(avctx, AV_LOG_ERROR, - %dx%d dimension invalid.\n, width, height); -goto done; -} - -avcodec_set_dimensions(avctx, width, height); +ret = ff_set_dimensions(avctx, width, height); +if (ret 0) +return ret; if (avctx-pix_fmt != AV_PIX_FMT_NONE) if (!libopenjpeg_matches_pix_fmt(image, avctx-pix_fmt)) -- 1.7.10.4 ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
[libav-devel] [PATCH 20/50] eatgv: stop using deprecated avcodec_set_dimensions
--- libavcodec/eatgv.c |7 +++ 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/libavcodec/eatgv.c b/libavcodec/eatgv.c index fabc516..3602795 100644 --- a/libavcodec/eatgv.c +++ b/libavcodec/eatgv.c @@ -269,9 +269,11 @@ static int tgv_decode_frame(AVCodecContext *avctx, s-width = AV_RL16(buf[0]); s-height = AV_RL16(buf[2]); if (s-avctx-width != s-width || s-avctx-height != s-height) { -avcodec_set_dimensions(s-avctx, s-width, s-height); av_freep(s-frame_buffer); av_frame_unref(s-last_frame); +ret = ff_set_dimensions(s-avctx, s-width, s-height); +if (ret 0) +return ret; } pal_count = AV_RL16(buf[6]); @@ -282,9 +284,6 @@ static int tgv_decode_frame(AVCodecContext *avctx, } } -if ((ret = av_image_check_size(s-width, s-height, 0, avctx)) 0) -return ret; - if ((ret = ff_get_buffer(avctx, frame, AV_GET_BUFFER_FLAG_REF)) 0) return ret; -- 1.7.10.4 ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
[libav-devel] [PATCH 14/50] dpx: stop using deprecated avcodec_set_dimensions
--- libavcodec/dpx.c |6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libavcodec/dpx.c b/libavcodec/dpx.c index da7457d..c1f163b 100644 --- a/libavcodec/dpx.c +++ b/libavcodec/dpx.c @@ -147,10 +147,10 @@ static int decode_frame(AVCodecContext *avctx, return AVERROR_INVALIDDATA; } -if ((ret = av_image_check_size(w, h, 0, avctx)) 0) +ret = ff_set_dimensions(avctx, w, h); +if (ret 0) return ret; -if (w != avctx-width || h != avctx-height) -avcodec_set_dimensions(avctx, w, h); + if ((ret = ff_get_buffer(avctx, p, 0)) 0) { av_log(avctx, AV_LOG_ERROR, get_buffer() failed\n); return ret; -- 1.7.10.4 ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
[libav-devel] [PATCH 44/50] tiff: stop using deprecated avcodec_set_dimensions
--- libavcodec/tiff.c |4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavcodec/tiff.c b/libavcodec/tiff.c index 735eafe..7fb0e7a 100644 --- a/libavcodec/tiff.c +++ b/libavcodec/tiff.c @@ -296,9 +296,9 @@ static int init_image(TiffContext *s, AVFrame *frame) return AVERROR_INVALIDDATA; } if (s-width != s-avctx-width || s-height != s-avctx-height) { -if ((ret = av_image_check_size(s-width, s-height, 0, s-avctx)) 0) +ret = ff_set_dimensions(s-avctx, s-width, s-height); +if (ret 0) return ret; -avcodec_set_dimensions(s-avctx, s-width, s-height); } if ((ret = ff_get_buffer(s-avctx, frame, 0)) 0) { av_log(s-avctx, AV_LOG_ERROR, get_buffer() failed\n); -- 1.7.10.4 ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
[libav-devel] [PATCH 27/50] kgv1dec: stop using deprecated avcodec_set_dimensions
--- libavcodec/kgv1dec.c |7 +++ 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/libavcodec/kgv1dec.c b/libavcodec/kgv1dec.c index 1774f36..a5f360c 100644 --- a/libavcodec/kgv1dec.c +++ b/libavcodec/kgv1dec.c @@ -61,12 +61,11 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, h = (buf[1] + 1) * 8; buf += 2; -if ((res = av_image_check_size(w, h, 0, avctx)) 0) -return res; - if (w != avctx-width || h != avctx-height) { av_frame_unref(c-prev); -avcodec_set_dimensions(avctx, w, h); +res = ff_set_dimensions(avctx, w, h); +if (res 0) +return res; } maxcnt = w * h; -- 1.7.10.4 ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
[libav-devel] [PATCH 17/50] eacmv: stop using deprecated avcodec_set_dimensions
--- libavcodec/eacmv.c | 18 -- 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/libavcodec/eacmv.c b/libavcodec/eacmv.c index 3b1256c..d39ebd3 100644 --- a/libavcodec/eacmv.c +++ b/libavcodec/eacmv.c @@ -129,19 +129,21 @@ static void cmv_decode_inter(CmvContext *s, AVFrame *frame, const uint8_t *buf, } } -static void cmv_process_header(CmvContext *s, const uint8_t *buf, const uint8_t *buf_end) +static int cmv_process_header(CmvContext *s, const uint8_t *buf, const uint8_t *buf_end) { -int pal_start, pal_count, i; +int pal_start, pal_count, i, ret; if(buf_end - buf 16) { av_log(s-avctx, AV_LOG_WARNING, truncated header\n); -return; +return AVERROR_INVALIDDATA; } s-width = AV_RL16(buf[4]); s-height = AV_RL16(buf[6]); -if (s-avctx-width!=s-width || s-avctx-height!=s-height) -avcodec_set_dimensions(s-avctx, s-width, s-height); + +ret = ff_set_dimensions(s-avctx, s-width, s-height); +if (ret 0) +return ret; s-avctx-time_base.num = 1; s-avctx-time_base.den = AV_RL16(buf[10]); @@ -154,6 +156,8 @@ static void cmv_process_header(CmvContext *s, const uint8_t *buf, const uint8_t s-palette[i] = AV_RB24(buf); buf += 3; } + +return 0; } #define EA_PREAMBLE_SIZE 8 @@ -174,7 +178,9 @@ static int cmv_decode_frame(AVCodecContext *avctx, return AVERROR_INVALIDDATA; if (AV_RL32(buf)==MVIh_TAG||AV_RB32(buf)==MVIh_TAG) { -cmv_process_header(s, buf+EA_PREAMBLE_SIZE, buf_end); +ret = cmv_process_header(s, buf+EA_PREAMBLE_SIZE, buf_end); +if (ret 0) +return ret; return buf_size; } -- 1.7.10.4 ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
[libav-devel] [PATCH 26/50] ivi_common: stop using deprecated avcodec_set_dimensions
--- libavcodec/ivi_common.c |5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libavcodec/ivi_common.c b/libavcodec/ivi_common.c index 7ca53b7..8c5d7f3 100644 --- a/libavcodec/ivi_common.c +++ b/libavcodec/ivi_common.c @@ -1015,7 +1015,10 @@ int ff_ivi_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, av_log(avctx, AV_LOG_ERROR, Buffer contains IP frames!\n); } -avcodec_set_dimensions(avctx, ctx-planes[0].width, ctx-planes[0].height); +result = ff_set_dimensions(avctx, ctx-planes[0].width, ctx-planes[0].height); +if (result 0) +return result; + if ((result = ff_get_buffer(avctx, frame, 0)) 0) { av_log(avctx, AV_LOG_ERROR, get_buffer() failed\n); return result; -- 1.7.10.4 ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
[libav-devel] [PATCH 46/50] txd: stop using deprecated avcodec_set_dimensions
--- libavcodec/txd.c |6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libavcodec/txd.c b/libavcodec/txd.c index 0eca07f..3bd986e 100644 --- a/libavcodec/txd.c +++ b/libavcodec/txd.c @@ -63,10 +63,10 @@ static int txd_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, return AVERROR_PATCHWELCOME; } -if ((ret = av_image_check_size(w, h, 0, avctx)) 0) +ret = ff_set_dimensions(avctx, w, h); +if (ret 0) return ret; -if (w != avctx-width || h != avctx-height) -avcodec_set_dimensions(avctx, w, h); + if ((ret = ff_get_buffer(avctx, p, 0)) 0) { av_log(avctx, AV_LOG_ERROR, get_buffer() failed\n); return ret; -- 1.7.10.4 ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
[libav-devel] [PATCH 01/50] libopenjpegdec: return meaningful error codes
--- libavcodec/libopenjpegdec.c | 15 +-- 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/libavcodec/libopenjpegdec.c b/libavcodec/libopenjpegdec.c index ca824c6..0062701 100644 --- a/libavcodec/libopenjpegdec.c +++ b/libavcodec/libopenjpegdec.c @@ -257,7 +257,7 @@ static int libopenjpeg_decode_frame(AVCodecContext *avctx, opj_dinfo_t *dec; opj_cio_t *stream; opj_image_t *image; -int width, height, ret = -1; +int width, height, ret; int pixel_size = 0; int ispacked = 0; int i; @@ -279,7 +279,7 @@ static int libopenjpeg_decode_frame(AVCodecContext *avctx, if (!dec) { av_log(avctx, AV_LOG_ERROR, Error initializing decoder.\n); -return -1; +return AVERROR_UNKNOWN; } opj_set_event_mgr((opj_common_ptr)dec, NULL, NULL); @@ -294,7 +294,7 @@ static int libopenjpeg_decode_frame(AVCodecContext *avctx, av_log(avctx, AV_LOG_ERROR, Codestream could not be opened for reading.\n); opj_destroy_decompress(dec); -return -1; +return AVERROR_UNKNOWN; } // Decode the header only. @@ -304,7 +304,7 @@ static int libopenjpeg_decode_frame(AVCodecContext *avctx, if (!image) { av_log(avctx, AV_LOG_ERROR, Error decoding codestream.\n); opj_destroy_decompress(dec); -return -1; +return AVERROR_UNKNOWN; } width = image-x1 - image-x0; @@ -315,7 +315,7 @@ static int libopenjpeg_decode_frame(AVCodecContext *avctx, height = (height + (1 ctx-lowres) - 1) ctx-lowres; } -if (av_image_check_size(width, height, 0, avctx) 0) { +if ((ret = av_image_check_size(width, height, 0, avctx)) 0) { av_log(avctx, AV_LOG_ERROR, %dx%d dimension invalid.\n, width, height); goto done; @@ -340,7 +340,7 @@ static int libopenjpeg_decode_frame(AVCodecContext *avctx, if (image-comps[i].prec avctx-bits_per_raw_sample) avctx-bits_per_raw_sample = image-comps[i].prec; -if (ff_thread_get_buffer(avctx, frame, 0) 0) { +if ((ret = ff_thread_get_buffer(avctx, frame, 0)) 0) { av_log(avctx, AV_LOG_ERROR, ff_thread_get_buffer() failed\n); goto done; } @@ -352,6 +352,7 @@ static int libopenjpeg_decode_frame(AVCodecContext *avctx, if (!stream) { av_log(avctx, AV_LOG_ERROR, Codestream could not be opened for reading.\n); +ret = AVERROR_UNKNOWN; goto done; } @@ -362,6 +363,7 @@ static int libopenjpeg_decode_frame(AVCodecContext *avctx, if (!image) { av_log(avctx, AV_LOG_ERROR, Error decoding codestream.\n); +ret = AVERROR_UNKNOWN; goto done; } @@ -398,6 +400,7 @@ static int libopenjpeg_decode_frame(AVCodecContext *avctx, break; default: av_log(avctx, AV_LOG_ERROR, unsupported pixel size %d\n, pixel_size); +ret = AVERROR_PATCHWELCOME; goto done; } -- 1.7.10.4 ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
[libav-devel] [PATCH 19/50] eatgq: stop using deprecated avcodec_set_dimensions
--- libavcodec/eatgq.c |7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/libavcodec/eatgq.c b/libavcodec/eatgq.c index 0a3e0f6..1ead5f7 100644 --- a/libavcodec/eatgq.c +++ b/libavcodec/eatgq.c @@ -216,9 +216,10 @@ static int tgq_decode_frame(AVCodecContext *avctx, s-height = bytestream2_get_le16u(s-gb); } -if (s-avctx-width!=s-width || s-avctx-height!=s-height) { -avcodec_set_dimensions(s-avctx, s-width, s-height); -} +ret = ff_set_dimensions(s-avctx, s-width, s-height); +if (ret 0) +return ret; + tgq_calculate_qtable(s, bytestream2_get_byteu(s-gb)); bytestream2_skip(s-gb, 3); -- 1.7.10.4 ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
[libav-devel] [PATCH 38/50] rv10: stop using deprecated avcodec_set_dimensions
--- libavcodec/rv10.c |9 ++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/libavcodec/rv10.c b/libavcodec/rv10.c index f790c1f..f80625a 100644 --- a/libavcodec/rv10.c +++ b/libavcodec/rv10.c @@ -28,6 +28,7 @@ #include libavutil/imgutils.h #include avcodec.h #include error_resilience.h +#include internal.h #include mpegvideo.h #include mpeg4video.h #include h263.h @@ -358,10 +359,12 @@ static int rv20_decode_picture_header(RVDecContext *rv) if (new_w != s-width || new_h != s-height) { av_log(s-avctx, AV_LOG_DEBUG, attempting to change resolution to %dx%d\n, new_w, new_h); -if (av_image_check_size(new_w, new_h, 0, s-avctx) 0) -return AVERROR_INVALIDDATA; ff_MPV_common_end(s); -avcodec_set_dimensions(s-avctx, new_w, new_h); + +ret = ff_set_dimensions(s-avctx, new_w, new_h); +if (ret 0) +return ret; + s-width = new_w; s-height = new_h; if ((ret = ff_MPV_common_init(s)) 0) -- 1.7.10.4 ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH] fate: add ffv1.0 test
On 27/10/13 10:14, Peter B. wrote: I was trying to read myself into FATE, in order to be able to add additional tests for FFV1. I've already read the documentation about FATE [1], and I've already managed to add new testing rules for FFV1 (in tests/fate/vcodec.mak). btw: The FATE docs [1] only describe how to run the existing tests, but I didn't find information about how to create new ones. So far so good, but now I have some questions: 1) How do I add the reference files, required for tests to be able to diff? You can upload to our local ftp[1] and drop me a note. 2) How do I get a LCOV HTML report locally? https://wiki.libav.org/GcovCoverageHowTo I'd like to cover more lines of FFV1's code, and therefore would like to be able to view the LCOV - code coverage report [2] from my local tests. I assumed that running the fate.sh script for submitting FATE results would create those HTML pages. No it would provide a FATE report. I've created a fate_config.sh file, based on doc/fate_config.sh.template and ran the tests. Any suggestions how I could have a local LCOV view? In theory all you need is in the wiki page I linked. I'll write a nicer howto on add FATE tests soon (I plan to refactor fate a little more) [1] http://upload.libav.org ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH 33/50] mpegvideo_parser: stop using deprecated avcodec_set_dimensions
On 27/10/13 11:10, Anton Khirnov wrote: --- libavcodec/mpegvideo_parser.c |4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavcodec/mpegvideo_parser.c b/libavcodec/mpegvideo_parser.c index 3219c10..bec1b36 100644 --- a/libavcodec/mpegvideo_parser.c +++ b/libavcodec/mpegvideo_parser.c @@ -62,7 +62,7 @@ static void mpegvideo_extract_headers(AVCodecParserContext *s, pc-width = (buf[0] 4) | (buf[1] 4); pc-height = ((buf[1] 0x0f) 8) | buf[2]; if(!avctx-width || !avctx-height || !avctx-coded_width || !avctx-coded_height){ -avcodec_set_dimensions(avctx, pc-width, pc-height); +ff_set_dimensions(avctx, pc-width, pc-height); did_set_size=1; } frame_rate_index = buf[3] 0xf; @@ -90,7 +90,7 @@ static void mpegvideo_extract_headers(AVCodecParserContext *s, pc-height |=( vert_size_ext 12); avctx-bit_rate += (bit_rate_ext 18) * 400; if(did_set_size) -avcodec_set_dimensions(avctx, pc-width, pc-height); +ff_set_dimensions(avctx, pc-width, pc-height); avctx-time_base.den = pc-frame_rate.den * (frame_rate_ext_n + 1) * 2; avctx-time_base.num = pc-frame_rate.num * (frame_rate_ext_d + 1); avctx-codec_id = AV_CODEC_ID_MPEG2VIDEO; Remind me to change this to return an error later. ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
[libav-devel] [PATCH] h263: Check init_get_bits return value
From: Michael Niedermayer michae...@gmx.at And use init_get_bits8 to check for integer overflows while at it. CC: libav-sta...@libav.org Signed-off-by: Luca Barbato lu_z...@gentoo.org --- We expect the first call to fail to find a vol header apparently, I hadn't look that deeply into mpeg4 yet (first I had to clean it up a bit). libavcodec/h263dec.c | 17 +++-- 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/libavcodec/h263dec.c b/libavcodec/h263dec.c index a1c7b00..8060d8f 100644 --- a/libavcodec/h263dec.c +++ b/libavcodec/h263dec.c @@ -405,12 +405,15 @@ int ff_h263_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, } if (s-bitstream_buffer_size (s-divx_packed || buf_size 20)) // divx 5.01+/xvid frame reorder -init_get_bits(s-gb, s-bitstream_buffer, - s-bitstream_buffer_size * 8); +ret = init_get_bits8(s-gb, s-bitstream_buffer, + s-bitstream_buffer_size); else -init_get_bits(s-gb, buf, buf_size * 8); +ret = init_get_bits8(s-gb, buf, buf_size); s-bitstream_buffer_size = 0; +if (ret 0) +return ret; + if (!s-context_initialized) // we need the idct permutaton for reading a custom matrix if ((ret = ff_MPV_common_init(s)) 0) @@ -434,9 +437,11 @@ int ff_h263_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, if (s-avctx-extradata_size s-picture_number == 0) { GetBitContext gb; -init_get_bits(gb, s-avctx-extradata, - s-avctx-extradata_size * 8); -ret = ff_mpeg4_decode_picture_header(s, gb); +ret = init_get_bits8(gb, s-avctx-extradata, + s-avctx-extradata_size); +if (ret 0) +return ret; +ff_mpeg4_decode_picture_header(s, gb); } ret = ff_mpeg4_decode_picture_header(s, s-gb); } else if (CONFIG_H263I_DECODER s-codec_id == AV_CODEC_ID_H263I) { -- 1.8.3.2 ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH] dcadec: use request_channel_layout instead of request_channels
On Sun, Oct 27, 2013 at 8:32 AM, Anton Khirnov an...@khirnov.net wrote: *stab* Whopps, sorry, I did check with FATE and no failures were reported but I'll be working more on this later. Vittorio ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH] dcadec: use request_channel_layout instead of request_channels
On Sun, 27 Oct 2013 12:28:19 +0100, Vittorio Giovara vittorio.giov...@gmail.com wrote: On Sun, Oct 27, 2013 at 8:32 AM, Anton Khirnov an...@khirnov.net wrote: *stab* Whopps, sorry, I did check with FATE and no failures were reported but I'll be working more on this later. FATE does not test everything, so you should always make sure you have a good enough understanding of what it is you're trying to do. (though it should test this specific feature, i wonder why didn't it fail) -- Anton Khirnov ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
[libav-devel] [PATCH 5/7] lavc: schedule FF_BUG_AC_VLC for removal on the next major bump.
It has been deprecated/unused for about 10 years. --- libavcodec/avcodec.h |2 ++ libavcodec/options_table.h |2 ++ libavcodec/version.h |3 +++ 3 files changed, 7 insertions(+) diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index 320dbdd..93576c6 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h @@ -2253,7 +2253,9 @@ typedef struct AVCodecContext { #define FF_BUG_UMP4 8 #define FF_BUG_NO_PADDING 16 #define FF_BUG_AMV 32 +#if FF_API_AC_VLC #define FF_BUG_AC_VLC 0 /// Will be removed, libavcodec can now handle these non-compliant files by default. +#endif #define FF_BUG_QPEL_CHROMA 64 #define FF_BUG_STD_QPEL 128 #define FF_BUG_QPEL_CHROMA2 256 diff --git a/libavcodec/options_table.h b/libavcodec/options_table.h index d9517b4..f80b622 100644 --- a/libavcodec/options_table.h +++ b/libavcodec/options_table.h @@ -122,7 +122,9 @@ static const AVOption avcodec_options[] = { {ump4, (autodetected if FOURCC == UMP4), 0, AV_OPT_TYPE_CONST, {.i64 = FF_BUG_UMP4 }, INT_MIN, INT_MAX, V|D, bug}, {no_padding, padding bug (autodetected), 0, AV_OPT_TYPE_CONST, {.i64 = FF_BUG_NO_PADDING }, INT_MIN, INT_MAX, V|D, bug}, {amv, NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_BUG_AMV }, INT_MIN, INT_MAX, V|D, bug}, +#if FF_API_AC_VLC {ac_vlc, illegal VLC bug (autodetected per FOURCC), 0, AV_OPT_TYPE_CONST, {.i64 = FF_BUG_AC_VLC }, INT_MIN, INT_MAX, V|D, bug}, +#endif {qpel_chroma, NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_BUG_QPEL_CHROMA }, INT_MIN, INT_MAX, V|D, bug}, {std_qpel, old standard qpel (autodetected per FOURCC/version), 0, AV_OPT_TYPE_CONST, {.i64 = FF_BUG_STD_QPEL }, INT_MIN, INT_MAX, V|D, bug}, {qpel_chroma2, NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_BUG_QPEL_CHROMA2 }, INT_MIN, INT_MAX, V|D, bug}, diff --git a/libavcodec/version.h b/libavcodec/version.h index af022d9..28193ac 100644 --- a/libavcodec/version.h +++ b/libavcodec/version.h @@ -79,5 +79,8 @@ #ifndef FF_API_DEBUG_MV #define FF_API_DEBUG_MV (LIBAVCODEC_VERSION_MAJOR 56) #endif +#ifndef FF_API_AC_VLC +#define FF_API_AC_VLC(LIBAVCODEC_VERSION_MAJOR 56) +#endif #endif /* AVCODEC_VERSION_H */ -- 1.7.10.4 ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
[libav-devel] [PATCH 7/7] lavc: move FF_ASPECT_EXTENDED from avcodec.h to h263.h
It's for internal use only. --- libavcodec/avcodec.h |2 ++ libavcodec/h263.h|4 libavcodec/version.h |3 +++ 3 files changed, 9 insertions(+) diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index 6295bea..0e5a805 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h @@ -1184,7 +1184,9 @@ typedef struct AVCodecContext { */ int coded_width, coded_height; +#if FF_API_ASPECT_EXTENDED #define FF_ASPECT_EXTENDED 15 +#endif /** * the number of pictures in a group of pictures, or 0 for intra_only diff --git a/libavcodec/h263.h b/libavcodec/h263.h index 4f58f92..c6ad618 100644 --- a/libavcodec/h263.h +++ b/libavcodec/h263.h @@ -26,6 +26,10 @@ #include mpegvideo.h #include rl.h +#if !FF_API_ASPECT_EXTENDED +#define FF_ASPECT_EXTENDED 15 +#endif + // The defines below define the number of bits that are read at once for // reading vlc values. Changing these may improve speed and data cache needs // be aware though that decreasing them may need the number of stages that is diff --git a/libavcodec/version.h b/libavcodec/version.h index 83a224f..b787f48 100644 --- a/libavcodec/version.h +++ b/libavcodec/version.h @@ -85,5 +85,8 @@ #ifndef FF_API_OLD_MSMPEG4 #define FF_API_OLD_MSMPEG4 (LIBAVCODEC_VERSION_MAJOR 56) #endif +#ifndef FF_API_ASPECT_EXTENDED +#define FF_API_ASPECT_EXTENDED (LIBAVCODEC_VERSION_MAJOR 56) +#endif #endif /* AVCODEC_VERSION_H */ -- 1.7.10.4 ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
[libav-devel] [PATCH 1/7] lavc: deprecate FF_DEBUG_MV and remove all traces of its use
It has not been actually used since 37045e422903695e610cca6ecb753df643ab9380, when the broken vismv code was removed. --- avconv.c |3 --- libavcodec/avcodec.h |5 + libavcodec/mpegvideo.c |3 +-- libavcodec/options_table.h |2 ++ libavcodec/version.h |3 +++ 5 files changed, 11 insertions(+), 5 deletions(-) diff --git a/avconv.c b/avconv.c index 7351b77..0cab53c 100644 --- a/avconv.c +++ b/avconv.c @@ -1740,9 +1740,6 @@ static int transcode_init(void) av_log(NULL, AV_LOG_WARNING, The bitrate parameter is set too low. It takes bits/s as argument, not kbits/s\n); extra_size += ost-st-codec-extradata_size; - -if (ost-st-codec-me_threshold) -input_streams[ost-source_index]-st-codec-debug |= FF_DEBUG_MV; } else { av_opt_set_dict(ost-st-codec, ost-opts); } diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index 856eda5..f406e8f 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h @@ -2303,7 +2303,12 @@ typedef struct AVCodecContext { #define FF_DEBUG_BITSTREAM 4 #define FF_DEBUG_MB_TYPE 8 #define FF_DEBUG_QP 16 +#if FF_API_DEBUG_MV +/** + * @deprecated this option does nothing + */ #define FF_DEBUG_MV 32 +#endif #define FF_DEBUG_DCT_COEFF 0x0040 #define FF_DEBUG_SKIP0x0080 #define FF_DEBUG_STARTCODE 0x0100 diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c index 718f946..ae458ab 100644 --- a/libavcodec/mpegvideo.c +++ b/libavcodec/mpegvideo.c @@ -321,8 +321,7 @@ static int alloc_picture_tables(MpegEncContext *s, Picture *pic) return AVERROR(ENOMEM); } -if (s-out_format == FMT_H263 || s-encoding || - (s-avctx-debug FF_DEBUG_MV) || s-avctx-debug_mv) { +if (s-out_format == FMT_H263 || s-encoding) { int mv_size= 2 * (b8_array_size + 4) * sizeof(int16_t); int ref_index_size = 4 * mb_array_size; diff --git a/libavcodec/options_table.h b/libavcodec/options_table.h index 5e9d484..c551363 100644 --- a/libavcodec/options_table.h +++ b/libavcodec/options_table.h @@ -208,7 +208,9 @@ static const AVOption avcodec_options[] = { {bitstream, NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_DEBUG_BITSTREAM }, INT_MIN, INT_MAX, V|D, debug}, {mb_type, macroblock (MB) type, 0, AV_OPT_TYPE_CONST, {.i64 = FF_DEBUG_MB_TYPE }, INT_MIN, INT_MAX, V|D, debug}, {qp, per-block quantization parameter (QP), 0, AV_OPT_TYPE_CONST, {.i64 = FF_DEBUG_QP }, INT_MIN, INT_MAX, V|D, debug}, +#if FF_API_DEBUG_MV {mv, motion vector, 0, AV_OPT_TYPE_CONST, {.i64 = FF_DEBUG_MV }, INT_MIN, INT_MAX, V|D, debug}, +#endif {dct_coeff, NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_DEBUG_DCT_COEFF }, INT_MIN, INT_MAX, V|D, debug}, {skip, NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_DEBUG_SKIP }, INT_MIN, INT_MAX, V|D, debug}, {startcode, NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_DEBUG_STARTCODE }, INT_MIN, INT_MAX, V|D, debug}, diff --git a/libavcodec/version.h b/libavcodec/version.h index 321c7ef..af022d9 100644 --- a/libavcodec/version.h +++ b/libavcodec/version.h @@ -76,5 +76,8 @@ #ifndef FF_API_SET_DIMENSIONS #define FF_API_SET_DIMENSIONS(LIBAVCODEC_VERSION_MAJOR 56) #endif +#ifndef FF_API_DEBUG_MV +#define FF_API_DEBUG_MV (LIBAVCODEC_VERSION_MAJOR 56) +#endif #endif /* AVCODEC_VERSION_H */ -- 1.7.10.4 ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
[libav-devel] [PATCH 2/7] avplay: drop -vismv option which does not do anything anymore
--- Changelog |1 + avplay.c|9 - doc/avplay.texi |2 -- 3 files changed, 1 insertion(+), 11 deletions(-) diff --git a/Changelog b/Changelog index 4032d07..06bbe57 100644 --- a/Changelog +++ b/Changelog @@ -40,6 +40,7 @@ version 10: - Opus in Ogg demuxing - Enhanced Low Delay AAC (ER AAC ELD) decoding (no LD SBR support) - F4V muxer +- remove avplay -vismv option, which has not worked for a long time version 9: diff --git a/avplay.c b/avplay.c index 00becbe..bb8c689 100644 --- a/avplay.c +++ b/avplay.c @@ -242,7 +242,6 @@ static int show_status = 1; static int av_sync_type = AV_SYNC_AUDIO_MASTER; static int64_t start_time = AV_NOPTS_VALUE; static int64_t duration = AV_NOPTS_VALUE; -static int debug_mv = 0; static int step = 0; static int workaround_bugs = 1; static int fast = 0; @@ -2036,7 +2035,6 @@ static int stream_component_open(VideoState *is, int stream_index) opts = filter_codec_opts(codec_opts, avctx-codec_id, ic, ic-streams[stream_index], NULL); codec = avcodec_find_decoder(avctx-codec_id); -avctx-debug_mv = debug_mv; avctx-workaround_bugs = workaround_bugs; avctx-idct_algo = idct; avctx-skip_frame= skip_frame; @@ -2812,12 +2810,6 @@ static int opt_duration(void *optctx, const char *opt, const char *arg) return 0; } -static int opt_vismv(void *optctx, const char *opt, const char *arg) -{ -debug_mv = parse_number_or_die(opt, arg, OPT_INT64, INT_MIN, INT_MAX); -return 0; -} - static const OptionDef options[] = { #include cmdutils_common_opts.h { x, HAS_ARG, { .func_arg = opt_width }, force displayed width, width }, @@ -2837,7 +2829,6 @@ static const OptionDef options[] = { { pix_fmt, HAS_ARG | OPT_EXPERT | OPT_VIDEO, { .func_arg = opt_frame_pix_fmt }, set pixel format, format }, { stats, OPT_BOOL | OPT_EXPERT, { show_status }, show status, }, { bug, OPT_INT | HAS_ARG | OPT_EXPERT, { workaround_bugs }, workaround bugs, }, -{ vismv, HAS_ARG | OPT_EXPERT, { .func_arg = opt_vismv }, visualize motion vectors, }, { fast, OPT_BOOL | OPT_EXPERT, { fast }, non spec compliant optimizations, }, { genpts, OPT_BOOL | OPT_EXPERT, { genpts }, generate pts, }, { drp, OPT_INT | HAS_ARG | OPT_EXPERT, { decoder_reorder_pts }, let decoder reorder pts 0=off 1=on -1=auto, }, diff --git a/doc/avplay.texi b/doc/avplay.texi index b856f9b..50142ab 100644 --- a/doc/avplay.texi +++ b/doc/avplay.texi @@ -78,8 +78,6 @@ Show the stream duration, the codec parameters, the current position in the stream and the audio/video synchronisation drift. @item -bug Work around bugs. -@item -vismv -Visualize motion vectors. @item -fast Non-spec-compliant optimizations. @item -genpts -- 1.7.10.4 ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
[libav-devel] [PATCH 6/7] lavc: deprecate unused FF_BUG_OLD_MSMPEG4
--- libavcodec/avcodec.h |2 ++ libavcodec/options_table.h |2 ++ libavcodec/version.h |3 +++ 3 files changed, 7 insertions(+) diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index 93576c6..6295bea 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h @@ -2248,7 +2248,9 @@ typedef struct AVCodecContext { */ int workaround_bugs; #define FF_BUG_AUTODETECT 1 /// autodetection +#if FF_API_OLD_MSMPEG4 #define FF_BUG_OLD_MSMPEG4 2 +#endif #define FF_BUG_XVID_ILACE 4 #define FF_BUG_UMP4 8 #define FF_BUG_NO_PADDING 16 diff --git a/libavcodec/options_table.h b/libavcodec/options_table.h index f80b622..addfed4 100644 --- a/libavcodec/options_table.h +++ b/libavcodec/options_table.h @@ -117,7 +117,9 @@ static const AVOption avcodec_options[] = { {codec_tag, NULL, OFFSET(codec_tag), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX}, {bug, work around not autodetected encoder bugs, OFFSET(workaround_bugs), AV_OPT_TYPE_FLAGS, {.i64 = FF_BUG_AUTODETECT }, INT_MIN, INT_MAX, V|D, bug}, {autodetect, NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_BUG_AUTODETECT }, INT_MIN, INT_MAX, V|D, bug}, +#if FF_API_OLD_MSMPEG4 {old_msmpeg4, some old lavc-generated MSMPEG4v3 files (no autodetection), 0, AV_OPT_TYPE_CONST, {.i64 = FF_BUG_OLD_MSMPEG4 }, INT_MIN, INT_MAX, V|D, bug}, +#endif {xvid_ilace, Xvid interlacing bug (autodetected if FOURCC == XVIX), 0, AV_OPT_TYPE_CONST, {.i64 = FF_BUG_XVID_ILACE }, INT_MIN, INT_MAX, V|D, bug}, {ump4, (autodetected if FOURCC == UMP4), 0, AV_OPT_TYPE_CONST, {.i64 = FF_BUG_UMP4 }, INT_MIN, INT_MAX, V|D, bug}, {no_padding, padding bug (autodetected), 0, AV_OPT_TYPE_CONST, {.i64 = FF_BUG_NO_PADDING }, INT_MIN, INT_MAX, V|D, bug}, diff --git a/libavcodec/version.h b/libavcodec/version.h index 28193ac..83a224f 100644 --- a/libavcodec/version.h +++ b/libavcodec/version.h @@ -82,5 +82,8 @@ #ifndef FF_API_AC_VLC #define FF_API_AC_VLC(LIBAVCODEC_VERSION_MAJOR 56) #endif +#ifndef FF_API_OLD_MSMPEG4 +#define FF_API_OLD_MSMPEG4 (LIBAVCODEC_VERSION_MAJOR 56) +#endif #endif /* AVCODEC_VERSION_H */ -- 1.7.10.4 ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
[libav-devel] [PATCH 3/7] lavc: deprecate AVCodecContext.debug_mv
It has been unused since 37045e422903695e610cca6ecb753df643ab9380. --- libavcodec/avcodec.h |7 --- libavcodec/options_table.h |2 ++ libavcodec/pthread.c |1 - 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index f406e8f..2e559b7 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h @@ -2321,15 +2321,16 @@ typedef struct AVCodecContext { #define FF_DEBUG_BUFFERS 0x8000 #define FF_DEBUG_THREADS 0x0001 +#if FF_API_DEBUG_MV /** - * debug - * - encoding: Set by user. - * - decoding: Set by user. + * @deprecated this option does not have any effect */ +attribute_deprecated int debug_mv; #define FF_DEBUG_VIS_MV_P_FOR 0x0001 //visualize forward predicted MVs of P frames #define FF_DEBUG_VIS_MV_B_FOR 0x0002 //visualize forward predicted MVs of B frames #define FF_DEBUG_VIS_MV_B_BACK 0x0004 //visualize backward predicted MVs of B frames +#endif /** * Error recognition; may misdetect some more or less valid parts as errors. diff --git a/libavcodec/options_table.h b/libavcodec/options_table.h index c551363..bd6b7af 100644 --- a/libavcodec/options_table.h +++ b/libavcodec/options_table.h @@ -222,10 +222,12 @@ static const AVOption avcodec_options[] = { {vis_mb_type, visualize block types, 0, AV_OPT_TYPE_CONST, {.i64 = FF_DEBUG_VIS_MB_TYPE }, INT_MIN, INT_MAX, V|D, debug}, {buffers, picture buffer allocations, 0, AV_OPT_TYPE_CONST, {.i64 = FF_DEBUG_BUFFERS }, INT_MIN, INT_MAX, V|D, debug}, {thread_ops, threading operations, 0, AV_OPT_TYPE_CONST, {.i64 = FF_DEBUG_THREADS }, INT_MIN, INT_MAX, V|D, debug}, +#if FF_API_DEBUG_MV {vismv, visualize motion vectors (MVs), OFFSET(debug_mv), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, 0, INT_MAX, V|D, debug_mv}, {pf, forward predicted MVs of P-frames, 0, AV_OPT_TYPE_CONST, {.i64 = FF_DEBUG_VIS_MV_P_FOR }, INT_MIN, INT_MAX, V|D, debug_mv}, {bf, forward predicted MVs of B-frames, 0, AV_OPT_TYPE_CONST, {.i64 = FF_DEBUG_VIS_MV_B_FOR }, INT_MIN, INT_MAX, V|D, debug_mv}, {bb, backward predicted MVs of B-frames, 0, AV_OPT_TYPE_CONST, {.i64 = FF_DEBUG_VIS_MV_B_BACK }, INT_MIN, INT_MAX, V|D, debug_mv}, +#endif {cmp, full-pel ME compare function, OFFSET(me_cmp), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, V|E, cmp_func}, {subcmp, sub-pel ME compare function, OFFSET(me_sub_cmp), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, V|E, cmp_func}, {mbcmp, macroblock compare function, OFFSET(mb_cmp), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, V|E, cmp_func}, diff --git a/libavcodec/pthread.c b/libavcodec/pthread.c index b646f66..480a115 100644 --- a/libavcodec/pthread.c +++ b/libavcodec/pthread.c @@ -423,7 +423,6 @@ FF_ENABLE_DEPRECATION_WARNINGS dst-opaque = src-opaque; dst-debug= src-debug; -dst-debug_mv = src-debug_mv; dst-slice_flags = src-slice_flags; dst-flags2 = src-flags2; -- 1.7.10.4 ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
[libav-devel] [PATCH 4/7] lavc: deprecate FF_DEBUG_VIS_*
Those flags have no effect since 37045e422903695e610cca6ecb753df643ab9380. --- libavcodec/avcodec.h |2 ++ libavcodec/options_table.h |2 ++ 2 files changed, 4 insertions(+) diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index 2e559b7..320dbdd 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h @@ -2316,8 +2316,10 @@ typedef struct AVCodecContext { #define FF_DEBUG_ER 0x0400 #define FF_DEBUG_MMCO0x0800 #define FF_DEBUG_BUGS0x1000 +#if FF_API_DEBUG_MV #define FF_DEBUG_VIS_QP 0x2000 #define FF_DEBUG_VIS_MB_TYPE 0x4000 +#endif #define FF_DEBUG_BUFFERS 0x8000 #define FF_DEBUG_THREADS 0x0001 diff --git a/libavcodec/options_table.h b/libavcodec/options_table.h index bd6b7af..d9517b4 100644 --- a/libavcodec/options_table.h +++ b/libavcodec/options_table.h @@ -218,8 +218,10 @@ static const AVOption avcodec_options[] = { {er, error recognition, 0, AV_OPT_TYPE_CONST, {.i64 = FF_DEBUG_ER }, INT_MIN, INT_MAX, V|D, debug}, {mmco, memory management control operations (H.264), 0, AV_OPT_TYPE_CONST, {.i64 = FF_DEBUG_MMCO }, INT_MIN, INT_MAX, V|D, debug}, {bugs, NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_DEBUG_BUGS }, INT_MIN, INT_MAX, V|D, debug}, +#if FF_API_DEBUG_MV {vis_qp, visualize quantization parameter (QP), lower QP are tinted greener, 0, AV_OPT_TYPE_CONST, {.i64 = FF_DEBUG_VIS_QP }, INT_MIN, INT_MAX, V|D, debug}, {vis_mb_type, visualize block types, 0, AV_OPT_TYPE_CONST, {.i64 = FF_DEBUG_VIS_MB_TYPE }, INT_MIN, INT_MAX, V|D, debug}, +#endif {buffers, picture buffer allocations, 0, AV_OPT_TYPE_CONST, {.i64 = FF_DEBUG_BUFFERS }, INT_MIN, INT_MAX, V|D, debug}, {thread_ops, threading operations, 0, AV_OPT_TYPE_CONST, {.i64 = FF_DEBUG_THREADS }, INT_MIN, INT_MAX, V|D, debug}, #if FF_API_DEBUG_MV -- 1.7.10.4 ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
[libav-devel] [PATCH 1/5] pthread: drop avcodec_ prefixes from static functions
--- libavcodec/pthread.c | 16 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/libavcodec/pthread.c b/libavcodec/pthread.c index 480a115..ce969af 100644 --- a/libavcodec/pthread.c +++ b/libavcodec/pthread.c @@ -174,7 +174,7 @@ static void* attribute_align_arg worker(void *v) } } -static av_always_inline void avcodec_thread_park_workers(ThreadContext *c, int thread_count) +static av_always_inline void thread_park_workers(ThreadContext *c, int thread_count) { while (c-current_job != thread_count + c-job_count) pthread_cond_wait(c-last_job_cond, c-current_job_lock); @@ -201,7 +201,7 @@ static void thread_free(AVCodecContext *avctx) av_freep(avctx-thread_opaque); } -static int avcodec_thread_execute(AVCodecContext *avctx, action_func* func, void *arg, int *ret, int job_count, int job_size) +static int thread_execute(AVCodecContext *avctx, action_func* func, void *arg, int *ret, int job_count, int job_size) { ThreadContext *c= avctx-thread_opaque; int dummy_ret; @@ -229,16 +229,16 @@ static int avcodec_thread_execute(AVCodecContext *avctx, action_func* func, void c-current_execute++; pthread_cond_broadcast(c-current_job_cond); -avcodec_thread_park_workers(c, avctx-thread_count); +thread_park_workers(c, avctx-thread_count); return 0; } -static int avcodec_thread_execute2(AVCodecContext *avctx, action_func2* func2, void *arg, int *ret, int job_count) +static int thread_execute2(AVCodecContext *avctx, action_func2* func2, void *arg, int *ret, int job_count) { ThreadContext *c= avctx-thread_opaque; c-func2 = func2; -return avcodec_thread_execute(avctx, NULL, arg, ret, job_count, 0); +return thread_execute(avctx, NULL, arg, ret, job_count, 0); } static int thread_init_internal(AVCodecContext *avctx) @@ -290,10 +290,10 @@ static int thread_init_internal(AVCodecContext *avctx) } } -avcodec_thread_park_workers(c, thread_count); +thread_park_workers(c, thread_count); -avctx-execute = avcodec_thread_execute; -avctx-execute2 = avcodec_thread_execute2; +avctx-execute = thread_execute; +avctx-execute2 = thread_execute2; return 0; } -- 1.7.10.4 ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
[libav-devel] [PATCH 3/5] pthread_slice: rename ThreadContext - SliceThreadContext
This should prevent confusion with frame threading. --- libavcodec/pthread_slice.c | 18 +- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/libavcodec/pthread_slice.c b/libavcodec/pthread_slice.c index 67ba3dd..2eca313 100644 --- a/libavcodec/pthread_slice.c +++ b/libavcodec/pthread_slice.c @@ -42,7 +42,7 @@ typedef int (action_func)(AVCodecContext *c, void *arg); typedef int (action_func2)(AVCodecContext *c, void *arg, int jobnr, int threadnr); -typedef struct ThreadContext { +typedef struct SliceThreadContext { pthread_t *workers; action_func *func; action_func2 *func2; @@ -58,12 +58,12 @@ typedef struct ThreadContext { unsigned current_execute; int current_job; int done; -} ThreadContext; +} SliceThreadContext; static void* attribute_align_arg worker(void *v) { AVCodecContext *avctx = v; -ThreadContext *c = avctx-thread_opaque; +SliceThreadContext *c = avctx-thread_opaque; unsigned last_execute = 0; int our_job = c-job_count; int thread_count = avctx-thread_count; @@ -98,7 +98,7 @@ static void* attribute_align_arg worker(void *v) void ff_slice_thread_free(AVCodecContext *avctx) { -ThreadContext *c = avctx-thread_opaque; +SliceThreadContext *c = avctx-thread_opaque; int i; pthread_mutex_lock(c-current_job_lock); @@ -116,7 +116,7 @@ void ff_slice_thread_free(AVCodecContext *avctx) av_freep(avctx-thread_opaque); } -static av_always_inline void thread_park_workers(ThreadContext *c, int thread_count) +static av_always_inline void thread_park_workers(SliceThreadContext *c, int thread_count) { while (c-current_job != thread_count + c-job_count) pthread_cond_wait(c-last_job_cond, c-current_job_lock); @@ -125,7 +125,7 @@ static av_always_inline void thread_park_workers(ThreadContext *c, int thread_co static int thread_execute(AVCodecContext *avctx, action_func* func, void *arg, int *ret, int job_count, int job_size) { -ThreadContext *c= avctx-thread_opaque; +SliceThreadContext *c= avctx-thread_opaque; int dummy_ret; if (!(avctx-active_thread_typeFF_THREAD_SLICE) || avctx-thread_count = 1) @@ -158,7 +158,7 @@ static int thread_execute(AVCodecContext *avctx, action_func* func, void *arg, i static int thread_execute2(AVCodecContext *avctx, action_func2* func2, void *arg, int *ret, int job_count) { -ThreadContext *c= avctx-thread_opaque; +SliceThreadContext *c= avctx-thread_opaque; c-func2 = func2; return thread_execute(avctx, NULL, arg, ret, job_count, 0); } @@ -166,7 +166,7 @@ static int thread_execute2(AVCodecContext *avctx, action_func2* func2, void *arg int ff_slice_thread_init(AVCodecContext *avctx) { int i; -ThreadContext *c; +SliceThreadContext *c; int thread_count = avctx-thread_count; #if HAVE_W32THREADS @@ -188,7 +188,7 @@ int ff_slice_thread_init(AVCodecContext *avctx) return 0; } -c = av_mallocz(sizeof(ThreadContext)); +c = av_mallocz(sizeof(SliceThreadContext)); if (!c) return -1; -- 1.7.10.4 ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
[libav-devel] [PATCH 4/5] pthread: store thread contexts in AVCodecInternal instead of AVCodecContext
It's a private field, it should not be visible to callers. Deprecate AVCodecContext.thread_opaque --- libavcodec/avcodec.h |8 libavcodec/internal.h |2 ++ libavcodec/options.c |1 - libavcodec/pthread_frame.c | 43 ++- libavcodec/pthread_slice.c | 12 ++-- libavcodec/utils.c |2 +- libavcodec/version.h |3 +++ 7 files changed, 38 insertions(+), 33 deletions(-) diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index 0e5a805..f5464d0 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h @@ -2522,13 +2522,13 @@ typedef struct AVCodecContext { */ int (*execute2)(struct AVCodecContext *c, int (*func)(struct AVCodecContext *c2, void *arg, int jobnr, int threadnr), void *arg2, int *ret, int count); +#if FF_API_THREAD_OPAQUE /** - * thread opaque - * Can be used by execute() to store some per AVCodecContext stuff. - * - encoding: set by execute() - * - decoding: set by execute() + * @deprecated this field should not be used from outside of lavc */ +attribute_deprecated void *thread_opaque; +#endif /** * noise vs. sse weight for the nsse comparsion function diff --git a/libavcodec/internal.h b/libavcodec/internal.h index 2133137..9a57209 100644 --- a/libavcodec/internal.h +++ b/libavcodec/internal.h @@ -86,6 +86,8 @@ typedef struct AVCodecInternal { AVFrame to_free; FramePool *pool; + +void *thread_ctx; } AVCodecInternal; struct AVCodecDefault { diff --git a/libavcodec/options.c b/libavcodec/options.c index 8d36c01..2e41ce4 100644 --- a/libavcodec/options.c +++ b/libavcodec/options.c @@ -150,7 +150,6 @@ int avcodec_copy_context(AVCodecContext *dest, const AVCodecContext *src) dest-codec = NULL; dest-slice_offset= NULL; dest-hwaccel = NULL; -dest-thread_opaque = NULL; dest-internal= NULL; /* reallocate values that should be allocated separately */ diff --git a/libavcodec/pthread_frame.c b/libavcodec/pthread_frame.c index d16078f..c2d12c8 100644 --- a/libavcodec/pthread_frame.c +++ b/libavcodec/pthread_frame.c @@ -46,7 +46,7 @@ #include libavutil/mem.h /** - * Context used by codec threads and stored in their AVCodecContext thread_opaque. + * Context used by codec threads and stored in their AVCodecInternal thread_ctx. */ typedef struct PerThreadContext { struct FrameThreadContext *parent; @@ -93,7 +93,7 @@ typedef struct PerThreadContext { } PerThreadContext; /** - * Context stored in the client AVCodecContext thread_opaque. + * Context stored in the client AVCodecInternal thread_ctx. */ typedef struct FrameThreadContext { PerThreadContext *threads; /// The contexts for each thread. @@ -365,7 +365,7 @@ int ff_thread_decode_frame(AVCodecContext *avctx, AVFrame *picture, int *got_picture_ptr, AVPacket *avpkt) { -FrameThreadContext *fctx = avctx-thread_opaque; +FrameThreadContext *fctx = avctx-internal-thread_ctx; int finished = fctx-next_finished; PerThreadContext *p; int err; @@ -441,7 +441,7 @@ void ff_thread_report_progress(ThreadFrame *f, int n, int field) if (!progress || progress[field] = n) return; -p = f-owner-thread_opaque; +p = f-owner-internal-thread_ctx; if (f-owner-debugFF_DEBUG_THREADS) av_log(f-owner, AV_LOG_DEBUG, %p finished %d field %d\n, progress, n, field); @@ -459,7 +459,7 @@ void ff_thread_await_progress(ThreadFrame *f, int n, int field) if (!progress || progress[field] = n) return; -p = f-owner-thread_opaque; +p = f-owner-internal-thread_ctx; if (f-owner-debugFF_DEBUG_THREADS) av_log(f-owner, AV_LOG_DEBUG, thread awaiting %d field %d from %p\n, n, field, progress); @@ -471,7 +471,7 @@ void ff_thread_await_progress(ThreadFrame *f, int n, int field) } void ff_thread_finish_setup(AVCodecContext *avctx) { -PerThreadContext *p = avctx-thread_opaque; +PerThreadContext *p = avctx-internal-thread_ctx; if (!(avctx-active_thread_typeFF_THREAD_FRAME)) return; @@ -500,7 +500,7 @@ static void park_frame_worker_threads(FrameThreadContext *fctx, int thread_count void ff_frame_thread_free(AVCodecContext *avctx, int thread_count) { -FrameThreadContext *fctx = avctx-thread_opaque; +FrameThreadContext *fctx = avctx-internal-thread_ctx; const AVCodec *codec = avctx-codec; int i; @@ -544,16 +544,16 @@ void ff_frame_thread_free(AVCodecContext *avctx, int thread_count) if (i) { av_freep(p-avctx-priv_data); -av_freep(p-avctx-internal); av_freep(p-avctx-slice_offset); } +av_freep(p-avctx-internal); av_freep(p-avctx); } av_freep(fctx-threads); pthread_mutex_destroy(fctx-buffer_mutex); -av_freep(avctx-thread_opaque); +
[libav-devel] [PATCH 5/5] lavc: move AVCodecContext.pkt to AVCodecInternal
It's a private field, not meant to be accessed from outside lavc. --- libavcodec/avcodec.h |8 +++- libavcodec/internal.h |6 ++ libavcodec/pthread_frame.c |2 +- libavcodec/rawdec.c|3 ++- libavcodec/utils.c |8 libavcodec/version.h |3 +++ 6 files changed, 19 insertions(+), 11 deletions(-) diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index f5464d0..8ab2ebc 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h @@ -2662,14 +2662,12 @@ typedef struct AVCodecContext { */ int error_rate; +#if FF_API_CODEC_PKT /** - * Current packet as passed into the decoder, to avoid having - * to pass the packet into every function. Currently only valid - * inside lavc and get/release_buffer callbacks. - * - decoding: set by avcodec_decode_*, read by get_buffer() for setting pkt_pts - * - encoding: unused + * @deprecated this field is not supposed to be accessed from outside lavc */ AVPacket *pkt; +#endif /** * VBV delay coded in the last frame (in periods of a 27 MHz clock). diff --git a/libavcodec/internal.h b/libavcodec/internal.h index 9a57209..4648c02 100644 --- a/libavcodec/internal.h +++ b/libavcodec/internal.h @@ -88,6 +88,12 @@ typedef struct AVCodecInternal { FramePool *pool; void *thread_ctx; + +/** + * Current packet as passed into the decoder, to avoid having to pass the + * packet into every function. + */ +AVPacket *pkt; } AVCodecInternal; struct AVCodecDefault { diff --git a/libavcodec/pthread_frame.c b/libavcodec/pthread_frame.c index c2d12c8..3dff960 100644 --- a/libavcodec/pthread_frame.c +++ b/libavcodec/pthread_frame.c @@ -608,7 +608,6 @@ int ff_frame_thread_init(AVCodecContext *avctx) } *copy = *src; -copy-pkt = p-avpkt; copy-internal = av_malloc(sizeof(AVCodecInternal)); if (!copy-internal) { @@ -617,6 +616,7 @@ int ff_frame_thread_init(AVCodecContext *avctx) } *copy-internal = *src-internal; copy-internal-thread_ctx = p; +copy-internal-pkt = p-avpkt; if (!i) { src = copy; diff --git a/libavcodec/rawdec.c b/libavcodec/rawdec.c index 24d06f3..a8227c7 100644 --- a/libavcodec/rawdec.c +++ b/libavcodec/rawdec.c @@ -25,6 +25,7 @@ */ #include avcodec.h +#include internal.h #include raw.h #include libavutil/buffer.h #include libavutil/common.h @@ -150,7 +151,7 @@ static int raw_decode(AVCodecContext *avctx, void *data, int *got_frame, frame-pict_type= AV_PICTURE_TYPE_I; frame-key_frame= 1; frame-reordered_opaque = avctx-reordered_opaque; -frame-pkt_pts = avctx-pkt-pts; +frame-pkt_pts = avctx-internal-pkt-pts; if (buf_size context-frame_size - (avctx-pix_fmt == AV_PIX_FMT_PAL8 ? AVPALETTE_SIZE : 0)) diff --git a/libavcodec/utils.c b/libavcodec/utils.c index 7b5c796..da519b5 100644 --- a/libavcodec/utils.c +++ b/libavcodec/utils.c @@ -613,7 +613,7 @@ int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame, int flags) default: return AVERROR(EINVAL); } -frame-pkt_pts = avctx-pkt ? avctx-pkt-pts : AV_NOPTS_VALUE; +frame-pkt_pts = avctx-internal-pkt ? avctx-internal-pkt-pts : AV_NOPTS_VALUE; frame-reordered_opaque = avctx-reordered_opaque; #if FF_API_GET_BUFFER @@ -1402,7 +1402,7 @@ int attribute_align_arg avcodec_decode_video2(AVCodecContext *avctx, AVFrame *pi if ((avctx-coded_width || avctx-coded_height) av_image_check_size(avctx-coded_width, avctx-coded_height, 0, avctx)) return -1; -avctx-pkt = avpkt; +avctx-internal-pkt = avpkt; ret = apply_param_change(avctx, avpkt); if (ret 0) { av_log(avctx, AV_LOG_ERROR, Error applying parameter changes.\n); @@ -1467,7 +1467,7 @@ int attribute_align_arg avcodec_decode_audio4(AVCodecContext *avctx, *got_frame_ptr = 0; -avctx-pkt = avpkt; +avctx-internal-pkt = avpkt; if (!avpkt-data avpkt-size) { av_log(avctx, AV_LOG_ERROR, invalid packet: NULL data, size != 0\n); @@ -1522,7 +1522,7 @@ int avcodec_decode_subtitle2(AVCodecContext *avctx, AVSubtitle *sub, { int ret; -avctx-pkt = avpkt; +avctx-internal-pkt = avpkt; *got_sub_ptr = 0; ret = avctx-codec-decode(avctx, sub, got_sub_ptr, avpkt); if (*got_sub_ptr) diff --git a/libavcodec/version.h b/libavcodec/version.h index 62201f5..8f6ae3c 100644 --- a/libavcodec/version.h +++ b/libavcodec/version.h @@ -91,5 +91,8 @@ #ifndef FF_API_THREAD_OPAQUE #define FF_API_THREAD_OPAQUE (LIBAVCODEC_VERSION_MAJOR 56) #endif +#ifndef FF_API_CODEC_PKT +#define FF_API_CODEC_PKT (LIBAVCODEC_VERSION_MAJOR 56) +#endif #endif /* AVCODEC_VERSION_H */ -- 1.7.10.4 ___ libav-devel mailing list libav-devel@libav.org
[libav-devel] [PATCH 2/5] lavc: split slice and frame threading functions into separate files
--- libavcodec/Makefile |4 +- libavcodec/pthread.c | 952 + libavcodec/{pthread.c = pthread_frame.c} | 280 + libavcodec/pthread_internal.h | 34 ++ libavcodec/pthread_slice.c| 224 +++ 5 files changed, 286 insertions(+), 1208 deletions(-) copy libavcodec/{pthread.c = pthread_frame.c} (76%) create mode 100644 libavcodec/pthread_internal.h create mode 100644 libavcodec/pthread_slice.c diff --git a/libavcodec/Makefile b/libavcodec/Makefile index 8e0d60d..5455de2 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -673,8 +673,8 @@ OBJS-$(CONFIG_REMOVE_EXTRADATA_BSF) += remove_extradata_bsf.o OBJS-$(CONFIG_TEXT2MOVSUB_BSF)+= movsub_bsf.o # thread libraries -OBJS-$(HAVE_PTHREADS) += pthread.o -OBJS-$(HAVE_W32THREADS)+= pthread.o +OBJS-$(HAVE_PTHREADS) += pthread.o pthread_slice.o pthread_frame.o +OBJS-$(HAVE_W32THREADS)+= pthread.o pthread_slice.o pthread_frame.o SKIPHEADERS+= %_tablegen.h \ %_tables.h\ diff --git a/libavcodec/pthread.c b/libavcodec/pthread.c index ce969af..682fd05 100644 --- a/libavcodec/pthread.c +++ b/libavcodec/pthread.c @@ -29,948 +29,10 @@ * @see doc/multithreading.txt */ -#include config.h - #include avcodec.h #include internal.h +#include pthread_internal.h #include thread.h -#include libavutil/avassert.h -#include libavutil/common.h -#include libavutil/cpu.h -#include libavutil/internal.h - -#if HAVE_PTHREADS -#include pthread.h -#elif HAVE_W32THREADS -#include compat/w32pthreads.h -#endif - -typedef int (action_func)(AVCodecContext *c, void *arg); -typedef int (action_func2)(AVCodecContext *c, void *arg, int jobnr, int threadnr); - -typedef struct ThreadContext { -pthread_t *workers; -action_func *func; -action_func2 *func2; -void *args; -int *rets; -int rets_count; -int job_count; -int job_size; - -pthread_cond_t last_job_cond; -pthread_cond_t current_job_cond; -pthread_mutex_t current_job_lock; -unsigned current_execute; -int current_job; -int done; -} ThreadContext; - -/** - * Context used by codec threads and stored in their AVCodecContext thread_opaque. - */ -typedef struct PerThreadContext { -struct FrameThreadContext *parent; - -pthread_t thread; -intthread_init; -pthread_cond_t input_cond; /// Used to wait for a new packet from the main thread. -pthread_cond_t progress_cond; /// Used by child threads to wait for progress to change. -pthread_cond_t output_cond; /// Used by the main thread to wait for frames to finish. - -pthread_mutex_t mutex; /// Mutex used to protect the contents of the PerThreadContext. -pthread_mutex_t progress_mutex; /// Mutex used to protect frame progress values and progress_cond. - -AVCodecContext *avctx; /// Context used to decode packets passed to this thread. - -AVPacket avpkt; /// Input packet (for decoding) or output (for encoding). -uint8_t *buf; /// backup storage for packet data when the input packet is not refcounted -intallocated_buf_size; /// Size allocated for buf - -AVFrame frame; /// Output frame (for decoding) or input (for encoding). -int got_frame; /// The output of got_picture_ptr from the last avcodec_decode_video() call. -int result; /// The result of the last codec decode/encode() call. - -enum { -STATE_INPUT_READY, /// Set when the thread is awaiting a packet. -STATE_SETTING_UP, /// Set before the codec has called ff_thread_finish_setup(). -STATE_GET_BUFFER, /** - * Set when the codec calls get_buffer(). - * State is returned to STATE_SETTING_UP afterwards. - */ -STATE_SETUP_FINISHED/// Set after the codec has called ff_thread_finish_setup(). -} state; - -/** - * Array of frames passed to ff_thread_release_buffer(). - * Frames are released after all threads referencing them are finished. - */ -AVFrame *released_buffers; -int num_released_buffers; -int released_buffers_allocated; - -AVFrame *requested_frame; /// AVFrame the codec passed to get_buffer() -int requested_flags; /// flags passed to get_buffer() for requested_frame -} PerThreadContext; - -/** - * Context stored in the client AVCodecContext thread_opaque. - */ -typedef struct FrameThreadContext { -PerThreadContext *threads; /// The contexts for each thread. -PerThreadContext *prev_thread; /// The last
Re: [libav-devel] [PATCH 1/7] lavc: deprecate FF_DEBUG_MV and remove all traces of its use
On 27/10/13 13:11, Anton Khirnov wrote: It has not been actually used since 37045e422903695e610cca6ecb753df643ab9380, when the broken vismv code was removed. --- avconv.c |3 --- libavcodec/avcodec.h |5 + libavcodec/mpegvideo.c |3 +-- libavcodec/options_table.h |2 ++ libavcodec/version.h |3 +++ 5 files changed, 11 insertions(+), 5 deletions(-) Ok. ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH 2/7] avplay: drop -vismv option which does not do anything anymore
On 27/10/13 13:11, Anton Khirnov wrote: --- Changelog |1 + avplay.c|9 - doc/avplay.texi |2 -- 3 files changed, 1 insertion(+), 11 deletions(-) I doubt we'll add it back much soon. lu ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH 3/7] lavc: deprecate AVCodecContext.debug_mv
On 27/10/13 13:11, Anton Khirnov wrote: It has been unused since 37045e422903695e610cca6ecb753df643ab9380. --- libavcodec/avcodec.h |7 --- libavcodec/options_table.h |2 ++ libavcodec/pthread.c |1 - 3 files changed, 6 insertions(+), 4 deletions(-) Ok. ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH 4/7] lavc: deprecate FF_DEBUG_VIS_*
On 27/10/13 13:11, Anton Khirnov wrote: Those flags have no effect since 37045e422903695e610cca6ecb753df643ab9380. --- libavcodec/avcodec.h |2 ++ libavcodec/options_table.h |2 ++ 2 files changed, 4 insertions(+) Ok. ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH 5/7] lavc: schedule FF_BUG_AC_VLC for removal on the next major bump.
On 27/10/13 13:11, Anton Khirnov wrote: It has been deprecated/unused for about 10 years. --- libavcodec/avcodec.h |2 ++ libavcodec/options_table.h |2 ++ libavcodec/version.h |3 +++ 3 files changed, 7 insertions(+) Ok. ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH 7/7] lavc: move FF_ASPECT_EXTENDED from avcodec.h to h263.h
On 27/10/13 13:12, Anton Khirnov wrote: It's for internal use only. --- libavcodec/avcodec.h |2 ++ libavcodec/h263.h|4 libavcodec/version.h |3 +++ 3 files changed, 9 insertions(+) Ok. ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH 6/7] lavc: deprecate unused FF_BUG_OLD_MSMPEG4
On 27/10/13 13:12, Anton Khirnov wrote: --- libavcodec/avcodec.h |2 ++ libavcodec/options_table.h |2 ++ libavcodec/version.h |3 +++ 3 files changed, 7 insertions(+) Ok. ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH 2/5] lavc: split slice and frame threading functions into separate files
On 27/10/13 13:17, Anton Khirnov wrote: Doesn't look bad even after a second read, there are few nits that might wait till they are globally fixed (e.g. include order). lu ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH 43/50] targa: stop using deprecated avcodec_set_dimensions
On 10/27/2013 06:10 AM, Anton Khirnov wrote: --- libavcodec/targa.c |6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libavcodec/targa.c b/libavcodec/targa.c index 9f0b286..4b736c9 100644 --- a/libavcodec/targa.c +++ b/libavcodec/targa.c @@ -142,10 +142,10 @@ static int decode_frame(AVCodecContext *avctx, return AVERROR_INVALIDDATA; } -if ((ret = av_image_check_size(w, h, 0, avctx)) 0) +ret = ff_set_dimensions(avctx, w, h); +if (ret 0) return ret; -if(w != avctx-width || h != avctx-height) -avcodec_set_dimensions(avctx, w, h); + if ((ret = ff_get_buffer(avctx, p, 0)) 0){ av_log(avctx, AV_LOG_ERROR, get_buffer() failed\n); return ret; Ok. -Justin ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH 44/50] tiff: stop using deprecated avcodec_set_dimensions
On 10/27/2013 06:10 AM, Anton Khirnov wrote: --- libavcodec/tiff.c |4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavcodec/tiff.c b/libavcodec/tiff.c index 735eafe..7fb0e7a 100644 --- a/libavcodec/tiff.c +++ b/libavcodec/tiff.c @@ -296,9 +296,9 @@ static int init_image(TiffContext *s, AVFrame *frame) return AVERROR_INVALIDDATA; } if (s-width != s-avctx-width || s-height != s-avctx-height) { -if ((ret = av_image_check_size(s-width, s-height, 0, s-avctx)) 0) +ret = ff_set_dimensions(s-avctx, s-width, s-height); +if (ret 0) return ret; -avcodec_set_dimensions(s-avctx, s-width, s-height); } if ((ret = ff_get_buffer(s-avctx, frame, 0)) 0) { av_log(s-avctx, AV_LOG_ERROR, get_buffer() failed\n); Ok. -Justin ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH 02/50] lavc: add error checking to apply_param_change.
On 10/27/2013 06:09 AM, Anton Khirnov wrote: --- libavcodec/utils.c | 51 +-- 1 file changed, 37 insertions(+), 14 deletions(-) LGTM -Justin ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH 06/50] lavc: replace avcodec_set_dimensions with ff_set_dimensions
On 10/27/2013 06:09 AM, Anton Khirnov wrote: avcodec_set_dimensions() is supposed to be an internal utility function, there is no reason whatsoever for it to be public. Therefore deprecate it. --- libavcodec/avcodec.h |6 ++ libavcodec/internal.h |6 ++ libavcodec/utils.c| 19 +++ libavcodec/version.h |3 +++ 4 files changed, 30 insertions(+), 4 deletions(-) diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index 84bfccb..856eda5 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h @@ -4019,7 +4019,13 @@ enum AVPixelFormat avcodec_default_get_format(struct AVCodecContext *s, const en * @} */ +#if FF_API_SET_DIMENSIONS +/** + * @deprecated this function is not supposed to be used from outside of lavc + */ +attribute_deprecated void avcodec_set_dimensions(AVCodecContext *s, int width, int height); +#endif /** * Put a string representing the codec tag codec_tag in buf. diff --git a/libavcodec/internal.h b/libavcodec/internal.h index f57bedc..2133137 100644 --- a/libavcodec/internal.h +++ b/libavcodec/internal.h @@ -166,4 +166,10 @@ const uint8_t *avpriv_find_start_code(const uint8_t *restrict p, const uint8_t *end, uint32_t *restrict state); +/** + * Check that the provided frame dimensions are valid and set them on the codec + * context. + */ +int ff_set_dimensions(AVCodecContext *s, int width, int height); + #endif /* AVCODEC_INTERNAL_H */ diff --git a/libavcodec/utils.c b/libavcodec/utils.c index d14d4f4..1e0026d 100644 --- a/libavcodec/utils.c +++ b/libavcodec/utils.c @@ -152,12 +152,23 @@ unsigned avcodec_get_edge_width(void) return EDGE_WIDTH; } +#if FF_API_SET_DIMENSIONS void avcodec_set_dimensions(AVCodecContext *s, int width, int height) { -s-coded_width = width; -s-coded_height = height; -s-width= width; -s-height = height; +ff_set_dimensions(s, width, height); +} +#endif + +int ff_set_dimensions(AVCodecContext *s, int width, int height) +{ +int ret = av_image_check_size(width, height, 0, s); + +if (ret 0) +width = height = 0; +s-width = s-coded_width = width; +s-height = s-coded_height = height; + +return ret; } #if HAVE_NEON || ARCH_PPC || HAVE_MMX diff --git a/libavcodec/version.h b/libavcodec/version.h index e394c76..321c7ef 100644 --- a/libavcodec/version.h +++ b/libavcodec/version.h @@ -73,5 +73,8 @@ #ifndef FF_API_VOXWARE #define FF_API_VOXWARE (LIBAVCODEC_VERSION_MAJOR 56) #endif +#ifndef FF_API_SET_DIMENSIONS +#define FF_API_SET_DIMENSIONS(LIBAVCODEC_VERSION_MAJOR 56) +#endif #endif /* AVCODEC_VERSION_H */ LGTM -Justin ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH 04/50] oggparsetheora: return meaningful error codes
On 10/27/2013 06:09 AM, Anton Khirnov wrote: --- libavformat/oggparsetheora.c |6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libavformat/oggparsetheora.c b/libavformat/oggparsetheora.c index 614cc29..ce4a462 100644 --- a/libavformat/oggparsetheora.c +++ b/libavformat/oggparsetheora.c @@ -68,7 +68,7 @@ static int theora_header(AVFormatContext * s, int idx) if (thp-version 0x030100) { av_log(s, AV_LOG_ERROR, Too old or unsupported Theora (%x)\n, thp-version); -return -1; +return AVERROR(ENOSYS); } width = get_bits(gb, 16) 4; @@ -118,10 +118,10 @@ static int theora_header(AVFormatContext * s, int idx) ff_vorbis_comment(s, st-metadata, os-buf + os-pstart + 7, os-psize - 7); case 0x82: if (!thp-version) -return -1; +return AVERROR_INVALIDDATA; break; default: -return -1; +return AVERROR_INVALIDDATA; } if ((err = av_reallocp(st-codec-extradata, Ok -Justin ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH 41/50] sunrast: stop using deprecated avcodec_set_dimensions
On 10/27/2013 06:10 AM, Anton Khirnov wrote: --- libavcodec/sunrast.c | 10 -- 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/libavcodec/sunrast.c b/libavcodec/sunrast.c index 4147cf0..ffa685c 100644 --- a/libavcodec/sunrast.c +++ b/libavcodec/sunrast.c @@ -61,10 +61,6 @@ static int sunrast_decode_frame(AVCodecContext *avctx, void *data, av_log(avctx, AV_LOG_ERROR, invalid (compression) type\n); return AVERROR_INVALIDDATA; } -if (av_image_check_size(w, h, 0, avctx)) { -av_log(avctx, AV_LOG_ERROR, invalid image size\n); -return AVERROR_INVALIDDATA; -} if (maptype == RMT_RAW) { avpriv_request_sample(avctx, Unknown colormap type); return AVERROR_PATCHWELCOME; @@ -90,8 +86,10 @@ static int sunrast_decode_frame(AVCodecContext *avctx, void *data, return AVERROR_INVALIDDATA; } -if (w != avctx-width || h != avctx-height) -avcodec_set_dimensions(avctx, w, h); +ret = ff_set_dimensions(avctx, w, h); +if (ret 0) +return ret; + if ((ret = ff_get_buffer(avctx, p, 0)) 0) { av_log(avctx, AV_LOG_ERROR, get_buffer() failed\n); return ret; Ok -Justin ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH 40/50] sgidec: stop using deprecated avcodec_set_dimensions
On 10/27/2013 06:10 AM, Anton Khirnov wrote: --- libavcodec/sgidec.c |6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libavcodec/sgidec.c b/libavcodec/sgidec.c index 476311d..928806f 100644 --- a/libavcodec/sgidec.c +++ b/libavcodec/sgidec.c @@ -200,9 +200,9 @@ static int decode_frame(AVCodecContext *avctx, return -1; } -if (av_image_check_size(s-width, s-height, 0, avctx)) -return -1; -avcodec_set_dimensions(avctx, s-width, s-height); +ret = ff_set_dimensions(avctx, s-width, s-height); +if (ret 0) +return ret; if (ff_get_buffer(avctx, p, 0) 0) { av_log(avctx, AV_LOG_ERROR, get_buffer() failed.\n); Ok -Justin ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH 42/50] svq1dec: stop using deprecated avcodec_set_dimensions
On 10/27/2013 06:10 AM, Anton Khirnov wrote: --- libavcodec/svq1dec.c |5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libavcodec/svq1dec.c b/libavcodec/svq1dec.c index 7d3ef50..3b1a275 100644 --- a/libavcodec/svq1dec.c +++ b/libavcodec/svq1dec.c @@ -638,7 +638,10 @@ static int svq1_decode_frame(AVCodecContext *avctx, void *data, av_dlog(avctx, Error in svq1_decode_frame_header %i\n, result); return result; } -avcodec_set_dimensions(avctx, s-width, s-height); + +result = ff_set_dimensions(avctx, s-width, s-height); +if (result 0) +return result; if ((avctx-skip_frame = AVDISCARD_NONREF s-nonref) || (avctx-skip_frame = AVDISCARD_NONKEY Ok -Justin ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH 37/50] ptx: stop using deprecated avcodec_set_dimensions
On 10/27/2013 06:10 AM, Anton Khirnov wrote: --- libavcodec/ptx.c |6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libavcodec/ptx.c b/libavcodec/ptx.c index 527e39a..9810e00 100644 --- a/libavcodec/ptx.c +++ b/libavcodec/ptx.c @@ -55,10 +55,10 @@ static int ptx_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, buf += offset; -if ((ret = av_image_check_size(w, h, 0, avctx)) 0) +ret = ff_set_dimensions(avctx, w, h); +if (ret 0) return ret; -if (w != avctx-width || h != avctx-height) -avcodec_set_dimensions(avctx, w, h); + if ((ret = ff_get_buffer(avctx, p, 0)) 0) { av_log(avctx, AV_LOG_ERROR, get_buffer() failed\n); return ret; Ok -Justin ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH 36/50] pictordec: stop using deprecated avcodec_set_dimensions
On 10/27/2013 06:10 AM, Anton Khirnov wrote: --- libavcodec/pictordec.c |6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libavcodec/pictordec.c b/libavcodec/pictordec.c index 2d72977..33c4545 100644 --- a/libavcodec/pictordec.c +++ b/libavcodec/pictordec.c @@ -141,9 +141,9 @@ static int decode_frame(AVCodecContext *avctx, avctx-pix_fmt = AV_PIX_FMT_PAL8; if (s-width != avctx-width s-height != avctx-height) { -if (av_image_check_size(s-width, s-height, 0, avctx) 0) -return -1; -avcodec_set_dimensions(avctx, s-width, s-height); +ret = ff_set_dimensions(avctx, s-width, s-height); +if (ret 0) +return ret; } if ((ret = ff_get_buffer(avctx, frame, 0)) 0) { Ok -Justin ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH 34/50] pcx: stop using deprecated avcodec_set_dimensions
On 10/27/2013 06:10 AM, Anton Khirnov wrote: --- libavcodec/pcx.c |6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libavcodec/pcx.c b/libavcodec/pcx.c index ad92d75..6c51f6c 100644 --- a/libavcodec/pcx.c +++ b/libavcodec/pcx.c @@ -135,10 +135,10 @@ static int pcx_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, buf += 128; -if ((ret = av_image_check_size(w, h, 0, avctx)) 0) +ret = ff_set_dimensions(avctx, w, h); +if (ret 0) return ret; -if (w != avctx-width || h != avctx-height) -avcodec_set_dimensions(avctx, w, h); + if ((ret = ff_get_buffer(avctx, p, 0)) 0) { av_log(avctx, AV_LOG_ERROR, get_buffer() failed\n); return ret; Ok -Justin ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH 28/50] libopenjpegdec: stop using deprecated avcodec_set_dimensions
On 10/27/2013 06:10 AM, Anton Khirnov wrote: --- libavcodec/libopenjpegdec.c | 11 --- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/libavcodec/libopenjpegdec.c b/libavcodec/libopenjpegdec.c index 0062701..77a37e9 100644 --- a/libavcodec/libopenjpegdec.c +++ b/libavcodec/libopenjpegdec.c @@ -33,6 +33,7 @@ #include libavutil/pixfmt.h #include libavutil/opt.h #include avcodec.h +#include internal.h #include thread.h #define JP2_SIG_TYPE0x6A502020 @@ -315,13 +316,9 @@ static int libopenjpeg_decode_frame(AVCodecContext *avctx, height = (height + (1 ctx-lowres) - 1) ctx-lowres; } -if ((ret = av_image_check_size(width, height, 0, avctx)) 0) { -av_log(avctx, AV_LOG_ERROR, - %dx%d dimension invalid.\n, width, height); -goto done; -} - -avcodec_set_dimensions(avctx, width, height); +ret = ff_set_dimensions(avctx, width, height); +if (ret 0) +return ret; if (avctx-pix_fmt != AV_PIX_FMT_NONE) if (!libopenjpeg_matches_pix_fmt(image, avctx-pix_fmt)) It looks like 'goto done' is needed to do some cleaning up. -Justin ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH 23/50] gifdec: stop using deprecated avcodec_set_dimensions
On 10/27/2013 06:10 AM, Anton Khirnov wrote: --- libavcodec/gifdec.c |5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/libavcodec/gifdec.c b/libavcodec/gifdec.c index a233797..4814230 100644 --- a/libavcodec/gifdec.c +++ b/libavcodec/gifdec.c @@ -292,9 +292,10 @@ static int gif_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, return ret; avctx-pix_fmt = AV_PIX_FMT_PAL8; -if ((ret = av_image_check_size(s-screen_width, s-screen_height, 0, avctx)) 0) + +ret = ff_set_dimensions(avctx, s-screen_width, s-screen_height); +if (ret 0) return ret; -avcodec_set_dimensions(avctx, s-screen_width, s-screen_height); if ((ret = ff_get_buffer(avctx, picture, 0)) 0) { av_log(avctx, AV_LOG_ERROR, get_buffer() failed\n); Ok -Justin ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel