#endif
self->emitFrameNumber(mlt_frame_get_position(frame_ptr));
+ if (frame_ptr->convert_image)
+ self->emitFrameUpdated(frame);
if (frame.get_double("_speed") == 0.0) {
self->emitConsumerStopped();
} else if (frame.get_double("_speed") < 0.0 && mlt_frame_get_position(frame_ptr) <= 0) {
int frame_height = imageHeight;
uint8_t *data = frame->get_image(format, frame_width, frame_height, 0);
QImage image((uchar *)data, frame_width, frame_height, QImage::Format_ARGB32);
- QPixmap pix(frame_width, frame_height);
+ QPixmap pix;
if (!image.isNull()) {
- pix = QPixmap::fromImage(image.rgbSwapped());
+ if (frame_width > (2 * width)) {
+ // there was a scaling problem, do it manually
+ QImage scaled = image.scaled(width, imageHeight);
+ pix = QPixmap::fromImage(scaled.rgbSwapped());
+ } else pix = QPixmap::fromImage(image.rgbSwapped());
} else
pix.fill(Qt::black);
return m_name;
}
+void Render::emitFrameUpdated(Mlt::Frame& frame)
+{
+ mlt_image_format format = mlt_image_rgb24a;
+ int width = 0;
+ int height = 0;
+ const uchar* image = frame.get_image(format, width, height);
+ QImage qimage(width, height, QImage::Format_ARGB32);
+ memcpy(qimage.bits(), image, width * height * 4);
+ emit frameUpdated(qimage.rgbSwapped());
+}
+
void Render::emitFrameNumber(double position)
{
- if (position == m_framePosition) {
- emit frameUpdated((int) position);
- return;
- }
m_framePosition = position;
emit rendererPosition((int) position);
}
QMap<QString, QString>::Iterator it;
QString key;
mlt_properties transproperties = MLT_TRANSITION_PROPERTIES(tr);
+
+ QString currentId = mlt_properties_get(transproperties, "kdenlive_id");
+ if (currentId != xml.attribute("id")) {
+ // The transition ID is not the same, so reset all properties
+ char *tmp = decodedString(xml.attribute("id"));
+ mlt_properties_set(transproperties, "kdenlive_id", tmp);
+ delete[] tmp;
+ // Cleanup previous properties
+ QStringList permanentProps;
+ permanentProps << "factory" << "kdenlive_id" << "mlt_service" << "mlt_type" << "in";
+ permanentProps << "out" << "a_track" << "b_track";
+ for (int i = 0; i < mlt_properties_count(transproperties); i++) {
+ QString propName = mlt_properties_get_name(transproperties, i);
+ if (!propName.startsWith('_') && ! permanentProps.contains(propName)) {
+ tmp = decodedString(propName);
+ mlt_properties_set(transproperties, tmp, "");
+ delete[] tmp;
+ }
+ }
+ }
+
mlt_properties_set_int(transproperties, "force_track", xml.attribute("force_track").toInt());
mlt_properties_set_int(transproperties, "automatic", xml.attribute("automatic", "0").toInt());
- // update the transition id in case it uses the same MLT service but different Kdenlive id
- char *tmp = decodedString(xml.attribute("id"));
- mlt_properties_set(transproperties, "kdenlive_id", tmp);
- delete[] tmp;
+
if (currentBTrack != a_track) {
- mlt_properties_set_int(properties, "a_track", a_track);
+ mlt_properties_set_int(transproperties, "a_track", a_track);
}
for (it = map.begin(); it != map.end(); ++it) {
key = it.key();