Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: James Almer <jamrial@gmail.com>
To: ffmpeg-devel@ffmpeg.org
Subject: [FFmpeg-devel] [PATCH 09/26] avcodec: remove FF_API_FLAG_TRUNCATED
Date: Mon, 16 Jan 2023 10:38:23 -0300
Message-ID: <20230116133840.512-10-jamrial@gmail.com> (raw)
In-Reply-To: <20230116133840.512-1-jamrial@gmail.com>

Signed-off-by: James Almer <jamrial@gmail.com>
---
 libavcodec/avcodec.h           |  9 -----
 libavcodec/codec.h             |  6 ----
 libavcodec/decode.c            |  4 ---
 libavcodec/h263_parser.c       | 11 ------
 libavcodec/h263_parser.h       | 29 ---------------
 libavcodec/h263dec.c           | 42 ----------------------
 libavcodec/mpeg12.c            | 66 ----------------------------------
 libavcodec/mpeg12.h            |  9 -----
 libavcodec/mpeg12dec.c         | 31 ----------------
 libavcodec/mpeg4video_parser.c | 12 -------
 libavcodec/mpeg4video_parser.h | 34 ------------------
 libavcodec/mpeg4videodec.c     |  3 --
 libavcodec/mpegvideo.c         |  9 -----
 libavcodec/mpegvideo.h         |  7 ----
 libavcodec/mpegvideo_dec.c     |  8 -----
 libavcodec/mpegvideo_parser.c  |  7 +---
 libavcodec/options_table.h     |  3 --
 libavcodec/pthread.c           |  3 --
 libavcodec/version_major.h     |  1 -
 19 files changed, 1 insertion(+), 293 deletions(-)
 delete mode 100644 libavcodec/h263_parser.h
 delete mode 100644 libavcodec/mpeg4video_parser.h

diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index 7f6aaf6964..86228e64b4 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -261,15 +261,6 @@ typedef struct RcOverride{
  * error[?] variables will be set during encoding.
  */
 #define AV_CODEC_FLAG_PSNR            (1 << 15)
-#if FF_API_FLAG_TRUNCATED
-/**
- * Input bitstream might be truncated at a random location
- * instead of only at frame boundaries.
- *
- * @deprecated use codec parsers for packetizing input
- */
-#define AV_CODEC_FLAG_TRUNCATED       (1 << 16)
-#endif
 /**
  * Use interlaced DCT.
  */
diff --git a/libavcodec/codec.h b/libavcodec/codec.h
index 8bf85b2f9c..035bcd080b 100644
--- a/libavcodec/codec.h
+++ b/libavcodec/codec.h
@@ -50,12 +50,6 @@
  * avcodec_default_get_buffer2 or avcodec_default_get_encode_buffer.
  */
 #define AV_CODEC_CAP_DR1                 (1 <<  1)
-#if FF_API_FLAG_TRUNCATED
-/**
- * @deprecated Use parsers to always send proper frames.
- */
-#define AV_CODEC_CAP_TRUNCATED           (1 <<  3)
-#endif
 /**
  * Encoder or decoder requires flushing with NULL input at the end in order to
  * give the complete and correct output.
diff --git a/libavcodec/decode.c b/libavcodec/decode.c
index b5edbb143e..96889f7dea 100644
--- a/libavcodec/decode.c
+++ b/libavcodec/decode.c
@@ -427,11 +427,7 @@ FF_ENABLE_DEPRECATION_WARNINGS
     if (!got_frame)
         av_frame_unref(frame);
 
-#if FF_API_FLAG_TRUNCATED
-    if (ret >= 0 && avctx->codec->type == AVMEDIA_TYPE_VIDEO && !(avctx->flags & AV_CODEC_FLAG_TRUNCATED))
-#else
     if (ret >= 0 && avctx->codec->type == AVMEDIA_TYPE_VIDEO)
-#endif
         ret = pkt->size;
 
     /* do not stop draining when actual_got_frame != 0 or ret < 0 */
diff --git a/libavcodec/h263_parser.c b/libavcodec/h263_parser.c
index 7a742caa80..f70a791177 100644
--- a/libavcodec/h263_parser.c
+++ b/libavcodec/h263_parser.c
@@ -25,16 +25,9 @@
  */
 
 #include "parser.h"
-#if FF_API_FLAG_TRUNCATED
-/* Nuke this header when removing FF_API_FLAG_TRUNCATED */
-#include "h263_parser.h"
-
-int ff_h263_find_frame_end(ParseContext *pc, const uint8_t *buf, int buf_size){
-#else
 
 static int h263_find_frame_end(ParseContext *pc, const uint8_t *buf, int buf_size)
 {
-#endif
     int vop_found, i;
     uint32_t state;
 
@@ -80,11 +73,7 @@ static int h263_parse(AVCodecParserContext *s,
     if (s->flags & PARSER_FLAG_COMPLETE_FRAMES) {
         next = buf_size;
     } else {
-#if FF_API_FLAG_TRUNCATED
-        next= ff_h263_find_frame_end(pc, buf, buf_size);
-#else
         next = h263_find_frame_end(pc, buf, buf_size);
-#endif
 
         if (ff_combine_frame(pc, next, &buf, &buf_size) < 0) {
             *poutbuf = NULL;
diff --git a/libavcodec/h263_parser.h b/libavcodec/h263_parser.h
deleted file mode 100644
index 565a222bc1..0000000000
--- a/libavcodec/h263_parser.h
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * H.263 parser
- * Copyright (c) 2002-2004 Michael Niedermayer <michaelni@gmx.at>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * FFmpeg is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVCODEC_H263_PARSER_H
-#define AVCODEC_H263_PARSER_H
-
-#include "parser.h"
-
-int ff_h263_find_frame_end(ParseContext *pc, const uint8_t *buf, int buf_size);
-
-#endif /* AVCODEC_H263_PARSER_H */
diff --git a/libavcodec/h263dec.c b/libavcodec/h263dec.c
index 0a2d7487a8..f4e7048a5f 100644
--- a/libavcodec/h263dec.c
+++ b/libavcodec/h263dec.c
@@ -36,17 +36,11 @@
 #include "flvdec.h"
 #include "h263.h"
 #include "h263dec.h"
-#if FF_API_FLAG_TRUNCATED
-#include "h263_parser.h"
-#endif
 #include "hwconfig.h"
 #include "mpeg_er.h"
 #include "mpeg4video.h"
 #include "mpeg4videodec.h"
 #include "mpeg4videodefs.h"
-#if FF_API_FLAG_TRUNCATED
-#include "mpeg4video_parser.h"
-#endif
 #include "mpegutils.h"
 #include "mpegvideo.h"
 #include "mpegvideodec.h"
@@ -163,14 +157,6 @@ 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)
@@ -448,28 +434,6 @@ int ff_h263_decode_frame(AVCodecContext *avctx, AVFrame *pict,
         return 0;
     }
 
-#if FF_API_FLAG_TRUNCATED
-    if (s->avctx->flags & AV_CODEC_FLAG_TRUNCATED) {
-        int next;
-
-        if (CONFIG_MPEG4_DECODER && s->codec_id == AV_CODEC_ID_MPEG4) {
-            next = ff_mpeg4_find_frame_end(&s->parse_context, buf, buf_size);
-        } else if (CONFIG_H263_DECODER && s->codec_id == AV_CODEC_ID_H263) {
-            next = ff_h263_find_frame_end(&s->parse_context, buf, buf_size);
-        } else if (CONFIG_H263P_DECODER && s->codec_id == AV_CODEC_ID_H263P) {
-            next = ff_h263_find_frame_end(&s->parse_context, buf, buf_size);
-        } else {
-            av_log(s->avctx, AV_LOG_ERROR,
-                   "this codec does not support truncated bitstreams\n");
-            return AVERROR(ENOSYS);
-        }
-
-        if (ff_combine_frame(&s->parse_context, next, (const uint8_t **)&buf,
-                             &buf_size) < 0)
-            return buf_size;
-    }
-#endif
-
 retry:
     if (s->divx_packed && s->bitstream_buffer_size) {
         int i;
@@ -749,9 +713,6 @@ const FFCodec ff_h263_decoder = {
     .close          = ff_h263_decode_end,
     FF_CODEC_DECODE_CB(ff_h263_decode_frame),
     .p.capabilities = AV_CODEC_CAP_DRAW_HORIZ_BAND | AV_CODEC_CAP_DR1 |
-#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,
@@ -770,9 +731,6 @@ const FFCodec ff_h263p_decoder = {
     .close          = ff_h263_decode_end,
     FF_CODEC_DECODE_CB(ff_h263_decode_frame),
     .p.capabilities = AV_CODEC_CAP_DRAW_HORIZ_BAND | AV_CODEC_CAP_DR1 |
-#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,
diff --git a/libavcodec/mpeg12.c b/libavcodec/mpeg12.c
index 5d5f39388f..a256d45c85 100644
--- a/libavcodec/mpeg12.c
+++ b/libavcodec/mpeg12.c
@@ -167,72 +167,6 @@ av_cold void ff_mpeg12_init_vlcs(void)
     ff_thread_once(&init_static_once, mpeg12_init_vlcs);
 }
 
-#if FF_API_FLAG_TRUNCATED
-/**
- * Find the end of the current frame in the bitstream.
- * @return the position of the first byte of the next frame, or -1
- */
-int ff_mpeg1_find_frame_end(ParseContext *pc, const uint8_t *buf, int buf_size, AVCodecParserContext *s)
-{
-    int i;
-    uint32_t state = pc->state;
-
-    /* EOF considered as end of frame */
-    if (buf_size == 0)
-        return 0;
-
-/*
- 0  frame start         -> 1/4
- 1  first_SEQEXT        -> 0/2
- 2  first field start   -> 3/0
- 3  second_SEQEXT       -> 2/0
- 4  searching end
-*/
-
-    for (i = 0; i < buf_size; i++) {
-        av_assert1(pc->frame_start_found >= 0 && pc->frame_start_found <= 4);
-        if (pc->frame_start_found & 1) {
-            if (state == EXT_START_CODE && (buf[i] & 0xF0) != 0x80)
-                pc->frame_start_found--;
-            else if (state == EXT_START_CODE + 2) {
-                if ((buf[i] & 3) == 3)
-                    pc->frame_start_found = 0;
-                else
-                    pc->frame_start_found = (pc->frame_start_found + 1) & 3;
-            }
-            state++;
-        } else {
-            i = avpriv_find_start_code(buf + i, buf + buf_size, &state) - buf - 1;
-            if (pc->frame_start_found == 0 && state >= SLICE_MIN_START_CODE && state <= SLICE_MAX_START_CODE) {
-                i++;
-                pc->frame_start_found = 4;
-            }
-            if (state == SEQ_END_CODE) {
-                pc->frame_start_found = 0;
-                pc->state=-1;
-                return i+1;
-            }
-            if (pc->frame_start_found == 2 && state == SEQ_START_CODE)
-                pc->frame_start_found = 0;
-            if (pc->frame_start_found  < 4 && state == EXT_START_CODE)
-                pc->frame_start_found++;
-            if (pc->frame_start_found == 4 && (state & 0xFFFFFF00) == 0x100) {
-                if (state < SLICE_MIN_START_CODE || state > SLICE_MAX_START_CODE) {
-                    pc->frame_start_found = 0;
-                    pc->state             = -1;
-                    return i - 3;
-                }
-            }
-            if (pc->frame_start_found == 0 && s && state == PICTURE_START_CODE) {
-                ff_fetch_timestamp(s, i - 3, 1, i > 3);
-            }
-        }
-    }
-    pc->state = state;
-    return END_NOT_FOUND;
-}
-#endif
-
 #define MAX_INDEX (64 - 1)
 
 int ff_mpeg1_decode_block_intra(GetBitContext *gb,
diff --git a/libavcodec/mpeg12.h b/libavcodec/mpeg12.h
index 4e2e67eae1..86dd627e95 100644
--- a/libavcodec/mpeg12.h
+++ b/libavcodec/mpeg12.h
@@ -34,15 +34,6 @@
 #define EXT_START_CODE          0x000001b5
 #define USER_START_CODE         0x000001b2
 
-#include "version_major.h"
-#if FF_API_FLAG_TRUNCATED
-#include <stdint.h>
-
-struct ParseContext;
-struct AVCodecParserContext;
-int ff_mpeg1_find_frame_end(struct ParseContext *pc, const uint8_t *buf, int buf_size, struct AVCodecParserContext *s);
-#endif
-
 void ff_mpeg12_find_best_frame_rate(AVRational frame_rate,
                                     int *code, int *ext_n, int *ext_d,
                                     int nonstandard);
diff --git a/libavcodec/mpeg12dec.c b/libavcodec/mpeg12dec.c
index 9999926f55..457d985265 100644
--- a/libavcodec/mpeg12dec.c
+++ b/libavcodec/mpeg12dec.c
@@ -1239,14 +1239,7 @@ static int mpeg_decode_postinit(AVCodecContext *avctx)
         (s1->save_progressive_seq != s->progressive_sequence && FFALIGN(s->height, 16) != FFALIGN(s->height, 32)) ||
         0) {
         if (s1->mpeg_enc_ctx_allocated) {
-#if FF_API_FLAG_TRUNCATED
-            ParseContext pc = s->parse_context;
-            s->parse_context.buffer = 0;
             ff_mpv_common_end(s);
-            s->parse_context = pc;
-#else
-            ff_mpv_common_end(s);
-#endif
             s1->mpeg_enc_ctx_allocated = 0;
         }
 
@@ -2482,11 +2475,7 @@ static int decode_chunks(AVCodecContext *avctx, AVFrame *picture,
             if (avctx->err_recognition & AV_EF_EXPLODE && s2->er.error_count)
                 return AVERROR_INVALIDDATA;
 
-#if FF_API_FLAG_TRUNCATED
-            return FFMAX(0, buf_ptr - buf - s2->parse_context.last_index);
-#else
             return FFMAX(0, buf_ptr - buf);
-#endif
         }
 
         input_size = buf_end - buf_ptr;
@@ -2799,17 +2788,6 @@ static int mpeg_decode_frame(AVCodecContext *avctx, AVFrame *picture,
         return buf_size;
     }
 
-#if FF_API_FLAG_TRUNCATED
-    if (s2->avctx->flags & AV_CODEC_FLAG_TRUNCATED) {
-        int next = ff_mpeg1_find_frame_end(&s2->parse_context, buf,
-                                           buf_size, NULL);
-
-        if (ff_combine_frame(&s2->parse_context, next,
-                             (const uint8_t **) &buf, &buf_size) < 0)
-            return buf_size;
-    }
-#endif
-
     if (s->mpeg_enc_ctx_allocated == 0 && (   s2->codec_tag == AV_RL32("VCR2")
                                            || s2->codec_tag == AV_RL32("BW10")
                                           ))
@@ -2886,9 +2864,6 @@ const FFCodec ff_mpeg1video_decoder = {
     .close                 = mpeg_decode_end,
     FF_CODEC_DECODE_CB(mpeg_decode_frame),
     .p.capabilities        = AV_CODEC_CAP_DRAW_HORIZ_BAND | AV_CODEC_CAP_DR1 |
-#if FF_API_FLAG_TRUNCATED
-                             AV_CODEC_CAP_TRUNCATED |
-#endif
                              AV_CODEC_CAP_DELAY | AV_CODEC_CAP_SLICE_THREADS,
     .caps_internal         = FF_CODEC_CAP_SKIP_FRAME_FILL_PARAM,
     .flush                 = flush,
@@ -2918,9 +2893,6 @@ const FFCodec ff_mpeg2video_decoder = {
     .close          = mpeg_decode_end,
     FF_CODEC_DECODE_CB(mpeg_decode_frame),
     .p.capabilities = AV_CODEC_CAP_DRAW_HORIZ_BAND | AV_CODEC_CAP_DR1 |
-#if FF_API_FLAG_TRUNCATED
-                      AV_CODEC_CAP_TRUNCATED |
-#endif
                       AV_CODEC_CAP_DELAY | AV_CODEC_CAP_SLICE_THREADS,
     .caps_internal  = FF_CODEC_CAP_SKIP_FRAME_FILL_PARAM,
     .flush          = flush,
@@ -2963,9 +2935,6 @@ const FFCodec ff_mpegvideo_decoder = {
     .close          = mpeg_decode_end,
     FF_CODEC_DECODE_CB(mpeg_decode_frame),
     .p.capabilities = AV_CODEC_CAP_DRAW_HORIZ_BAND | AV_CODEC_CAP_DR1 |
-#if FF_API_FLAG_TRUNCATED
-                      AV_CODEC_CAP_TRUNCATED |
-#endif
                       AV_CODEC_CAP_DELAY | AV_CODEC_CAP_SLICE_THREADS,
     .caps_internal  = FF_CODEC_CAP_SKIP_FRAME_FILL_PARAM,
     .flush          = flush,
diff --git a/libavcodec/mpeg4video_parser.c b/libavcodec/mpeg4video_parser.c
index 3beb5f6dae..28353aa146 100644
--- a/libavcodec/mpeg4video_parser.c
+++ b/libavcodec/mpeg4video_parser.c
@@ -27,10 +27,6 @@
 #include "mpegvideo.h"
 #include "mpeg4videodec.h"
 #include "mpeg4videodefs.h"
-#if FF_API_FLAG_TRUNCATED
-/* Nuke this header when removing FF_API_FLAG_TRUNCATED */
-#include "mpeg4video_parser.h"
-#endif
 
 struct Mp4vParseContext {
     ParseContext pc;
@@ -38,15 +34,11 @@ struct Mp4vParseContext {
     int first_picture;
 };
 
-#if FF_API_FLAG_TRUNCATED
-int ff_mpeg4_find_frame_end(ParseContext *pc, const uint8_t *buf, int buf_size)
-#else
 /**
  * Find the end of the current frame in the bitstream.
  * @return the position of the first byte of the next frame, or -1
  */
 static int mpeg4_find_frame_end(ParseContext *pc, const uint8_t *buf, int buf_size)
-#endif
 {
     int vop_found, i;
     uint32_t state;
@@ -148,11 +140,7 @@ static int mpeg4video_parse(AVCodecParserContext *s,
     if (s->flags & PARSER_FLAG_COMPLETE_FRAMES) {
         next = buf_size;
     } else {
-#if FF_API_FLAG_TRUNCATED
-        next = ff_mpeg4_find_frame_end(pc, buf, buf_size);
-#else
         next = mpeg4_find_frame_end(pc, buf, buf_size);
-#endif
 
         if (ff_combine_frame(pc, next, &buf, &buf_size) < 0) {
             *poutbuf      = NULL;
diff --git a/libavcodec/mpeg4video_parser.h b/libavcodec/mpeg4video_parser.h
deleted file mode 100644
index 8008e693b4..0000000000
--- a/libavcodec/mpeg4video_parser.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * MPEG-4 video parser prototypes
- * Copyright (c) 2003 Fabrice Bellard
- * Copyright (c) 2003 Michael Niedermayer
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * FFmpeg is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVCODEC_MPEG4VIDEO_PARSER_H
-#define AVCODEC_MPEG4VIDEO_PARSER_H
-
-#include "parser.h"
-
-/**
- * Find the end of the current frame in the bitstream.
- * @return the position of the first byte of the next frame, or -1
- */
-int ff_mpeg4_find_frame_end(ParseContext *pc, const uint8_t *buf, int buf_size);
-
-#endif /* AVCODEC_MPEG4VIDEO_PARSER_H */
diff --git a/libavcodec/mpeg4videodec.c b/libavcodec/mpeg4videodec.c
index f96b6a3117..d456e5dd11 100644
--- a/libavcodec/mpeg4videodec.c
+++ b/libavcodec/mpeg4videodec.c
@@ -3859,9 +3859,6 @@ const FFCodec ff_mpeg4_decoder = {
     .close                 = ff_h263_decode_end,
     FF_CODEC_DECODE_CB(ff_h263_decode_frame),
     .p.capabilities        = AV_CODEC_CAP_DRAW_HORIZ_BAND | AV_CODEC_CAP_DR1 |
-#if FF_API_FLAG_TRUNCATED
-                             AV_CODEC_CAP_TRUNCATED |
-#endif
                              AV_CODEC_CAP_DELAY | AV_CODEC_CAP_FRAME_THREADS,
     .caps_internal         = FF_CODEC_CAP_SKIP_FRAME_FILL_PARAM |
                              FF_CODEC_CAP_ALLOCATE_PROGRESS,
diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c
index 836869c1d9..fc73abab9c 100644
--- a/libavcodec/mpegvideo.c
+++ b/libavcodec/mpegvideo.c
@@ -738,10 +738,6 @@ av_cold int ff_mpv_common_init(MpegEncContext *s)
         nb_slices = max_slices;
     }
 
-#if FF_API_FLAG_TRUNCATED
-    s->parse_context.state = -1;
-#endif
-
     s->context_initialized = 1;
     memset(s->thread_context, 0, sizeof(s->thread_context));
     s->thread_context[0]   = s;
@@ -791,11 +787,6 @@ void ff_mpv_common_end(MpegEncContext *s)
     if (s->slice_context_count > 1)
         s->slice_context_count = 1;
 
-#if FF_API_FLAG_TRUNCATED
-    av_freep(&s->parse_context.buffer);
-    s->parse_context.buffer_size = 0;
-#endif
-
     av_freep(&s->bitstream_buffer);
     s->allocated_bitstream_buffer_size = 0;
 
diff --git a/libavcodec/mpegvideo.h b/libavcodec/mpegvideo.h
index 42275953b9..55828e6102 100644
--- a/libavcodec/mpegvideo.h
+++ b/libavcodec/mpegvideo.h
@@ -44,9 +44,6 @@
 #include "pixblockdsp.h"
 #include "put_bits.h"
 #include "ratecontrol.h"
-#if FF_API_FLAG_TRUNCATED
-#include "parser.h"
-#endif
 #include "mpegutils.h"
 #include "qpeldsp.h"
 #include "videodsp.h"
@@ -353,10 +350,6 @@ typedef struct MpegEncContext {
     GetBitContext last_resync_gb;    ///< used to search for the next resync marker
     int mb_num_left;                 ///< number of MBs left in this video packet (for partitioned Slices only)
 
-#if FF_API_FLAG_TRUNCATED
-    ParseContext parse_context;
-#endif
-
     /* H.263 specific */
     int gob_index;
     int obmc;                       ///< overlapped block motion compensation
diff --git a/libavcodec/mpegvideo_dec.c b/libavcodec/mpegvideo_dec.c
index 12c7144ffb..7a0c51e53d 100644
--- a/libavcodec/mpegvideo_dec.c
+++ b/libavcodec/mpegvideo_dec.c
@@ -554,14 +554,6 @@ void ff_mpeg_flush(AVCodecContext *avctx)
 
     s->mb_x = s->mb_y = 0;
 
-#if FF_API_FLAG_TRUNCATED
-    s->parse_context.state = -1;
-    s->parse_context.frame_start_found = 0;
-    s->parse_context.overread = 0;
-    s->parse_context.overread_index = 0;
-    s->parse_context.index = 0;
-    s->parse_context.last_index = 0;
-#endif
     s->bitstream_buffer_size = 0;
     s->pp_time = 0;
 }
diff --git a/libavcodec/mpegvideo_parser.c b/libavcodec/mpegvideo_parser.c
index 57bc1f706c..8e7e88ff25 100644
--- a/libavcodec/mpegvideo_parser.c
+++ b/libavcodec/mpegvideo_parser.c
@@ -20,6 +20,7 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
+#include "libavutil/avassert.h"
 #include "decode.h"
 #include "parser.h"
 #include "mpeg12.h"
@@ -33,7 +34,6 @@ struct MpvParseContext {
     int width, height;
 };
 
-#if !FF_API_FLAG_TRUNCATED
 /**
  * Find the end of the current frame in the bitstream.
  * @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,
     pc->state = state;
     return END_NOT_FOUND;
 }
-#endif
 
 static void mpegvideo_extract_headers(AVCodecParserContext *s,
                                       AVCodecContext *avctx,
@@ -255,11 +254,7 @@ static int mpegvideo_parse(AVCodecParserContext *s,
     if(s->flags & PARSER_FLAG_COMPLETE_FRAMES){
         next= buf_size;
     }else{
-#if FF_API_FLAG_TRUNCATED
-        next= ff_mpeg1_find_frame_end(pc, buf, buf_size, s);
-#else
         next = mpeg1_find_frame_end(pc, buf, buf_size, s);
-#endif
 
         if (ff_combine_frame(pc, next, &buf, &buf_size) < 0) {
             *poutbuf = NULL;
diff --git a/libavcodec/options_table.h b/libavcodec/options_table.h
index 7924ca6144..f6f73fb3f9 100644
--- a/libavcodec/options_table.h
+++ b/libavcodec/options_table.h
@@ -62,9 +62,6 @@ static const AVOption avcodec_options[] = {
 {"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"},
 {"gray", "only decode/encode grayscale", 0, AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_FLAG_GRAY }, INT_MIN, INT_MAX, V|E|D, "flags"},
 {"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"},
-#if FF_API_FLAG_TRUNCATED
-{"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"},
-#endif
 {"ildct", "use interlaced DCT", 0, AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_FLAG_INTERLACED_DCT }, INT_MIN, INT_MAX, V|E, "flags"},
 {"low_delay", "force low delay", 0, AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_FLAG_LOW_DELAY }, INT_MIN, INT_MAX, V|D|E, "flags"},
 {"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"},
diff --git a/libavcodec/pthread.c b/libavcodec/pthread.c
index 60ba87dac4..ca84b81391 100644
--- a/libavcodec/pthread.c
+++ b/libavcodec/pthread.c
@@ -48,9 +48,6 @@
 static void validate_thread_parameters(AVCodecContext *avctx)
 {
     int frame_threading_supported = (avctx->codec->capabilities & AV_CODEC_CAP_FRAME_THREADS)
-#if FF_API_FLAG_TRUNCATED
-                                && !(avctx->flags  & AV_CODEC_FLAG_TRUNCATED)
-#endif
                                 && !(avctx->flags  & AV_CODEC_FLAG_LOW_DELAY)
                                 && !(avctx->flags2 & AV_CODEC_FLAG2_CHUNKS);
     if (avctx->thread_count == 1) {
diff --git a/libavcodec/version_major.h b/libavcodec/version_major.h
index 17f2acb319..a0cd3728fa 100644
--- a/libavcodec/version_major.h
+++ b/libavcodec/version_major.h
@@ -38,7 +38,6 @@
  */
 
 #define FF_API_INIT_PACKET         (LIBAVCODEC_VERSION_MAJOR < 60)
-#define FF_API_FLAG_TRUNCATED      (LIBAVCODEC_VERSION_MAJOR < 60)
 #define FF_API_SUB_TEXT_FORMAT     (LIBAVCODEC_VERSION_MAJOR < 60)
 #define FF_API_IDCT_NONE           (LIBAVCODEC_VERSION_MAJOR < 60)
 #define FF_API_SVTAV1_OPTS         (LIBAVCODEC_VERSION_MAJOR < 60)
-- 
2.39.0

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

  parent reply	other threads:[~2023-01-16 13:40 UTC|newest]

Thread overview: 102+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-16 13:38 [FFmpeg-devel] [PATCH 00/26] Major library version bump James Almer
2023-01-16 13:38 ` [FFmpeg-devel] [PATCH 01/26] avcodec: remove FF_API_OPENH264_SLICE_MODE James Almer
2023-01-16 13:38 ` [FFmpeg-devel] [PATCH 02/26] avcodec: remove FF_API_OPENH264_CABAC James Almer
2023-01-16 13:38 ` [FFmpeg-devel] [PATCH 03/26] avcodec: remove FF_API_UNUSED_CODEC_CAPS James Almer
2023-01-16 13:38 ` [FFmpeg-devel] [PATCH 04/26] avcodec: remove FF_API_THREAD_SAFE_CALLBACKS James Almer
2023-01-20 22:44   ` Michael Niedermayer
2023-01-23 22:05     ` James Almer
2023-01-16 13:38 ` [FFmpeg-devel] [PATCH 05/26] avcodec: remove FF_API_DEBUG_MV James Almer
2023-01-16 13:38 ` [FFmpeg-devel] [PATCH 06/26] avcodec: remove FF_API_GET_FRAME_CLASS James Almer
2023-01-16 13:38 ` [FFmpeg-devel] [PATCH 07/26] avcodec: remove FF_API_AUTO_THREADS James Almer
2023-01-16 13:38 ` [FFmpeg-devel] [PATCH 08/26] avcodec: remove FF_API_AVCTX_TIMEBASE James Almer
2023-01-16 13:38 ` James Almer [this message]
2023-01-16 13:38 ` [FFmpeg-devel] [PATCH 10/26] avcodec: remove FF_API_SUB_TEXT_FORMAT James Almer
2023-01-16 13:38 ` [FFmpeg-devel] [PATCH 11/26] avformat: remove FF_API_LAVF_PRIV_OPT James Almer
2023-01-16 13:38 ` [FFmpeg-devel] [PATCH 12/26] avformat: remove FF_API_AVIOCONTEXT_WRITTEN James Almer
2023-01-16 13:38 ` [FFmpeg-devel] [PATCH 13/26] avformat: remove FF_HLS_TS_OPTIONS James Almer
2023-01-16 13:38 ` [FFmpeg-devel] [PATCH 14/26] avformat: remove FF_API_AVSTREAM_CLASS James Almer
2023-01-16 13:38 ` [FFmpeg-devel] [PATCH 15/26] avfilter: remove FF_API_SWS_PARAM_OPTION James Almer
2023-01-16 13:38 ` [FFmpeg-devel] [PATCH 16/26] avfilter: remove FF_API_BUFFERSINK_ALLOC James Almer
2023-01-16 13:38 ` [FFmpeg-devel] [PATCH 17/26] avfilter: remove FF_API_PAD_COUNT James Almer
2023-01-16 13:38 ` [FFmpeg-devel] [PATCH 18/26] avdevice: remove FF_API_DEVICE_CAPABILITIES James Almer
2023-01-16 13:38 ` [FFmpeg-devel] [PATCH 19/26] avutil: remove FF_API_D2STR James Almer
2023-01-16 13:38 ` [FFmpeg-devel] [PATCH 20/26] avutil: remove FF_API_DECLARE_ALIGNED James Almer
2023-01-16 13:38 ` [FFmpeg-devel] [PATCH 21/26] avutil: remove FF_API_COLORSPACE_NAME James Almer
2023-01-16 13:38 ` [FFmpeg-devel] [PATCH 22/26] avutil: remove FF_API_AV_MALLOCZ_ARRAY James Almer
2023-01-16 13:38 ` [FFmpeg-devel] [PATCH 23/26] avutil/version: postpone the remaining API deprecations James Almer
2023-01-16 13:38 ` [FFmpeg-devel] [PATCH 24/26] avcodec/version: " James Almer
2023-01-16 13:38 ` [FFmpeg-devel] [PATCH 25/26] avformat/version: " James Almer
2023-01-16 13:38 ` [FFmpeg-devel] [PATCH 26/26] Bump major versions of all libraries James Almer
2023-01-18 19:28 ` [FFmpeg-devel] [PATCH 00/26] Major library version bump Anton Khirnov
2023-01-18 21:23   ` James Almer
2023-01-19  7:26     ` Anton Khirnov
2023-01-19 12:18       ` James Almer
2023-01-19 15:23         ` Anton Khirnov
2023-01-20  2:05     ` Michael Niedermayer
2023-01-21 16:51       ` Anton Khirnov
2023-01-21 19:33         ` Marvin Scholz
2023-01-21 20:17           ` Hendrik Leppkes
2023-01-21 21:30             ` Marvin Scholz
2023-01-21 22:47               ` Hendrik Leppkes
2023-01-21 21:36         ` Michael Niedermayer
2023-01-21 22:00           ` Marton Balint
2023-01-22 22:54             ` Michael Niedermayer
2023-01-23 17:03             ` Anton Khirnov
2023-01-23 22:41               ` Marton Balint
2023-01-23 22:50                 ` Anton Khirnov
2023-01-23 23:22                   ` Marton Balint
2023-01-24  0:01                     ` Michael Niedermayer
2023-01-24  0:06                       ` Marton Balint
2023-01-24  7:59                         ` Anton Khirnov
2023-01-24 19:48                           ` Marton Balint
2023-01-21 22:01           ` Marvin Scholz
2023-01-20 15:07     ` Tomas Härdin
2023-01-20 21:23   ` Leo Izen
2023-01-21 16:54     ` Anton Khirnov
2023-01-24 15:45 ` Anton Khirnov
2023-01-25 15:44   ` James Almer
2023-01-25 20:08     ` Marton Balint
2023-01-25 20:44       ` Jean-Baptiste Kempf
2023-01-25 21:03         ` Marton Balint
2023-01-25 21:15           ` Jean-Baptiste Kempf
2023-01-25 21:20             ` Paul B Mahol
2023-01-25 21:26               ` Jean-Baptiste Kempf
2023-01-25 21:29                 ` Paul B Mahol
2023-01-25 21:31                   ` Jean-Baptiste Kempf
2023-01-25 21:34                     ` Paul B Mahol
2023-01-25 22:28             ` Marton Balint
2023-01-25 22:48               ` Jean-Baptiste Kempf
2023-01-25 23:25                 ` Marton Balint
2023-01-26 22:16                   ` Michael Niedermayer
2023-01-26 22:49                     ` Jean-Baptiste Kempf
2023-01-26 23:19                       ` Michael Niedermayer
2023-01-26 23:21                         ` Jean-Baptiste Kempf
2023-01-27 18:42                       ` James Almer
2023-01-27 14:05 ` [FFmpeg-devel] [PATCH 26/31] avcodec/avcodec: Remove AV_CODEC_FLAG2_DROP_FRAME_TIMECODE Andreas Rheinhardt
     [not found] ` <20230127140600.2831578-1-andreas.rheinhardt@outlook.com>
2023-01-27 14:05   ` [FFmpeg-devel] [PATCH 27/31] avformat/avformat: Remove AVOutputFormat.data_codec Andreas Rheinhardt
2023-01-27 14:05   ` [FFmpeg-devel] [PATCH 28/31] avformat/avformat: Move codecpar up in AVStream Andreas Rheinhardt
2023-01-27 14:05   ` [FFmpeg-devel] [PATCH 29/31] avcodec: Make avcodec_decode_subtitle2 accept a const AVPacket* Andreas Rheinhardt
2023-01-27 14:05   ` [FFmpeg-devel] [PATCH 30/31] avformat/demux: Avoid stack packet when decoding frame Andreas Rheinhardt
2023-01-27 14:06   ` [FFmpeg-devel] [PATCH 31/31] avformat/avformat: Move AVOutputFormat internals out of public header Andreas Rheinhardt
2023-01-28 13:58 ` [FFmpeg-devel] [PATCH 32/32] avutil/{color_utils, csp}: merge color_utils into csp and expose API Leo Izen
2023-01-29 11:08   ` Anton Khirnov
2023-01-30 16:50     ` [FFmpeg-devel] [PATCH v2] " Leo Izen
2023-01-30 17:08       ` Zhao Zhili
2023-01-30 17:12         ` Paul B Mahol
2023-01-30 18:22         ` Leo Izen
2023-01-31  2:20           ` "zhilizhao(赵志立)"
2023-02-02  7:02   ` [FFmpeg-devel] [PATCH major bump 0/6] Fix HDR vivid support Zhao Zhili
2023-02-02  8:00     ` Lance Wang
     [not found]   ` <20230202070208.1962086-1-quinkblack@foxmail.com>
2023-02-02  7:02     ` [FFmpeg-devel] [PATCH major bump 1/6] libavutil/hdr_dynamic_vivid_metadata: fix AVHDRVividColorToneMappingParams Zhao Zhili
2023-02-02  8:16       ` Anton Khirnov
2023-02-02  8:52         ` "zhilizhao(赵志立)"
2023-02-03 14:28           ` Anton Khirnov
2023-02-02  7:02     ` [FFmpeg-devel] [PATCH major bump 2/6] libavcodec/dynamic_hdr_vivid: fix start code check Zhao Zhili
2023-02-02  7:02     ` [FFmpeg-devel] [PATCH major bump 3/6] avcodec/dynamic_hdr_vivid: fix base_param_Delta Zhao Zhili
2023-02-02  7:02     ` [FFmpeg-devel] [PATCH major bump 4/6] avcodec/dynamic_hdr_vivid: fix base_enable_flag control Zhao Zhili
2023-02-02  7:02     ` [FFmpeg-devel] [PATCH major bump 5/6] avcodec/dynamic_hdr_vivid: reindent after the previous commit Zhao Zhili
2023-02-02  7:02     ` [FFmpeg-devel] [PATCH major bump 6/6] fftools/ffprobe: fix print_dynamic_hdr_vivid Zhao Zhili
2023-01-29 10:17 ` [FFmpeg-devel] [PATCH 1/3] lavu/fifo: remove FF_API_FIFO_PEEK2 Anton Khirnov
2023-01-29 10:17   ` [FFmpeg-devel] [PATCH 2/3] lavu/fifo: uninline deprecated av_fifo_peek2() Anton Khirnov
2023-01-29 16:11     ` Andreas Rheinhardt
2023-01-29 10:17   ` [FFmpeg-devel] [PATCH 3/3] lavu/fifo: mark all AVFifoBuffer members as deprecated Anton Khirnov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230116133840.512-10-jamrial@gmail.com \
    --to=jamrial@gmail.com \
    --cc=ffmpeg-devel@ffmpeg.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git