Commit cdd6c94f authored by Nicolas Carion's avatar Nicolas Carion
Browse files

Correctly propagate metadata when cloning avfilter clip. Closes #71

parent bc4e1ec9
......@@ -765,9 +765,21 @@ std::shared_ptr<Mlt::Producer> ProjectClip::cloneProducer(bool removeEffects)
const QByteArray clipXml = c.get("string");
std::shared_ptr<Mlt::Producer> prod;
prod.reset(new Mlt::Producer(pCore->getCurrentProfile()->profile(), "xml-string", clipXml.constData()));
if (strcmp(prod->get("mlt_service"), "avformat") == 0) {
prod->set("mlt_service", "avformat-novalidate");
}
// we pass some properties that wouldn't be passed because of the novalidate
const char *prefix = "meta.";
const size_t prefix_len = strlen(prefix);
for (int i = 0; i < m_masterProducer->count(); ++i) {
char *current = m_masterProducer->get_name(i);
if (strlen(current) >= prefix_len && strncmp(current, prefix, prefix_len) == 0) {
prod->set(current, m_masterProducer->get(i));
}
}
if (removeEffects) {
int ct = 0;
Mlt::Filter *filter = prod->filter(ct);
......
......@@ -32,11 +32,12 @@ AudioEnvelope::AudioEnvelope(const QString &binId, int clipId, size_t offset, si
connect(&m_watcher, &QFutureWatcherBase::finished, this, [this] { envelopeReady(this); });
if (!m_producer || !m_producer->is_valid()) {
qCDebug(KDENLIVE_LOG) << "// Cannot create envelope for producer: " << binId;
}
m_info = std::make_unique<AudioInfo>(m_producer);
if (length > 0) {
Q_ASSERT(length + m_offset <= m_envelopeSize);
m_envelopeSize = length;
} else {
m_info = std::make_unique<AudioInfo>(m_producer);
if (length > 0) {
Q_ASSERT(length + m_offset <= m_envelopeSize);
m_envelopeSize = length;
}
}
}
......@@ -89,6 +90,9 @@ AudioEnvelope::AudioSummary AudioEnvelope::loadAndNormalizeEnvelope() const
{
qCDebug(KDENLIVE_LOG) << "Loading envelope ...";
AudioSummary summary(m_envelopeSize);
if (!m_info || m_info->size() == 0) {
return summary;
}
int samplingRate = m_info->info(0)->samplingRate();
mlt_audio_format format_s16 = mlt_audio_s16;
int channels = 1;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment