[FFmpeg-devel] [PATCH] lavc: remove not required includes, relocate some functions
vitamin-caig
vitamin.caig at gmail.com
Wed Dec 25 22:13:32 EET 2019
Signed-off-by: vitamin-caig <vitamin.caig at gmail.com>
---
libavcodec/raw.c | 11 +++++++++++
libavcodec/raw.h | 2 --
libavcodec/rawdec.c | 2 +-
libavcodec/utils.c | 12 ------------
4 files changed, 12 insertions(+), 15 deletions(-)
diff --git a/libavcodec/raw.c b/libavcodec/raw.c
index b6fb91c1c6..96b7442f51 100644
--- a/libavcodec/raw.c
+++ b/libavcodec/raw.c
@@ -301,6 +301,17 @@ const struct PixelFormatTag *avpriv_get_raw_pix_fmt_tags(void)
return ff_raw_pix_fmt_tags;
}
+enum AVPixelFormat avpriv_find_pix_fmt(const PixelFormatTag *tags,
+ unsigned int fourcc)
+{
+ while (tags->pix_fmt >= 0) {
+ if (tags->fourcc == fourcc)
+ return tags->pix_fmt;
+ tags++;
+ }
+ return AV_PIX_FMT_NONE;
+}
+
unsigned int avcodec_pix_fmt_to_codec_tag(enum AVPixelFormat fmt)
{
const PixelFormatTag *tags = ff_raw_pix_fmt_tags;
diff --git a/libavcodec/raw.h b/libavcodec/raw.h
index 28a27b1f9e..af3dd4fb79 100644
--- a/libavcodec/raw.h
+++ b/libavcodec/raw.h
@@ -36,8 +36,6 @@ typedef struct PixelFormatTag {
unsigned int fourcc;
} PixelFormatTag;
-extern const PixelFormatTag ff_raw_pix_fmt_tags[]; // exposed through avpriv_get_raw_pix_fmt_tags()
-
const struct PixelFormatTag *avpriv_get_raw_pix_fmt_tags(void);
enum AVPixelFormat avpriv_find_pix_fmt(const PixelFormatTag *tags, unsigned int fourcc);
diff --git a/libavcodec/rawdec.c b/libavcodec/rawdec.c
index 0b2d8708e6..a99f1a2c52 100644
--- a/libavcodec/rawdec.c
+++ b/libavcodec/rawdec.c
@@ -81,7 +81,7 @@ static av_cold int raw_init_decoder(AVCodecContext *avctx)
avctx->pix_fmt = avpriv_find_pix_fmt(avpriv_pix_fmt_bps_avi,
avctx->bits_per_coded_sample);
else if (avctx->codec_tag && (avctx->codec_tag & 0xFFFFFF) != MKTAG('B','I','T', 0))
- avctx->pix_fmt = avpriv_find_pix_fmt(ff_raw_pix_fmt_tags, avctx->codec_tag);
+ avctx->pix_fmt = avpriv_find_pix_fmt(avpriv_get_raw_pix_fmt_tags(), avctx->codec_tag);
else if (avctx->pix_fmt == AV_PIX_FMT_NONE && avctx->bits_per_coded_sample)
avctx->pix_fmt = avpriv_find_pix_fmt(avpriv_pix_fmt_bps_avi,
avctx->bits_per_coded_sample);
diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index 8a49234bcd..6ce8d7b964 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -55,7 +55,6 @@
#include "version.h"
#include <stdlib.h>
#include <stdarg.h>
-#include <stdatomic.h>
#include <limits.h>
#include <float.h>
#if CONFIG_ICONV
@@ -464,17 +463,6 @@ int avcodec_default_execute2(AVCodecContext *c, int (*func)(AVCodecContext *c2,
return 0;
}
-enum AVPixelFormat avpriv_find_pix_fmt(const PixelFormatTag *tags,
- unsigned int fourcc)
-{
- while (tags->pix_fmt >= 0) {
- if (tags->fourcc == fourcc)
- return tags->pix_fmt;
- tags++;
- }
- return AV_PIX_FMT_NONE;
-}
-
#if FF_API_CODEC_GET_SET
MAKE_ACCESSORS(AVCodecContext, codec, AVRational, pkt_timebase)
MAKE_ACCESSORS(AVCodecContext, codec, const AVCodecDescriptor *, codec_descriptor)
--
2.20.1
More information about the ffmpeg-devel
mailing list