From patchwork Mon Jan 16 13:38:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Almer X-Patchwork-Id: 40035 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:1d43:b0:b8:6755:f97e with SMTP id cs3csp1037402pzb; Mon, 16 Jan 2023 05:40:08 -0800 (PST) X-Google-Smtp-Source: AMrXdXu/36+gpO83KebaRc1Pggrv63HnflxxchJ7yHMxX8SZ/GYM+oPWCeEG1llnuWDzeveb9h6h X-Received: by 2002:a17:907:9d0b:b0:78d:f455:30db with SMTP id kt11-20020a1709079d0b00b0078df45530dbmr83466697ejc.3.1673876408757; Mon, 16 Jan 2023 05:40:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673876408; cv=none; d=google.com; s=arc-20160816; b=PWnyR8ZfyAVhpfHi1fZQnXozAqWVYkZCIBDr+KlbgRgtqYjZ1iuFfKan04q793+97X Tn3WUXdQlPGcB3gE8wyFyVqOLuNTvvthKJxFIHdi+qFIitq1gkIM54roLKZx79LOj7W9 PLgqOVnTw8x3RhQVekw3Dfw087miNKoKr5tGc08r2af7T1mdbbrfXyd8OgaiQblT9a9n 12FnRNh4V2onkgHYeFCh/qwusx+5IMtyOUo4ULzYuL01fb9hgs4LCPN5t/BhBmxkmLrY 3/YrZvn4CcqCbQCt/FFH89JyqH/n2FZAVep635O+CpcpGCNr0BwYK4xBZvdzS2ffhm0i YoaQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:references:in-reply-to:message-id :date:to:from:dkim-signature:delivered-to; bh=vk8NRZ9n+1An8toXtczDp6/BWSy/mrGLauiztEXFpJs=; b=gVUdjCtEejKP0kmiI79WcNaCSq2ki0l25GApNwaCQyMxVkgxfd3CDxNiKBLERz4vVQ 5SHmEBeQcI057SQH67o9d5fBw9q6gad5ln2wxBeqDRb3/chqve6++LsZvfbxEiS6XDnv wtJviqkxJSO3jzzAT4A3Ak4/5OlZv26BjU0GZ/oCWqG6uSFoXEJ+J++LMaLbipwEPEGR 6Wb7Htk4srQLld+1mO3Nakxr3+qQwL5Vt3BkQEVq1Xkkj4bEEZCqcgNy7X9FlxBV/9Mr sjnrOBLEbe70Yat0QcizSIJMk7gZgwhoPc0roWyfXzgHvh6XLTSvZZA3tc9W5rTft1KB jGdQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20210112 header.b=p8gxgDUM; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id qf30-20020a1709077f1e00b0087122fab4a5si2609445ejc.255.2023.01.16.05.40.07; Mon, 16 Jan 2023 05:40:08 -0800 (PST) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20210112 header.b=p8gxgDUM; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 7B1E168BDCD; Mon, 16 Jan 2023 15:39:22 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-ot1-f52.google.com (mail-ot1-f52.google.com [209.85.210.52]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 284BE68BD96 for ; Mon, 16 Jan 2023 15:39:19 +0200 (EET) Received: by mail-ot1-f52.google.com with SMTP id j16-20020a056830271000b0067202045ee9so16104423otu.7 for ; Mon, 16 Jan 2023 05:39:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=HnA5+B1ePXcQoUpa8fPwBEbCYlm25Qn6lo/yuOYZyRM=; b=p8gxgDUMi7YjsWSvSS+3pihdHZkz8PdrH+p/NCDgUdeTpsp69I+fiBD1tS993iAjRT 4/jPEn/27SlfdEPKJMoKuD1V5Pm9SppjJAFDZZZ6RF/2rI0KbwRWirlCB6shFjRz0/rb krATSLn+g+tUD0gWpQyykLY2sLgbj1Olg4ZbNv4uYnp0vvte7/QYSLVN131SuGp0QXVw wU8amsBjMd4pg595gHxlNhoY29OpS00BeZrQieaXlxp/Gi7nPUkDnLsldIU7HvJezBUo FEUWxmNNaMwUDZVuktKTCFn3iiDlTDIYs8AgXWVUojH3Hs85A7lX7E5URDS6KE4qhdvW n88w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=HnA5+B1ePXcQoUpa8fPwBEbCYlm25Qn6lo/yuOYZyRM=; b=BDPMmI3lfw8m4WGIUITFbxlGGLb52az9RqVl/KGMgY+H9guReM0ojbRjsuEM0ighx2 MMe2dhUXdxMcoACKogY4QrI5wwHWhX6Y/kECkGGctDhnsGKt1qK4tv4a0WX0rB7H04CS /04R5PGwKAmUawhtahlrJxHzzgTT9RD1la8jBZ/G+OJljf/raUsNpE3hd5i/53tVSPaX U2DUMq1lQhDvBKXkEuRhx3KGjNJqrUTKvLhZZQU0TkCpbULLCVHjIOnmBdXVGy60sHO9 +mDONuDM1pbofiHhz+iqiGAKyDb6YGOcCCSf4unXTSJBsqNSqC/B8/pKYIx58nefTx3H N/gQ== X-Gm-Message-State: AFqh2kqyPd/mPJMPV3itfXRgCk98n3bs1iyGKAu+vlx3RwFWZrwNGEtz sD6RNuGmDFpSP/TkEHbiVkCUv6cwe9M= X-Received: by 2002:a9d:1783:0:b0:684:ad70:5815 with SMTP id j3-20020a9d1783000000b00684ad705815mr11130083otj.9.1673876358009; Mon, 16 Jan 2023 05:39:18 -0800 (PST) Received: from localhost.localdomain (host197.190-225-105.telecom.net.ar. [190.225.105.197]) by smtp.gmail.com with ESMTPSA id 3-20020a9d0303000000b0066ca9001e68sm388524otv.5.2023.01.16.05.39.17 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Jan 2023 05:39:17 -0800 (PST) From: James Almer To: ffmpeg-devel@ffmpeg.org Date: Mon, 16 Jan 2023 10:38:23 -0300 Message-Id: <20230116133840.512-10-jamrial@gmail.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230116133840.512-1-jamrial@gmail.com> References: <20230116133840.512-1-jamrial@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 09/26] avcodec: remove FF_API_FLAG_TRUNCATED X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: ZFHwJXpAUOZL Signed-off-by: James Almer --- 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 - * - * 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 - -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)