Skip to content

Commit 710312a

Browse files
committed
DirectShow: use FourCC as a codec name if unknown
1 parent 6ffea77 commit 710312a

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/video_capture/DirectShowGrabber.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1227,6 +1227,13 @@ static const CHAR * GetSubtypeNameA(const GUID *pSubtype)
12271227
// would use the header file that picks the A or W version.
12281228
static const CHAR * GetSubtypeName(const GUID *pSubtype)
12291229
{
1230-
return GetSubtypeNameA(pSubtype);
1230+
thread_local char fourcc[5] = "";
1231+
// the type is unknown to us, so print FourCC
1232+
if (LocateSubtype(pSubtype) == sizeof BitCountMap / sizeof BitCountMap[0] - 1) {
1233+
memcpy(fourcc, &pSubtype->Data1, 4);
1234+
return fourcc;
1235+
} else {
1236+
return GetSubtypeNameA(pSubtype);
1237+
}
12311238
}
12321239

0 commit comments

Comments
 (0)