setenv("MLT_PROFILE", m_activeProfile.toUtf8().constData(), 1);
m_mltProfile->set_explicit(true);
- m_blackClip = new Mlt::Producer(*m_mltProfile, "colour", "black");
+ m_blackClip = new Mlt::Producer(*m_mltProfile, "colour:black");
m_blackClip->set("id", "black");
m_blackClip->set("mlt_type", "producer");
if (KdenliveSettings::external_display() && m_name != Kdenlive::clipMonitor && m_winid != 0) {
if (m_mltConsumer->is_valid()) {
externalConsumer = true;
m_mltConsumer->set("terminate_on_pause", 0);
- m_mltConsumer->set("deinterlace_method", "onefield");
- m_mltConsumer->set("rescale", "nearest");
+ m_mltConsumer->set("deinterlace_method", KdenliveSettings::mltdeinterlacer().toUtf8().constData());
+ m_mltConsumer->set("rescale", KdenliveSettings::mltinterpolation().toUtf8().constData());
m_mltConsumer->set("buffer", "1");
m_mltConsumer->set("real_time", KdenliveSettings::mltthreads());
}
// Set defaults for decklink consumer
if (m_mltConsumer) {
m_mltConsumer->set("terminate_on_pause", 0);
- m_mltConsumer->set("deinterlace_method", "onefield");
+ m_mltConsumer->set("deinterlace_method", KdenliveSettings::mltdeinterlacer().toUtf8().constData());
externalConsumer = true;
}
}
}
//m_mltConsumer->set("resize", 1);
m_mltConsumer->set("window_background", KdenliveSettings::window_background().name().toUtf8().constData());
- m_mltConsumer->set("rescale", "nearest");
+ m_mltConsumer->set("rescale", KdenliveSettings::mltinterpolation().toUtf8().constData());
mlt_log_set_callback(kdenlive_callback);
QString audioDevice = KdenliveSettings::audiodevicename();
int dropFrames = KdenliveSettings::mltthreads();
if (show == false) dropFrames = -dropFrames;
m_mltConsumer->stop();
- if (m_winid == 0)
- m_mltConsumer->set("real_time", dropFrames);
- else
- m_mltConsumer->set("play.real_time", dropFrames);
-
+ m_mltConsumer->set("real_time", dropFrames);
if (m_mltConsumer->start() == -1) {
kDebug(QtWarningMsg) << "ERROR, Cannot start monitor";
}
}
}
+void Render::setConsumerProperty(const QString &name, const QString &value)
+{
+ QMutexLocker locker(&m_mutex);
+ if (m_mltConsumer) {
+ m_mltConsumer->stop();
+ m_mltConsumer->set(name.toUtf8().constData(), value.toUtf8().constData());
+ if (m_isActive && m_mltConsumer->start() == -1) {
+ kDebug(QtWarningMsg) << "ERROR, Cannot start monitor";
+ }
+
+ }
+}
+
bool Render::isPlaying() const
{
if (!m_mltConsumer || m_mltConsumer->is_stopped()) return false;
void Render::emitFrameUpdated(Mlt::Frame& frame)
{
- mlt_image_format format = mlt_image_rgb24a;
+ mlt_image_format format = mlt_image_rgb24;
int width = 0;
int height = 0;
const uchar* image = frame.get_image(format, width, height);
- QImage qimage(width, height, QImage::Format_ARGB32_Premultiplied);
- memcpy(qimage.scanLine(0), image, width * height * 4);
- emit frameUpdated(qimage.rgbSwapped());
+ QImage qimage(width, height, QImage::Format_RGB888); //Format_ARGB32_Premultiplied);
+ memcpy(qimage.scanLine(0), image, width * height * 3);
+ emit frameUpdated(qimage);
}
int Render::getCurrentSeekPosition() const
if (currentPos == requestedSeekPosition) requestedSeekPosition = SEEK_INACTIVE;
emit rendererPosition(currentPos);
if (frame->is_valid()) {
- mlt_image_format format = mlt_image_rgb24a;
+ mlt_image_format format = mlt_image_rgb24;
int width = 0;
int height = 0;
const uchar* image = frame->get_image(format, width, height);
- QImage qimage(width, height, QImage::Format_ARGB32_Premultiplied);
- memcpy(qimage.scanLine(0), image, width * height * 4);
+ QImage qimage(width, height, QImage::Format_RGB888); //Format_ARGB32_Premultiplied);
+ memcpy(qimage.scanLine(0), image, width * height * 3);
if (analyseAudio) showAudio(*frame);
delete frame;
emit showImageSignal(qimage);
if (sendFrameForAnalysis) {
- emit frameUpdated(qimage.rgbSwapped());
+ emit frameUpdated(qimage);//.rgbSwapped());
}
} else delete frame;
showFrameSemaphore.release();
Mlt::Properties trans_props(transition.get_properties());
Mlt::Transition new_transition(*m_mltProfile, transition.get("mlt_service"));
Mlt::Properties new_trans_props(new_transition.get_properties());
- new_trans_props.inherit(trans_props);
- new_transition.set_in_and_out(new_in, new_out);
+ // We cannot use MLT's property inherit because it also clones internal values like _unique_id which messes up the playlist
+ cloneProperties(new_trans_props, trans_props);
+ new_transition.set_in_and_out(new_in, new_out);
field->disconnect_service(transition);
mltPlantTransition(field, new_transition, newTransitionTrack, newTrack);
- //field->plant_transition(new_transition, newTransitionTrack, newTrack);
} else transition.set_in_and_out(new_in, new_out);
break;
}
return found;
}
+void Render::cloneProperties(Mlt::Properties &dest, Mlt::Properties &source)
+{
+ int count = source.count();
+ int i = 0;
+ for ( i = 0; i < count; i ++ )
+ {
+ char *value = source.get(i);
+ if ( value != NULL )
+ {
+ char *name = source.get_name( i );
+ if (name != NULL && name[0] != '_') dest.set(name, value);
+ }
+ }
+}
void Render::mltPlantTransition(Mlt::Field *field, Mlt::Transition &tr, int a_track, int b_track)
{
Mlt::Properties trans_props(transition.get_properties());
Mlt::Transition *cp = new Mlt::Transition(*m_mltProfile, transition.get("mlt_service"));
Mlt::Properties new_trans_props(cp->get_properties());
- new_trans_props.inherit(trans_props);
+ //new_trans_props.inherit(trans_props);
+ cloneProperties(new_trans_props, trans_props);
trList.append(cp);
field->disconnect_service(transition);
}
Mlt::Properties trans_props(transition.get_properties());
Mlt::Transition *cp = new Mlt::Transition(*m_mltProfile, transition.get("mlt_service"));
Mlt::Properties new_trans_props(cp->get_properties());
- new_trans_props.inherit(trans_props);
+ cloneProperties(new_trans_props, trans_props);
+ //new_trans_props.inherit(trans_props);
if (trackChanged) {
// Transition track needs to be adjusted