本文整理汇总了C++中DSCaptureDevice类的典型用法代码示例。如果您正苦于以下问题:C++ DSCaptureDevice类的具体用法?C++ DSCaptureDevice怎么用?C++ DSCaptureDevice使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了DSCaptureDevice类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
/**
* \brief Get current format.
* \param env JNI environment
* \param obj object
* \param native pointer
* \return current format
*/
JNIEXPORT jobject JNICALL Java_net_java_sip_communicator_impl_neomedia_directshow_DSCaptureDevice_getFormat
(JNIEnv* env, jobject obj, jlong ptr)
{
DSCaptureDevice* dev = reinterpret_cast<DSCaptureDevice*>(ptr);
VideoFormat fmt = dev->getFormat();
jclass clazzDSFormat = NULL;
jmethodID initDSFormat = NULL;
jobject ret = NULL;
/* get DSFormat class to instantiate some object */
clazzDSFormat = env->FindClass("net/java/sip/communicator/impl/neomedia/directshow/DSFormat");
if(clazzDSFormat == NULL)
{
return NULL;
}
initDSFormat = env->GetMethodID(clazzDSFormat, "<init>", "(IIJ)V");
if(initDSFormat == NULL)
{
return NULL;
}
ret = env->NewObject(clazzDSFormat, initDSFormat, static_cast<size_t>(fmt.width),
static_cast<size_t>(fmt.height), static_cast<jlong>(fmt.pixelFormat));
return ret;
}
开发者ID:Echo-tcx,项目名称:Jitsi,代码行数:34,代码来源:net_java_sip_communicator_impl_neomedia_directshow_DSCaptureDevice.cpp
示例2: Grabber
/**
* \brief Set delegate.
* \param env JNI environment
* \param obj object
* \param ptr native pointer on DSCaptureDevice
* \param delegate delegate object
*/
JNIEXPORT void JNICALL Java_net_java_sip_communicator_impl_neomedia_directshow_DSCaptureDevice_setDelegate
(JNIEnv* env, jobject obj, jlong ptr, jobject delegate)
{
Grabber* grab = NULL;
DSCaptureDevice* dev = reinterpret_cast<DSCaptureDevice*>(ptr);
DSGrabberCallback* prev = dev->getCallback();
if(delegate != NULL)
{
delegate = env->NewGlobalRef(delegate);
if(delegate)
{
JavaVM* vm = NULL;
/* get JavaVM */
env->GetJavaVM(&vm);
grab = new Grabber(vm, delegate, dev);
dev->setCallback(grab);
}
}
else
{
dev->setCallback(NULL);
}
if(prev)
{
jobject tmp_delegate = ((Grabber*)prev)->m_delegate;
if(tmp_delegate)
{
env->DeleteGlobalRef(tmp_delegate);
}
delete prev;
}
}
开发者ID:Echo-tcx,项目名称:Jitsi,代码行数:41,代码来源:net_java_sip_communicator_impl_neomedia_directshow_DSCaptureDevice.cpp
示例3: SampleGrabberCB
/**
* \brief Set delegate.
* \param env JNI environment
* \param obj object
* \param ptr native pointer on DSCaptureDevice
* \param delegate delegate object
*/
JNIEXPORT void JNICALL Java_org_jitsi_impl_neomedia_jmfext_media_protocol_directshow_DSCaptureDevice_setDelegate
(JNIEnv* env, jobject obj, jlong ptr, jobject delegate)
{
SampleGrabberCB* grab = NULL;
DSCaptureDevice* dev = reinterpret_cast<DSCaptureDevice*>(ptr);
BasicSampleGrabberCB* prev = dev->getCallback();
if(delegate != NULL)
{
delegate = env->NewGlobalRef(delegate);
if(delegate)
{
JavaVM* vm = NULL;
/* get JavaVM */
env->GetJavaVM(&vm);
grab = new SampleGrabberCB(vm, delegate, dev);
dev->setCallback(grab);
}
}
else
{
dev->setCallback(NULL);
}
if(prev)
{
jobject tmp_delegate = ((SampleGrabberCB *) prev)->_delegate;
if(tmp_delegate)
env->DeleteGlobalRef(tmp_delegate);
delete prev;
}
}
开发者ID:Sts0mrg0,项目名称:libjitsi,代码行数:39,代码来源:org_jitsi_impl_neomedia_jmfext_media_protocol_directshow_DSCaptureDevice.cpp
示例4:
/**
* \brief Get current format.
* \param env JNI environment
* \param obj object
* \param native pointer
* \return current format
*/
JNIEXPORT jobject JNICALL Java_org_jitsi_impl_neomedia_jmfext_media_protocol_directshow_DSCaptureDevice_getFormat
(JNIEnv* env, jobject obj, jlong ptr)
{
DSCaptureDevice* dev = reinterpret_cast<DSCaptureDevice*>(ptr);
DSFormat fmt = dev->getFormat();
jclass clazzDSFormat = NULL;
jmethodID initDSFormat = NULL;
/* 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;
return
env->NewObject(
clazzDSFormat,
initDSFormat,
static_cast<jint>(fmt.width),
static_cast<jint>(fmt.height),
static_cast<jint>(fmt.pixelFormat));
}
开发者ID:Sts0mrg0,项目名称:libjitsi,代码行数:33,代码来源:org_jitsi_impl_neomedia_jmfext_media_protocol_directshow_DSCaptureDevice.cpp
示例5: return
JNIEXPORT jint JNICALL
Java_org_jitsi_impl_neomedia_jmfext_media_protocol_directshow_DSCaptureDevice_stop
(JNIEnv *env, jobject obj, jlong ptr)
{
DSCaptureDevice *thiz = reinterpret_cast<DSCaptureDevice *>(ptr);
return (jint) (thiz->stop());
}
开发者ID:Sts0mrg0,项目名称:libjitsi,代码行数:8,代码来源:org_jitsi_impl_neomedia_jmfext_media_protocol_directshow_DSCaptureDevice.cpp
示例6: 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
示例7: memcpy
/**
* \brief Get name of native capture device.
* \param env JNI environment
* \param obj DSCaptureDevice object
* \param ptr native pointer of DSCaptureDevice
* \return name of the native capture device
*/
JNIEXPORT jstring JNICALL Java_net_java_sip_communicator_impl_neomedia_directshow_DSCaptureDevice_getName
(JNIEnv* env, jobject obj, jlong ptr)
{
DSCaptureDevice* dev = reinterpret_cast<DSCaptureDevice*>(ptr);
jstring ret = NULL;
jsize len = static_cast<jsize>(wcslen(dev->getName()));
jchar* name = new jchar[len];
/* jchar is two bytes! */
memcpy((void*)name, (void*)dev->getName(), len * 2);
ret = env->NewString(name, len);
delete[] name;
return ret;
}
开发者ID:Echo-tcx,项目名称:Jitsi,代码行数:23,代码来源:net_java_sip_communicator_impl_neomedia_directshow_DSCaptureDevice.cpp
示例8: CoCreateInstance
void DSManager::initCaptureDevices()
{
HRESULT ret = 0;
VARIANT name;
ICreateDevEnum* devEnum = NULL;
IEnumMoniker* monikerEnum = NULL;
IMoniker* moniker = NULL;
if(m_devices.size() > 0)
{
/* clean up our list in case of reinitialization */
for(std::list<DSCaptureDevice*>::iterator it = m_devices.begin() ; it != m_devices.end() ; ++it)
{
delete *it;
}
m_devices.clear();
}
/* get the available devices list */
ret = CoCreateInstance(CLSID_SystemDeviceEnum, NULL, CLSCTX_INPROC_SERVER,
IID_ICreateDevEnum, (void**)&devEnum);
if(FAILED(ret))
{
return;
}
ret = devEnum->CreateClassEnumerator(CLSID_VideoInputDeviceCategory,
&monikerEnum, 0);
/* error or no devices */
if(FAILED(ret) || ret == S_FALSE)
{
devEnum->Release();
return;
}
/* loop and initialize all available capture devices */
while(monikerEnum->Next(1, &moniker, 0) == S_OK)
{
DSCaptureDevice* captureDevice = NULL;
IPropertyBag* propertyBag = NULL;
{
IBaseFilter* cp = NULL;
if(!FAILED(moniker->BindToObject(0, 0, IID_IBaseFilter, (void**)&cp)))
{
IAMVfwCaptureDialogs* vfw = NULL;
if(!FAILED(
cp->QueryInterface(IID_IAMVfwCaptureDialogs, (void**)&vfw)))
{
if(vfw)
{
vfw->Release();
cp->Release();
continue;
}
}
}
}
/* get properties of the device */
ret = moniker->BindToStorage(0, 0, IID_IPropertyBag, (void**)&propertyBag);
if(!FAILED(ret))
{
VariantInit(&name);
ret = propertyBag->Read(L"FriendlyName", &name, 0);
if(FAILED(ret))
{
VariantClear(&name);
propertyBag->Release();
moniker->Release();
continue;
}
/* create a new capture device */
captureDevice = new DSCaptureDevice(name.bstrVal);
/* wprintf(L"%ws\n", name.bstrVal); */
if(captureDevice && captureDevice->initDevice(moniker))
{
/* initialization success, add to the list */
m_devices.push_back(captureDevice);
}
else
{
/* printf("failed to initialize device\n"); */
delete captureDevice;
}
/* clean up */
VariantClear(&name);
propertyBag->Release();
}
moniker->Release();
}
/* cleanup */
monikerEnum->Release();
//.........这里部分代码省略.........