History

avcodec: remove FF_API_FLAG_TRUNCATED

James Almer committed 3 years ago

Commit 3ceffe71 parent 5f9e84819 files · +1 −293Browse files

Unified · Split

19 files
  1. libavcodec/avcodec.h +0 −9
  2. libavcodec/codec.h +0 −6
  3. libavcodec/decode.c +0 −4
  4. libavcodec/h263_parser.c +0 −11
  5. libavcodec/h263_parser.h +0 −29
  6. libavcodec/h263dec.c +0 −42
  7. libavcodec/mpeg12.c +0 −66
  8. libavcodec/mpeg12.h +0 −9
  9. libavcodec/mpeg12dec.c +0 −31
  10. libavcodec/mpeg4video_parser.c +0 −12
  11. libavcodec/mpeg4video_parser.h +0 −34
  12. libavcodec/mpeg4videodec.c +0 −3
  13. libavcodec/mpegvideo.c +0 −9
  14. libavcodec/mpegvideo.h +0 −7
  15. libavcodec/mpegvideo_dec.c +0 −8
  16. libavcodec/mpegvideo_parser.c +1 −6
  17. libavcodec/options_table.h +0 −3
  18. libavcodec/pthread.c +0 −3
  19. libavcodec/version_major.h +0 −1
libavcodec/avcodec.h+0−9
@@ -303,15 +303,6 @@ typedef struct RcOverride{ · 302 unmodified lines
303 * error[?] variables will be set during encoding.303 * error[?] variables will be set during encoding.
304 */304 */
305#define AV_CODEC_FLAG_PSNR (1 << 15)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 * Use interlaced DCT.307 * Use interlaced DCT.
317 */308 */
libavcodec/codec.h+0−6
@@ -50,12 +50,6 @@ · 49 unmodified lines
50 * avcodec_default_get_buffer2 or avcodec_default_get_encode_buffer.50 * avcodec_default_get_buffer2 or avcodec_default_get_encode_buffer.
51 */51 */
52#define AV_CODEC_CAP_DR1 (1 << 1)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 * Encoder or decoder requires flushing with NULL input at the end in order to54 * Encoder or decoder requires flushing with NULL input at the end in order to
61 * give the complete and correct output.55 * give the complete and correct output.
libavcodec/decode.c+0−4
@@ -427,11 +427,7 @@ FF_ENABLE_DEPRECATION_WARNINGS · 426 unmodified lines
427 if (!got_frame)427 if (!got_frame)
428 av_frame_unref(frame);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 if (ret >= 0 && avctx->codec->type == AVMEDIA_TYPE_VIDEO)430 if (ret >= 0 && avctx->codec->type == AVMEDIA_TYPE_VIDEO)
434#endif
435 ret = pkt->size;431 ret = pkt->size;
436 432
437 /* do not stop draining when actual_got_frame != 0 or ret < 0 */433 /* do not stop draining when actual_got_frame != 0 or ret < 0 */
libavcodec/h263_parser.c+0−11
@@ -25,16 +25,9 @@ · 24 unmodified lines
25 */25 */
26 26
27#include "parser.h"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
32int ff_h263_find_frame_end(ParseContext *pc, const uint8_t *buf, int buf_size){
33#else
34 28
35static int h263_find_frame_end(ParseContext *pc, const uint8_t *buf, int buf_size)29static int h263_find_frame_end(ParseContext *pc, const uint8_t *buf, int buf_size)
36{30{
37#endif
38 int vop_found, i;31 int vop_found, i;
39 uint32_t state;32 uint32_t state;
40 33
@@ -80,11 +73,7 @@ static int h263_parse(AVCodecParserContext *s, · 39 unmodified lines
80 if (s->flags & PARSER_FLAG_COMPLETE_FRAMES) {73 if (s->flags & PARSER_FLAG_COMPLETE_FRAMES) {
81 next = buf_size;74 next = buf_size;
82 } else {75 } else {
83#if FF_API_FLAG_TRUNCATED
84 next= ff_h263_find_frame_end(pc, buf, buf_size);
85#else
86 next = h263_find_frame_end(pc, buf, buf_size);76 next = h263_find_frame_end(pc, buf, buf_size);
87#endif
88 77
89 if (ff_combine_frame(pc, next, &buf, &buf_size) < 0) {78 if (ff_combine_frame(pc, next, &buf, &buf_size) < 0) {
90 *poutbuf = NULL;79 *poutbuf = NULL;
libavcodec/h263_parser.h+0−29
@@ -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
27int ff_h263_find_frame_end(ParseContext *pc, const uint8_t *buf, int buf_size);
28
29#endif /* AVCODEC_H263_PARSER_H */
libavcodec/h263dec.c+0−42
@@ -36,17 +36,11 @@ · 35 unmodified lines
36#include "flvdec.h"36#include "flvdec.h"
37#include "h263.h"37#include "h263.h"
38#include "h263dec.h"38#include "h263dec.h"
39#if FF_API_FLAG_TRUNCATED
40#include "h263_parser.h"
41#endif
42#include "hwconfig.h"39#include "hwconfig.h"
43#include "mpeg_er.h"40#include "mpeg_er.h"
44#include "mpeg4video.h"41#include "mpeg4video.h"
45#include "mpeg4videodec.h"42#include "mpeg4videodec.h"
46#include "mpeg4videodefs.h"43#include "mpeg4videodefs.h"
47#if FF_API_FLAG_TRUNCATED
48#include "mpeg4video_parser.h"
49#endif
50#include "mpegutils.h"44#include "mpegutils.h"
51#include "mpegvideo.h"45#include "mpegvideo.h"
52#include "mpegvideodec.h"46#include "mpegvideodec.h"
@@ -163,14 +157,6 @@ static int get_consumed_bytes(MpegEncContext *s, int buf_size) · 110 unmodified lines
163 /* We would have to scan through the whole buf to handle the weird157 /* We would have to scan through the whole buf to handle the weird
164 * reordering ... */158 * reordering ... */
165 return buf_size;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 } else {160 } else {
175 // avoid infinite loops (maybe not needed...)161 // avoid infinite loops (maybe not needed...)
176 if (pos == 0)162 if (pos == 0)
@@ -448,28 +434,6 @@ int ff_h263_decode_frame(AVCodecContext *avctx, AVFrame *pict, · 271 unmodified lines
448 return 0;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
473retry:437retry:
474 if (s->divx_packed && s->bitstream_buffer_size) {438 if (s->divx_packed && s->bitstream_buffer_size) {
475 int i;439 int i;
@@ -749,9 +713,6 @@ const FFCodec ff_h263_decoder = { · 273 unmodified lines
749 .close = ff_h263_decode_end,713 .close = ff_h263_decode_end,
750 FF_CODEC_DECODE_CB(ff_h263_decode_frame),714 FF_CODEC_DECODE_CB(ff_h263_decode_frame),
751 .p.capabilities = AV_CODEC_CAP_DRAW_HORIZ_BAND | AV_CODEC_CAP_DR1 |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 AV_CODEC_CAP_DELAY,716 AV_CODEC_CAP_DELAY,
756 .caps_internal = FF_CODEC_CAP_SKIP_FRAME_FILL_PARAM,717 .caps_internal = FF_CODEC_CAP_SKIP_FRAME_FILL_PARAM,
757 .flush = ff_mpeg_flush,718 .flush = ff_mpeg_flush,
@@ -770,9 +731,6 @@ const FFCodec ff_h263p_decoder = { · 12 unmodified lines
770 .close = ff_h263_decode_end,731 .close = ff_h263_decode_end,
771 FF_CODEC_DECODE_CB(ff_h263_decode_frame),732 FF_CODEC_DECODE_CB(ff_h263_decode_frame),
772 .p.capabilities = AV_CODEC_CAP_DRAW_HORIZ_BAND | AV_CODEC_CAP_DR1 |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 AV_CODEC_CAP_DELAY,734 AV_CODEC_CAP_DELAY,
777 .caps_internal = FF_CODEC_CAP_SKIP_FRAME_FILL_PARAM,735 .caps_internal = FF_CODEC_CAP_SKIP_FRAME_FILL_PARAM,
778 .flush = ff_mpeg_flush,736 .flush = ff_mpeg_flush,
libavcodec/mpeg12.c+0−66
@@ -167,72 +167,6 @@ av_cold void ff_mpeg12_init_vlcs(void) · 166 unmodified lines
167 ff_thread_once(&init_static_once, mpeg12_init_vlcs);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 */
175int 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#define MAX_INDEX (64 - 1)170#define MAX_INDEX (64 - 1)
237 171
238int ff_mpeg1_decode_block_intra(GetBitContext *gb,172int ff_mpeg1_decode_block_intra(GetBitContext *gb,
libavcodec/mpeg12.h+0−9
@@ -34,15 +34,6 @@ · 33 unmodified lines
34#define EXT_START_CODE 0x000001b534#define EXT_START_CODE 0x000001b5
35#define USER_START_CODE 0x000001b235#define USER_START_CODE 0x000001b2
36 36
37#include "version_major.h"
38#if FF_API_FLAG_TRUNCATED
39#include <stdint.h>
40
41struct ParseContext;
42struct AVCodecParserContext;
43int ff_mpeg1_find_frame_end(struct ParseContext *pc, const uint8_t *buf, int buf_size, struct AVCodecParserContext *s);
44#endif
45
46void ff_mpeg12_find_best_frame_rate(AVRational frame_rate,37void ff_mpeg12_find_best_frame_rate(AVRational frame_rate,
47 int *code, int *ext_n, int *ext_d,38 int *code, int *ext_n, int *ext_d,
48 int nonstandard);39 int nonstandard);
libavcodec/mpeg12dec.c+0−31
@@ -1239,14 +1239,7 @@ static int mpeg_decode_postinit(AVCodecContext *avctx) · 1238 unmodified lines
1239 (s1->save_progressive_seq != s->progressive_sequence && FFALIGN(s->height, 16) != FFALIGN(s->height, 32)) ||1239 (s1->save_progressive_seq != s->progressive_sequence && FFALIGN(s->height, 16) != FFALIGN(s->height, 32)) ||
1240 0) {1240 0) {
1241 if (s1->mpeg_enc_ctx_allocated) {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 ff_mpv_common_end(s);1242 ff_mpv_common_end(s);
1246 s->parse_context = pc;
1247#else
1248 ff_mpv_common_end(s);
1249#endif
1250 s1->mpeg_enc_ctx_allocated = 0;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 if (avctx->err_recognition & AV_EF_EXPLODE && s2->er.error_count)2475 if (avctx->err_recognition & AV_EF_EXPLODE && s2->er.error_count)
2483 return AVERROR_INVALIDDATA;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 return FFMAX(0, buf_ptr - buf);2478 return FFMAX(0, buf_ptr - buf);
2489#endif
2490 }2479 }
2491 2480
2492 input_size = buf_end - buf_ptr;2481 input_size = buf_end - buf_ptr;
@@ -2799,17 +2788,6 @@ static int mpeg_decode_frame(AVCodecContext *avctx, AVFrame *picture, · 306 unmodified lines
2799 return buf_size;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 if (s->mpeg_enc_ctx_allocated == 0 && ( s2->codec_tag == AV_RL32("VCR2")2791 if (s->mpeg_enc_ctx_allocated == 0 && ( s2->codec_tag == AV_RL32("VCR2")
2814 || s2->codec_tag == AV_RL32("BW10")2792 || s2->codec_tag == AV_RL32("BW10")
2815 ))2793 ))
@@ -2886,9 +2864,6 @@ const FFCodec ff_mpeg1video_decoder = { · 70 unmodified lines
2886 .close = mpeg_decode_end,2864 .close = mpeg_decode_end,
2887 FF_CODEC_DECODE_CB(mpeg_decode_frame),2865 FF_CODEC_DECODE_CB(mpeg_decode_frame),
2888 .p.capabilities = AV_CODEC_CAP_DRAW_HORIZ_BAND | AV_CODEC_CAP_DR1 |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 AV_CODEC_CAP_DELAY | AV_CODEC_CAP_SLICE_THREADS,2867 AV_CODEC_CAP_DELAY | AV_CODEC_CAP_SLICE_THREADS,
2893 .caps_internal = FF_CODEC_CAP_SKIP_FRAME_FILL_PARAM,2868 .caps_internal = FF_CODEC_CAP_SKIP_FRAME_FILL_PARAM,
2894 .flush = flush,2869 .flush = flush,
@@ -2918,9 +2893,6 @@ const FFCodec ff_mpeg2video_decoder = { · 23 unmodified lines
2918 .close = mpeg_decode_end,2893 .close = mpeg_decode_end,
2919 FF_CODEC_DECODE_CB(mpeg_decode_frame),2894 FF_CODEC_DECODE_CB(mpeg_decode_frame),
2920 .p.capabilities = AV_CODEC_CAP_DRAW_HORIZ_BAND | AV_CODEC_CAP_DR1 |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 AV_CODEC_CAP_DELAY | AV_CODEC_CAP_SLICE_THREADS,2896 AV_CODEC_CAP_DELAY | AV_CODEC_CAP_SLICE_THREADS,
2925 .caps_internal = FF_CODEC_CAP_SKIP_FRAME_FILL_PARAM,2897 .caps_internal = FF_CODEC_CAP_SKIP_FRAME_FILL_PARAM,
2926 .flush = flush,2898 .flush = flush,
@@ -2963,9 +2935,6 @@ const FFCodec ff_mpegvideo_decoder = { · 36 unmodified lines
2963 .close = mpeg_decode_end,2935 .close = mpeg_decode_end,
2964 FF_CODEC_DECODE_CB(mpeg_decode_frame),2936 FF_CODEC_DECODE_CB(mpeg_decode_frame),
2965 .p.capabilities = AV_CODEC_CAP_DRAW_HORIZ_BAND | AV_CODEC_CAP_DR1 |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 AV_CODEC_CAP_DELAY | AV_CODEC_CAP_SLICE_THREADS,2938 AV_CODEC_CAP_DELAY | AV_CODEC_CAP_SLICE_THREADS,
2970 .caps_internal = FF_CODEC_CAP_SKIP_FRAME_FILL_PARAM,2939 .caps_internal = FF_CODEC_CAP_SKIP_FRAME_FILL_PARAM,
2971 .flush = flush,2940 .flush = flush,
libavcodec/mpeg4video_parser.c+0−12
@@ -27,10 +27,6 @@ · 26 unmodified lines
27#include "mpegvideo.h"27#include "mpegvideo.h"
28#include "mpeg4videodec.h"28#include "mpeg4videodec.h"
29#include "mpeg4videodefs.h"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
35struct Mp4vParseContext {31struct Mp4vParseContext {
36 ParseContext pc;32 ParseContext pc;
@@ -38,15 +34,11 @@ struct Mp4vParseContext { · 1 unmodified line
38 int first_picture;34 int first_picture;
39};35};
40 36
41#if FF_API_FLAG_TRUNCATED
42int ff_mpeg4_find_frame_end(ParseContext *pc, const uint8_t *buf, int buf_size)
43#else
44/**37/**
45 * Find the end of the current frame in the bitstream.38 * Find the end of the current frame in the bitstream.
46 * @return the position of the first byte of the next frame, or -139 * @return the position of the first byte of the next frame, or -1
47 */40 */
48static int mpeg4_find_frame_end(ParseContext *pc, const uint8_t *buf, int buf_size)41static int mpeg4_find_frame_end(ParseContext *pc, const uint8_t *buf, int buf_size)
49#endif
50{42{
51 int vop_found, i;43 int vop_found, i;
52 uint32_t state;44 uint32_t state;
@@ -148,11 +140,7 @@ static int mpeg4video_parse(AVCodecParserContext *s, · 95 unmodified lines
148 if (s->flags & PARSER_FLAG_COMPLETE_FRAMES) {140 if (s->flags & PARSER_FLAG_COMPLETE_FRAMES) {
149 next = buf_size;141 next = buf_size;
150 } else {142 } else {
151#if FF_API_FLAG_TRUNCATED
152 next = ff_mpeg4_find_frame_end(pc, buf, buf_size);
153#else
154 next = mpeg4_find_frame_end(pc, buf, buf_size);143 next = mpeg4_find_frame_end(pc, buf, buf_size);
155#endif
156 144
157 if (ff_combine_frame(pc, next, &buf, &buf_size) < 0) {145 if (ff_combine_frame(pc, next, &buf, &buf_size) < 0) {
158 *poutbuf = NULL;146 *poutbuf = NULL;
libavcodec/mpeg4video_parser.h+0−34
@@ -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 */
32int ff_mpeg4_find_frame_end(ParseContext *pc, const uint8_t *buf, int buf_size);
33
34#endif /* AVCODEC_MPEG4VIDEO_PARSER_H */
libavcodec/mpeg4videodec.c+0−3
@@ -3859,9 +3859,6 @@ const FFCodec ff_mpeg4_decoder = { · 3858 unmodified lines
3859 .close = ff_h263_decode_end,3859 .close = ff_h263_decode_end,
3860 FF_CODEC_DECODE_CB(ff_h263_decode_frame),3860 FF_CODEC_DECODE_CB(ff_h263_decode_frame),
3861 .p.capabilities = AV_CODEC_CAP_DRAW_HORIZ_BAND | AV_CODEC_CAP_DR1 |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 AV_CODEC_CAP_DELAY | AV_CODEC_CAP_FRAME_THREADS,3862 AV_CODEC_CAP_DELAY | AV_CODEC_CAP_FRAME_THREADS,
3866 .caps_internal = FF_CODEC_CAP_SKIP_FRAME_FILL_PARAM |3863 .caps_internal = FF_CODEC_CAP_SKIP_FRAME_FILL_PARAM |
3867 FF_CODEC_CAP_ALLOCATE_PROGRESS,3864 FF_CODEC_CAP_ALLOCATE_PROGRESS,
libavcodec/mpegvideo.c+0−9
@@ -738,10 +738,6 @@ av_cold int ff_mpv_common_init(MpegEncContext *s) · 737 unmodified lines
738 nb_slices = max_slices;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 s->context_initialized = 1;741 s->context_initialized = 1;
746 memset(s->thread_context, 0, sizeof(s->thread_context));742 memset(s->thread_context, 0, sizeof(s->thread_context));
747 s->thread_context[0] = s;743 s->thread_context[0] = s;
@@ -791,11 +787,6 @@ void ff_mpv_common_end(MpegEncContext *s) · 43 unmodified lines
791 if (s->slice_context_count > 1)787 if (s->slice_context_count > 1)
792 s->slice_context_count = 1;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 av_freep(&s->bitstream_buffer);790 av_freep(&s->bitstream_buffer);
800 s->allocated_bitstream_buffer_size = 0;791 s->allocated_bitstream_buffer_size = 0;
801 792
libavcodec/mpegvideo.h+0−7
@@ -44,9 +44,6 @@ · 43 unmodified lines
44#include "pixblockdsp.h"44#include "pixblockdsp.h"
45#include "put_bits.h"45#include "put_bits.h"
46#include "ratecontrol.h"46#include "ratecontrol.h"
47#if FF_API_FLAG_TRUNCATED
48#include "parser.h"
49#endif
50#include "mpegutils.h"47#include "mpegutils.h"
51#include "qpeldsp.h"48#include "qpeldsp.h"
52#include "videodsp.h"49#include "videodsp.h"
@@ -353,10 +350,6 @@ typedef struct MpegEncContext { · 300 unmodified lines
353 GetBitContext last_resync_gb; ///< used to search for the next resync marker350 GetBitContext last_resync_gb; ///< used to search for the next resync marker
354 int mb_num_left; ///< number of MBs left in this video packet (for partitioned Slices only)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 /* H.263 specific */353 /* H.263 specific */
361 int gob_index;354 int gob_index;
362 int obmc; ///< overlapped block motion compensation355 int obmc; ///< overlapped block motion compensation
libavcodec/mpegvideo_dec.c+0−8
@@ -554,14 +554,6 @@ void ff_mpeg_flush(AVCodecContext *avctx) · 553 unmodified lines
554 554
555 s->mb_x = s->mb_y = 0;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 s->bitstream_buffer_size = 0;557 s->bitstream_buffer_size = 0;
566 s->pp_time = 0;558 s->pp_time = 0;
567}559}
libavcodec/mpegvideo_parser.c+1−6
@@ -20,6 +20,7 @@ · 19 unmodified lines
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21 */21 */
22 22
23#include "libavutil/avassert.h"
23#include "decode.h"24#include "decode.h"
24#include "parser.h"25#include "parser.h"
25#include "mpeg12.h"26#include "mpeg12.h"
@@ -33,7 +34,6 @@ struct MpvParseContext { · 7 unmodified lines
33 int width, height;34 int width, height;
34};35};
35 36
36#if !FF_API_FLAG_TRUNCATED
37/**37/**
38 * Find the end of the current frame in the bitstream.38 * Find the end of the current frame in the bitstream.
39 * @return the position of the first byte of the next frame, or -139 * @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 pc->state = state;98 pc->state = state;
99 return END_NOT_FOUND;99 return END_NOT_FOUND;
100}100}
101#endif
102 101
103static void mpegvideo_extract_headers(AVCodecParserContext *s,102static void mpegvideo_extract_headers(AVCodecParserContext *s,
104 AVCodecContext *avctx,103 AVCodecContext *avctx,
@@ -255,11 +254,7 @@ static int mpegvideo_parse(AVCodecParserContext *s, · 150 unmodified lines
255 if(s->flags & PARSER_FLAG_COMPLETE_FRAMES){254 if(s->flags & PARSER_FLAG_COMPLETE_FRAMES){
256 next= buf_size;255 next= buf_size;
257 }else{256 }else{
258#if FF_API_FLAG_TRUNCATED
259 next= ff_mpeg1_find_frame_end(pc, buf, buf_size, s);
260#else
261 next = mpeg1_find_frame_end(pc, buf, buf_size, s);257 next = mpeg1_find_frame_end(pc, buf, buf_size, s);
262#endif
263 258
264 if (ff_combine_frame(pc, next, &buf, &buf_size) < 0) {259 if (ff_combine_frame(pc, next, &buf, &buf_size) < 0) {
265 *poutbuf = NULL;260 *poutbuf = NULL;
libavcodec/options_table.h+0−3
@@ -64,9 +64,6 @@ static const AVOption avcodec_options[] = { · 63 unmodified lines
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"},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{"gray", "only decode/encode grayscale", 0, AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_FLAG_GRAY }, INT_MIN, INT_MAX, V|E|D, "flags"},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{"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"},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{"ildct", "use interlaced DCT", 0, AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_FLAG_INTERLACED_DCT }, INT_MIN, INT_MAX, V|E, "flags"},67{"ildct", "use interlaced DCT", 0, AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_FLAG_INTERLACED_DCT }, INT_MIN, INT_MAX, V|E, "flags"},
71{"low_delay", "force low delay", 0, AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_FLAG_LOW_DELAY }, INT_MIN, INT_MAX, V|D|E, "flags"},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{"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"},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"},
libavcodec/pthread.c+0−3
@@ -48,9 +48,6 @@ · 47 unmodified lines
48static void validate_thread_parameters(AVCodecContext *avctx)48static void validate_thread_parameters(AVCodecContext *avctx)
49{49{
50 int frame_threading_supported = (avctx->codec->capabilities & AV_CODEC_CAP_FRAME_THREADS)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 && !(avctx->flags & AV_CODEC_FLAG_LOW_DELAY)51 && !(avctx->flags & AV_CODEC_FLAG_LOW_DELAY)
55 && !(avctx->flags2 & AV_CODEC_FLAG2_CHUNKS);52 && !(avctx->flags2 & AV_CODEC_FLAG2_CHUNKS);
56 if (avctx->thread_count == 1) {53 if (avctx->thread_count == 1) {
libavcodec/version_major.h+0−1
@@ -38,7 +38,6 @@ · 37 unmodified lines
38 */38 */
39 39
40#define FF_API_INIT_PACKET (LIBAVCODEC_VERSION_MAJOR < 60)40#define FF_API_INIT_PACKET (LIBAVCODEC_VERSION_MAJOR < 60)
41#define FF_API_FLAG_TRUNCATED (LIBAVCODEC_VERSION_MAJOR < 60)
42#define FF_API_SUB_TEXT_FORMAT (LIBAVCODEC_VERSION_MAJOR < 60)41#define FF_API_SUB_TEXT_FORMAT (LIBAVCODEC_VERSION_MAJOR < 60)
43#define FF_API_IDCT_NONE (LIBAVCODEC_VERSION_MAJOR < 60)42#define FF_API_IDCT_NONE (LIBAVCODEC_VERSION_MAJOR < 60)
44#define FF_API_SVTAV1_OPTS (LIBAVCODEC_VERSION_MAJOR < 60)43#define FF_API_SVTAV1_OPTS (LIBAVCODEC_VERSION_MAJOR < 60)

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t