From 710312a511158aa5cfb2d014268e15882e2f087c Mon Sep 17 00:00:00 2001 From: Martin Pulec Date: Tue, 4 Nov 2014 15:49:47 +0100 Subject: [PATCH] DirectShow: use FourCC as a codec name if unknown --- src/video_capture/DirectShowGrabber.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/video_capture/DirectShowGrabber.cpp b/src/video_capture/DirectShowGrabber.cpp index 21b6dfabe..a534ba9c3 100644 --- a/src/video_capture/DirectShowGrabber.cpp +++ b/src/video_capture/DirectShowGrabber.cpp @@ -1227,6 +1227,13 @@ static const CHAR * GetSubtypeNameA(const GUID *pSubtype) // would use the header file that picks the A or W version. static const CHAR * GetSubtypeName(const GUID *pSubtype) { - return GetSubtypeNameA(pSubtype); + thread_local char fourcc[5] = ""; + // the type is unknown to us, so print FourCC + if (LocateSubtype(pSubtype) == sizeof BitCountMap / sizeof BitCountMap[0] - 1) { + memcpy(fourcc, &pSubtype->Data1, 4); + return fourcc; + } else { + return GetSubtypeNameA(pSubtype); + } }