}
}
+void check_filter_outputs(void)
+{
+ int i;
+ for (i = 0; i < nb_filtergraphs; i++) {
+ int n;
+ for (n = 0; n < filtergraphs[i]->nb_outputs; n++) {
+ OutputFilter *output = filtergraphs[i]->outputs[n];
+ if (!output->ost) {
+ av_log(NULL, AV_LOG_FATAL, "Filter %s has an unconnected output\n", output->name);
+ exit_program(1);
+ }
+ }
+ }
+}
+
static int sub2video_prepare(InputStream *ist, InputFilter *ifilter)
{
AVFormatContext *avf = input_files[ist->file_index]->ctx;
if ((ret = avfilter_graph_parse2(fg->graph, graph_desc, &inputs, &outputs)) < 0)
goto fail;
- if (hw_device_ctx) {
+ if (filter_hw_device || hw_device_ctx) {
+ AVBufferRef *device = filter_hw_device ? filter_hw_device->device_ref
+ : hw_device_ctx;
for (i = 0; i < fg->graph->nb_filters; i++) {
- fg->graph->filters[i]->hw_device_ctx = av_buffer_ref(hw_device_ctx);
+ fg->graph->filters[i]->hw_device_ctx = av_buffer_ref(device);
+ if (!fg->graph->filters[i]->hw_device_ctx) {
+ ret = AVERROR(ENOMEM);
+ goto fail;
+ }
}
}