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