mirror of
https://github.com/opencv/opencv.git
synced 2024-11-29 13:47:32 +08:00
Fixed selecting media type in DShow video capture.
Set correct value of sample size when calling IAMStreamConfig::SetFormat function. For non-RGB media type it can be set to zero value. (See http://msdn.microsoft.com/en-us/library/windows/desktop/dd373477%28v=vs.85%29.aspx)
This commit is contained in:
parent
7018f94959
commit
7e78b5d06e
@ -2427,7 +2427,15 @@ static bool setSizeAndSubtype(videoDevice * VD, int attemptWidth, int attemptHei
|
||||
VD->pAmMediaType->subtype = mediatype;
|
||||
|
||||
//buffer size
|
||||
VD->pAmMediaType->lSampleSize = attemptWidth*attemptHeight*3;
|
||||
if (mediatype == MEDIASUBTYPE_RGB24)
|
||||
{
|
||||
VD->pAmMediaType->lSampleSize = attemptWidth*attemptHeight*3;
|
||||
}
|
||||
else
|
||||
{
|
||||
// For compressed data, the value can be zero.
|
||||
VD->pAmMediaType->lSampleSize = 0;
|
||||
}
|
||||
|
||||
//set fps if requested
|
||||
if( VD->requestedFrameTime != -1){
|
||||
|
Loading…
Reference in New Issue
Block a user