[FFmpeg-devel] [PATCH] avcodec/raw: add avpriv_get_raw_pix_fmt_tags()

James Almer jamrial at gmail.com
Thu Aug 7 03:14:42 CEST 2014


Used to expose ff_raw_pix_fmt_tags[] to other libav* libraries

Signed-off-by: James Almer <jamrial at gmail.com>
---
 libavcodec/raw.c    | 5 +++++
 libavcodec/raw.h    | 6 ++++++
 libavdevice/dshow.c | 3 ++-
 3 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/libavcodec/raw.c b/libavcodec/raw.c
index 56c4a6b..62ad338 100644
--- a/libavcodec/raw.c
+++ b/libavcodec/raw.c
@@ -224,6 +224,11 @@ const PixelFormatTag ff_raw_pix_fmt_tags[] = {
     { AV_PIX_FMT_NONE, 0 },
 };
 
+const struct PixelFormatTag *avpriv_get_raw_pix_fmt_tags(void)
+{
+    return ff_raw_pix_fmt_tags;
+}
+
 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 1812825..a79b851 100644
--- a/libavcodec/raw.h
+++ b/libavcodec/raw.h
@@ -35,7 +35,13 @@ typedef struct PixelFormatTag {
     unsigned int fourcc;
 } PixelFormatTag;
 
+#if LIBAVCODEC_VERSION_MAJOR < 56
 extern av_export const PixelFormatTag ff_raw_pix_fmt_tags[];
+#else
+extern const PixelFormatTag ff_raw_pix_fmt_tags[]; // exposed through avpriv_get_raw_pix_fmt_tags()
+#endif
+
+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/libavdevice/dshow.c b/libavdevice/dshow.c
index adf36a7..e10ae4c 100644
--- a/libavdevice/dshow.c
+++ b/libavdevice/dshow.c
@@ -74,6 +74,7 @@ struct dshow_ctx {
 
 static enum AVPixelFormat dshow_pixfmt(DWORD biCompression, WORD biBitCount)
 {
+    const PixelFormatTag *tags = avpriv_get_raw_pix_fmt_tags();
     switch(biCompression) {
     case BI_BITFIELDS:
     case BI_RGB:
@@ -92,7 +93,7 @@ static enum AVPixelFormat dshow_pixfmt(DWORD biCompression, WORD biBitCount)
                 return AV_PIX_FMT_0RGB32;
         }
     }
-    return avpriv_find_pix_fmt(ff_raw_pix_fmt_tags, biCompression); // all others
+    return avpriv_find_pix_fmt(tags, biCompression); // all others
 }
 
 static int
-- 
1.8.5.5



More information about the ffmpeg-devel mailing list