WIP
This commit is contained in:
47
links.c
47
links.c
@ -100,6 +100,22 @@ error:
|
||||
return -1;
|
||||
}
|
||||
|
||||
int links_open_buffer_list_from(device_t *dev, bool do_capture, buffer_list_t *parent_buffer, unsigned format)
|
||||
{
|
||||
if (!parent_buffer) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
return device_open_buffer_list(
|
||||
dev,
|
||||
do_capture,
|
||||
parent_buffer->fmt_width,
|
||||
parent_buffer->fmt_height,
|
||||
format ? format : parent_buffer->fmt_format,
|
||||
parent_buffer->nbufs
|
||||
);
|
||||
}
|
||||
|
||||
int links_init(link_t *all_links)
|
||||
{
|
||||
// create all outputs (sinks)
|
||||
@ -109,6 +125,20 @@ int links_init(link_t *all_links)
|
||||
if (!link->capture) {
|
||||
E_LOG_ERROR(NULL, "Missing link capture.");
|
||||
}
|
||||
|
||||
if (link->capture_format) {
|
||||
int ret = links_open_buffer_list_from(
|
||||
link->capture,
|
||||
true,
|
||||
link->capture->upstream_device ? link->capture->upstream_device->output_list : link->capture->output_list,
|
||||
link->capture_format
|
||||
);
|
||||
|
||||
if (ret < 0) {
|
||||
E_LOG_ERROR(link->capture, "Failed to create capture_list.");
|
||||
}
|
||||
}
|
||||
|
||||
if (!link->capture->capture_list) {
|
||||
E_LOG_ERROR(link->capture, "Missing capture device.");
|
||||
}
|
||||
@ -116,20 +146,9 @@ int links_init(link_t *all_links)
|
||||
for (int j = 0; link->outputs[j]; j++) {
|
||||
device_t *output = link->outputs[j];
|
||||
|
||||
if (output->output_list) {
|
||||
E_LOG_ERROR(output, "Device already has output created. Duplicate?");
|
||||
}
|
||||
|
||||
int ret = device_open_buffer_list(output, false,
|
||||
link->capture->capture_list->fmt_width,
|
||||
link->capture->capture_list->fmt_height,
|
||||
link->capture->capture_list->fmt_format,
|
||||
link->capture->capture_list->nbufs,
|
||||
true
|
||||
);
|
||||
|
||||
int ret = links_open_buffer_list_from(output, false, link->capture->capture_list, 0);
|
||||
if (ret < 0) {
|
||||
E_LOG_ERROR(output, "Failed to create capture.");
|
||||
E_LOG_ERROR(output, "Failed to create output_list.");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -150,9 +169,11 @@ int links_loop(link_t *all_links, bool *running)
|
||||
|
||||
while(*running) {
|
||||
if (links_step(all_links, 1000) < 0) {
|
||||
links_stream(all_links, false);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
links_stream(all_links, false);
|
||||
return 0;
|
||||
}
|
Reference in New Issue
Block a user