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 1A9484BD2D for ; Tue, 16 Jul 2024 18:17:33 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id C854F68DC03; Tue, 16 Jul 2024 21:14:37 +0300 (EEST) Received: from mail1.khirnov.net (quelana.khirnov.net [94.230.150.81]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 2A2EF68DACD for ; Tue, 16 Jul 2024 21:14:04 +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=Oq8+jZFW; dkim-atps=neutral Received: from localhost (mail1.khirnov.net [IPv6:::1]) by mail1.khirnov.net (Postfix) with ESMTP id 025BD4E29 for ; Tue, 16 Jul 2024 19:24:20 +0200 (CEST) Received: from mail1.khirnov.net ([IPv6:::1]) by localhost (mail1.khirnov.net [IPv6:::1]) (amavis, port 10024) with ESMTP id w3LHWluH2cpn for ; Tue, 16 Jul 2024 19:24:19 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=khirnov.net; s=mail; t=1721150659; bh=36+7gYRJo2/sMHXuXzDjMZHeB9MYGG2weLwxinaUQzo=; h=From:To:Subject:Date:In-Reply-To:References:From; b=Oq8+jZFW0nI1w9WqG9zKDzSA3A9JexofHe/rOi88vEYzJrNJ3M8q2X5zQ2xOwPcCq 9oWjJvcUA7W0NtJv6kRO2YUEmlEYSwqYj8bFCk+/5aQ4Hmd1JvvEASNOVYFbPDzbm1 Co4Vv9kuYUz9lOd57Poz/IBS+O+xHsM3PSCWOytLdFjm9yRXaAf+XLEq3yuAMoYMtA YEyMH0N0sJrI9gUc1VFp9FnKQpyUpvQfjdzj9dmOb8AhS3FdO9NCO5Q7b5x/sPgFEH WMut0i6oicyw5usJ+I89MpLRPp7ZahwQsaHB9snpeQQqTUk6us7akOwaT70LHzQcU3 x+mWt3a58cM8Q== 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 381B24E23 for ; Tue, 16 Jul 2024 19:24:19 +0200 (CEST) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:::1]) by libav.khirnov.net (Postfix) with ESMTP id 845E93A2E91 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:44 +0200 Message-ID: <20240716171155.31838-29-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 29/39] lavc/thread: move generic-layer API to avcodec_internal.h 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: thread.h currently contains both API for decoder use and functions internal to lavc generic layer. Move the latter to avcodec_internal.h, which is a more appropriate place for them. --- libavcodec/avcodec_internal.h | 24 ++++++++++++++++++++++++ libavcodec/pthread.c | 1 + libavcodec/thread.h | 25 +------------------------ libavcodec/utils.c | 8 -------- 4 files changed, 26 insertions(+), 32 deletions(-) diff --git a/libavcodec/avcodec_internal.h b/libavcodec/avcodec_internal.h index 0a024378ae..816f39ae76 100644 --- a/libavcodec/avcodec_internal.h +++ b/libavcodec/avcodec_internal.h @@ -72,4 +72,28 @@ struct AVCodecInternal *ff_encode_internal_alloc(void); void ff_codec_close(struct AVCodecContext *avctx); +int ff_thread_init(struct AVCodecContext *s); +void ff_thread_free(struct AVCodecContext *s); + +/** + * Wait for decoding threads to finish and reset internal state. + * Called by avcodec_flush_buffers(). + * + * @param avctx The context. + */ +void ff_thread_flush(struct AVCodecContext *avctx); + +/** + * Submit a new frame to a decoding thread. + * Returns the next available frame in picture. *got_picture_ptr + * will be 0 if none is available. + * The return value on success is the size of the consumed packet for + * compatibility with FFCodec.decode. This means the decoder + * has to consume the full packet. + * + * Parameters are the same as FFCodec.decode. + */ +int ff_thread_decode_frame(struct AVCodecContext *avctx, struct AVFrame *frame, + int *got_picture_ptr, struct AVPacket *avpkt); + #endif // AVCODEC_AVCODEC_INTERNAL_H diff --git a/libavcodec/pthread.c b/libavcodec/pthread.c index ca84b81391..d32e56de0d 100644 --- a/libavcodec/pthread.c +++ b/libavcodec/pthread.c @@ -32,6 +32,7 @@ #include "libavutil/thread.h" #include "avcodec.h" +#include "avcodec_internal.h" #include "codec_internal.h" #include "pthread_internal.h" #include "thread.h" diff --git a/libavcodec/thread.h b/libavcodec/thread.h index 5ab12848b4..47c00a0ed2 100644 --- a/libavcodec/thread.h +++ b/libavcodec/thread.h @@ -20,7 +20,7 @@ /** * @file - * Multithreading support functions + * Multithreading API for decoders * @author Alexander Strange */ @@ -31,27 +31,6 @@ #include "avcodec.h" -/** - * Wait for decoding threads to finish and reset internal state. - * Called by avcodec_flush_buffers(). - * - * @param avctx The context. - */ -void ff_thread_flush(AVCodecContext *avctx); - -/** - * Submit a new frame to a decoding thread. - * Returns the next available frame in picture. *got_picture_ptr - * will be 0 if none is available. - * The return value on success is the size of the consumed packet for - * compatibility with FFCodec.decode. This means the decoder - * has to consume the full packet. - * - * Parameters are the same as FFCodec.decode. - */ -int ff_thread_decode_frame(AVCodecContext *avctx, AVFrame *picture, - int *got_picture_ptr, AVPacket *avpkt); - int ff_thread_can_start_frame(AVCodecContext *avctx); /** @@ -74,11 +53,9 @@ void ff_thread_finish_setup(AVCodecContext *avctx); */ int ff_thread_get_buffer(AVCodecContext *avctx, AVFrame *f, int flags); -int ff_thread_init(AVCodecContext *s); int ff_slice_thread_execute_with_mainfunc(AVCodecContext *avctx, int (*action_func2)(AVCodecContext *c, void *arg, int jobnr, int threadnr), int (*main_func)(AVCodecContext *c), void *arg, int *ret, int job_count); -void ff_thread_free(AVCodecContext *s); int ff_slice_thread_allocz_entries(AVCodecContext *avctx, int count); int ff_slice_thread_init_progress(AVCodecContext *avctx); void ff_thread_report_progress2(AVCodecContext *avctx, int field, int thread, int n); diff --git a/libavcodec/utils.c b/libavcodec/utils.c index 337c00e789..b17fc3c7e2 100644 --- a/libavcodec/utils.c +++ b/libavcodec/utils.c @@ -806,14 +806,6 @@ int av_get_audio_frame_duration2(AVCodecParameters *par, int frame_bytes) return FFMAX(0, duration); } -#if !HAVE_THREADS -int ff_thread_init(AVCodecContext *s) -{ - return -1; -} - -#endif - unsigned int av_xiphlacing(unsigned char *s, unsigned int v) { unsigned int n = 0; -- 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".