mirror of
https://github.com/opencv/opencv.git
synced 2025-01-13 00:01:27 +08:00
fix #3477:
CV_CAP_PROP_SUPPORTED_PREVIEW_SIZES_STRING property is not supported
by all VideoCapture backends. Some backends can return 0.0 or -1.0.(cherry picked from commit c41e8006c7
)
This commit is contained in:
parent
2c7cf52e3b
commit
5f88e2b496
@ -329,7 +329,10 @@ JNIEXPORT jstring JNICALL Java_org_opencv_highgui_VideoCapture_n_1getSupportedPr
|
|||||||
VideoCapture* me = (VideoCapture*) self; //TODO: check for NULL
|
VideoCapture* me = (VideoCapture*) self; //TODO: check for NULL
|
||||||
union {double prop; const char* name;} u;
|
union {double prop; const char* name;} u;
|
||||||
u.prop = me->get(CV_CAP_PROP_SUPPORTED_PREVIEW_SIZES_STRING);
|
u.prop = me->get(CV_CAP_PROP_SUPPORTED_PREVIEW_SIZES_STRING);
|
||||||
return env->NewStringUTF(u.name);
|
// VideoCapture::get can return 0.0 or -1.0 if it doesn't support
|
||||||
|
// CV_CAP_PROP_SUPPORTED_PREVIEW_SIZES_STRING
|
||||||
|
if (u.prop != 0.0 && u.prop != -1.0)
|
||||||
|
return env->NewStringUTF(u.name);
|
||||||
} catch(const std::exception &e) {
|
} catch(const std::exception &e) {
|
||||||
throwJavaException(env, &e, method_name);
|
throwJavaException(env, &e, method_name);
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
|
Loading…
Reference in New Issue
Block a user