lavfi: add FF_*LINK_IDX convenience macros.
authorNicolas George <nicolas.george@normalesup.org>
Thu, 19 Jul 2012 10:59:38 +0000 (12:59 +0200)
committerNicolas George <nicolas.george@normalesup.org>
Fri, 20 Jul 2012 11:16:24 +0000 (13:16 +0200)
libavfilter/internal.h

index b80a6fe..5f0299c 100644 (file)
@@ -350,4 +350,12 @@ int ff_request_frame(AVFilterLink *link);
 AVFilterBufferRef *ff_copy_buffer_ref(AVFilterLink *outlink,
                                       AVFilterBufferRef *ref);
 
+/**
+ * Find the index of a link.
+ *
+ * I.e. find i such that link == ctx->(in|out)puts[i]
+ */
+#define FF_INLINK_IDX(link)  ((int)((link)->dstpad - (link)->dst->input_pads))
+#define FF_OUTLINK_IDX(link) ((int)((link)->srcpad - (link)->src->output_pads))
+
 #endif /* AVFILTER_INTERNAL_H */