- if (KUrl(item->text(0)).path() == src.path()) {
- // Replace movie with transcoded version
- item->setText(0, transcoded.path());
-
- QFile f(transcoded.path());
- qint64 fileSize = f.size();
-
- Mlt::Profile profile;
- profile.set_explicit(false);
- item->setText(2, KIO::convertSize(fileSize));
- item->setData(2, Qt::UserRole, fileSize);
- item->setData(0, Qt::DecorationRole, KIcon("video-x-generic").pixmap(60, 45));
- item->setToolTip(0, transcoded.path());
-
- QString resource = transcoded.path();
- resource.prepend("avformat:");
- Mlt::Producer *producer = new Mlt::Producer(profile, resource.toUtf8().data());
- if (producer && producer->is_valid() && !producer->is_blank()) {
- profile.from_producer(*producer);
- int width = 45.0 * profile.dar();
- int swidth = 45.0 * profile.width() / profile.height();
- if (width % 2 == 1) width++;
- item->setData(0, Qt::DecorationRole, QPixmap::fromImage(KThumb::getFrame(producer, 0, swidth, width, 45)));
- int playTime = producer->get_playtime();
- item->setText(1, Timecode::getStringTimecode(playTime, profile.fps()));
- item->setData(1, Qt::UserRole, playTime);
- int standard = -1;
- int aspect = profile.dar() * 100;
- if (profile.height() == 576) {
- if (aspect > 150) standard = 1;
- else standard = 0;
- }
- else if (profile.height() == 480) {
- if (aspect > 150) standard = 3;
- else standard = 2;
- }
- QString standardName;
- switch (standard) {
- case 3:
- standardName = i18n("NTSC 16:9");
- break;
- case 2:
- standardName = i18n("NTSC 4:3");
- break;
- case 1:
- standardName = i18n("PAL 16:9");
- break;
- case 0:
- standardName = i18n("PAL 4:3");
- break;
- default:
- standardName = i18n("Unknown");
- }
- item->setData(0, Qt::UserRole, standardName);
- item->setData(0, Qt::UserRole + 1, standard);
- item->setData(0, Qt::UserRole + 2, QSize(profile.dar() * profile.height(), profile.height()));
- }
- else {
- // Cannot load movie, reject
- showError(i18n("The clip %1 is invalid.", transcoded.fileName()));
- }
- if (producer) delete producer;
- slotCheckVobList();
- slotCheckProfiles();
- break;
- }
+ if (KUrl(item->text(0)).path() == src.path()) {
+ // Replace movie with transcoded version
+ item->setText(0, transcoded.path());
+
+ QFile f(transcoded.path());
+ qint64 fileSize = f.size();
+
+ Mlt::Profile profile;
+ profile.set_explicit(false);
+ item->setText(2, KIO::convertSize(fileSize));
+ item->setData(2, Qt::UserRole, fileSize);
+ item->setData(0, Qt::DecorationRole, KIcon("video-x-generic").pixmap(60, 45));
+ item->setToolTip(0, transcoded.path());
+
+ QString resource = transcoded.path();
+ resource.prepend("avformat:");
+ Mlt::Producer *producer = new Mlt::Producer(profile, resource.toUtf8().data());
+ if (producer && producer->is_valid() && !producer->is_blank()) {
+ profile.from_producer(*producer);
+ int width = 45.0 * profile.dar();
+ int swidth = 45.0 * profile.width() / profile.height();
+ if (width % 2 == 1) width++;
+ item->setData(0, Qt::DecorationRole, QPixmap::fromImage(KThumb::getFrame(producer, 0, swidth, width, 45)));
+ int playTime = producer->get_playtime();
+ item->setText(1, Timecode::getStringTimecode(playTime, profile.fps()));
+ item->setData(1, Qt::UserRole, playTime);
+ int standard = -1;
+ int aspect = profile.dar() * 100;
+ if (profile.height() == 576) {
+ if (aspect > 150) standard = 1;
+ else standard = 0;
+ }
+ else if (profile.height() == 480) {
+ if (aspect > 150) standard = 3;
+ else standard = 2;
+ }
+ QString standardName;
+ switch (standard) {
+ case 3:
+ standardName = i18n("NTSC 16:9");
+ break;
+ case 2:
+ standardName = i18n("NTSC 4:3");
+ break;
+ case 1:
+ standardName = i18n("PAL 16:9");
+ break;
+ case 0:
+ standardName = i18n("PAL 4:3");
+ break;
+ default:
+ standardName = i18n("Unknown");
+ }
+ item->setData(0, Qt::UserRole, standardName);
+ item->setData(0, Qt::UserRole + 1, standard);
+ item->setData(0, Qt::UserRole + 2, QSize(profile.dar() * profile.height(), profile.height()));
+ }
+ else {
+ // Cannot load movie, reject
+ showError(i18n("The clip %1 is invalid.", transcoded.fileName()));
+ }
+ if (producer) delete producer;
+ slotCheckVobList();
+ slotCheckProfiles();
+ break;
+ }