设备测试的封装类。
更多...
#include <av_device_test.h>
AVContext::StartContext()执行成功之后,App可以通过AVContext::GetDeviceTest()获得对应的AVDeviceTest对象。
typedef void(* tencent::av::AVDeviceTest::DeviceOperationCallback) (AVDeviceTest *device_test, AVDevice::DeviceOperation oper, const std::string &device_id, int32 result, void *custom_data) |
此函数是和SetDeviceOperationCallback()一起使用的回调函数,用来异步返回设备操作的执行结果。 大部分设备操作都包含异步执行流程。为了避免App设置大量的异步回调,SDK统一把所有设备的异步回调集中到一起。
- 参数
-
device_test | 执行设备操作的AVDeviceTest对象。 |
operation | 设备操作类型,详情见DeviceOperation的定义。 |
device_id | 操作对应的设备Id。 |
result | 错误码。 |
custom_data | 值等于调用SetDeviceOperationCallback()时的入参custom_data。 |
virtual tencent::av::AVDeviceTest::~AVDeviceTest |
( |
| ) |
|
|
protectedvirtual |
virtual int32 tencent::av::AVDeviceTest::EnableDevice |
( |
const std::string & |
device_id, |
|
|
bool |
is_enable = true |
|
) |
| |
|
pure virtual |
打开/关闭设备。
- 参数
-
| device_id | 设备Id。 |
[in] | is_enable | true打开,false关闭。 |
- 返回
- 返回值为AV_OK时表示已去执行系统的打开/关闭设备操作,并通过SetDeviceOperationCallback()传入的回调函数异步通知操作结果;其他返回值表示操作失败,不会执行前述的回调函数。
virtual AVDevice* tencent::av::AVDeviceTest::GetDeviceById |
( |
const std::string & |
device_id | ) |
|
|
pure virtual |
- 参数
-
- 返回
- 如果存在对应ID的设备,则返回设备,否则返回NULL。
virtual int32 tencent::av::AVDeviceTest::GetDeviceCountByType |
( |
const std::string & |
device_type | ) |
|
|
pure virtual |
- 参数
-
[in] | device_type | 设备类型。注意,支持设备测试的设备类型仅有DEVICE_MIC、DEVICE_PLAYER和DEVICE_CAMERA,也就是麦克风、扬声器和摄像头。 |
- 返回
- 如果支持对应的设备类型,则返回该设备类型的设备个数,否则返回0。
virtual std::vector<std::string> tencent::av::AVDeviceTest::GetDeviceIdListByType |
( |
const std::string & |
device_type | ) |
|
|
pure virtual |
- 参数
-
[in] | device_type | 设备类型。注意,支持设备测试的设备类型仅有DEVICE_MIC、DEVICE_PLAYER和DEVICE_CAMERA,也就是麦克风、扬声器和摄像头。 |
- 返回
- 该设备类型的设备id列表。
virtual int32 tencent::av::AVDeviceTest::GetDeviceListByType |
( |
const std::string & |
device_type, |
|
|
AVDevice ** |
device_array[] |
|
) |
| |
|
pure virtual |
- 参数
-
[in] | device_type | 设备类型。注意,支持设备测试的设备类型仅有DEVICE_MIC、DEVICE_PLAYER和DEVICE_CAMERA,也就是麦克风、扬声器和摄像头。 |
[out] | device_array | 设备列表。 |
- 返回
- device_array对应的size。
virtual std::vector<std::string> tencent::av::AVDeviceTest::GetDeviceNameListByType |
( |
const std::string & |
device_type | ) |
|
|
pure virtual |
- 参数
-
[in] | device_type | 设备类型。注意,支持设备测试的设备类型仅有DEVICE_MIC、DEVICE_PLAYER和DEVICE_CAMERA,也就是麦克风、扬声器和摄像头。 |
- 返回
- 该设备类型的设备名称列表。
virtual void tencent::av::AVDeviceTest::SetDeviceOperationCallback |
( |
DeviceOperationCallback |
device_operation_callback, |
|
|
void * |
custom_data = NULL |
|
) |
| |
|
pure virtual |
App可以通过设置设备操作回调,在回调函数中获得设备操作的执行结果。
- 参数
-
[in] | device_operation_callback | 函数指针,指向App定义的回调函数,NULL表示取消回调。 |
[in] | custom_data | App指定的一个没有类型的指针,SDK会在回调函数中把该值回传给App。 |