CAP_PROP_AUTOFOCUS =39,
CAP_PROP_SAR_NUM =40, //!< Sample aspect ratio: num/den (num)
CAP_PROP_SAR_DEN =41, //!< Sample aspect ratio: num/den (den)
+ CAP_PROP_BACKEND =42, //!< current backend (enum VideoCaptureAPIs). Read-only property
#ifndef CV_DOXYGEN
CV__CAP_PROP_LATEST
#endif
bool VideoCapture::set(int propId, double value)
{
+ CV_CheckNE(propId, (int)CAP_PROP_BACKEND, "Can set read-only property");
+
if (!icap.empty())
return icap->setProperty(propId, value);
return cvSetCaptureProperty(cap, propId, value) != 0;
double VideoCapture::get(int propId) const
{
+ if (propId == CAP_PROP_BACKEND)
+ {
+ int api = 0;
+ if (icap)
+ api = icap->isOpened() ? icap->getCaptureDomain() : 0;
+ else if (cap)
+ api = cap->getCaptureDomain();
+ if (api <= 0)
+ return -1.0;
+ return (double)api;
+ }
if (!icap.empty())
return icap->getProperty(propId);
return cap ? cap->getProperty(propId) : 0;
bool VideoWriter::set(int propId, double value)
{
+ CV_CheckNE(propId, (int)CAP_PROP_BACKEND, "Can set read-only property");
+
if (!iwriter.empty())
return iwriter->setProperty(propId, value);
return false;
double VideoWriter::get(int propId) const
{
+ if (propId == CAP_PROP_BACKEND)
+ {
+ int api = 0;
+ if (iwriter)
+ api = iwriter->getCaptureDomain();
+ else if (writer)
+ api = writer->getCaptureDomain();
+ if (api <= 0)
+ return -1.0;
+ return (double)api;
+ }
if (!iwriter.empty())
return iwriter->getProperty(propId);
return 0.;