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 37E24472B9 for ; Sat, 4 Nov 2023 09:22:10 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id BA33868CE4C; Sat, 4 Nov 2023 11:21:56 +0200 (EET) Received: from mail1.khirnov.net (quelana.khirnov.net [94.230.150.81]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id D213568CE3A for ; Sat, 4 Nov 2023 11:21:49 +0200 (EET) Received: from localhost (mail1.khirnov.net [IPv6:::1]) by mail1.khirnov.net (Postfix) with ESMTP id 2A3981006 for ; Sat, 4 Nov 2023 10:21:49 +0100 (CET) Received: from mail1.khirnov.net ([IPv6:::1]) by localhost (mail1.khirnov.net [IPv6:::1]) (amavis, port 10024) with ESMTP id Vctmo95MHGel for ; Sat, 4 Nov 2023 10:21:48 +0100 (CET) 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 696EE951 for ; Sat, 4 Nov 2023 10:21:47 +0100 (CET) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:::1]) by libav.khirnov.net (Postfix) with ESMTP id 3AE6A3A06E4 for ; Sat, 4 Nov 2023 10:21:40 +0100 (CET) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Sat, 4 Nov 2023 08:56:13 +0100 Message-ID: <20231104092125.10213-5-anton@khirnov.net> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231104092125.10213-1-anton@khirnov.net> References: <20231104092125.10213-1-anton@khirnov.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 04/24] fftools/ffmpeg: move a few inline function into a new header 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: Will allow to use them in future commits without including the whole ffmpeg.h. --- fftools/ffmpeg.c | 1 + fftools/ffmpeg.h | 21 ------------------ fftools/ffmpeg_dec.c | 1 + fftools/ffmpeg_demux.c | 1 + fftools/ffmpeg_mux.c | 1 + fftools/ffmpeg_utils.h | 50 ++++++++++++++++++++++++++++++++++++++++++ 6 files changed, 54 insertions(+), 21 deletions(-) create mode 100644 fftools/ffmpeg_utils.h diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c index 46a85b41a8..cdb16ef90b 100644 --- a/fftools/ffmpeg.c +++ b/fftools/ffmpeg.c @@ -99,6 +99,7 @@ #include "cmdutils.h" #include "ffmpeg.h" +#include "ffmpeg_utils.h" #include "sync_queue.h" const char program_name[] = "ffmpeg"; diff --git a/fftools/ffmpeg.h b/fftools/ffmpeg.h index 0983d026cd..d52c954df5 100644 --- a/fftools/ffmpeg.h +++ b/fftools/ffmpeg.h @@ -880,17 +880,6 @@ int trigger_fix_sub_duration_heartbeat(OutputStream *ost, const AVPacket *pkt); int fix_sub_duration_heartbeat(InputStream *ist, int64_t signal_pts); void update_benchmark(const char *fmt, ...); -/** - * Merge two return codes - return one of the error codes if at least one of - * them was negative, 0 otherwise. - * Currently just picks the first one, eventually we might want to do something - * more sophisticated, like sorting them by priority. - */ -static inline int err_merge(int err0, int err1) -{ - return (err0 < 0) ? err0 : FFMIN(err1, 0); -} - #define SPECIFIER_OPT_FMT_str "%s" #define SPECIFIER_OPT_FMT_i "%i" #define SPECIFIER_OPT_FMT_i64 "%"PRId64 @@ -942,14 +931,4 @@ extern const char * const opt_name_frame_rates[]; extern const char * const opt_name_top_field_first[]; #endif -static inline void pkt_move(void *dst, void *src) -{ - av_packet_move_ref(dst, src); -} - -static inline void frame_move(void *dst, void *src) -{ - av_frame_move_ref(dst, src); -} - #endif /* FFTOOLS_FFMPEG_H */ diff --git a/fftools/ffmpeg_dec.c b/fftools/ffmpeg_dec.c index fcee8b65ac..8795a94c1a 100644 --- a/fftools/ffmpeg_dec.c +++ b/fftools/ffmpeg_dec.c @@ -30,6 +30,7 @@ #include "libavfilter/buffersrc.h" #include "ffmpeg.h" +#include "ffmpeg_utils.h" #include "thread_queue.h" struct Decoder { diff --git a/fftools/ffmpeg_demux.c b/fftools/ffmpeg_demux.c index 350f233ab7..ec96daf26b 100644 --- a/fftools/ffmpeg_demux.c +++ b/fftools/ffmpeg_demux.c @@ -20,6 +20,7 @@ #include #include "ffmpeg.h" +#include "ffmpeg_utils.h" #include "libavutil/avassert.h" #include "libavutil/avstring.h" diff --git a/fftools/ffmpeg_mux.c b/fftools/ffmpeg_mux.c index 7a924dba6c..30c033036d 100644 --- a/fftools/ffmpeg_mux.c +++ b/fftools/ffmpeg_mux.c @@ -22,6 +22,7 @@ #include "ffmpeg.h" #include "ffmpeg_mux.h" +#include "ffmpeg_utils.h" #include "objpool.h" #include "sync_queue.h" #include "thread_queue.h" diff --git a/fftools/ffmpeg_utils.h b/fftools/ffmpeg_utils.h new file mode 100644 index 0000000000..20cde94969 --- /dev/null +++ b/fftools/ffmpeg_utils.h @@ -0,0 +1,50 @@ +/* + * 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 FFTOOLS_FFMPEG_UTILS_H +#define FFTOOLS_FFMPEG_UTILS_H + +#include + +#include "libavutil/common.h" +#include "libavutil/frame.h" + +#include "libavcodec/packet.h" + +/** + * Merge two return codes - return one of the error codes if at least one of + * them was negative, 0 otherwise. + * Currently just picks the first one, eventually we might want to do something + * more sophisticated, like sorting them by priority. + */ +static inline int err_merge(int err0, int err1) +{ + return (err0 < 0) ? err0 : FFMIN(err1, 0); +} + +static inline void pkt_move(void *dst, void *src) +{ + av_packet_move_ref(dst, src); +} + +static inline void frame_move(void *dst, void *src) +{ + av_frame_move_ref(dst, src); +} + +#endif // FFTOOLS_FFMPEG_UTILS_H -- 2.42.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".