+void
+Region::deep_sources (std::set<boost::shared_ptr<Source> > & sources) const
+{
+ for (SourceList::const_iterator i = _sources.begin(); i != _sources.end(); ++i) {
+
+ boost::shared_ptr<PlaylistSource> ps = boost::dynamic_pointer_cast<PlaylistSource> (*i);
+
+ if (ps) {
+ if (sources.find (ps) == sources.end()) {
+ /* (Playlist)Source not currently in
+ accumulating set, so recurse.
+ */
+ ps->playlist()->deep_sources (sources);
+ }
+ }
+
+ /* add this source */
+ sources.insert (*i);
+ }
+
+ for (SourceList::const_iterator i = _master_sources.begin(); i != _master_sources.end(); ++i) {
+
+ boost::shared_ptr<PlaylistSource> ps = boost::dynamic_pointer_cast<PlaylistSource> (*i);
+
+ if (ps) {
+ if (sources.find (ps) == sources.end()) {
+ /* (Playlist)Source not currently in
+ accumulating set, so recurse.
+ */
+ ps->playlist()->deep_sources (sources);
+ }
+ }
+
+ /* add this source */
+ sources.insert (*i);
+ }
+}
+