- Mlt::Tractor *tractor = getTractor();
- if (tractor) {
- Mlt::Tractor newTractor;
- mlt_service service = tractor->get_service();
- mlt_service nextservice = mlt_service_get_producer(service);
- int old_position = m_mltProducer->position();
- for (int track = 0;track < 10;track++) {
- Mlt::Producer *trackprod = tractor->track(track);
- if (!trackprod)
- continue;
- newTractor.multitrack()->connect(*trackprod, track);
- }
- for (int i = 2;i <= 5;i++) {
- Mlt::Transition tr(*m_mltProfile, "mix");
- tr.set("combine", 1);
- tr.set("internal_added", 237);
- tr.set_in_and_out(0, 15000);
- newTractor.plant_transition(tr, 1, i);
- }
- while (nextservice != NULL) {
- mlt_properties prop = MLT_SERVICE_PROPERTIES(nextservice);
- //kDebug() << mlt_properties_get(prop, "mlt_type") << mlt_properties_get(prop, "id");
- if (QString(mlt_properties_get(prop, "mlt_type")) == "transition" && QString(mlt_properties_get(prop, "internal_added")) != "237") {
-
- mlt_transition tr = (mlt_transition) nextservice;
- Mlt::Transition transition(tr);
- int current_a_track = mlt_transition_get_a_track(tr);
- int current_b_track = mlt_transition_get_b_track(tr);
- int currentIn = (int) mlt_transition_get_in(tr);
- int currentOut = (int) mlt_transition_get_out(tr);
- int old_pos = (int)((in.frames(m_fps) + out.frames(m_fps)) / 2);
- kDebug() << current_a_track << current_b_track << a_track << b_track << currentIn << currentOut << old_pos << mlt_properties_get(prop, "mlt_service");
- if (current_a_track == a_track && b_track == current_b_track && currentIn <= old_pos && currentOut >= old_pos) {
- kDebug() << "removing " << mlt_properties_get(prop, "mlt_service");
- } else
- newTractor.plant_transition(transition, current_a_track, current_b_track);
- }
- nextservice = mlt_service_producer(nextservice);
- }