Find interface entity by type
This commit is contained in:
parent
26f0d561cd
commit
3cc9c9b867
11
device.c
11
device.c
|
@ -176,6 +176,17 @@ const struct media_v2_entity *mp_device_find_entity(const MPDevice *device, cons
|
|||
return NULL;
|
||||
}
|
||||
|
||||
const struct media_v2_entity *mp_device_find_entity_type(const MPDevice *device, const uint32_t type)
|
||||
{
|
||||
// Find the entity from the entity type
|
||||
for (uint32_t i = 0; i < device->num_entities; ++i) {
|
||||
if (device->entities[i].function == type) {
|
||||
return &device->entities[i];
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
const struct media_device_info *mp_device_get_info(const MPDevice *device)
|
||||
{
|
||||
return &device->info;
|
||||
|
|
1
device.h
1
device.h
|
@ -18,6 +18,7 @@ bool mp_device_setup_link(MPDevice *device, uint32_t source_pad_id, uint32_t sin
|
|||
|
||||
const struct media_device_info *mp_device_get_info(const MPDevice *device);
|
||||
const struct media_v2_entity *mp_device_find_entity(const MPDevice *device, const char *driver_name);
|
||||
const struct media_v2_entity *mp_device_find_entity_type(const MPDevice *device, const uint32_t type);
|
||||
const struct media_v2_entity *mp_device_get_entity(const MPDevice *device, uint32_t id);
|
||||
const struct media_v2_entity *mp_device_get_entities(const MPDevice *device);
|
||||
size_t mp_device_get_num_entities(const MPDevice *device);
|
||||
|
|
|
@ -116,7 +116,7 @@ static void setup_camera(MPDeviceList **device_list, const struct mp_camera_conf
|
|||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
const struct media_v2_entity *entity = mp_device_find_entity(info->device, info->media_dev_name);
|
||||
const struct media_v2_entity *entity = mp_device_find_entity_type(info->device, MEDIA_ENT_F_IO_V4L);
|
||||
if (!entity) {
|
||||
g_printerr("Could not find device video entity\n");
|
||||
exit(EXIT_FAILURE);
|
||||
|
|
Loading…
Reference in New Issue