1 /***************************************************************************
2 * DocClipBase.cpp - description *
3 * ------------------- *
4 * begin : Fri Apr 12 2002 *
5 * Copyright (C) 2002 by Jason Wood (jasonwood@blueyonder.co.uk) *
6 * Copyright (C) 2007 by Jean-Baptiste Mardelle (jb@kdenlive.org) *
8 * This program is free software; you can redistribute it and/or modify *
9 * it under the terms of the GNU General Public License as published by *
10 * the Free Software Foundation; either version 2 of the License, or *
11 * (at your option) any later version. *
13 * This program is distributed in the hope that it will be useful, *
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
16 * GNU General Public License for more details. *
18 * You should have received a copy of the GNU General Public License *
19 * along with this program; if not, write to the *
20 * Free Software Foundation, Inc., *
21 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
22 ***************************************************************************/
27 #include "docclipbase.h"
28 #include "kdenlivesettings.h"
30 #include "clipmanager.h"
34 #include <QCryptographicHash>
36 DocClipBase::DocClipBase(ClipManager *clipManager, QDomElement xml, const QString &id) :
41 m_baseTrackProducers(),
42 m_audioTrackProducers(),
43 m_videoOnlyProducer(NULL),
48 m_audioThumbCreated(false),
52 int type = xml.attribute("type").toInt();
53 m_clipType = (CLIPTYPE) type;
55 QDomNamedNodeMap attributes = xml.attributes();
56 for (unsigned int i = 0; i < attributes.count(); i++) {
57 m_properties.insert(attributes.item(i).nodeName(), attributes.item(i).nodeValue());
60 KUrl url = KUrl(xml.attribute("resource"));
61 if (!m_properties.contains("file_hash") && !url.isEmpty()) getFileHash(url.path());
63 if (xml.hasAttribute("duration")) {
64 setDuration(GenTime(xml.attribute("duration").toInt(), KdenliveSettings::project_fps()));
66 int out = xml.attribute("out").toInt();
67 int in = xml.attribute("in").toInt();
68 setDuration(GenTime(out - in, KdenliveSettings::project_fps()));
71 if (!m_properties.contains("name")) m_properties.insert("name", url.fileName());
73 //if (!url.isEmpty() && QFile::exists(url.path()))
75 m_thumbProd = new KThumb(clipManager, url, m_id, m_properties.value("file_hash"));
76 if (m_clipType == AV || m_clipType == AUDIO) slotCreateAudioTimer();
78 //kDebug() << "type is video" << (m_clipType == AV) << " " << m_clipType;
81 /*DocClipBase & DocClipBase::operator=(const DocClipBase & clip) {
82 DocClipBase::operator=(clip);
84 m_clipType = clip.clipType();
86 m_duration = clip.duration();
87 m_audioThumbCreated = clip.audioThumbCreated();
88 m_properties = clip.properties();
92 DocClipBase::~DocClipBase()
101 qDeleteAll(m_baseTrackProducers);
102 m_baseTrackProducers.clear();
103 qDeleteAll(m_audioTrackProducers);
104 m_audioTrackProducers.clear();
105 if (m_videoOnlyProducer) delete m_videoOnlyProducer;
106 m_videoOnlyProducer = NULL;
109 void DocClipBase::setZone(QPoint zone)
111 m_properties.insert("zone_in", QString::number(zone.x()));
112 m_properties.insert("zone_out", QString::number(zone.y()));
115 QPoint DocClipBase::zone() const
118 zone.setX(m_properties.value("zone_in").toInt());
119 zone.setY(m_properties.value("zone_out", "50").toInt());
123 void DocClipBase::slotCreateAudioTimer()
125 connect(m_thumbProd, SIGNAL(audioThumbReady(QMap <int, QMap <int, QByteArray> >)), this , SLOT(updateAudioThumbnail(QMap <int, QMap <int, QByteArray> >)));
126 connect(this, SIGNAL(getAudioThumbs()), this , SLOT(slotGetAudioThumbs()));
127 m_audioTimer = new QTimer(this);
128 connect(m_audioTimer, SIGNAL(timeout()), this, SLOT(slotGetAudioThumbs()));
131 void DocClipBase::askForAudioThumbs()
133 if (m_thumbProd) m_thumbProd->askForAudioThumbs(getId());
136 void DocClipBase::slotClearAudioCache()
138 if (m_thumbProd) m_thumbProd->stopAudioThumbs();
139 if (m_audioTimer != NULL) m_audioTimer->stop();
140 audioFrameChache.clear();
141 m_audioThumbCreated = false;
144 /*void DocClipBase::getClipMainThumb() {
145 if (m_thumbProd) m_thumbProd->getMainThumb(m_properties.value("thumbnail").toInt());
148 KThumb *DocClipBase::thumbProducer()
153 bool DocClipBase::audioThumbCreated() const
155 return m_audioThumbCreated;
158 const QString DocClipBase::name() const
161 return m_properties.value("name");
164 const QString &DocClipBase::getId() const
169 void DocClipBase::setId(const QString &newId)
174 const CLIPTYPE & DocClipBase::clipType() const
179 void DocClipBase::setClipType(CLIPTYPE type)
183 m_properties.insert("type", QString::number((int) type));
184 if (m_thumbProd && m_audioTimer == NULL && (m_clipType == AV || m_clipType == AUDIO))
185 slotCreateAudioTimer();
188 KUrl DocClipBase::fileURL() const
190 QString res = m_properties.value("resource");
191 if (m_clipType != COLOR && !res.isEmpty()) return KUrl(res);
195 void DocClipBase::setClipThumbFrame(const uint &ix)
197 m_properties.insert("thumbnail", QString::number((int) ix));
200 uint DocClipBase::getClipThumbFrame() const
202 return (uint) m_properties.value("thumbnail").toInt();
205 const QString DocClipBase::description() const
207 return m_properties.value("description");
210 bool DocClipBase::isTransparent() const
212 return (m_properties.value("transparency") == "1");
215 const QString DocClipBase::getProperty(const QString prop) const
217 return m_properties.value(prop);
220 void DocClipBase::setDuration(GenTime dur)
223 m_properties.insert("duration", QString::number((int) dur.frames(KdenliveSettings::project_fps())));
226 const GenTime &DocClipBase::duration() const
231 const GenTime DocClipBase::maxDuration() const
233 if (m_clipType == COLOR || m_clipType == IMAGE || m_clipType == TEXT || (m_clipType == SLIDESHOW && m_properties.value("loop") == "1")) {
234 const GenTime dur(15000, KdenliveSettings::project_fps());
240 bool DocClipBase::hasFileSize() const
247 QDomElement DocClipBase::toXML() const
250 QDomElement clip = doc.createElement("producer");
252 QMapIterator<QString, QString> i(m_properties);
253 while (i.hasNext()) {
255 if (!i.value().isEmpty()) clip.setAttribute(i.key(), i.value());
257 doc.appendChild(clip);
258 //kDebug()<<"/// CLIP XML: "<<doc.toString();
259 return doc.documentElement();
263 void DocClipBase::setAudioThumbCreated(bool isDone)
265 m_audioThumbCreated = isDone;
269 void DocClipBase::setThumbnail(const QPixmap & pixmap)
271 m_thumbnail = pixmap;
274 const QPixmap & DocClipBase::thumbnail() const
279 void DocClipBase::updateAudioThumbnail(QMap<int, QMap<int, QByteArray> > data)
281 //kDebug() << "CLIPBASE RECIEDVED AUDIO DATA*********************************************";
282 audioFrameChache = data;
283 m_audioThumbCreated = true;
287 QList < GenTime > DocClipBase::snapMarkers() const
289 QList < GenTime > markers;
291 for (uint count = 0; count < m_snapMarkers.count(); ++count) {
292 markers.append(m_snapMarkers[count].time());
298 QList < CommentedTime > DocClipBase::commentedSnapMarkers() const
300 return m_snapMarkers;
303 void DocClipBase::setSnapMarkers(QList < CommentedTime > markers)
305 m_snapMarkers = markers;
308 void DocClipBase::addSnapMarker(const GenTime & time, QString comment)
310 QList < CommentedTime >::Iterator it = m_snapMarkers.begin();
311 for (it = m_snapMarkers.begin(); it != m_snapMarkers.end(); ++it) {
312 if ((*it).time() >= time)
316 if ((it != m_snapMarkers.end()) && ((*it).time() == time)) {
317 (*it).setComment(comment);
318 //kError() << "trying to add Snap Marker that already exists, this will cause inconsistancies with undo/redo";
320 CommentedTime t(time, comment);
321 m_snapMarkers.insert(it, t);
326 void DocClipBase::editSnapMarker(const GenTime & time, QString comment)
328 QList < CommentedTime >::Iterator it;
329 for (it = m_snapMarkers.begin(); it != m_snapMarkers.end(); ++it) {
330 if ((*it).time() == time)
333 if (it != m_snapMarkers.end()) {
334 (*it).setComment(comment);
336 kError() << "trying to edit Snap Marker that does not already exists";
340 QString DocClipBase::deleteSnapMarker(const GenTime & time)
342 QString result = i18n("Marker");
343 QList < CommentedTime >::Iterator itt = m_snapMarkers.begin();
345 while (itt != m_snapMarkers.end()) {
346 if ((*itt).time() == time)
351 if ((itt != m_snapMarkers.end()) && ((*itt).time() == time)) {
352 result = (*itt).comment();
353 m_snapMarkers.erase(itt);
359 GenTime DocClipBase::hasSnapMarkers(const GenTime & time)
361 QList < CommentedTime >::Iterator itt = m_snapMarkers.begin();
363 while (itt != m_snapMarkers.end()) {
364 if ((*itt).time() == time)
372 GenTime DocClipBase::findPreviousSnapMarker(const GenTime & currTime)
375 for (it = 0; it < m_snapMarkers.count(); it++) {
376 if (m_snapMarkers[it].time() >= currTime)
379 if (it == 0) return GenTime();
380 else if (it == m_snapMarkers.count() - 1 && m_snapMarkers[it].time() < currTime)
381 return m_snapMarkers[it].time();
382 else return m_snapMarkers[it-1].time();
385 GenTime DocClipBase::findNextSnapMarker(const GenTime & currTime)
388 for (it = 0; it < m_snapMarkers.count(); it++) {
389 if (m_snapMarkers[it].time() > currTime)
392 if (it < m_snapMarkers.count() && m_snapMarkers[it].time() > currTime) return m_snapMarkers[it].time();
396 QString DocClipBase::markerComment(GenTime t)
398 QList < CommentedTime >::Iterator itt = m_snapMarkers.begin();
400 while (itt != m_snapMarkers.end()) {
401 if ((*itt).time() == t)
402 return (*itt).comment();
408 void DocClipBase::deleteProducers()
410 qDeleteAll(m_baseTrackProducers);
411 m_baseTrackProducers.clear();
412 if (m_thumbProd) m_thumbProd->clearProducer();
413 qDeleteAll(m_audioTrackProducers);
414 m_audioTrackProducers.clear();
415 if (m_videoOnlyProducer) delete m_videoOnlyProducer;
416 m_videoOnlyProducer = NULL;
419 void DocClipBase::setProducer(Mlt::Producer *producer)
421 if (producer == NULL) return;
422 QString id = producer->get("id");
423 if (id.contains('_')) {
424 // this is a subtrack producer, insert it at correct place
425 id = id.section('_', 1);
426 if (id.endsWith("audio")) {
427 int pos = id.section('_', 0, 0).toInt();
428 if (pos >= m_audioTrackProducers.count()) {
429 while (m_audioTrackProducers.count() - 1 < pos) {
430 m_audioTrackProducers.append(NULL);
433 if (m_audioTrackProducers.at(pos) == NULL) m_audioTrackProducers[pos] = producer;
436 if (id.endsWith("video")) {
437 m_videoOnlyProducer = producer;
440 int pos = id.toInt();
441 if (pos >= m_baseTrackProducers.count()) {
442 while (m_baseTrackProducers.count() - 1 < pos) {
443 m_baseTrackProducers.append(NULL);
446 if (m_baseTrackProducers.at(pos) == NULL) m_baseTrackProducers[pos] = producer;
448 if (m_baseTrackProducers.isEmpty()) m_baseTrackProducers.append(producer);
449 else if (m_baseTrackProducers.at(0) == NULL) m_baseTrackProducers[0] = producer;
451 //m_clipProducer = producer;
452 //m_clipProducer->set("transparency", m_properties.value("transparency").toInt());
453 if (m_thumbProd && !m_thumbProd->hasProducer()) m_thumbProd->setProducer(producer);
456 Mlt::Producer *DocClipBase::audioProducer(int track)
458 if (m_audioTrackProducers.count() <= track) {
459 while (m_audioTrackProducers.count() - 1 < track) {
460 m_audioTrackProducers.append(NULL);
463 if (m_audioTrackProducers.at(track) == NULL) {
464 Mlt::Producer *base = producer();
465 m_audioTrackProducers[track] = new Mlt::Producer(*(base->profile()), base->get("resource"));
466 if (m_properties.contains("force_aspect_ratio")) m_audioTrackProducers.at(track)->set("force_aspect_ratio", m_properties.value("force_aspect_ratio").toDouble());
467 if (m_properties.contains("threads")) m_audioTrackProducers.at(track)->set("threads", m_properties.value("threads").toInt());
468 m_audioTrackProducers.at(track)->set("video_index", -1);
469 if (m_properties.contains("audio_index")) m_audioTrackProducers.at(track)->set("audio_index", m_properties.value("audio_index").toInt());
470 char *tmp = (char *) qstrdup(QString(getId() + '_' + QString::number(track) + "_audio").toUtf8().data());
471 m_audioTrackProducers.at(track)->set("id", tmp);
474 return m_audioTrackProducers.at(track);
477 Mlt::Producer *DocClipBase::videoProducer()
479 if (m_videoOnlyProducer == NULL) {
481 for (i = 0; i < m_baseTrackProducers.count(); i++)
482 if (m_baseTrackProducers.at(i) != NULL) break;
483 if (i >= m_baseTrackProducers.count()) return NULL;
484 m_videoOnlyProducer = new Mlt::Producer(*m_baseTrackProducers.at(i)->profile(), m_baseTrackProducers.at(i)->get("resource"));
485 if (m_properties.contains("force_aspect_ratio")) m_videoOnlyProducer->set("force_aspect_ratio", m_properties.value("force_aspect_ratio").toDouble());
486 if (m_properties.contains("threads")) m_videoOnlyProducer->set("threads", m_properties.value("threads").toInt());
487 m_videoOnlyProducer->set("audio_index", -1);
488 if (m_properties.contains("video_index")) m_videoOnlyProducer->set("video_index", m_properties.value("video_index").toInt());
489 char *tmp = (char *) qstrdup(QString(getId() + "_video").toUtf8().data());
490 m_videoOnlyProducer->set("id", tmp);
493 return m_videoOnlyProducer;
496 Mlt::Producer *DocClipBase::producer(int track)
498 /*for (int i = 0; i < m_baseTrackProducers.count(); i++) {
499 if (m_baseTrackProducers.at(i)) kDebug() << "// PROD: " << i << ", ID: " << m_baseTrackProducers.at(i)->get("id");
501 if (track == -1 || (m_clipType != AUDIO && m_clipType != AV)) {
502 if (m_baseTrackProducers.count() == 0) return NULL;
503 for (int i = 0; i < m_baseTrackProducers.count(); i++) {
504 if (m_baseTrackProducers.at(i) != NULL)
505 return m_baseTrackProducers.at(i);
509 if (track >= m_baseTrackProducers.count()) {
510 while (m_baseTrackProducers.count() - 1 < track) {
511 m_baseTrackProducers.append(NULL);
514 if (m_baseTrackProducers.at(track) == NULL) {
516 for (i = 0; i < m_baseTrackProducers.count(); i++)
517 if (m_baseTrackProducers.at(i) != NULL) break;
518 if (i >= m_baseTrackProducers.count()) return NULL;
519 m_baseTrackProducers[track] = new Mlt::Producer(*m_baseTrackProducers.at(i)->profile(), m_baseTrackProducers.at(i)->get("resource"));
520 if (m_properties.contains("force_aspect_ratio")) m_baseTrackProducers[track]->set("force_aspect_ratio", m_properties.value("force_aspect_ratio").toDouble());
521 if (m_properties.contains("threads")) m_baseTrackProducers[track]->set("threads", m_properties.value("threads").toInt());
522 if (m_properties.contains("video_index")) m_baseTrackProducers[track]->set("video_index", m_properties.value("video_index").toInt());
523 if (m_properties.contains("audio_index")) m_baseTrackProducers[track]->set("audio_index", m_properties.value("audio_index").toInt());
524 char *tmp = (char *) qstrdup(QString(getId() + '_' + QString::number(track)).toUtf8().data());
525 m_baseTrackProducers[track]->set("id", tmp);
527 if (KdenliveSettings::dropbframes() && m_baseTrackProducers.at(i)->get("skip_loop_filter") && strcmp(m_baseTrackProducers.at(i)->get("skip_loop_filter"), "all") == 0) {
528 m_baseTrackProducers[track]->set("skip_loop_filter", "all");
529 m_baseTrackProducers[track]->set("skip_frame", "bidir");
532 return m_baseTrackProducers.at(track);
535 void DocClipBase::setProducerProperty(const char *name, int data)
537 for (int i = 0; i < m_baseTrackProducers.count(); i++) {
538 if (m_baseTrackProducers.at(i) != NULL)
539 m_baseTrackProducers[i]->set(name, data);
543 void DocClipBase::setProducerProperty(const char *name, const char *data)
545 for (int i = 0; i < m_baseTrackProducers.count(); i++) {
546 if (m_baseTrackProducers.at(i) != NULL)
547 m_baseTrackProducers[i]->set(name, data);
551 const char *DocClipBase::producerProperty(const char *name) const
553 for (int i = 0; i < m_baseTrackProducers.count(); i++) {
554 if (m_baseTrackProducers.at(i) != NULL) {
555 return m_baseTrackProducers.at(i)->get(name);
562 void DocClipBase::slotRefreshProducer()
564 if (m_baseTrackProducers.count() == 0) return;
565 kDebug() << "//////////// REFRESH CLIP !!!!!!!!!!!!!!!!";
566 if (m_clipType == SLIDESHOW) {
567 /*char *tmp = (char *) qstrdup(getProperty("resource").toUtf8().data());
568 Mlt::Producer producer(*(m_clipProducer->profile()), tmp);
570 delete m_clipProducer;
571 m_clipProducer = new Mlt::Producer(producer.get_producer());
572 if (!getProperty("out").isEmpty()) m_clipProducer->set_in_and_out(getProperty("in").toInt(), getProperty("out").toInt());*/
573 setProducerProperty("ttl", getProperty("ttl").toInt());
574 //m_clipProducer->set("id", getProperty("id"));
575 if (getProperty("fade") == "1") {
576 // we want a fade filter effect
577 kDebug() << "//////////// FADE WANTED";
578 Mlt::Service clipService(m_baseTrackProducers.at(0)->get_service());
580 Mlt::Filter *filter = clipService.filter(ct);
582 if (strcmp(filter->get("mlt_service"), "luma") == 0) {
586 filter = clipService.filter(ct);
589 if (filter && strcmp(filter->get("mlt_service"), "luma") == 0) {
590 filter->set("period", getProperty("ttl").toInt() - 1);
591 filter->set("luma.out", getProperty("luma_duration").toInt());
592 QString resource = getProperty("luma_file");
593 char *tmp = (char *) qstrdup(resource.toUtf8().data());
594 filter->set("luma.resource", tmp);
596 if (!getProperty("softness").isEmpty()) {
597 int soft = getProperty("softness").toInt();
598 filter->set("luma.softness", (double) soft / 100.0);
601 // filter does not exist, create it...
602 Mlt::Filter *filter = new Mlt::Filter(*(m_baseTrackProducers.at(0)->profile()), "luma");
603 filter->set("period", getProperty("ttl").toInt() - 1);
604 filter->set("luma.out", getProperty("luma_duration").toInt());
605 QString resource = getProperty("luma_file");
606 char *tmp = (char *) qstrdup(resource.toUtf8().data());
607 filter->set("luma.resource", tmp);
609 if (!getProperty("softness").isEmpty()) {
610 int soft = getProperty("softness").toInt();
611 filter->set("luma.softness", (double) soft / 100.0);
613 clipService.attach(*filter);
616 kDebug() << "//////////// FADE NOT WANTED!!!";
617 Mlt::Service clipService(m_baseTrackProducers.at(0)->get_service());
619 Mlt::Filter *filter = clipService.filter(0);
621 if (strcmp(filter->get("mlt_service"), "luma") == 0) {
622 clipService.detach(*filter);
624 filter = clipService.filter(ct);
630 void DocClipBase::setProperties(QMap <QString, QString> properties)
632 // changing clip type is not allowed
633 properties.remove("type");
634 QMapIterator<QString, QString> i(properties);
635 bool refreshProducer = false;
637 keys << "luma_duration" << "luma_file" << "fade" << "ttl" << "softness";
638 while (i.hasNext()) {
640 setProperty(i.key(), i.value());
641 if (m_clipType == SLIDESHOW && keys.contains(i.key())) refreshProducer = true;
643 if (refreshProducer) slotRefreshProducer();
646 void DocClipBase::setMetadata(QMap <QString, QString> properties)
648 m_metadata = properties;
651 QMap <QString, QString> DocClipBase::metadata() const
656 void DocClipBase::clearProperty(const QString &key)
658 m_properties.remove(key);
661 void DocClipBase::getFileHash(const QString url)
663 if (m_clipType == SLIDESHOW) return;
665 if (file.open(QIODevice::ReadOnly)) { // write size and hash only if resource points to a file
668 //kDebug() << "SETTING HASH of" << value;
669 m_properties.insert("file_size", QString::number(file.size()));
671 * 1 MB = 1 second per 450 files (or faster)
672 * 10 MB = 9 seconds per 450 files (or faster)
674 if (file.size() > 1000000*2) {
675 fileData = file.read(1000000);
676 if (file.seek(file.size() - 1000000))
677 fileData.append(file.readAll());
679 fileData = file.readAll();
681 fileHash = QCryptographicHash::hash(fileData, QCryptographicHash::Md5);
682 m_properties.insert("file_hash", QString(fileHash.toHex()));
683 //kDebug() << file.fileName() << file.size() << fileHash.toHex();
687 QString DocClipBase::getClipHash() const
690 if (m_clipType == SLIDESHOW) hash = QCryptographicHash::hash(m_properties.value("resource").toAscii().data(), QCryptographicHash::Md5).toHex();
691 else if (m_clipType == COLOR) hash = QCryptographicHash::hash(m_properties.value("colour").toAscii().data(), QCryptographicHash::Md5).toHex();
692 else hash = m_properties.value("file_hash");
696 void DocClipBase::refreshThumbUrl()
698 if (m_thumbProd) m_thumbProd->updateThumbUrl(m_properties.value("file_hash"));
701 void DocClipBase::setProperty(const QString &key, const QString &value)
703 m_properties.insert(key, value);
704 if (key == "resource") {
706 if (m_thumbProd) m_thumbProd->updateClipUrl(KUrl(value), m_properties.value("file_hash"));
707 } else if (key == "out") setDuration(GenTime(value.toInt(), KdenliveSettings::project_fps()));
708 //else if (key == "transparency") m_clipProducer->set("transparency", value.toInt());
709 else if (key == "colour") {
710 char *tmp = (char *) qstrdup(value.toUtf8().data());
711 setProducerProperty("colour", tmp);
713 } else if (key == "xmldata") {
714 setProducerProperty("force_reload", 1);
715 } else if (key == "force_aspect_ratio") {
716 if (value.isEmpty()) {
717 m_properties.remove("force_aspect_ratio");
718 setProducerProperty("force_aspect_ratio", 0);
719 } else setProducerProperty("force_aspect_ratio", value.toDouble());
720 } else if (key == "threads") {
721 if (value.isEmpty()) {
722 m_properties.remove("threads");
723 setProducerProperty("threads", 1);
724 } else setProducerProperty("threads", value.toInt());
725 } else if (key == "video_index") {
726 if (value.isEmpty()) {
727 m_properties.remove("video_index");
728 setProducerProperty("video_index", m_properties.value("default_video").toInt());
729 } else setProducerProperty("video_index", value.toInt());
730 } else if (key == "audio_index") {
731 if (value.isEmpty()) {
732 m_properties.remove("audio_index");
733 setProducerProperty("audio_index", m_properties.value("default_audio").toInt());
734 } else setProducerProperty("audio_index", value.toInt());
738 QMap <QString, QString> DocClipBase::properties() const
743 bool DocClipBase::slotGetAudioThumbs()
745 if (m_thumbProd == NULL) return false;
746 if (!KdenliveSettings::audiothumbnails()) {
747 if (m_audioTimer != NULL) m_audioTimer->stop();
750 if (m_audioThumbCreated) {
751 if (m_audioTimer != NULL) m_audioTimer->stop();
754 if (m_audioTimer != NULL)
755 m_audioTimer->start(1500);
756 double lengthInFrames = duration().frames(KdenliveSettings::project_fps());
757 m_thumbProd->getAudioThumbs(2, 0, lengthInFrames /*must be number of frames*/, 20);