Change filter opening.
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Thu, 6 Jun 2013 04:33:04 +0000 (06:33 +0200)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Thu, 6 Jun 2013 20:28:12 +0000 (22:28 +0200)
src/main/java/net/pterodactylus/sonitus/data/Pipeline.java

index 5b7edae..c63b272 100644 (file)
@@ -138,15 +138,16 @@ public class Pipeline implements Iterable<Filter> {
                }
                List<Filter> filters = Lists.newArrayList();
                filters.add(source);
-               source.open(Metadata.UNKNOWN);
+               Metadata currentMetadata = Metadata.UNKNOWN;
                /* collect all source->sink pairs. */
                while (!filters.isEmpty()) {
                        Filter filter = filters.remove(0);
+                       logger.info(String.format("Opening %s with %s...", filter.name(), currentMetadata));
+                       filter.open(currentMetadata);
+                       currentMetadata = filter.metadata();
                        Collection<Filter> sinks = this.filters.get(filter);
                        connections.add(new Connection(filter, sinks));
                        for (Filter sink : sinks) {
-                               logger.info(String.format("Opening %s with %s...", sink.name(), source.metadata()));
-                               sink.open(filter.metadata());
                                filters.add(sink);
                        }
                }