producer->set("pad", "10");
delete[] tmp;
}
- if (m_thumbProd && (reset || !m_thumbProd->hasProducer())) m_thumbProd->setProducer(producer);
+ QString id = producer->get("id");
+ if (m_thumbProd) {
+ if (reset) m_thumbProd->setProducer(NULL);
+ if (!m_thumbProd->hasProducer()) {
+ if (m_clipType != AUDIO) {
+ if (!id.endsWith("_audio"))
+ m_thumbProd->setProducer(producer);
+ }
+ else m_thumbProd->setProducer(producer);
+ }
+ }
if (reset) {
// Clear all previous producers
kDebug() << "/+++++++++++++++ DELETE ALL PRODS " << producer->get("id");
deleteProducers(false);
}
- QString id = producer->get("id");
bool updated = false;
if (id.contains('_')) {
// this is a subtrack producer, insert it at correct place
else if (m_clipType == TEXT) hash = QCryptographicHash::hash(QString("title" + getId() + m_properties.value("xmldata")).toUtf8().data(), QCryptographicHash::Md5).toHex();
else {
if (m_properties.contains("file_hash")) hash = m_properties.value("file_hash");
- else hash = getHash(fileURL().path());
+ if (hash.isEmpty()) hash = getHash(fileURL().path());
}
return hash;
m_producer = producer;
// FIXME: the profile() call leaks an object, but trying to free
// it leads to a double-free in Profile::~Profile()
- m_dar = producer->profile()->dar();
+ if (producer) m_dar = producer->profile()->dar();
}
void KThumb::clearProducer()
{
- m_producer = NULL;
+ setProducer(NULL);
}
bool KThumb::hasProducer() const
void KThumb::slotCreateAudioThumbs()
{
Mlt::Profile prof((char*) KdenliveSettings::current_profile().toUtf8().data());
- Mlt::Producer m_producer(prof, m_url.path().toUtf8().data());
- if (!m_producer.is_valid()) {
+ Mlt::Producer producer(prof, m_url.path().toUtf8().data());
+ if (!producer.is_valid()) {
kDebug() << "++++++++ INVALID CLIP: " << m_url.path();
return;
}
if (KdenliveSettings::normaliseaudiothumbs()) {
Mlt::Filter m_convert(prof, "volume");
m_convert.set("gain", "normalise");
- m_producer.attach(m_convert);
+ producer.attach(m_convert);
}
int last_val = 0;
int val = 0;
//kDebug() << "for " << m_frame << " " << m_frameLength << " " << m_producer.is_valid();
- for (int z = (int) m_frame; z < (int)(m_frame + m_frameLength) && m_producer.is_valid(); z++) {
+ for (int z = (int) m_frame; z < (int)(m_frame + m_frameLength) && producer.is_valid(); z++) {
if (m_stopAudioThumbs) break;
val = (int)((z - m_frame) / (m_frame + m_frameLength) * 100.0);
if (last_val != val && val > 1) {
m_clipManager->setThumbsProgress(i18n("Creating thumbnail for %1", m_url.fileName()), val);
last_val = val;
}
- m_producer.seek(z);
- Mlt::Frame *mlt_frame = m_producer.get_frame();
+ producer.seek(z);
+ Mlt::Frame *mlt_frame = producer.get_frame();
if (mlt_frame && mlt_frame->is_valid()) {
- double m_framesPerSecond = mlt_producer_get_fps(m_producer.get_producer());
+ double m_framesPerSecond = mlt_producer_get_fps(producer.get_producer());
int m_samples = mlt_sample_calculator(m_framesPerSecond, m_frequency, mlt_frame_get_position(mlt_frame->get_frame()));
mlt_audio_format m_audioFormat = mlt_audio_pcm;
qint16* m_pcm = static_cast<qint16*>(mlt_frame->get_audio(m_audioFormat, m_frequency, m_channels, m_samples));
{
ProjectItem *item = getItemById(id);
m_processingClips.removeAll(id);
+ m_thumbnailQueue.removeAll(id);
if (!m_queueRunner.isRunning() && m_processingClips.isEmpty()) m_queueRunner = QtConcurrent::run(this, &ProjectList::slotProcessNextClipInQueue);
if (item) {
const QString path = item->referencedClip()->fileURL().path();
}
}
m_processingClips.removeAll(id);
+ m_thumbnailQueue.removeAll(id);
if (!m_queueRunner.isRunning() && m_processingClips.isEmpty()) m_queueRunner = QtConcurrent::run(this, &ProjectList::slotProcessNextClipInQueue);
}
}
if (item && m_listView->isEnabled() && replace) {
// update clip in clip monitor
- emit clipSelected(item->referencedClip());
+ if (item->isSelected() && m_listView->selectedItems().count() == 1)
+ emit clipSelected(item->referencedClip());
//TODO: Make sure the line below has no side effect
toReload = clipId;
}