update(r);
}
if (m_selectedEffect == -1) {
- m_selectedEffect = 0;
- setSelectedEffect(m_selectedEffect);
+ m_selectedEffect = 0;
+ setSelectedEffect(m_selectedEffect);
}
return effectParams;
}
if (props.contains("aspect_ratio"))
m_view.clip_ratio->setText(props.value("aspect_ratio"));
- QPixmap pix = m_clip->thumbProducer()->getImage(url, 240, 180);
+ QPixmap pix = m_clip->thumbProducer()->getImage(url, m_clip->getClipThumbFrame(), 240, 180);
m_view.clip_thumb->setPixmap(pix);
if (t == IMAGE || t == VIDEO) m_view.tabWidget->removeTab(AUDIOTAB);
} else {
#include "clipmanager.h"
DocClipBase::DocClipBase(ClipManager *clipManager, QDomElement xml, uint id):
- m_id(id), m_description(QString()), m_refcount(0), m_projectThumbFrame(0), m_audioThumbCreated(false), m_duration(GenTime()), m_thumbProd(NULL), m_audioTimer(NULL) {
+ m_id(id), m_description(QString()), m_refcount(0), m_audioThumbCreated(false), m_duration(GenTime()), m_thumbProd(NULL), m_audioTimer(NULL) {
int type = xml.attribute("type").toInt();
m_clipType = (CLIPTYPE) type;
m_name = xml.attribute("name");
return KUrl();
}
-void DocClipBase::setProjectThumbFrame(const uint &ix) {
- m_projectThumbFrame = ix;
+void DocClipBase::setClipThumbFrame(const uint &ix) {
+ m_properties.insert("thumbnail", QString::number((int) ix));
}
-uint DocClipBase::getProjectThumbFrame() const {
- return m_projectThumbFrame;
+uint DocClipBase::getClipThumbFrame() const {
+ return (uint) m_properties.value("thumbnail").toInt();
}
const QString DocClipBase::description() const {
const GenTime &DocClipBase::maxDuration() const {
if (m_clipType == COLOR || m_clipType == IMAGE || m_clipType == TEXT || (m_clipType == SLIDESHOW && m_properties.value("loop") == "1")) {
- GenTime dur(10000, KdenliveSettings::project_fps());
+ const GenTime dur(10000, KdenliveSettings::project_fps());
return dur;
}
return m_duration;
/** a unique numeric id */
uint m_id;
- uint m_projectThumbFrame;
void setAudioThumbCreated(bool isDone);
/** Holds clip infos like fps, size,... */
QMap <QString, QString> m_properties;
void addSnapMarker(const GenTime & time, QString comment);
QList < GenTime > snapMarkers() const;
QString markerComment(GenTime t);
- void setProjectThumbFrame(const uint &ix);
- uint getProjectThumbFrame() const;
+ void setClipThumbFrame(const uint &ix);
+ uint getClipThumbFrame() const;
void setProperties(QMap <QString, QString> properties);
QMap <QString, QString> properties() const;
Mlt::Producer producer(profile, "westley-xml", tmp);
delete[] tmp;
-
if (producer.is_blank()) {
pix.fill(Qt::black);
connect(m_projectList, SIGNAL(getFileProperties(const QDomElement &, int)), m_clipMonitor->render, SLOT(getFileProperties(const QDomElement &, int)));
connect(m_clipMonitor->render, SIGNAL(replyGetImage(int, int, const QPixmap &, int, int)), m_projectList, SLOT(slotReplyGetImage(int, int, const QPixmap &, int, int)));
connect(m_clipMonitor->render, SIGNAL(replyGetFileProperties(int, const QMap < QString, QString > &, const QMap < QString, QString > &)), m_projectList, SLOT(slotReplyGetFileProperties(int, const QMap < QString, QString > &, const QMap < QString, QString > &)));
+ connect(m_clipMonitor, SIGNAL(refreshClipThumbnail(int)), m_projectList, SLOT(slotRefreshClipThumbnail(int)));
}
void MainWindow::setupActions() {
render = new Render(m_name, (int) m_monitorRefresh->winId(), -1, this);
m_monitorRefresh->setRenderer(render);
+
+ m_contextMenu = new QMenu(this);
+ m_contextMenu->addMenu(playMenu);
+ QAction *extractFrame = m_contextMenu->addAction(KIcon("document-new"), i18n("Extract frame"));
+ connect(extractFrame, SIGNAL(triggered()), this, SLOT(slotExtractCurrentFrame()));
+ connect(m_ruler, SIGNAL(seekRenderer(int)), this, SLOT(slotSeek(int)));
+
connect(render, SIGNAL(durationChanged(int)), this, SLOT(adjustRulerSize(int)));
connect(render, SIGNAL(rendererPosition(int)), this, SLOT(seekCursor(int)));
connect(render, SIGNAL(rendererStopped(int)), this, SLOT(rendererStopped(int)));
if (name != "clip") {
connect(render, SIGNAL(rendererPosition(int)), this, SIGNAL(renderPosition(int)));
connect(render, SIGNAL(durationChanged(int)), this, SIGNAL(durationChanged(int)));
+ } else {
+ QAction *setThumbFrame = m_contextMenu->addAction(KIcon("document-new"), i18n("Set current image as thumbnail"));
+ connect(setThumbFrame, SIGNAL(triggered()), this, SLOT(slotSetThumbFrame()));
}
//render->createVideoXWindow(ui.video_frame->winId(), -1);
int width = m_ruler->width();
m_ruler->setMaximum(width);
m_length = 0;
- m_contextMenu = new QMenu(this);
- m_contextMenu->addMenu(playMenu);
- QAction *extractFrame = m_contextMenu->addAction(KIcon("document-new"), i18n("Extract frame"));
- connect(extractFrame, SIGNAL(triggered()), this, SLOT(slotExtractCurrentFrame()));
- connect(m_ruler, SIGNAL(seekRenderer(int)), this, SLOT(slotSeek(int)));
kDebug() << "/////// BUILDING MONITOR, ID: " << ui.video_frame->winId();
}
}
}
+void Monitor::slotSetThumbFrame() {
+ if (m_currentClip == NULL) {
+ return;
+ }
+ m_currentClip->setClipThumbFrame((uint) m_position);
+ emit refreshClipThumbnail(m_currentClip->getId());
+}
+
void Monitor::slotExtractCurrentFrame() {
QPixmap frame = render->extractFrame(m_position);
QString outputFile = KFileDialog::getSaveFileName(KUrl(), "image/png");
void seekCursor(int pos);
void rendererStopped(int pos);
void slotExtractCurrentFrame();
+ void slotSetThumbFrame();
public slots:
void slotOpenFile(const QString &);
signals:
void renderPosition(int);
void durationChanged(int);
+ void refreshClipThumbnail(int);
};
#endif
if (item) {
int height = 50;
int width = (int)(height * m_render->dar());
- QPixmap pix = KThumb::getImage(item->toXml(), item->referencedClip()->getProjectThumbFrame(), width, height);
- //QPixmap pix = KThumb::getFrame(item->toXml()), 0, width, height);
+ QPixmap pix = KThumb::getImage(item->toXml(), item->referencedClip()->getClipThumbFrame(), width, height);
item->setIcon(0, pix);
}
}
delete[] tmp;
if (producer.is_blank()) {
+ kDebug() << " / / / / / / / /ERRROR / / / / // CANNOT LOAD PRODUCER: " << doc.toString();
return;
}
- int frameNumber = xml.attribute("frame_thumbnail", "0").toInt();
+ int frameNumber = xml.attribute("thumbnail", "0").toInt();
if (frameNumber != 0) producer.seek(frameNumber);
mlt_properties properties = MLT_PRODUCER_PROPERTIES(producer.get_producer());
if (context != NULL) {
// Get the video_index
int index = mlt_properties_get_int(properties, "video_index");
-
#if ENABLE_FFMPEG_CODEC_DESCRIPTION
- if (context->streams && context->streams [index] && context->streams[ index ]->codec && context->streams[ index ]->codec->codec->long_name)
+ if (context->streams && context->streams [index] && context->streams[ index ]->codec && context->streams[ index ]->codec->codec->long_name) {
filePropertyMap["videocodec"] = context->streams[ index ]->codec->codec->long_name;
- else
+ } else
#endif
- if (context->streams && context->streams [index] && context->streams[ index ]->codec && context->streams[ index ]->codec->codec->name)
+ if (context->streams && context->streams [index] && context->streams[ index ]->codec && context->streams[ index ]->codec->codec->name) {
filePropertyMap["videocodec"] = context->streams[ index ]->codec->codec->name;
- }
+ }
+ } else kDebug() << " / / / / /WARNING, VIDEO CONTEXT IS NULL!!!!!!!!!!!!!!";
context = (AVFormatContext *) mlt_properties_get_data(properties, "audio_context", NULL);
if (context != NULL) {
// Get the video_index