From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id 60D9D4BD58 for ; Tue, 16 Jul 2024 17:18:29 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 3206168DB0B; Tue, 16 Jul 2024 20:16:52 +0300 (EEST) Received: from mail1.khirnov.net (quelana.khirnov.net [94.230.150.81]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 4E65C68DA97 for ; Tue, 16 Jul 2024 20:16:37 +0300 (EEST) Authentication-Results: mail1.khirnov.net; dkim=pass (2048-bit key; unprotected) header.d=khirnov.net header.i=@khirnov.net header.a=rsa-sha256 header.s=mail header.b=RRErsuUq; dkim-atps=neutral Received: from localhost (mail1.khirnov.net [IPv6:::1]) by mail1.khirnov.net (Postfix) with ESMTP id 3FDA04DF6 for ; Tue, 16 Jul 2024 19:16:34 +0200 (CEST) Received: from mail1.khirnov.net ([IPv6:::1]) by localhost (mail1.khirnov.net [IPv6:::1]) (amavis, port 10024) with ESMTP id ItsDNYvSJAva for ; Tue, 16 Jul 2024 19:16:33 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=khirnov.net; s=mail; t=1721150188; bh=sneAjab5H4DhVBIahuJaYqKM53TMGKmS6i3RtLH/J5c=; h=From:To:Subject:Date:In-Reply-To:References:From; b=RRErsuUq/74Qr5Px2awvNriAPwFHmitI0ZbGSMI6aRXQmTF+NWphz8sgEAAWVRCp1 Ect0SE9QIEoxI8hNFOZ/IHmzWqZRwR7jKth5V4ojxRgOXuMS7KAhAlidNaBeW91glP +JcC4A/+u8zaE+74qXIV6vSHYgUyOsVM/OmZWc6A7awZiHyzx1k4EsxNp0JDB4U4Oa BMKkmzFTtn/tmnCeMSyOr00PEGg7pDwt39hMIXsV1eViwMGq3UbTyzVC1RmC6aEV4f n0iIZwBi9hWQqS59j84f3Z+LoVxdCpFL1++J/MrqhFdWr4L8QqWpG/9rv95TGtEiXK cVajHzjVd3i9w== Received: from libav.khirnov.net (libav.khirnov.net [IPv6:2a00:c500:561:201::7]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "libav.khirnov.net", Issuer "smtp.khirnov.net SMTP CA" (verified OK)) by mail1.khirnov.net (Postfix) with ESMTPS id 969394E08 for ; Tue, 16 Jul 2024 19:16:28 +0200 (CEST) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:::1]) by libav.khirnov.net (Postfix) with ESMTP id CABEE3A33D7 for ; Tue, 16 Jul 2024 19:16:21 +0200 (CEST) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Tue, 16 Jul 2024 19:11:50 +0200 Message-ID: <20240716171155.31838-35-anton@khirnov.net> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240716171155.31838-1-anton@khirnov.net> References: <20240716171155.31838-1-anton@khirnov.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 35/39] lavc/hevcdec: switch to receive_frame() 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 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: Required by following commits, where we will want to output multiple frames per packet. --- libavcodec/hevc/hevcdec.c | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/libavcodec/hevc/hevcdec.c b/libavcodec/hevc/hevcdec.c index 0e4b26dad3..fc87169a1a 100644 --- a/libavcodec/hevc/hevcdec.c +++ b/libavcodec/hevc/hevcdec.c @@ -3401,22 +3401,25 @@ static int hevc_decode_extradata(HEVCContext *s, uint8_t *buf, int length, int f return 0; } -static int hevc_decode_frame(AVCodecContext *avctx, AVFrame *rframe, - int *got_output, AVPacket *avpkt) +static int hevc_receive_frame(AVCodecContext *avctx, AVFrame *frame) { + HEVCContext *s = avctx->priv_data; + AVCodecInternal *avci = avctx->internal; + AVPacket *avpkt = avci->in_pkt; + int ret; uint8_t *sd; size_t sd_size; - HEVCContext *s = avctx->priv_data; - if (!avpkt->size) { - ret = ff_hevc_output_frame(s, rframe, 1); + av_packet_unref(avpkt); + ret = ff_decode_get_packet(avctx, avpkt); + if (ret == AVERROR_EOF) { + ret = ff_hevc_output_frame(s, frame, 1); if (ret < 0) return ret; - - *got_output = ret; - return 0; - } + return (ret > 0) ? 0 : AVERROR_EOF; + } else if (ret < 0) + return ret; sd = av_packet_get_side_data(avpkt, AV_PKT_DATA_NEW_EXTRADATA, &sd_size); if (sd && sd_size > 0) { @@ -3440,11 +3443,11 @@ static int hevc_decode_frame(AVCodecContext *avctx, AVFrame *rframe, return ret; if (s->output_frame->buf[0]) { - av_frame_move_ref(rframe, s->output_frame); - *got_output = 1; + av_frame_move_ref(frame, s->output_frame); + return 0; } - return avpkt->size; + return AVERROR(EAGAIN); } static int hevc_ref_frame(HEVCFrame *dst, const HEVCFrame *src) @@ -3721,7 +3724,7 @@ const FFCodec ff_hevc_decoder = { .p.priv_class = &hevc_decoder_class, .init = hevc_decode_init, .close = hevc_decode_free, - FF_CODEC_DECODE_CB(hevc_decode_frame), + FF_CODEC_RECEIVE_FRAME_CB(hevc_receive_frame), .flush = hevc_decode_flush, UPDATE_THREAD_CONTEXT(hevc_update_thread_context), .p.capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_DELAY | -- 2.43.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".