mltcontroller.cpp (shotcut-22.10.22) | : | mltcontroller.cpp (shotcut-22.11.25) | ||
---|---|---|---|---|
skipping to change at line 121 | skipping to change at line 121 | |||
if (error) { | if (error) { | |||
return error; | return error; | |||
} | } | |||
Mlt::Producer *newProducer = nullptr; | Mlt::Producer *newProducer = nullptr; | |||
close(); | close(); | |||
auto myUrl = url; | auto myUrl = url; | |||
if (url.endsWith(".mlt")) { | if (url.endsWith(".mlt")) { | |||
// MLT xml producer does URL encoding; so if the URL contains % it must be encoded. | // MLT xml producer does URL decoding; so if the URL contains % it must be encoded. | |||
myUrl = QUrl::toPercentEncoding(url).constData(); | myUrl = QUrl::toPercentEncoding(url).constData(); | |||
} | } | |||
if (Settings.playerGPU() && !profile().is_explicit()) | if (Settings.playerGPU() && !profile().is_explicit()) | |||
// Prevent loading normalizing filters, which might be Movit ones that | // Prevent loading normalizing filters, which might be Movit ones that | |||
// may not have a proper OpenGL context when requesting a sample frame. | // may not have a proper OpenGL context when requesting a sample frame. | |||
newProducer = new Mlt::Producer(profile(), "abnormal", myUrl.toUtf8().co nstData()); | newProducer = new Mlt::Producer(profile(), "abnormal", myUrl.toUtf8().co nstData()); | |||
else | else | |||
newProducer = new Mlt::Producer(profile(), myUrl.toUtf8().constData()); | newProducer = new Mlt::Producer(profile(), myUrl.toUtf8().constData()); | |||
if (newProducer && newProducer->is_valid()) { | if (newProducer && newProducer->is_valid()) { | |||
double fps = profile().fps(); | double fps = profile().fps(); | |||
skipping to change at line 180 | skipping to change at line 180 | |||
error = 1; | error = 1; | |||
} | } | |||
m_producer.reset(newProducer); | m_producer.reset(newProducer); | |||
return error; | return error; | |||
} | } | |||
bool Controller::openXML(const QString &filename) | bool Controller::openXML(const QString &filename) | |||
{ | { | |||
bool error = true; | bool error = true; | |||
close(); | close(); | |||
auto myFilename = filename; | Producer *producer = new Mlt::Producer(profile(), filename.toUtf8().constDat | |||
if (myFilename.endsWith(".mlt")) { | a()); | |||
// MLT xml producer does URL encoding; so if the URL contains % it must | ||||
be encoded. | ||||
myFilename = QUrl::toPercentEncoding(filename).constData(); | ||||
} | ||||
Producer *producer = new Mlt::Producer(profile(), myFilename.toUtf8().constD | ||||
ata()); | ||||
if (producer->is_valid()) { | if (producer->is_valid()) { | |||
double fps = profile().fps(); | double fps = profile().fps(); | |||
if (!profile().is_explicit()) { | if (!profile().is_explicit()) { | |||
profile().from_producer(*producer); | profile().from_producer(*producer); | |||
profile().set_width(Util::coerceMultiple(profile().width())); | profile().set_width(Util::coerceMultiple(profile().width())); | |||
profile().set_height(Util::coerceMultiple(profile().height())); | profile().set_height(Util::coerceMultiple(profile().height())); | |||
} | } | |||
updatePreviewProfile(); | updatePreviewProfile(); | |||
setPreviewScale(Settings.playerPreviewScale()); | setPreviewScale(Settings.playerPreviewScale()); | |||
if (isFpsDifferent(profile().fps(), fps)) { | if (isFpsDifferent(profile().fps(), fps)) { | |||
// reopen with the correct fps | // reopen with the correct fps | |||
delete producer; | delete producer; | |||
producer = new Mlt::Producer(profile(), nullptr, myFilename.toUtf8() .constData()); | producer = new Mlt::Producer(profile(), filename.toUtf8().constData( )); | |||
} | } | |||
producer->set(kShotcutVirtualClip, 1); | producer->set(kShotcutVirtualClip, 1); | |||
producer->set("resource", myFilename.toUtf8().constData()); | producer->set("resource", filename.toUtf8().constData()); | |||
setProducer(new Producer(producer)); | setProducer(new Producer(producer)); | |||
error = false; | error = false; | |||
} | } | |||
delete producer; | delete producer; | |||
return error; | return error; | |||
} | } | |||
void Controller::close() | void Controller::close() | |||
{ | { | |||
if (m_profile.is_explicit()) { | if (m_profile.is_explicit()) { | |||
End of changes. 4 change blocks. | ||||
11 lines changed or deleted | 5 lines changed or added |