+Mlt::Producer *Render::getProducerById(const QString &id) {
+ for (int i = 0; i < m_producersList.count(); i++) {
+ if (m_producersList.at(i)->get("id") == id) return m_producersList.at(i);
+ }
+ return NULL;
+}
+
+void Render::parsePlaylistForClips() {
+ // clear current producers list
+ while (! m_producersList.isEmpty()) delete m_producersList.takeFirst();
+
+ //parse entire playlists to find all the different clips
+ Mlt::Producer parentProd(m_mltProducer->parent());
+ if (parentProd.get_producer() == NULL) {
+ kDebug() << "PLAYLIST BROKEN, CANNOT INSERT CLIP //////";
+ return;
+ }
+ Mlt::Service service(parentProd.get_service());
+ if (service.type() != tractor_type) return;
+ Mlt::Tractor tractor(service);
+ mlt_service_lock(service.get_service());
+ for (int i = 0; i < tractor.count(); i++) {
+ Mlt::Producer trackProducer(tractor.track(i));
+ Mlt::Playlist trackPlaylist((mlt_playlist) trackProducer.get_service());
+ for (int j = 0; j < trackPlaylist.count(); j++) {
+ if (!trackPlaylist.is_blank(j)) {
+ Mlt::Producer *clip = trackPlaylist.get_clip(j);
+ if (clip) {
+ if (getProducerById(clip->get("id")) == NULL)
+ m_producersList.append(new Mlt::Producer(clip->get_parent()));
+ }
+ }
+ }
+ }
+}
+