diff options
author | Anton Khirnov <anton@khirnov.net> | 2021-03-08 11:26:32 +0100 |
---|---|---|
committer | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2021-09-20 00:20:13 +0200 |
commit | dd846bc4a9163f875cc2c4e99325c1a7b4ab8e7d (patch) | |
tree | 454f000005c2df2d1c1867239ea50534678b2583 /libavcodec/h263dec.c | |
parent | 9c489a0f3a954d8b63d0e8dc2a387ff8f2a8aa3a (diff) |
lavc: deprecate AV_CODEC_(FLAG|CAP)_TRUNCATED
It is supported only by a few decoders (h263, h263p, mpeg(1|2|)video
and mpeg4) and is entirely redundant with parsers. Furthermore, using
it leads to missing frames, as flushing the decoder at the end does not
work properly.
Co-authored-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Diffstat (limited to 'libavcodec/h263dec.c')
-rw-r--r-- | libavcodec/h263dec.c | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/libavcodec/h263dec.c b/libavcodec/h263dec.c index d7ae8a0727..2682a7f43a 100644 --- a/libavcodec/h263dec.c +++ b/libavcodec/h263dec.c @@ -33,12 +33,16 @@ #include "error_resilience.h" #include "flv.h" #include "h263.h" +#if FF_API_FLAG_TRUNCATED #include "h263_parser.h" +#endif #include "hwconfig.h" #include "internal.h" #include "mpeg_er.h" #include "mpeg4video.h" +#if FF_API_FLAG_TRUNCATED #include "mpeg4video_parser.h" +#endif #include "mpegutils.h" #include "mpegvideo.h" #include "msmpeg4.h" @@ -170,12 +174,14 @@ static int get_consumed_bytes(MpegEncContext *s, int buf_size) /* We would have to scan through the whole buf to handle the weird * reordering ... */ return buf_size; +#if FF_API_FLAG_TRUNCATED } else if (s->avctx->flags & AV_CODEC_FLAG_TRUNCATED) { pos -= s->parse_context.last_index; // padding is not really read so this might be -1 if (pos < 0) pos = 0; return pos; +#endif } else { // avoid infinite loops (maybe not needed...) if (pos == 0) @@ -441,6 +447,7 @@ int ff_h263_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, return 0; } +#if FF_API_FLAG_TRUNCATED if (s->avctx->flags & AV_CODEC_FLAG_TRUNCATED) { int next; @@ -460,6 +467,7 @@ int ff_h263_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, &buf_size) < 0) return buf_size; } +#endif retry: if (s->divx_packed && s->bitstream_buffer_size) { @@ -768,7 +776,10 @@ const AVCodec ff_h263_decoder = { .close = ff_h263_decode_end, .decode = ff_h263_decode_frame, .capabilities = AV_CODEC_CAP_DRAW_HORIZ_BAND | AV_CODEC_CAP_DR1 | - AV_CODEC_CAP_TRUNCATED | AV_CODEC_CAP_DELAY, +#if FF_API_FLAG_TRUNCATED + AV_CODEC_CAP_TRUNCATED | +#endif + AV_CODEC_CAP_DELAY, .caps_internal = FF_CODEC_CAP_SKIP_FRAME_FILL_PARAM, .flush = ff_mpeg_flush, .max_lowres = 3, @@ -786,7 +797,10 @@ const AVCodec ff_h263p_decoder = { .close = ff_h263_decode_end, .decode = ff_h263_decode_frame, .capabilities = AV_CODEC_CAP_DRAW_HORIZ_BAND | AV_CODEC_CAP_DR1 | - AV_CODEC_CAP_TRUNCATED | AV_CODEC_CAP_DELAY, +#if FF_API_FLAG_TRUNCATED + AV_CODEC_CAP_TRUNCATED | +#endif + AV_CODEC_CAP_DELAY, .caps_internal = FF_CODEC_CAP_SKIP_FRAME_FILL_PARAM, .flush = ff_mpeg_flush, .max_lowres = 3, |