From 946e818077f63363554137c297aa81611cf774d3 Mon Sep 17 00:00:00 2001 From: liuhua Date: Thu, 10 May 2018 09:19:59 +0800 Subject: [PATCH] for default mjpg output , convert to other support type --- escapi_dll/capture.cpp | 30 +++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/escapi_dll/capture.cpp b/escapi_dll/capture.cpp index 494d30c..140c3c4 100644 --- a/escapi_dll/capture.cpp +++ b/escapi_dll/capture.cpp @@ -515,7 +515,13 @@ int CaptureClass::isMediaOk(IMFMediaType *aType, int aIndex) break; } } + + if (found) + { + hr = setVideoType(aType); + } } + return found; } @@ -660,15 +666,21 @@ HRESULT CaptureClass::initCapture(int aDevice) DO_OR_DIE_CRITSECTION; - hr = setVideoType(type); - - DO_OR_DIE_CRITSECTION; - - hr = mReader->SetCurrentMediaType( - (DWORD)MF_SOURCE_READER_FIRST_VIDEO_STREAM, - NULL, - type - ); + //for default mjpg type , convert to other support type + if (isMediaOk(type, preferredmode)) + hr = 0; + else + hr = -1; + + //hr = setVideoType(type); + // + //DO_OR_DIE_CRITSECTION; + + //hr = mReader->SetCurrentMediaType( + // (DWORD)MF_SOURCE_READER_FIRST_VIDEO_STREAM, + // NULL, + // type + //); DO_OR_DIE_CRITSECTION;