From: Hao Truong <[email protected]>

Map BI_RGB 24-bit and 32-bit DIB formats to the corresponding pixel formats.
This improves capture on devices that expose only RGB24/RGB32.

Signed-off-by: Hao Truong <[email protected]>
---
 libavdevice/dshow.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/libavdevice/dshow.c b/libavdevice/dshow.c
index 6e97304850..582b2d05fe 100644
--- a/libavdevice/dshow.c
+++ b/libavdevice/dshow.c
@@ -76,6 +76,14 @@ static enum AVPixelFormat dshow_pixfmt(DWORD biCompression, 
WORD biBitCount)
             case 32:
                 return AV_PIX_FMT_0RGB32;
         }
+    case 0xe436eb7b:
+        return AV_PIX_FMT_RGB565;
+    case 0xe436eb7c:
+        return AV_PIX_FMT_RGB555;
+    case 0xe436eb7d:
+        return AV_PIX_FMT_RGB24;
+    case 0xe436eb7e:
+        return AV_PIX_FMT_0RGB32;
     }
     return avpriv_pix_fmt_find(PIX_FMT_LIST_RAW, biCompression); // all others
 }
@@ -1581,7 +1589,7 @@ dshow_add_device(AVFormatContext *avctx,
         par->codec_type = AVMEDIA_TYPE_VIDEO;
         par->width      = fmt_info->width;
         par->height     = fmt_info->height;
-        par->codec_tag  = bih->biCompression;
+        par->codec_tag  = fmt_info->pix_fmt == AV_PIX_FMT_NONE ? 
bih->biCompression : 0;
         par->format     = fmt_info->pix_fmt;
         if (bih->biCompression == MKTAG('H', 'D', 'Y', 'C')) {
             av_log(avctx, AV_LOG_DEBUG, "attempt to use full range for 
HDYC...\n");
-- 
2.43.0

_______________________________________________
ffmpeg-devel mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to