设备管理器的封装类。
更多...
#include <av_device_mgr.h>
AVContext::StartContext()执行成功之后,App可以:
- 通过AVContext::GetAudioDeviceMgr()获得音频对应的AVDeviceMgr对象;
- 通过AVContext::GetVideoDeviceMgr()获得视频对应的AVDeviceMgr对象。
typedef void(* tencent::av::AVDeviceMgr::DeviceChangeCallback) (AVDeviceMgr *device_mgr, void *custom_data) |
此函数是和SetDeviceChangeCallback()一起使用的回调函数,用来通知App发生设备变更。
- 参数
-
device_mgr | 发生设备变更的AVDeviceMgr对象。 |
custom_data | 值等于调用SetDeviceOperationCallback()时的入参custom_data。 |
typedef void(* tencent::av::AVDeviceMgr::DeviceOperationCallback) (AVDeviceMgr *device_mgr, AVDevice::DeviceOperation oper, const std::string &device_id, int32 result, void *custom_data) |
此函数是和SetDeviceOperationCallback()一起使用的回调函数,用来异步返回设备操作的执行结果。 大部分设备操作都包含异步执行流程。为了避免App设置大量的异步回调,SDK统一把所有设备的异步回调集中到一起。
- 参数
-
device_mgr | 执行设备操作的AVDeviceMgr对象。 |
operation | 设备操作类型,详情见DeviceOperation的定义。 |
device_id | 操作对应的设备Id。 |
result | 错误码。 |
custom_data | 值等于调用SetDeviceOperationCallback()时的入参custom_data。 |
typedef void(* tencent::av::AVDeviceMgr::OnDeviveDetectNotify) (AVDeviceMgr *device_mgr, DetectedDeviceInfo &info, bool *pbSelect, void *custom_data) |
此函数是和SetDeviceDetectNotify()一起使用的回调函数,用来通知App发生设备热插拔的通知。
- 参数
-
device_mgr | 发生设备变更的AVDeviceMgr对象。 |
info | 热插拔的设备信息 具体可以查看DetectedDeviceInfo。 |
pbSelect | 当新插入设备时,这个值表示是否自动选上新的设备。 当拔除设备时,这个值指的是第一个设备是否自动选上。 这里可以根据info.isUsedDevice和info.isNewDevice做处理,如果这两个都是true的话,就代表当前使用的设备被拔掉。 |
custom_data | 值等于调用SetDeviceOperationCallback()时的入参custom_data。 |
virtual tencent::av::AVDeviceMgr::~AVDeviceMgr |
( |
| ) |
|
|
protectedvirtual |
virtual void tencent::av::AVDeviceMgr::ClearSelectedDevice |
( |
bool |
is_output | ) |
|
|
pure virtual |
- 参数
-
is_output | true停用输出设备,false停用输入设备。 |
virtual void tencent::av::AVDeviceMgr::EnableInputDevice |
( |
bool |
is_enable = true | ) |
|
|
pure virtual |
同步返回结果。如果没有特别需要,App不需要调用此接口。平时在进入房间之后,SDK内部 默认会打开所有选中的设备。
- 参数
-
[in] | is_enable | true打开,false关闭。 |
virtual void tencent::av::AVDeviceMgr::EnableOutputDevice |
( |
bool |
is_enable = true | ) |
|
|
pure virtual |
同步返回结果。如果没有特别需要,App不需要调用此接口。平时在进入房间之后,SDK内部 默认会打开所有选中的设备。
- 参数
-
[in] | is_enable | true打开,false关闭。 |
virtual AVDevice* tencent::av::AVDeviceMgr::GetDeviceById |
( |
const std::string & |
device_id | ) |
|
|
pure virtual |
- 参数
-
- 返回
- 如果存在对应ID的设备,则返回设备,否则返回NULL。
virtual int32 tencent::av::AVDeviceMgr::GetDeviceByType |
( |
const std::string & |
device_type, |
|
|
AVDevice ** |
device_array[] |
|
) |
| |
|
pure virtual |
- 参数
-
[in] | device_type | 设备类型。 |
[out] | device_array | 设备列表。 |
- 返回
- device_array对应的size。
virtual AVDevice* tencent::av::AVDeviceMgr::GetInputDevice |
( |
int32 |
index | ) |
|
|
pure virtual |
- 参数
-
[in] | index | 设备索引,不能超过GetInputDeviceCount()。 |
- 返回
- 成功返回AVDevice对象,超出索引返回NULL。
virtual int32 tencent::av::AVDeviceMgr::GetInputDeviceCount |
( |
| ) |
|
|
pure virtual |
virtual AVDevice* tencent::av::AVDeviceMgr::GetOutputDevice |
( |
int32 |
index | ) |
|
|
pure virtual |
- 参数
-
[in] | index | 设备索引,不能超过GetOutputDeviceCount()。 |
- 返回
- 成功返回AVDevice对象,超出索引返回NULL。
virtual int32 tencent::av::AVDeviceMgr::GetOutputDeviceCount |
( |
| ) |
|
|
pure virtual |
virtual AVDevice* tencent::av::AVDeviceMgr::GetSelectedInputDevice |
( |
int32 |
index | ) |
|
|
pure virtual |
- 参数
-
- 返回
- 成功返回索引对应的设备,否则返回NULL。
virtual int32 tencent::av::AVDeviceMgr::GetSelectedInputDeviceCount |
( |
| ) |
|
|
pure virtual |
virtual AVDevice* tencent::av::AVDeviceMgr::GetSelectedOutputDevice |
( |
int32 |
index | ) |
|
|
pure virtual |
- 参数
-
- 返回
- 成功则返回索引对应的设备,否则返回NULL。
virtual int32 tencent::av::AVDeviceMgr::GetSelectedOutputDeviceCount |
( |
| ) |
|
|
pure virtual |
virtual bool tencent::av::AVDeviceMgr::IsInputDeviceEnabled |
( |
| ) |
|
|
pure virtual |
virtual bool tencent::av::AVDeviceMgr::IsOutputDeviceEnabled |
( |
| ) |
|
|
pure virtual |
virtual int32 tencent::av::AVDeviceMgr::SelectInputDevice |
( |
const std::string & |
device_id, |
|
|
bool |
is_select = true |
|
) |
| |
|
pure virtual |
同步返回结果。App调用此方法选中/取消设备,SDK会自动在合适的时机打开/关闭设备。 这里的时机主要分两种情况:
- 未进入房间时,选中/取消选中设备不会产生任何变化。
- 进入房间后,选中/取消选中设备会进行对应的打开/关闭设备。
结果会通过SetDeviceOperationCallback()传入的device_change_callback进行通知。
- 参数
-
| device_id | 设备Id。 |
[in] | is_select | true选中,false取消选中。 |
- 返回
- AV_OK表示成功,其他返回值表示失败:
virtual int32 tencent::av::AVDeviceMgr::SelectOutputDevice |
( |
const std::string & |
device_id, |
|
|
bool |
is_select = true |
|
) |
| |
|
pure virtual |
同步返回结果。App调用此方法选中/取消设备,SDK会自动在合适的时机打开/关闭设备。 这里的时机主要分两种情况:
- 未进入房间时,选中/取消选中设备不会产生任何变化。
- 进入房间后,选中/取消选中设备会进行对应的打开/关闭设备。
结果会通过SetDeviceOperationCallback()传入的device_change_callback进行通知。
- 参数
-
| device_id | 设备Id。 |
[in] | is_select | true选中,false取消选中。 |
- 返回
- AV_OK表示成功,其他返回值表示失败。
virtual void tencent::av::AVDeviceMgr::SetDeviceChangeCallback |
( |
DeviceChangeCallback |
device_change_callback, |
|
|
void * |
custom_data = NULL |
|
) |
| |
|
pure virtual |
App可以通过设置设备变更回调,在回调函数中处理设备变更。
- 参数
-
[in] | device_change_callback | 函数指针,指向App定义的回调函数,NULL表示取消回调。 |
[in] | custom_data | App指定的一个没有类型的指针,SDK会在回调函数中把该值回传给App。 |
virtual void tencent::av::AVDeviceMgr::SetDeviceDetectNotify |
( |
OnDeviveDetectNotify |
notify, |
|
|
void * |
custom_data = NULL |
|
) |
| |
|
pure virtual |
App可以通过设置设备热插拔通知回调,在回调函数中处理设备变更。 当进入房间后,mic或扬声器插拔会触发这个回调。
- 参数
-
[in] | notify | 函数指针,指向App定义的回调函数,NULL表示取消回调。详细的说明请参考OnDeviveDetectNotify的注释 |
[in] | custom_data | App指定的一个没有类型的指针,SDK会在回调函数中把该值回传给App。 |
virtual void tencent::av::AVDeviceMgr::SetDeviceOperationCallback |
( |
DeviceOperationCallback |
device_operation_callback, |
|
|
void * |
custom_data = NULL |
|
) |
| |
|
pure virtual |
App可以通过设置设备操作回调,在回调函数中获得设备操作的执行结果。
- 参数
-
[in] | device_operation_callback | 函数指针,指向App定义的回调函数,NULL表示取消回调。 |
[in] | custom_data | App指定的一个没有类型的指针,SDK会在回调函数中把该值回传给App。 |