[FFmpeg-devel] [PATCH] add MEDIASUBTYPE_RGB8 support

Jim Hauxwell james at dattrax.co.uk
Mon Feb 17 02:15:02 EET 2020


windows/win32/directshow/uncompressed-rgb-video-subtypes

The Magwell series of HDMI USB capture boards use this format for bgr24
input.
---
 libavcodec/raw.c    | 3 +++
 libavcodec/rawdec.c | 3 ++-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/libavcodec/raw.c b/libavcodec/raw.c
index b6fb91c1c6..f9ad1548c1 100644
--- a/libavcodec/raw.c
+++ b/libavcodec/raw.c
@@ -289,6 +289,9 @@ const PixelFormatTag ff_raw_pix_fmt_tags[] = {
     { AV_PIX_FMT_YUV444P16LE, MKTAG('I', '4', 'F', 'L') },
     { AV_PIX_FMT_YUV444P16BE, MKTAG('I', '4', 'F', 'B') },
 
+    /* directshow */
+    { AV_PIX_FMT_BGR24, MKTAG(0x7D, 0xEB, 0x36, 0xE4) }, /* MEDIASUBTYPE_RGB8 */
+
     /* special */
     { AV_PIX_FMT_RGB565LE,MKTAG( 3 ,  0 ,  0 ,  0 ) }, /* flipped RGB565LE */
     { AV_PIX_FMT_YUV444P, MKTAG('Y', 'V', '2', '4') }, /* YUV444P, swapped UV */
diff --git a/libavcodec/rawdec.c b/libavcodec/rawdec.c
index a110a690f5..43d8e8a5ae 100644
--- a/libavcodec/rawdec.c
+++ b/libavcodec/rawdec.c
@@ -111,7 +111,8 @@ static av_cold int raw_init_decoder(AVCodecContext *avctx)
          !memcmp(avctx->extradata + avctx->extradata_size - 9, "BottomUp", 9)) ||
         avctx->codec_tag == MKTAG('c','y','u','v') ||
         avctx->codec_tag == MKTAG(3, 0, 0, 0) ||
-        avctx->codec_tag == MKTAG('W','R','A','W'))
+        avctx->codec_tag == MKTAG('W','R','A','W') ||
+        avctx->codec_tag == MKTAG(0x7D, 0xEB, 0x36, 0xE4))
         context->flip = 1;
 
     if (avctx->pix_fmt == AV_PIX_FMT_MONOWHITE ||
-- 
2.17.1



More information about the ffmpeg-devel mailing list