mirror of
https://github.com/pion/mediadevices.git
synced 2025-09-26 20:41:46 +08:00
reveal Name var for driver.info
This commit is contained in:

committed by
Eric Daniels

parent
b9ce5bb861
commit
57c9ba0fc5
@@ -27,6 +27,7 @@
|
||||
#define MAX_DEVICES 8
|
||||
#define MAX_PROPERTIES 64
|
||||
#define MAX_DEVICE_UID_CHARS 64
|
||||
#define MAX_DEVICE_NAME_CHARS 64
|
||||
|
||||
typedef const char* STATUS;
|
||||
static STATUS STATUS_OK = (STATUS) NULL;
|
||||
@@ -65,6 +66,7 @@ typedef struct AVBindSession AVBindSession, *PAVBindSession;
|
||||
|
||||
typedef struct {
|
||||
char uid[MAX_DEVICE_UID_CHARS + 1];
|
||||
char name[MAX_DEVICE_NAME_CHARS + 1];
|
||||
} AVBindDevice, *PAVBindDevice;
|
||||
|
||||
// AVBindDevices returns a list of AVBindDevices. The result array is pointing to a static
|
||||
|
@@ -201,6 +201,8 @@ STATUS AVBindDevices(AVBindMediaType mediaType, PAVBindDevice *ppDevices, int *p
|
||||
pDevice = devices + i;
|
||||
strncpy(pDevice->uid, refDevice.uniqueID.UTF8String, MAX_DEVICE_UID_CHARS);
|
||||
pDevice->uid[MAX_DEVICE_UID_CHARS] = '\0';
|
||||
strncpy(pDevice->name, refDevice.localizedName.UTF8String, MAX_DEVICE_NAME_CHARS);
|
||||
pDevice->name[MAX_DEVICE_NAME_CHARS] = '\0';
|
||||
i++;
|
||||
}
|
||||
|
||||
|
@@ -34,6 +34,7 @@ type Device struct {
|
||||
// UID is a unique identifier for a device
|
||||
UID string
|
||||
cDevice C.AVBindDevice
|
||||
Name string
|
||||
}
|
||||
|
||||
func frameFormatToAVBind(f frame.Format) (C.AVBindFrameFormat, bool) {
|
||||
@@ -87,6 +88,7 @@ func Devices(mediaType MediaType) ([]Device, error) {
|
||||
for i := range devices {
|
||||
devices[i].UID = C.GoString(&cDevices[i].uid[0])
|
||||
devices[i].cDevice = cDevices[i]
|
||||
devices[i].Name = C.GoString(&cDevices[i].name[0])
|
||||
}
|
||||
|
||||
return devices, nil
|
||||
|
@@ -32,6 +32,7 @@ func Initialize() {
|
||||
driver.GetManager().Register(cam, driver.Info{
|
||||
Label: device.UID,
|
||||
DeviceType: driver.Camera,
|
||||
Name: device.Name,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
@@ -116,6 +116,7 @@ func discover(discovered map[string]struct{}, pattern string) {
|
||||
Label: label + LabelSeparator + reallink,
|
||||
DeviceType: driver.Camera,
|
||||
Priority: priority,
|
||||
Name: label,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
@@ -30,6 +30,7 @@ type Info struct {
|
||||
Label string
|
||||
DeviceType DeviceType
|
||||
Priority Priority
|
||||
Name string
|
||||
}
|
||||
|
||||
type Adapter interface {
|
||||
|
Reference in New Issue
Block a user