Merge pull request #18736 from mshabunin:mfx-frame-size-34

This commit is contained in:
Alexander Alekhin 2020-11-05 17:00:35 +00:00
commit 39ecd96b09
3 changed files with 20 additions and 3 deletions

View File

@ -111,6 +111,7 @@ VideoCapture_IntelMFX::VideoCapture_IntelMFX(const cv::String &filename)
return; return;
} }
frameSize = Size(params.mfx.FrameInfo.CropW, params.mfx.FrameInfo.CropH);
good = true; good = true;
} }
@ -126,10 +127,23 @@ VideoCapture_IntelMFX::~VideoCapture_IntelMFX()
cleanup(deviceHandler); cleanup(deviceHandler);
} }
double VideoCapture_IntelMFX::getProperty(int) const double VideoCapture_IntelMFX::getProperty(int prop) const
{ {
MSG(cerr << "MFX: getProperty() is not implemented" << endl); if (!good)
return 0; {
MSG(cerr << "MFX: can not call getProperty(), backend has not been initialized" << endl);
return 0;
}
switch (prop)
{
case CAP_PROP_FRAME_WIDTH:
return frameSize.width;
case CAP_PROP_FRAME_HEIGHT:
return frameSize.height;
default:
MSG(cerr << "MFX: unsupported property" << endl);
return 0;
}
} }
bool VideoCapture_IntelMFX::setProperty(int, double) bool VideoCapture_IntelMFX::setProperty(int, double)

View File

@ -34,6 +34,7 @@ private:
MFXVideoDECODE *decoder; MFXVideoDECODE *decoder;
SurfacePool *pool; SurfacePool *pool;
void *outSurface; void *outSurface;
cv::Size frameSize;
bool good; bool good;
}; };

View File

@ -111,6 +111,8 @@ TEST_P(Videoio_MFX, read_write_raw)
VideoCapture cap; VideoCapture cap;
cap.open(filename, CAP_INTEL_MFX); cap.open(filename, CAP_INTEL_MFX);
ASSERT_TRUE(cap.isOpened()); ASSERT_TRUE(cap.isOpened());
EXPECT_EQ(FRAME_SIZE.width, cap.get(CAP_PROP_FRAME_WIDTH));
EXPECT_EQ(FRAME_SIZE.height, cap.get(CAP_PROP_FRAME_HEIGHT));
for (int i = 0; i < FRAME_COUNT; ++i) for (int i = 0; i < FRAME_COUNT; ++i)
{ {
ASSERT_TRUE(cap.read(frame)); ASSERT_TRUE(cap.read(frame));