本文整理汇总了C++中DSCaptureDevice::getSupportedFormats方法的典型用法代码示例。如果您正苦于以下问题:C++ DSCaptureDevice::getSupportedFormats方法的具体用法?C++ DSCaptureDevice::getSupportedFormats怎么用?C++ DSCaptureDevice::getSupportedFormats使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DSCaptureDevice
的用法示例。
在下文中一共展示了DSCaptureDevice::getSupportedFormats方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: fprintf
/**
* \brief Get formats supported by native capture device.
* \param env JNI environment
* \param obj DSCaptureDevice object
* \param ptr native pointer of DSCaptureDevice
* \return array of DSFormat object
*/
JNIEXPORT jobjectArray JNICALL Java_org_jitsi_impl_neomedia_jmfext_media_protocol_directshow_DSCaptureDevice_getSupportedFormats
(JNIEnv* env, jobject obj, jlong ptr)
{
jobjectArray ret = NULL;
DSCaptureDevice* dev = reinterpret_cast<DSCaptureDevice*>(ptr);
std::list<DSFormat> formats;
jclass clazzDSFormat = NULL;
jmethodID initDSFormat = NULL;
jsize i = 0;
/* get DSFormat class to instantiate some object */
clazzDSFormat = env->FindClass("org/jitsi/impl/neomedia/jmfext/media/protocol/directshow/DSFormat");
if(clazzDSFormat == NULL)
return NULL;
initDSFormat = env->GetMethodID(clazzDSFormat, "<init>", "(III)V");
if(initDSFormat == NULL)
return NULL;
formats = dev->getSupportedFormats();
ret = env->NewObjectArray(static_cast<jsize>(formats.size()), clazzDSFormat, NULL);
for(std::list<DSFormat>::iterator it = formats.begin() ; it != formats.end() ; ++it)
{
DSFormat tmp = (*it);
jobject o
= env->NewObject(
clazzDSFormat,
initDSFormat,
static_cast<jint>(tmp.width),
static_cast<jint>(tmp.height),
static_cast<jint>(tmp.pixelFormat));
if(o == NULL)
{
fprintf(stderr, "failed!!\n");
fflush(stderr);
}
else
{
env->SetObjectArrayElement(ret, i, o);
env->DeleteLocalRef(o);
i++;
}
}
return ret;
}
开发者ID:Sts0mrg0,项目名称:libjitsi,代码行数:57,代码来源:org_jitsi_impl_neomedia_jmfext_media_protocol_directshow_DSCaptureDevice.cpp