Unified · Split
| @@ -303,15 +303,6 @@ typedef struct RcOverride{ · 302 unmodified lines | ||
| 303 | 303 | * error[?] variables will be set during encoding. |
| 304 | 304 | */ |
| 305 | 305 | #define AV_CODEC_FLAG_PSNR (1 << 15) |
| 306 | −#if FF_API_FLAG_TRUNCATED | |
| 307 | −/** | |
| 308 | − * Input bitstream might be truncated at a random location | |
| 309 | − * instead of only at frame boundaries. | |
| 310 | − * | |
| 311 | − * @deprecated use codec parsers for packetizing input | |
| 312 | − */ | |
| 313 | −#define AV_CODEC_FLAG_TRUNCATED (1 << 16) | |
| 314 | −#endif | |
| 315 | 306 | /** |
| 316 | 307 | * Use interlaced DCT. |
| 317 | 308 | */ |
| @@ -50,12 +50,6 @@ · 49 unmodified lines | ||
| 50 | 50 | * avcodec_default_get_buffer2 or avcodec_default_get_encode_buffer. |
| 51 | 51 | */ |
| 52 | 52 | #define AV_CODEC_CAP_DR1 (1 << 1) |
| 53 | −#if FF_API_FLAG_TRUNCATED | |
| 54 | −/** | |
| 55 | − * @deprecated Use parsers to always send proper frames. | |
| 56 | − */ | |
| 57 | −#define AV_CODEC_CAP_TRUNCATED (1 << 3) | |
| 58 | −#endif | |
| 59 | 53 | /** |
| 60 | 54 | * Encoder or decoder requires flushing with NULL input at the end in order to |
| 61 | 55 | * give the complete and correct output. |
| @@ -427,11 +427,7 @@ FF_ENABLE_DEPRECATION_WARNINGS · 426 unmodified lines | ||
| 427 | 427 | if (!got_frame) |
| 428 | 428 | av_frame_unref(frame); |
| 429 | 429 | |
| 430 | −#if FF_API_FLAG_TRUNCATED | |
| 431 | − if (ret >= 0 && avctx->codec->type == AVMEDIA_TYPE_VIDEO && !(avctx->flags & AV_CODEC_FLAG_TRUNCATED)) | |
| 432 | −#else | |
| 433 | 430 | if (ret >= 0 && avctx->codec->type == AVMEDIA_TYPE_VIDEO) |
| 434 | −#endif | |
| 435 | 431 | ret = pkt->size; |
| 436 | 432 | |
| 437 | 433 | /* do not stop draining when actual_got_frame != 0 or ret < 0 */ |
| @@ -25,16 +25,9 @@ · 24 unmodified lines | ||
| 25 | 25 | */ |
| 26 | 26 | |
| 27 | 27 | #include "parser.h" |
| 28 | −#if FF_API_FLAG_TRUNCATED | |
| 29 | −/* Nuke this header when removing FF_API_FLAG_TRUNCATED */ | |
| 30 | −#include "h263_parser.h" | |
| 31 | − | |
| 32 | −int ff_h263_find_frame_end(ParseContext *pc, const uint8_t *buf, int buf_size){ | |
| 33 | −#else | |
| 34 | 28 | |
| 35 | 29 | static int h263_find_frame_end(ParseContext *pc, const uint8_t *buf, int buf_size) |
| 36 | 30 | { |
| 37 | −#endif | |
| 38 | 31 | int vop_found, i; |
| 39 | 32 | uint32_t state; |
| 40 | 33 | |
| @@ -80,11 +73,7 @@ static int h263_parse(AVCodecParserContext *s, · 39 unmodified lines | ||
| 80 | 73 | if (s->flags & PARSER_FLAG_COMPLETE_FRAMES) { |
| 81 | 74 | next = buf_size; |
| 82 | 75 | } else { |
| 83 | −#if FF_API_FLAG_TRUNCATED | |
| 84 | − next= ff_h263_find_frame_end(pc, buf, buf_size); | |
| 85 | −#else | |
| 86 | 76 | next = h263_find_frame_end(pc, buf, buf_size); |
| 87 | −#endif | |
| 88 | 77 | |
| 89 | 78 | if (ff_combine_frame(pc, next, &buf, &buf_size) < 0) { |
| 90 | 79 | *poutbuf = NULL; |
| @@ -1,29 +0,0 @@ | ||
| 1 | −/* | |
| 2 | − * H.263 parser | |
| 3 | − * Copyright (c) 2002-2004 Michael Niedermayer <michaelni@gmx.at> | |
| 4 | − * | |
| 5 | − * This file is part of FFmpeg. | |
| 6 | − * | |
| 7 | − * FFmpeg is free software; you can redistribute it and/or | |
| 8 | − * modify it under the terms of the GNU Lesser General Public | |
| 9 | − * License as published by the Free Software Foundation; either | |
| 10 | − * version 2.1 of the License, or (at your option) any later version. | |
| 11 | − * | |
| 12 | − * FFmpeg is distributed in the hope that it will be useful, | |
| 13 | − * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 14 | − * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| 15 | − * Lesser General Public License for more details. | |
| 16 | − * | |
| 17 | − * You should have received a copy of the GNU Lesser General Public | |
| 18 | − * License along with FFmpeg; if not, write to the Free Software | |
| 19 | − * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | |
| 20 | − */ | |
| 21 | − | |
| 22 | −#ifndef AVCODEC_H263_PARSER_H | |
| 23 | −#define AVCODEC_H263_PARSER_H | |
| 24 | − | |
| 25 | −#include "parser.h" | |
| 26 | − | |
| 27 | −int ff_h263_find_frame_end(ParseContext *pc, const uint8_t *buf, int buf_size); | |
| 28 | − | |
| 29 | −#endif /* AVCODEC_H263_PARSER_H */ | |
| @@ -36,17 +36,11 @@ · 35 unmodified lines | ||
| 36 | 36 | #include "flvdec.h" |
| 37 | 37 | #include "h263.h" |
| 38 | 38 | #include "h263dec.h" |
| 39 | −#if FF_API_FLAG_TRUNCATED | |
| 40 | −#include "h263_parser.h" | |
| 41 | −#endif | |
| 42 | 39 | #include "hwconfig.h" |
| 43 | 40 | #include "mpeg_er.h" |
| 44 | 41 | #include "mpeg4video.h" |
| 45 | 42 | #include "mpeg4videodec.h" |
| 46 | 43 | #include "mpeg4videodefs.h" |
| 47 | −#if FF_API_FLAG_TRUNCATED | |
| 48 | −#include "mpeg4video_parser.h" | |
| 49 | −#endif | |
| 50 | 44 | #include "mpegutils.h" |
| 51 | 45 | #include "mpegvideo.h" |
| 52 | 46 | #include "mpegvideodec.h" |
| @@ -163,14 +157,6 @@ static int get_consumed_bytes(MpegEncContext *s, int buf_size) · 110 unmodified lines | ||
| 163 | 157 | /* We would have to scan through the whole buf to handle the weird |
| 164 | 158 | * reordering ... */ |
| 165 | 159 | return buf_size; |
| 166 | −#if FF_API_FLAG_TRUNCATED | |
| 167 | − } else if (s->avctx->flags & AV_CODEC_FLAG_TRUNCATED) { | |
| 168 | − pos -= s->parse_context.last_index; | |
| 169 | − // padding is not really read so this might be -1 | |
| 170 | − if (pos < 0) | |
| 171 | − pos = 0; | |
| 172 | − return pos; | |
| 173 | −#endif | |
| 174 | 160 | } else { |
| 175 | 161 | // avoid infinite loops (maybe not needed...) |
| 176 | 162 | if (pos == 0) |
| @@ -448,28 +434,6 @@ int ff_h263_decode_frame(AVCodecContext *avctx, AVFrame *pict, · 271 unmodified lines | ||
| 448 | 434 | return 0; |
| 449 | 435 | } |
| 450 | 436 | |
| 451 | −#if FF_API_FLAG_TRUNCATED | |
| 452 | − if (s->avctx->flags & AV_CODEC_FLAG_TRUNCATED) { | |
| 453 | − int next; | |
| 454 | − | |
| 455 | − if (CONFIG_MPEG4_DECODER && s->codec_id == AV_CODEC_ID_MPEG4) { | |
| 456 | − next = ff_mpeg4_find_frame_end(&s->parse_context, buf, buf_size); | |
| 457 | − } else if (CONFIG_H263_DECODER && s->codec_id == AV_CODEC_ID_H263) { | |
| 458 | − next = ff_h263_find_frame_end(&s->parse_context, buf, buf_size); | |
| 459 | − } else if (CONFIG_H263P_DECODER && s->codec_id == AV_CODEC_ID_H263P) { | |
| 460 | − next = ff_h263_find_frame_end(&s->parse_context, buf, buf_size); | |
| 461 | − } else { | |
| 462 | − av_log(s->avctx, AV_LOG_ERROR, | |
| 463 | − "this codec does not support truncated bitstreams\n"); | |
| 464 | − return AVERROR(ENOSYS); | |
| 465 | − } | |
| 466 | − | |
| 467 | − if (ff_combine_frame(&s->parse_context, next, (const uint8_t **)&buf, | |
| 468 | − &buf_size) < 0) | |
| 469 | − return buf_size; | |
| 470 | − } | |
| 471 | −#endif | |
| 472 | − | |
| 473 | 437 | retry: |
| 474 | 438 | if (s->divx_packed && s->bitstream_buffer_size) { |
| 475 | 439 | int i; |
| @@ -749,9 +713,6 @@ const FFCodec ff_h263_decoder = { · 273 unmodified lines | ||
| 749 | 713 | .close = ff_h263_decode_end, |
| 750 | 714 | FF_CODEC_DECODE_CB(ff_h263_decode_frame), |
| 751 | 715 | .p.capabilities = AV_CODEC_CAP_DRAW_HORIZ_BAND | AV_CODEC_CAP_DR1 | |
| 752 | −#if FF_API_FLAG_TRUNCATED | |
| 753 | − AV_CODEC_CAP_TRUNCATED | | |
| 754 | −#endif | |
| 755 | 716 | AV_CODEC_CAP_DELAY, |
| 756 | 717 | .caps_internal = FF_CODEC_CAP_SKIP_FRAME_FILL_PARAM, |
| 757 | 718 | .flush = ff_mpeg_flush, |
| @@ -770,9 +731,6 @@ const FFCodec ff_h263p_decoder = { · 12 unmodified lines | ||
| 770 | 731 | .close = ff_h263_decode_end, |
| 771 | 732 | FF_CODEC_DECODE_CB(ff_h263_decode_frame), |
| 772 | 733 | .p.capabilities = AV_CODEC_CAP_DRAW_HORIZ_BAND | AV_CODEC_CAP_DR1 | |
| 773 | −#if FF_API_FLAG_TRUNCATED | |
| 774 | − AV_CODEC_CAP_TRUNCATED | | |
| 775 | −#endif | |
| 776 | 734 | AV_CODEC_CAP_DELAY, |
| 777 | 735 | .caps_internal = FF_CODEC_CAP_SKIP_FRAME_FILL_PARAM, |
| 778 | 736 | .flush = ff_mpeg_flush, |
| @@ -167,72 +167,6 @@ av_cold void ff_mpeg12_init_vlcs(void) · 166 unmodified lines | ||
| 167 | 167 | ff_thread_once(&init_static_once, mpeg12_init_vlcs); |
| 168 | 168 | } |
| 169 | 169 | |
| 170 | −#if FF_API_FLAG_TRUNCATED | |
| 171 | −/** | |
| 172 | − * Find the end of the current frame in the bitstream. | |
| 173 | − * @return the position of the first byte of the next frame, or -1 | |
| 174 | − */ | |
| 175 | −int ff_mpeg1_find_frame_end(ParseContext *pc, const uint8_t *buf, int buf_size, AVCodecParserContext *s) | |
| 176 | −{ | |
| 177 | − int i; | |
| 178 | − uint32_t state = pc->state; | |
| 179 | − | |
| 180 | − /* EOF considered as end of frame */ | |
| 181 | − if (buf_size == 0) | |
| 182 | − return 0; | |
| 183 | − | |
| 184 | −/* | |
| 185 | − 0 frame start -> 1/4 | |
| 186 | − 1 first_SEQEXT -> 0/2 | |
| 187 | − 2 first field start -> 3/0 | |
| 188 | − 3 second_SEQEXT -> 2/0 | |
| 189 | − 4 searching end | |
| 190 | −*/ | |
| 191 | − | |
| 192 | − for (i = 0; i < buf_size; i++) { | |
| 193 | − av_assert1(pc->frame_start_found >= 0 && pc->frame_start_found <= 4); | |
| 194 | − if (pc->frame_start_found & 1) { | |
| 195 | − if (state == EXT_START_CODE && (buf[i] & 0xF0) != 0x80) | |
| 196 | − pc->frame_start_found--; | |
| 197 | − else if (state == EXT_START_CODE + 2) { | |
| 198 | − if ((buf[i] & 3) == 3) | |
| 199 | − pc->frame_start_found = 0; | |
| 200 | − else | |
| 201 | − pc->frame_start_found = (pc->frame_start_found + 1) & 3; | |
| 202 | − } | |
| 203 | − state++; | |
| 204 | − } else { | |
| 205 | − i = avpriv_find_start_code(buf + i, buf + buf_size, &state) - buf - 1; | |
| 206 | − if (pc->frame_start_found == 0 && state >= SLICE_MIN_START_CODE && state <= SLICE_MAX_START_CODE) { | |
| 207 | − i++; | |
| 208 | − pc->frame_start_found = 4; | |
| 209 | − } | |
| 210 | − if (state == SEQ_END_CODE) { | |
| 211 | − pc->frame_start_found = 0; | |
| 212 | − pc->state=-1; | |
| 213 | − return i+1; | |
| 214 | − } | |
| 215 | − if (pc->frame_start_found == 2 && state == SEQ_START_CODE) | |
| 216 | − pc->frame_start_found = 0; | |
| 217 | − if (pc->frame_start_found < 4 && state == EXT_START_CODE) | |
| 218 | − pc->frame_start_found++; | |
| 219 | − if (pc->frame_start_found == 4 && (state & 0xFFFFFF00) == 0x100) { | |
| 220 | − if (state < SLICE_MIN_START_CODE || state > SLICE_MAX_START_CODE) { | |
| 221 | − pc->frame_start_found = 0; | |
| 222 | − pc->state = -1; | |
| 223 | − return i - 3; | |
| 224 | − } | |
| 225 | − } | |
| 226 | − if (pc->frame_start_found == 0 && s && state == PICTURE_START_CODE) { | |
| 227 | − ff_fetch_timestamp(s, i - 3, 1, i > 3); | |
| 228 | − } | |
| 229 | − } | |
| 230 | − } | |
| 231 | − pc->state = state; | |
| 232 | − return END_NOT_FOUND; | |
| 233 | −} | |
| 234 | −#endif | |
| 235 | − | |
| 236 | 170 | #define MAX_INDEX (64 - 1) |
| 237 | 171 | |
| 238 | 172 | int ff_mpeg1_decode_block_intra(GetBitContext *gb, |
| @@ -34,15 +34,6 @@ · 33 unmodified lines | ||
| 34 | 34 | #define EXT_START_CODE 0x000001b5 |
| 35 | 35 | #define USER_START_CODE 0x000001b2 |
| 36 | 36 | |
| 37 | −#include "version_major.h" | |
| 38 | −#if FF_API_FLAG_TRUNCATED | |
| 39 | −#include <stdint.h> | |
| 40 | − | |
| 41 | −struct ParseContext; | |
| 42 | −struct AVCodecParserContext; | |
| 43 | −int ff_mpeg1_find_frame_end(struct ParseContext *pc, const uint8_t *buf, int buf_size, struct AVCodecParserContext *s); | |
| 44 | −#endif | |
| 45 | − | |
| 46 | 37 | void ff_mpeg12_find_best_frame_rate(AVRational frame_rate, |
| 47 | 38 | int *code, int *ext_n, int *ext_d, |
| 48 | 39 | int nonstandard); |
| @@ -1239,14 +1239,7 @@ static int mpeg_decode_postinit(AVCodecContext *avctx) · 1238 unmodified lines | ||
| 1239 | 1239 | (s1->save_progressive_seq != s->progressive_sequence && FFALIGN(s->height, 16) != FFALIGN(s->height, 32)) || |
| 1240 | 1240 | 0) { |
| 1241 | 1241 | if (s1->mpeg_enc_ctx_allocated) { |
| 1242 | −#if FF_API_FLAG_TRUNCATED | |
| 1243 | − ParseContext pc = s->parse_context; | |
| 1244 | − s->parse_context.buffer = 0; | |
| 1245 | 1242 | ff_mpv_common_end(s); |
| 1246 | − s->parse_context = pc; | |
| 1247 | −#else | |
| 1248 | − ff_mpv_common_end(s); | |
| 1249 | −#endif | |
| 1250 | 1243 | s1->mpeg_enc_ctx_allocated = 0; |
| 1251 | 1244 | } |
| 1252 | 1245 | |
| @@ -2482,11 +2475,7 @@ static int decode_chunks(AVCodecContext *avctx, AVFrame *picture, · 1229 unmodified lines | ||
| 2482 | 2475 | if (avctx->err_recognition & AV_EF_EXPLODE && s2->er.error_count) |
| 2483 | 2476 | return AVERROR_INVALIDDATA; |
| 2484 | 2477 | |
| 2485 | −#if FF_API_FLAG_TRUNCATED | |
| 2486 | − return FFMAX(0, buf_ptr - buf - s2->parse_context.last_index); | |
| 2487 | −#else | |
| 2488 | 2478 | return FFMAX(0, buf_ptr - buf); |
| 2489 | −#endif | |
| 2490 | 2479 | } |
| 2491 | 2480 | |
| 2492 | 2481 | input_size = buf_end - buf_ptr; |
| @@ -2799,17 +2788,6 @@ static int mpeg_decode_frame(AVCodecContext *avctx, AVFrame *picture, · 306 unmodified lines | ||
| 2799 | 2788 | return buf_size; |
| 2800 | 2789 | } |
| 2801 | 2790 | |
| 2802 | −#if FF_API_FLAG_TRUNCATED | |
| 2803 | − if (s2->avctx->flags & AV_CODEC_FLAG_TRUNCATED) { | |
| 2804 | − int next = ff_mpeg1_find_frame_end(&s2->parse_context, buf, | |
| 2805 | − buf_size, NULL); | |
| 2806 | − | |
| 2807 | − if (ff_combine_frame(&s2->parse_context, next, | |
| 2808 | − (const uint8_t **) &buf, &buf_size) < 0) | |
| 2809 | − return buf_size; | |
| 2810 | − } | |
| 2811 | −#endif | |
| 2812 | − | |
| 2813 | 2791 | if (s->mpeg_enc_ctx_allocated == 0 && ( s2->codec_tag == AV_RL32("VCR2") |
| 2814 | 2792 | || s2->codec_tag == AV_RL32("BW10") |
| 2815 | 2793 | )) |
| @@ -2886,9 +2864,6 @@ const FFCodec ff_mpeg1video_decoder = { · 70 unmodified lines | ||
| 2886 | 2864 | .close = mpeg_decode_end, |
| 2887 | 2865 | FF_CODEC_DECODE_CB(mpeg_decode_frame), |
| 2888 | 2866 | .p.capabilities = AV_CODEC_CAP_DRAW_HORIZ_BAND | AV_CODEC_CAP_DR1 | |
| 2889 | −#if FF_API_FLAG_TRUNCATED | |
| 2890 | − AV_CODEC_CAP_TRUNCATED | | |
| 2891 | −#endif | |
| 2892 | 2867 | AV_CODEC_CAP_DELAY | AV_CODEC_CAP_SLICE_THREADS, |
| 2893 | 2868 | .caps_internal = FF_CODEC_CAP_SKIP_FRAME_FILL_PARAM, |
| 2894 | 2869 | .flush = flush, |
| @@ -2918,9 +2893,6 @@ const FFCodec ff_mpeg2video_decoder = { · 23 unmodified lines | ||
| 2918 | 2893 | .close = mpeg_decode_end, |
| 2919 | 2894 | FF_CODEC_DECODE_CB(mpeg_decode_frame), |
| 2920 | 2895 | .p.capabilities = AV_CODEC_CAP_DRAW_HORIZ_BAND | AV_CODEC_CAP_DR1 | |
| 2921 | −#if FF_API_FLAG_TRUNCATED | |
| 2922 | − AV_CODEC_CAP_TRUNCATED | | |
| 2923 | −#endif | |
| 2924 | 2896 | AV_CODEC_CAP_DELAY | AV_CODEC_CAP_SLICE_THREADS, |
| 2925 | 2897 | .caps_internal = FF_CODEC_CAP_SKIP_FRAME_FILL_PARAM, |
| 2926 | 2898 | .flush = flush, |
| @@ -2963,9 +2935,6 @@ const FFCodec ff_mpegvideo_decoder = { · 36 unmodified lines | ||
| 2963 | 2935 | .close = mpeg_decode_end, |
| 2964 | 2936 | FF_CODEC_DECODE_CB(mpeg_decode_frame), |
| 2965 | 2937 | .p.capabilities = AV_CODEC_CAP_DRAW_HORIZ_BAND | AV_CODEC_CAP_DR1 | |
| 2966 | −#if FF_API_FLAG_TRUNCATED | |
| 2967 | − AV_CODEC_CAP_TRUNCATED | | |
| 2968 | −#endif | |
| 2969 | 2938 | AV_CODEC_CAP_DELAY | AV_CODEC_CAP_SLICE_THREADS, |
| 2970 | 2939 | .caps_internal = FF_CODEC_CAP_SKIP_FRAME_FILL_PARAM, |
| 2971 | 2940 | .flush = flush, |
| @@ -27,10 +27,6 @@ · 26 unmodified lines | ||
| 27 | 27 | #include "mpegvideo.h" |
| 28 | 28 | #include "mpeg4videodec.h" |
| 29 | 29 | #include "mpeg4videodefs.h" |
| 30 | −#if FF_API_FLAG_TRUNCATED | |
| 31 | −/* Nuke this header when removing FF_API_FLAG_TRUNCATED */ | |
| 32 | −#include "mpeg4video_parser.h" | |
| 33 | −#endif | |
| 34 | 30 | |
| 35 | 31 | struct Mp4vParseContext { |
| 36 | 32 | ParseContext pc; |
| @@ -38,15 +34,11 @@ struct Mp4vParseContext { · 1 unmodified line | ||
| 38 | 34 | int first_picture; |
| 39 | 35 | }; |
| 40 | 36 | |
| 41 | −#if FF_API_FLAG_TRUNCATED | |
| 42 | −int ff_mpeg4_find_frame_end(ParseContext *pc, const uint8_t *buf, int buf_size) | |
| 43 | −#else | |
| 44 | 37 | /** |
| 45 | 38 | * Find the end of the current frame in the bitstream. |
| 46 | 39 | * @return the position of the first byte of the next frame, or -1 |
| 47 | 40 | */ |
| 48 | 41 | static int mpeg4_find_frame_end(ParseContext *pc, const uint8_t *buf, int buf_size) |
| 49 | −#endif | |
| 50 | 42 | { |
| 51 | 43 | int vop_found, i; |
| 52 | 44 | uint32_t state; |
| @@ -148,11 +140,7 @@ static int mpeg4video_parse(AVCodecParserContext *s, · 95 unmodified lines | ||
| 148 | 140 | if (s->flags & PARSER_FLAG_COMPLETE_FRAMES) { |
| 149 | 141 | next = buf_size; |
| 150 | 142 | } else { |
| 151 | −#if FF_API_FLAG_TRUNCATED | |
| 152 | − next = ff_mpeg4_find_frame_end(pc, buf, buf_size); | |
| 153 | −#else | |
| 154 | 143 | next = mpeg4_find_frame_end(pc, buf, buf_size); |
| 155 | −#endif | |
| 156 | 144 | |
| 157 | 145 | if (ff_combine_frame(pc, next, &buf, &buf_size) < 0) { |
| 158 | 146 | *poutbuf = NULL; |
| @@ -1,34 +0,0 @@ | ||
| 1 | −/* | |
| 2 | − * MPEG-4 video parser prototypes | |
| 3 | − * Copyright (c) 2003 Fabrice Bellard | |
| 4 | − * Copyright (c) 2003 Michael Niedermayer | |
| 5 | − * | |
| 6 | − * This file is part of FFmpeg. | |
| 7 | − * | |
| 8 | − * FFmpeg is free software; you can redistribute it and/or | |
| 9 | − * modify it under the terms of the GNU Lesser General Public | |
| 10 | − * License as published by the Free Software Foundation; either | |
| 11 | − * version 2.1 of the License, or (at your option) any later version. | |
| 12 | − * | |
| 13 | − * FFmpeg is distributed in the hope that it will be useful, | |
| 14 | − * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 15 | − * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| 16 | − * Lesser General Public License for more details. | |
| 17 | − * | |
| 18 | − * You should have received a copy of the GNU Lesser General Public | |
| 19 | − * License along with FFmpeg; if not, write to the Free Software | |
| 20 | − * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | |
| 21 | − */ | |
| 22 | − | |
| 23 | −#ifndef AVCODEC_MPEG4VIDEO_PARSER_H | |
| 24 | −#define AVCODEC_MPEG4VIDEO_PARSER_H | |
| 25 | − | |
| 26 | −#include "parser.h" | |
| 27 | − | |
| 28 | −/** | |
| 29 | − * Find the end of the current frame in the bitstream. | |
| 30 | − * @return the position of the first byte of the next frame, or -1 | |
| 31 | − */ | |
| 32 | −int ff_mpeg4_find_frame_end(ParseContext *pc, const uint8_t *buf, int buf_size); | |
| 33 | − | |
| 34 | −#endif /* AVCODEC_MPEG4VIDEO_PARSER_H */ | |
| @@ -3859,9 +3859,6 @@ const FFCodec ff_mpeg4_decoder = { · 3858 unmodified lines | ||
| 3859 | 3859 | .close = ff_h263_decode_end, |
| 3860 | 3860 | FF_CODEC_DECODE_CB(ff_h263_decode_frame), |
| 3861 | 3861 | .p.capabilities = AV_CODEC_CAP_DRAW_HORIZ_BAND | AV_CODEC_CAP_DR1 | |
| 3862 | −#if FF_API_FLAG_TRUNCATED | |
| 3863 | − AV_CODEC_CAP_TRUNCATED | | |
| 3864 | −#endif | |
| 3865 | 3862 | AV_CODEC_CAP_DELAY | AV_CODEC_CAP_FRAME_THREADS, |
| 3866 | 3863 | .caps_internal = FF_CODEC_CAP_SKIP_FRAME_FILL_PARAM | |
| 3867 | 3864 | FF_CODEC_CAP_ALLOCATE_PROGRESS, |
| @@ -738,10 +738,6 @@ av_cold int ff_mpv_common_init(MpegEncContext *s) · 737 unmodified lines | ||
| 738 | 738 | nb_slices = max_slices; |
| 739 | 739 | } |
| 740 | 740 | |
| 741 | −#if FF_API_FLAG_TRUNCATED | |
| 742 | − s->parse_context.state = -1; | |
| 743 | −#endif | |
| 744 | − | |
| 745 | 741 | s->context_initialized = 1; |
| 746 | 742 | memset(s->thread_context, 0, sizeof(s->thread_context)); |
| 747 | 743 | s->thread_context[0] = s; |
| @@ -791,11 +787,6 @@ void ff_mpv_common_end(MpegEncContext *s) · 43 unmodified lines | ||
| 791 | 787 | if (s->slice_context_count > 1) |
| 792 | 788 | s->slice_context_count = 1; |
| 793 | 789 | |
| 794 | −#if FF_API_FLAG_TRUNCATED | |
| 795 | − av_freep(&s->parse_context.buffer); | |
| 796 | − s->parse_context.buffer_size = 0; | |
| 797 | −#endif | |
| 798 | − | |
| 799 | 790 | av_freep(&s->bitstream_buffer); |
| 800 | 791 | s->allocated_bitstream_buffer_size = 0; |
| 801 | 792 | |
| @@ -44,9 +44,6 @@ · 43 unmodified lines | ||
| 44 | 44 | #include "pixblockdsp.h" |
| 45 | 45 | #include "put_bits.h" |
| 46 | 46 | #include "ratecontrol.h" |
| 47 | −#if FF_API_FLAG_TRUNCATED | |
| 48 | −#include "parser.h" | |
| 49 | −#endif | |
| 50 | 47 | #include "mpegutils.h" |
| 51 | 48 | #include "qpeldsp.h" |
| 52 | 49 | #include "videodsp.h" |
| @@ -353,10 +350,6 @@ typedef struct MpegEncContext { · 300 unmodified lines | ||
| 353 | 350 | GetBitContext last_resync_gb; ///< used to search for the next resync marker |
| 354 | 351 | int mb_num_left; ///< number of MBs left in this video packet (for partitioned Slices only) |
| 355 | 352 | |
| 356 | −#if FF_API_FLAG_TRUNCATED | |
| 357 | − ParseContext parse_context; | |
| 358 | −#endif | |
| 359 | − | |
| 360 | 353 | /* H.263 specific */ |
| 361 | 354 | int gob_index; |
| 362 | 355 | int obmc; ///< overlapped block motion compensation |
| @@ -554,14 +554,6 @@ void ff_mpeg_flush(AVCodecContext *avctx) · 553 unmodified lines | ||
| 554 | 554 | |
| 555 | 555 | s->mb_x = s->mb_y = 0; |
| 556 | 556 | |
| 557 | −#if FF_API_FLAG_TRUNCATED | |
| 558 | − s->parse_context.state = -1; | |
| 559 | − s->parse_context.frame_start_found = 0; | |
| 560 | − s->parse_context.overread = 0; | |
| 561 | − s->parse_context.overread_index = 0; | |
| 562 | − s->parse_context.index = 0; | |
| 563 | − s->parse_context.last_index = 0; | |
| 564 | −#endif | |
| 565 | 557 | s->bitstream_buffer_size = 0; |
| 566 | 558 | s->pp_time = 0; |
| 567 | 559 | } |
| @@ -20,6 +20,7 @@ · 19 unmodified lines | ||
| 20 | 20 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
| 21 | 21 | */ |
| 22 | 22 | |
| 23 | +#include "libavutil/avassert.h" | |
| 23 | 24 | #include "decode.h" |
| 24 | 25 | #include "parser.h" |
| 25 | 26 | #include "mpeg12.h" |
| @@ -33,7 +34,6 @@ struct MpvParseContext { · 7 unmodified lines | ||
| 33 | 34 | int width, height; |
| 34 | 35 | }; |
| 35 | 36 | |
| 36 | −#if !FF_API_FLAG_TRUNCATED | |
| 37 | 37 | /** |
| 38 | 38 | * Find the end of the current frame in the bitstream. |
| 39 | 39 | * @return the position of the first byte of the next frame, or -1 |
| @@ -98,7 +98,6 @@ static int mpeg1_find_frame_end(ParseContext *pc, const uint8_t *buf, · 58 unmodified lines | ||
| 98 | 98 | pc->state = state; |
| 99 | 99 | return END_NOT_FOUND; |
| 100 | 100 | } |
| 101 | −#endif | |
| 102 | 101 | |
| 103 | 102 | static void mpegvideo_extract_headers(AVCodecParserContext *s, |
| 104 | 103 | AVCodecContext *avctx, |
| @@ -255,11 +254,7 @@ static int mpegvideo_parse(AVCodecParserContext *s, · 150 unmodified lines | ||
| 255 | 254 | if(s->flags & PARSER_FLAG_COMPLETE_FRAMES){ |
| 256 | 255 | next= buf_size; |
| 257 | 256 | }else{ |
| 258 | −#if FF_API_FLAG_TRUNCATED | |
| 259 | − next= ff_mpeg1_find_frame_end(pc, buf, buf_size, s); | |
| 260 | −#else | |
| 261 | 257 | next = mpeg1_find_frame_end(pc, buf, buf_size, s); |
| 262 | −#endif | |
| 263 | 258 | |
| 264 | 259 | if (ff_combine_frame(pc, next, &buf, &buf_size) < 0) { |
| 265 | 260 | *poutbuf = NULL; |
| @@ -64,9 +64,6 @@ static const AVOption avcodec_options[] = { · 63 unmodified lines | ||
| 64 | 64 | {"pass2", "use internal 2-pass ratecontrol in second pass mode", 0, AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_FLAG_PASS2 }, INT_MIN, INT_MAX, 0, "flags"}, |
| 65 | 65 | {"gray", "only decode/encode grayscale", 0, AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_FLAG_GRAY }, INT_MIN, INT_MAX, V|E|D, "flags"}, |
| 66 | 66 | {"psnr", "error[?] variables will be set during encoding", 0, AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_FLAG_PSNR }, INT_MIN, INT_MAX, V|E, "flags"}, |
| 67 | −#if FF_API_FLAG_TRUNCATED | |
| 68 | −{"truncated", "(Deprecated, use parsers instead.) Input bitstream might be randomly truncated", 0, AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_FLAG_TRUNCATED }, INT_MIN, INT_MAX, V|D | AV_OPT_FLAG_DEPRECATED, "flags"}, | |
| 69 | −#endif | |
| 70 | 67 | {"ildct", "use interlaced DCT", 0, AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_FLAG_INTERLACED_DCT }, INT_MIN, INT_MAX, V|E, "flags"}, |
| 71 | 68 | {"low_delay", "force low delay", 0, AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_FLAG_LOW_DELAY }, INT_MIN, INT_MAX, V|D|E, "flags"}, |
| 72 | 69 | {"global_header", "place global headers in extradata instead of every keyframe", 0, AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_FLAG_GLOBAL_HEADER }, INT_MIN, INT_MAX, V|A|E, "flags"}, |
| @@ -48,9 +48,6 @@ · 47 unmodified lines | ||
| 48 | 48 | static void validate_thread_parameters(AVCodecContext *avctx) |
| 49 | 49 | { |
| 50 | 50 | int frame_threading_supported = (avctx->codec->capabilities & AV_CODEC_CAP_FRAME_THREADS) |
| 51 | −#if FF_API_FLAG_TRUNCATED | |
| 52 | − && !(avctx->flags & AV_CODEC_FLAG_TRUNCATED) | |
| 53 | −#endif | |
| 54 | 51 | && !(avctx->flags & AV_CODEC_FLAG_LOW_DELAY) |
| 55 | 52 | && !(avctx->flags2 & AV_CODEC_FLAG2_CHUNKS); |
| 56 | 53 | if (avctx->thread_count == 1) { |
| @@ -38,7 +38,6 @@ · 37 unmodified lines | ||
| 38 | 38 | */ |
| 39 | 39 | |
| 40 | 40 | #define FF_API_INIT_PACKET (LIBAVCODEC_VERSION_MAJOR < 60) |
| 41 | −#define FF_API_FLAG_TRUNCATED (LIBAVCODEC_VERSION_MAJOR < 60) | |
| 42 | 41 | #define FF_API_SUB_TEXT_FORMAT (LIBAVCODEC_VERSION_MAJOR < 60) |
| 43 | 42 | #define FF_API_IDCT_NONE (LIBAVCODEC_VERSION_MAJOR < 60) |
| 44 | 43 | #define FF_API_SVTAV1_OPTS (LIBAVCODEC_VERSION_MAJOR < 60) |