summaryrefslogtreecommitdiff
path: root/libavcodec/raw.c
diff options
context:
space:
mode:
Diffstat (limited to 'libavcodec/raw.c')
-rw-r--r--libavcodec/raw.c40
1 files changed, 35 insertions, 5 deletions
diff --git a/libavcodec/raw.c b/libavcodec/raw.c
index 079d5c5d10..5efc1eb465 100644
--- a/libavcodec/raw.c
+++ b/libavcodec/raw.c
@@ -28,7 +28,7 @@
#include "raw.h"
#include "libavutil/common.h"
-const PixelFormatTag ff_raw_pix_fmt_tags[] = {
+static const PixelFormatTag raw_pix_fmt_tags[] = {
{ AV_PIX_FMT_YUV420P, MKTAG('I', '4', '2', '0') }, /* Planar formats */
{ AV_PIX_FMT_YUV420P, MKTAG('I', 'Y', 'U', 'V') },
{ AV_PIX_FMT_YUV420P, MKTAG('y', 'v', '1', '2') },
@@ -299,12 +299,12 @@ const PixelFormatTag ff_raw_pix_fmt_tags[] = {
const struct PixelFormatTag *avpriv_get_raw_pix_fmt_tags(void)
{
- return ff_raw_pix_fmt_tags;
+ return raw_pix_fmt_tags;
}
unsigned int avcodec_pix_fmt_to_codec_tag(enum AVPixelFormat fmt)
{
- const PixelFormatTag *tags = ff_raw_pix_fmt_tags;
+ const PixelFormatTag *tags = raw_pix_fmt_tags;
while (tags->pix_fmt >= 0) {
if (tags->pix_fmt == fmt)
return tags->fourcc;
@@ -313,7 +313,7 @@ unsigned int avcodec_pix_fmt_to_codec_tag(enum AVPixelFormat fmt)
return 0;
}
-const PixelFormatTag avpriv_pix_fmt_bps_avi[] = {
+static const PixelFormatTag pix_fmt_bps_avi[] = {
{ AV_PIX_FMT_PAL8, 1 },
{ AV_PIX_FMT_PAL8, 2 },
{ AV_PIX_FMT_PAL8, 4 },
@@ -326,7 +326,7 @@ const PixelFormatTag avpriv_pix_fmt_bps_avi[] = {
{ AV_PIX_FMT_NONE, 0 },
};
-const PixelFormatTag avpriv_pix_fmt_bps_mov[] = {
+static const PixelFormatTag pix_fmt_bps_mov[] = {
{ AV_PIX_FMT_PAL8, 1 },
{ AV_PIX_FMT_PAL8, 2 },
{ AV_PIX_FMT_PAL8, 4 },
@@ -337,3 +337,33 @@ const PixelFormatTag avpriv_pix_fmt_bps_mov[] = {
{ AV_PIX_FMT_PAL8, 33 },
{ AV_PIX_FMT_NONE, 0 },
};
+
+static enum AVPixelFormat find_pix_fmt(const PixelFormatTag *tags,
+ unsigned int fourcc)
+{
+ while (tags->pix_fmt != AV_PIX_FMT_NONE) {
+ if (tags->fourcc == fourcc)
+ return tags->pix_fmt;
+ tags++;
+ }
+ return AV_PIX_FMT_NONE;
+}
+
+enum AVPixelFormat avpriv_pix_fmt_find(enum PixelFormatTagLists list,
+ unsigned fourcc)
+{
+ const PixelFormatTag *tags;
+
+ switch (list) {
+ case PIX_FMT_LIST_RAW:
+ tags = raw_pix_fmt_tags;
+ break;
+ case PIX_FMT_LIST_AVI:
+ tags = pix_fmt_bps_avi;
+ break;
+ case PIX_FMT_LIST_MOV:
+ tags = pix_fmt_bps_mov;
+ break;
+ }
+ return find_pix_fmt(tags, fourcc);
+}