setBrush(QColor(100, 100, 150));
if (m_clipType == VIDEO || m_clipType == AV) {
- m_thumbProd = new KThumb(KUrl(xml.attribute("resource")));
- connect(this, SIGNAL(getThumb(int, int, int, int)), m_thumbProd, SLOT(extractImage(int, int, int, int)));
+ m_thumbProd = new KThumb(KUrl(xml.attribute("resource")), KdenliveSettings::track_height() * KdenliveSettings::project_display_ratio(), KdenliveSettings::track_height());
+ connect(this, SIGNAL(getThumb(int, int)), m_thumbProd, SLOT(extractImage(int, int)));
connect(m_thumbProd, SIGNAL(thumbReady(int, QPixmap)), this, SLOT(slotThumbReady(int, QPixmap)));
QTimer::singleShot(300, this, SLOT(slotFetchThumbs()));
else if (m_clipType == IMAGE) {
m_startPix = KThumb::getImage(KUrl(xml.attribute("resource")), 50 * KdenliveSettings::project_display_ratio(), 50);
}
- //m_startPix.load("/home/one/Desktop/thumb.jpg");
}
ClipItem::~ClipItem()
void ClipItem::slotFetchThumbs()
{
- emit getThumb(m_cropStart, m_cropStart + m_cropDuration, 50 * KdenliveSettings::project_display_ratio(), 50);
+ emit getThumb(m_cropStart, m_cropStart + m_cropDuration);
}
void ClipItem::slotGetStartThumb()
{
- emit getThumb(m_cropStart, -1, 50 * KdenliveSettings::project_display_ratio(), 50);
+ emit getThumb(m_cropStart, -1);
}
void ClipItem::slotGetEndThumb()
{
- emit getThumb(-1, m_cropStart + m_cropDuration, 50 * KdenliveSettings::project_display_ratio(), 50);
+ emit getThumb(-1, m_cropStart + m_cropDuration);
}
void ClipItem::slotThumbReady(int frame, QPixmap pix)
#include <QGraphicsSceneMouseEvent>
#include "definitions.h"
+#include "gentime.h"
#include "kthumb.h"
void slotGetEndThumb();
signals:
- void getThumb(int, int, int, int);
+ void getThumb(int, int);
};
// virtual
void CustomTrackView::mousePressEvent ( QMouseEvent * event )
{
+ kDebug()<<"-- TIMELINE MSE PRESSED";
int pos = event->x();
if (event->modifiers() == Qt::ControlModifier)
setDragMode(QGraphicsView::ScrollHandDrag);
/*QDomElement westley = m_document.createElement("westley");
m_document.appendChild(westley);*/
- QDomElement prod = m_document.createElement("producer");
- prod.setAttribute("resource", "colour");
- prod.setAttribute("colour", "red");
- prod.setAttribute("id", "black");
- prod.setAttribute("in", "0");
- prod.setAttribute("out", "0");
+
QDomElement tractor = m_document.createElement("tractor");
QDomElement multitrack = m_document.createElement("multitrack");
QDomElement playlist1 = m_document.createElement("playlist");
- playlist1.appendChild(prod);
playlist1.setAttribute("id", "playlist1");
multitrack.appendChild(playlist1);
QDomElement playlist2 = m_document.createElement("playlist");
<label>Current project display ratio.</label>
<default>1.7777778</default>
</entry>
+ <entry name="track_height" type="Int">
+ <label>Timeline track size.</label>
+ <default>50</default>
+ </entry>
+ <entry name="default_profile" type="String">
+ <label>Default project format.</label>
+ <default>hdv_1080_50i</default>
+ </entry>
+ <entry name="current_profile" type="String">
+ <label>active project format.</label>
+ <default>hdv_1080_50i</default>
+ </entry>
</group>
</kcfg>
\ No newline at end of file
#include "renderer.h"
#include "kthumb.h"
+#include "kdenlivesettings.h"
/*
void MyThread::init(KUrl url, QString target, double frame, double frameLength, int frequency, int channels, int arrayWidth)
#define _G(y,u,v) (0x2568*(y) - 0x0c92*(v) - 0x1a1e*(u)) /0x2000
#define _B(y,u,v) (0x2568*(y) + 0x40cf*(v)) /0x2000
*/
-KThumb::KThumb(KUrl url, QObject * parent, const char *name):QObject(parent), m_url(url)
+KThumb::KThumb(KUrl url, int width, int height, QObject * parent, const char *name):QObject(parent), m_url(url), m_width(width), m_height(height)
{
+ kDebug()<<"+++++++++++ CREATING THMB PROD FOR: "<<url;
+ m_profile = Mlt::Profile((char*) KdenliveSettings::current_profile().data());
}
KThumb::~KThumb()
{
if (url.isEmpty()) return QPixmap();
QPixmap pix(width, height);
+ kDebug()<<"+++++++++++ GET THMB IMG FOR: "<<url;
char *tmp = Render::decodedString(url.path());
- Mlt::Producer m_producer(tmp);
+ Mlt::Profile prof((char*) KdenliveSettings::current_profile().data());
+ Mlt::Producer m_producer(prof, tmp);
delete tmp;
if (m_producer.is_blank()) {
}
Mlt::Frame * m_frame;
mlt_image_format format = mlt_image_rgb24a;
- Mlt::Filter m_convert("avcolour_space");
+ Mlt::Filter m_convert(prof, "avcolour_space");
m_convert.set("forced", mlt_image_rgb24a);
m_producer.attach(m_convert);
//m_producer.seek(frame);
return pix;
}
-void KThumb::extractImage(int frame, int frame2, int width, int height)
+void KThumb::extractImage(int frame, int frame2)
{
if (m_url.isEmpty()) return;
- QPixmap pix(width, height);
+ QPixmap pix(m_width, m_height);
char *tmp = Render::decodedString(m_url.path());
- Mlt::Producer m_producer(tmp);
+ Mlt::Producer m_producer(m_profile, tmp);
delete tmp;
if (m_producer.is_blank()) {
}
Mlt::Frame * m_frame;
mlt_image_format format = mlt_image_rgb24a;
- Mlt::Filter m_convert("avcolour_space");
+ Mlt::Filter m_convert(m_profile, "avcolour_space");
m_convert.set("forced", mlt_image_rgb24a);
m_producer.attach(m_convert);
if (frame != -1) {
m_producer.seek(frame);
m_frame = m_producer.get_frame();
if (m_frame && m_frame->is_valid()) {
- uint8_t *thumb = m_frame->get_image(format, width, height);
- QImage image(thumb, width, height, QImage::Format_ARGB32);
+ uint8_t *thumb = m_frame->get_image(format, m_width, m_height);
+ QImage image(thumb, m_width, m_height, QImage::Format_ARGB32);
if (!image.isNull()) {
pix = pix.fromImage(image);
}
m_producer.seek(frame2);
m_frame = m_producer.get_frame();
if (m_frame && m_frame->is_valid()) {
- uint8_t *thumb = m_frame->get_image(format, width, height);
- QImage image(thumb, width, height, QImage::Format_ARGB32);
+ uint8_t *thumb = m_frame->get_image(format, m_width, m_height);
+ QImage image(thumb, m_width, m_height, QImage::Format_ARGB32);
if (!image.isNull()) {
pix = pix.fromImage(image);
}
#include <kurl.h>
+#include <mlt++/Mlt.h>
/**KRender encapsulates the client side of the interface to a renderer.
From Kdenlive's point of view, you treat the KRender object as the
class Consumer;
class Producer;
class Frame;
+ class Profile;
};
Q_OBJECT public:
- KThumb(KUrl url, QObject * parent = 0, const char *name = 0);
+ KThumb(KUrl url, int width, int height, QObject * parent = 0, const char *name = 0);
~KThumb();
public slots:
- void extractImage( int frame, int frame2, int width, int height);
+ void extractImage( int frame, int frame2);
static QPixmap getImage(KUrl url, int width, int height);
/* void getImage(KUrl url, int frame, int width, int height);
void getThumbs(KUrl url, int startframe, int endframe, int width, int height);
// MyThread thumbProducer;
KUrl m_url;
QString m_thumbFile;
+ int m_width;
+ int m_height;
+ Mlt::Profile m_profile;
signals:
void thumbReady(int frame, QPixmap pm);
m_timelineArea->setTabReorderingEnabled(true);
connect(m_timelineArea, SIGNAL(currentChanged (int)), this, SLOT(activateDocument()));
+ Mlt::Factory::init(NULL);
m_monitorManager = new MonitorManager();
projectListDock = new QDockWidget(i18n("Project Tree"), this);
transitionConfigDock->setWidget(transitionConfig);
addDockWidget(Qt::TopDockWidgetArea, transitionConfigDock);
- Mlt::Factory::init(NULL);
clipMonitorDock = new QDockWidget(i18n("Clip Monitor"), this);
clipMonitorDock->setObjectName("clip_monitor");
m_clipMonitor = new Monitor("clip", m_monitorManager, this);
clipMonitorDock->setWidget(m_clipMonitor);
addDockWidget(Qt::TopDockWidgetArea, clipMonitorDock);
-
+ //m_clipMonitor->stop();
+
projectMonitorDock = new QDockWidget(i18n("Project Monitor"), this);
projectMonitorDock->setObjectName("project_monitor");
m_projectMonitor = new Monitor("project", m_monitorManager, this);
#include "monitor.h"
Monitor::Monitor(QString name, MonitorManager *manager, QWidget *parent)
- : QWidget(parent), render(NULL), m_monitorManager(manager), m_name(name)
+ : QWidget(parent), render(NULL), m_monitorManager(manager), m_name(name), m_isActive(false)
{
ui.setupUi(this);
m_scale = 1;
connect(ui.button_fwd, SIGNAL(clicked()), this, SLOT(slotForward()));
connect(ui.button_fwd1, SIGNAL(clicked()), this, SLOT(slotForwardOneFrame()));
connect(ui.button_play, SIGNAL(clicked()), this, SLOT(slotPlay()));
+ //if ( render ) return;
+ render = new Render(m_name, (int) ui.video_frame->winId(), -1, this);
+ connect(render, SIGNAL(playListDuration(int)), this, SLOT(adjustRulerSize(int)));
+ connect(render, SIGNAL(rendererPosition(int)), this, SLOT(seekCursor(int)));
+ connect(render, SIGNAL(rendererStopped(int)), this, SLOT(rendererStopped(int)));
+ //render->createVideoXWindow(ui.video_frame->winId(), -1);
+ int width = m_ruler->width();
+ m_ruler->setLength(width);
+ m_ruler->setMaximum(width);
+ m_length = 0;
+
+ kDebug()<<"/////// BUILDING MONITOR, ID: "<<ui.video_frame->winId();
}
// virtual
void Monitor::slotSeek(int pos)
{
+ if (!m_isActive) m_monitorManager->activateMonitor(m_name);
if ( render == NULL ) return;
int realPos = ((double) pos) / m_scale;
render->seekToFrame(realPos);
void Monitor::slotRewind()
{
+ if (!m_isActive) m_monitorManager->activateMonitor(m_name);
double speed = render->playSpeed();
if ( speed >= 0 ) render->play(-2);
else render->play(speed * 2);
void Monitor::slotForward()
{
+ if (!m_isActive) m_monitorManager->activateMonitor(m_name);
double speed = render->playSpeed();
if ( speed <= 1 ) render->play(2);
else render->play(speed * 2);
void Monitor::slotRewindOneFrame()
{
+ if (!m_isActive) m_monitorManager->activateMonitor(m_name);
render->play(0);
if (m_position < 1) return;
m_position--;
void Monitor::slotForwardOneFrame()
{
+ if (!m_isActive) m_monitorManager->activateMonitor(m_name);
render->play(0);
if (m_position >= m_length) return;
m_position++;
void Monitor::seekCursor(int pos)
{
+ if (!m_isActive) m_monitorManager->activateMonitor(m_name);
int rulerPos = (int) (pos * m_scale);
m_position = pos;
ui.monitor_time->setText(m_monitorManager->timecode().getTimecodeFromFrames(pos));
void Monitor::initMonitor()
{
- if ( render ) return;
- render = new Render(m_name, this);
- render->createVideoXWindow(ui.video_frame->winId(), -1);
- connect(render, SIGNAL(playListDuration(int)), this, SLOT(adjustRulerSize(int)));
- connect(render, SIGNAL(rendererPosition(int)), this, SLOT(seekCursor(int)));
- connect(render, SIGNAL(rendererStopped(int)), this, SLOT(rendererStopped(int)));
- int width = m_ruler->width();
- m_ruler->setLength(width);
- m_ruler->setMaximum(width);
- m_length = 0;
+ kDebug()<<"/////// INITING MONITOR, ID: "<<ui.video_frame->winId();
+
}
// virtual
void Monitor::stop()
{
+ m_isActive = false;
if (render) render->stop();
}
void Monitor::start()
{
+ m_isActive = true;
if (render) render->start();
}
void Monitor::slotPlay()
{
if ( render == NULL ) return;
- m_monitorManager->activateMonitor(m_name);
+ if (!m_isActive) m_monitorManager->activateMonitor(m_name);
render->switchPlay();
ui.button_play->setChecked(true);
ui.button_play->setIcon(m_pauseIcon);
void Monitor::slotSetXml(const QDomElement &e)
{
if ( render == NULL ) return;
- m_monitorManager->activateMonitor(m_name);
+ if (!m_isActive) m_monitorManager->activateMonitor(m_name);
QDomDocument doc;
QDomElement westley = doc.createElement("westley");
doc.appendChild(westley);
void Monitor::slotOpenFile(const QString &file)
{
if ( render == NULL ) return;
- m_monitorManager->activateMonitor(m_name);
+ if (!m_isActive) m_monitorManager->activateMonitor(m_name);
QDomDocument doc;
QDomElement westley = doc.createElement("westley");
doc.appendChild(westley);
SmallRuler *m_ruler;
KIcon m_playIcon;
KIcon m_pauseIcon;
+ bool m_isActive;
private slots:
void slotPlay();
#include <QTimer>
#include "monitormanager.h"
+#include <mlt++/Mlt.h>
MonitorManager::MonitorManager(QWidget *parent)
: QObject(parent)
{
m_clipMonitor = clipMonitor;
m_projectMonitor = projectMonitor;
- //QTimer::singleShot(750, this, SLOT(initClipMonitor()));
+ //QTimer::singleShot(1750, this, SLOT(initClipMonitor()));
initClipMonitor();
//initProjectMonitor();
}
void MonitorManager::initClipMonitor()
{
m_clipMonitor->initMonitor();
- initProjectMonitor();
+ emit connectMonitors();
+ //initProjectMonitor();
//QTimer::singleShot(1500, this, SLOT(initProjectMonitor()));
}
void MonitorManager::initProjectMonitor()
{
- m_clipMonitor->stop();
- // m_projectMonitor->initMonitor();
+ //m_clipMonitor->stop();
+ m_projectMonitor->initMonitor();
// activateMonitor("project");
emit connectMonitors();
}
#include <KLocale>
#include <KFileDialog>
#include <KInputDialog>
-#include <nepomuk/resourcemanager.h>
#include <kio/netaccess.h>
#include <KMessageBox>
+#include <nepomuk/global.h>
+#include <nepomuk/resource.h>
+#include <nepomuk/tag.h>
+
#include "projectlist.h"
#include "projectitem.h"
#include "kdenlivesettings.h"
#include <QtGui>
- const int NameRole = Qt::UserRole;
- const int DurationRole = NameRole + 1;
- const int FullPathRole = NameRole + 2;
- const int ClipTypeRole = NameRole + 3;
-
-class ItemDelegate: public QItemDelegate
-{
- public:
- ItemDelegate(QObject* parent = 0): QItemDelegate(parent)
- {
- }
-
-void paint(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const
-{
- if (index.column() == 1)
- {
- const bool hover = option.state & (QStyle::State_Selected|QStyle::State_MouseOver|QStyle::State_HasFocus);
- QRect r1 = option.rect;
- painter->save();
- if (hover) {
- painter->setPen(option.palette.color(QPalette::HighlightedText));
- QColor backgroundColor = option.palette.color(QPalette::Highlight);
- painter->setBrush(QBrush(backgroundColor));
- painter->fillRect(r1, QBrush(backgroundColor));
- }
- QFont font = painter->font();
- font.setPointSize(font.pointSize() - 1 );
- font.setBold(true);
- painter->setFont(font);
- int mid = (int) ((r1.height() / 2 ));
- r1.setBottom(r1.y() + mid);
- QRect r2 = option.rect;
- r2.setTop(r2.y() + mid);
- painter->drawText(r1, Qt::AlignLeft | Qt::AlignBottom , index.data().toString());
- //painter->setPen(Qt::green);
- font.setBold(false);
- painter->setFont(font);
- painter->drawText(r2, Qt::AlignLeft | Qt::AlignVCenter , index.data(DurationRole).toString());
- painter->restore();
- }
- else
- {
- QItemDelegate::paint(painter, option, index);
- }
-}
-};
-
-
ProjectList::ProjectList(QWidget *parent)
: QWidget(parent), m_render(NULL), m_fps(-1), m_commandStack(NULL)
{
connect(listView, SIGNAL(addClip ()), this, SLOT(slotAddClip()));
connect(listView, SIGNAL(addClip (QUrl, const QString &)), this, SLOT(slotAddClip(QUrl, const QString &)));
-
- listView->setItemDelegate(new ItemDelegate(listView));
+ m_listViewDelegate = new ItemDelegate(listView);
+ listView->setItemDelegate(m_listViewDelegate);
listView->setIconSize(QSize(60, 40));
listView->setSortingEnabled (true);
-
}
ProjectList::~ProjectList()
{
bool enable = false;
if (item) {
+ QFrame *w = new QFrame;
+ w->setFrameShape(QFrame::StyledPanel);
+ w->setLineWidth(2);
+ w->setAutoFillBackground(true);
+ QHBoxLayout *layout = new QHBoxLayout;
+ layout->addWidget( new QLabel(i18n("Color:")));
+ layout->addWidget( new KColorButton());
+ layout->addWidget( new QLabel(i18n("Duration:")));
+ layout->addWidget( new KRestrictedLine());
+ w->setLayout( layout );
+ m_listViewDelegate->extendItem(w, listView->currentIndex());
enable = true;
}
m_editAction->setEnabled(enable);
else item = new ProjectItem(listView, name, elem, clipId);
if (!url.isEmpty()) {
item->setData(1, FullPathRole, url.path());
-/* Nepomuk::File f( url.path() );
- QString annotation = f.getAnnotation();
- if (!annotation.isEmpty()) item->setText(2, annotation);*/
+ // if file has Nepomuk comment, use it
+ Nepomuk::Resource f( url.path() );
+ QString annotation = f.description();
+ if (!annotation.isEmpty()) item->setText(2, annotation);
QString resource = url.path();
if (resource.endsWith("westley") || resource.endsWith("kdenlive")) {
QString tmpfile;
#include <QDomNodeList>
#include <QToolBar>
#include <QTreeWidget>
+#include <QPainter>
#include <KUndoStack>
#include <KTreeWidgetSearchLine>
+#include <KExtendableItemDelegate>
#include "definitions.h"
#include "kdenlivedoc.h"
class ProjectItem;
+ const int NameRole = Qt::UserRole;
+ const int DurationRole = NameRole + 1;
+ const int FullPathRole = NameRole + 2;
+ const int ClipTypeRole = NameRole + 3;
+
+class ItemDelegate: public KExtendableItemDelegate
+{
+ public:
+ ItemDelegate(QAbstractItemView* parent = 0): KExtendableItemDelegate(parent)
+ {
+ }
+/*
+void expand()
+{
+ QWidget *w = new QWidget;
+ QVBoxLayout *layout = new QVBoxLayout;
+ layout->addWidget( new KColorButton(w));
+ w->setLayout( layout );
+ extendItem(w,
+}
+*/
+
+void paint(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const
+{
+ if (index.column() == 1)
+ {
+ const bool hover = option.state & (QStyle::State_Selected|QStyle::State_MouseOver|QStyle::State_HasFocus);
+ QRect r1 = option.rect;
+ painter->save();
+ if (hover) {
+ painter->setPen(option.palette.color(QPalette::HighlightedText));
+ QColor backgroundColor = option.palette.color(QPalette::Highlight);
+ painter->setBrush(QBrush(backgroundColor));
+ painter->fillRect(r1, QBrush(backgroundColor));
+ }
+ QFont font = painter->font();
+ font.setPointSize(font.pointSize() - 1 );
+ font.setBold(true);
+ painter->setFont(font);
+ int mid = (int) ((r1.height() / 2 ));
+ r1.setBottom(r1.y() + mid);
+ QRect r2 = option.rect;
+ r2.setTop(r2.y() + mid);
+ painter->drawText(r1, Qt::AlignLeft | Qt::AlignBottom , index.data().toString());
+ //painter->setPen(Qt::green);
+ font.setBold(false);
+ painter->setFont(font);
+ painter->drawText(r2, Qt::AlignLeft | Qt::AlignVCenter , index.data(DurationRole).toString());
+ painter->restore();
+ }
+ else
+ {
+ KExtendableItemDelegate::paint(painter, option, index);
+ }
+}
+};
+
class ProjectList : public QWidget
{
Q_OBJECT
ProjectItem *getItemById(int id);
QAction *m_editAction;
QAction *m_deleteAction;
+ ItemDelegate *m_listViewDelegate;
private slots:
void slotAddClip(QUrl givenUrl = QUrl(), const QString &group = QString::null);
#include <KMessageBox>
#include <KLocale>
-
-#include <mlt++/Mlt.h>
-
-
#include "renderer.h"
-Render::Render(const QString & rendererName, QWidget *parent):QObject(parent), m_name(rendererName), m_mltConsumer(NULL), m_mltProducer(NULL), m_mltTextProducer(NULL), m_sceneList(QDomDocument()), m_winid(-1), m_framePosition(0), m_generateScenelist(false), isBlocked(true)
+static void consumer_frame_show(mlt_consumer, Render * self, mlt_frame frame_ptr)
{
+ // detect if the producer has finished playing. Is there a better way to do it ?
+ //if (self->isBlocked) return;
+ if (mlt_properties_get_double( MLT_FRAME_PROPERTIES( frame_ptr ), "_speed" ) == 0.0) {
+ self->emitConsumerStopped();
+ }
+ else {
+ self->emitFrameNumber(mlt_frame_get_position(frame_ptr));
+ }
+}
+
+Render::Render(const QString & rendererName, int winid, int extid, QWidget *parent):QObject(parent), m_name(rendererName), m_mltConsumer(NULL), m_mltProducer(NULL), m_mltTextProducer(NULL), m_sceneList(QDomDocument()), m_winid(-1), m_framePosition(0), m_generateScenelist(false), isBlocked(true)
+{
+ m_mltProfile = new Mlt::Profile("pal_dv");
refreshTimer = new QTimer( this );
connect( refreshTimer, SIGNAL(timeout()), this, SLOT( refresh()) );
connect( osdTimer, SIGNAL(timeout()), this, SLOT(slotOsdTimeout()) );
m_osdProfile = KStandardDirs::locate("data", "kdenlive/profiles/metadata.properties");
+ //if (rendererName == "clip")
+ {
+ //Mlt::Consumer *consumer = new Mlt::Consumer( profile , "sdl_preview");
+ m_mltConsumer = new Mlt::Consumer( *m_mltProfile , "sdl_preview");//consumer;
+ m_mltConsumer->set("resize", 1);
+ m_mltConsumer->set("window_id", winid);
+ m_mltConsumer->set("terminate_on_pause", 1);
+ m_externalwinid = extid;
+ m_winid = winid;
+ m_mltConsumer->listen("consumer-frame-show", this, (mlt_listener) consumer_frame_show);
+ Mlt::Producer *producer = new Mlt::Producer( *m_mltProfile , "westley-xml", "<westley><playlist><producer mlt_service=\"colour\" colour=\"blue\" /></playlist></westley>");
+ m_mltProducer = producer;
+ m_mltConsumer->connect(*m_mltProducer);
+ m_mltProducer->set_speed(0.0);
+ //m_mltConsumer->start();
+ //refresh();
+ //initSceneList();
+ }
/*m_osdInfo = new Mlt::Filter("data_show");
char *tmp = decodedString(m_osdProfile);
m_osdInfo->set("resource", tmp);
-static void consumer_frame_show(mlt_consumer, Render * self, mlt_frame frame_ptr)
-{
- // detect if the producer has finished playing. Is there a better way to do it ?
- //if (self->isBlocked) return;
- if (mlt_properties_get_double( MLT_FRAME_PROPERTIES( frame_ptr ), "_speed" ) == 0.0) {
- self->emitConsumerStopped();
- }
- else {
- self->emitFrameNumber(mlt_frame_get_position(frame_ptr));
- }
-}
+
/** Wraps the VEML command of the same name; requests that the renderer
should create a video window. If show is true, then the window should be
void Render::createVideoXWindow(WId winid, WId externalMonitor)
{
+ return;
if (m_mltConsumer) {
delete m_mltConsumer;
}
- m_mltConsumer = new Mlt::Consumer("sdl_preview");
+ kDebug()<<"///////// INIT MONITOR WID";
+ //Mlt::Profile profile("dv_pal");//hdv_1080_50i");
+ //m_profile = profile;
+ //Mlt::Producer *producer = new Mlt::Producer( profile, "/home/one/Video002.mp4" );
+ Mlt::Consumer *consumer = new Mlt::Consumer( *m_mltProfile , "sdl_preview");
+ //m_mltProducer = producer;
+ m_mltConsumer = consumer;
+ //consumer->set( "rescale", "none" );
+ m_mltConsumer->set("resize", 1);
+ m_mltConsumer->set("window_id", (int) winid);
+ m_mltConsumer->set("terminate_on_pause", 1);
+ m_externalwinid = (int) externalMonitor;
+ m_winid = (int) winid;
+ m_mltConsumer->listen("consumer-frame-show", this, (mlt_listener) consumer_frame_show);
+ //m_mltProducer->set_speed(0.0);
+ //m_mltConsumer->connect( *m_mltProducer );
+ //m_mltConsumer->start( );
+/*
+ m_mltConsumer = new Mlt::Consumer(m_profile, "sdl_preview");
if (!m_mltConsumer || !m_mltConsumer->is_valid()) {
KMessageBox::error(qApp->activeWindow(), i18n("Could not create the video preview window.\nThere is something wrong with your Kdenlive install.\n Exiting now..."));
kError()<<"Sorry, cannot create MLT consumer, check your MLT install you miss SDL libraries support in MLT";
exit(1);
}
- //only as is saw, if we want to lock something with the sdl lock
- /*if (!KdenliveSettings::videoprofile().isEmpty())
- m_mltConsumer->set("profile", KdenliveSettings::videoprofile().ascii());*/
-
- m_mltConsumer->set("profile", "hdv_1080_50i"); //KdenliveSettings::videoprofile().ascii());
- /*m_mltConsumer->set("app_locked", 1);
- m_mltConsumer->set("app_lock", (void *) &my_lock, 0);
- m_mltConsumer->set("app_unlock", (void *) &my_unlock, 0);*/
m_externalwinid = (int) externalMonitor;
m_winid = (int) winid;
m_mltConsumer->set("resize", 1);
m_mltConsumer->set("terminate_on_pause", 1);
- /*QString aDevice = KdenliveSettings::audiodevice();
- if (!KdenliveSettings::videodriver().isEmpty()) m_mltConsumer->set("video_driver", KdenliveSettings::videodriver().ascii());
- if (!KdenliveSettings::audiodriver().isEmpty()) m_mltConsumer->set("audio_driver", KdenliveSettings::audiodriver().ascii());
- m_mltConsumer->set("audio_device", aDevice.section(";", 1).ascii());*/
m_mltConsumer->set("progressive", 1);
m_mltConsumer->set("audio_buffer", 1024);
m_mltConsumer->set("frequency", 48000);
m_mltConsumer->listen("consumer-frame-show", this, (mlt_listener) consumer_frame_show);
- //m_mltConsumer->start();
- initSceneList();
+*/
+ /*QString aDevice = KdenliveSettings::audiodevice();
+ if (!KdenliveSettings::videodriver().isEmpty()) m_mltConsumer->set("video_driver", KdenliveSettings::videodriver().ascii());
+ if (!KdenliveSettings::audiodriver().isEmpty()) m_mltConsumer->set("audio_driver", KdenliveSettings::audiodriver().ascii());
+ m_mltConsumer->set("audio_device", aDevice.section(";", 1).ascii());*/
+
+ initSceneList();
//QTimer::singleShot(500, this, SLOT(initSceneList()));
//initSceneList();
if (!m_mltConsumer) return 0;
if (!m_mltConsumer->is_stopped()) m_mltConsumer->stop();
m_mltConsumer->set("refresh", 0);
- m_mltConsumer->set("profile", profile);
+ //m_mltConsumer->set("profile", profile);
kDebug()<<" + + RESET CONSUMER WITH PROFILE: "<<profile;
- m_fps = 25;
- m_mltConsumer->set("fps", m_fps);
mlt_properties properties = MLT_CONSUMER_PROPERTIES( m_mltConsumer->get_consumer() );
- int result = mlt_consumer_profile( properties, profile );
+// apply_profile_properties( m_profile, m_mltConsumer->get_consumer(), properties );
refresh();
- return result;
+ return 1;
}
void Render::restartConsumer()
char *t = new char[fn.length() + 1];
strcpy(t, (const char *)fn);*/
- return qstrdup( str.toLatin1().data() );
+ return qstrdup( str.toUtf8().data() ); //toLatin1
}
//static
return pix;
}
Mlt::Producer *mlt_producer = m_mltProducer->cut(frame_position, frame_position + 1);
- Mlt::Filter m_convert("avcolour_space");
+ Mlt::Filter m_convert(*m_mltProfile, "avcolour_space");
m_convert.set("forced", mlt_image_rgb24a);
mlt_producer->attach(m_convert);
Mlt::Frame *frame = mlt_producer->get_frame();
}
//static
-QPixmap Render::getVideoThumbnail(QString file, int frame_position, int width, int height)
+QPixmap Render::getVideoThumbnail(char *profile, QString file, int frame_position, int width, int height)
{
QPixmap pix(width, height);
char *tmp = decodedString(file);
- Mlt::Producer m_producer(tmp);
+ Mlt::Profile *prof = new Mlt::Profile(profile);
+ Mlt::Producer m_producer(*prof, tmp);
delete[] tmp;
if (m_producer.is_blank()) {
pix.fill(Qt::black);
return pix;
}
- Mlt::Filter m_convert("avcolour_space");
+ Mlt::Filter m_convert(*prof, "avcolour_space");
m_convert.set("forced", mlt_image_rgb24a);
m_producer.attach(m_convert);
m_producer.seek(frame_position);
pix = frameThumbnail(frame, width, height, true);
delete frame;
}
+ if (prof) delete prof;
return pix;
}
bool Render::isValid(KUrl url)
{
char *tmp = decodedString(url.path());
- Mlt::Producer producer(tmp);
+ Mlt::Producer producer(*m_mltProfile, tmp);
delete[] tmp;
if (producer.is_blank())
return false;
kDebug()<<"////////////\n"<<doc.toString()<<"////////////////\n";
char *tmp = decodedString(doc.toString());
- Mlt::Producer producer("westley-xml", tmp);
+ Mlt::Producer producer(*m_mltProfile, "westley-xml", tmp);
delete[] tmp;
if (producer.is_blank()) {
KUrl url = xml.attribute("resource", QString::null);
filePropertyMap["filename"] = url.path();
filePropertyMap["duration"] = QString::number(producer.get_playtime());
-
- Mlt::Filter m_convert("avcolour_space");
+ kDebug()<<"/////// PRODUCER: "<<url.path()<<" IS: "<<producer.get_playtime();
+ Mlt::Filter m_convert(*m_mltProfile, "avcolour_space");
m_convert.set("forced", mlt_image_rgb24a);
producer.attach(m_convert);
- producer.set("profile", "hdv_1080_50i");
Mlt::Frame * frame = producer.get_frame();
if (frame->is_valid()) {
kWarning()<<"////// RENDER, SET SCENE LIST";
- Mlt::Playlist track;
- char *tmp = decodedString(list.toString());
-
- Mlt::Producer clip("westley-xml", tmp);
- delete[] tmp;
+/*
if (!clip.is_valid()) {
kWarning()<<" ++++ WARNING, UNABLE TO CREATE MLT PRODUCER";
m_generateScenelist = false;
return;
- }
-
- track.append(clip);
+ }*/
if (m_mltConsumer) {
m_mltConsumer->set("refresh", 0);
emit stopped();
}
- m_mltProducer = new Mlt::Producer(clip); //track.current();
- m_mltProducer->optimise();
+ char *tmp = decodedString(list.toString());
+ //Mlt::Producer clip(profile, "westley-xml", tmp);
+
+ m_mltProducer = new Mlt::Producer(*m_mltProfile, "westley-xml", tmp);
+ delete[] tmp;
+ //m_mltProducer->optimise();
if (position != 0) m_mltProducer->seek(position);
/*if (KdenliveSettings::osdtimecode()) {
if (!m_mltConsumer) {
restartConsumer();
}
- emit playListDuration( (int) m_mltProducer->get_playtime());
- m_connectTimer->start( 500 );
+ emit playListDuration(m_mltProducer->get_playtime());
+ //m_connectTimer->start( 500 );
+ connectPlaylist();
m_generateScenelist = false;
}
}
void Render::connectPlaylist() {
- kDebug()<<"************** CONNECTING PLAYLIST";
+
m_connectTimer->stop();
+ m_mltConsumer->connect(*m_mltProducer);
+ m_mltProducer->set_speed(0.0);
+ m_mltConsumer->start();
+ //refresh();
+/*
if (m_mltConsumer->start() == -1) {
KMessageBox::error(qApp->activeWindow(), i18n("Could not create the video preview window.\nThere is something wrong with your Kdenlive install or your driver settings, please fix it."));
m_mltConsumer = NULL;
}
else {
- m_mltConsumer->connect(*m_mltProducer);
- m_mltProducer->set_speed(0.0);
refresh();
- }
+ }*/
}
void Render::refreshDisplay() {
void Render::start()
{
+ kDebug()<<"----- STARTING MONITOR: "<<m_name;
if (!m_mltConsumer || m_winid == -1) {
+ kDebug()<<"----- BROKEN MONITOR: "<<m_name<<", RESTART";
restartConsumer();
return;
}
if (m_mltConsumer->is_stopped()) {
+ kDebug()<<"----- MONITOR: "<<m_name<<" WAS STOPPED";
if (m_mltConsumer->start() == -1) {
KMessageBox::error(qApp->activeWindow(), i18n("Could not create the video preview window.\nThere is something wrong with your Kdenlive install or your driver settings, please fix it."));
m_mltConsumer = NULL;
return;
}
else {
+ kDebug()<<"----- MONITOR: "<<m_name<<" REFRESH";
refresh();
}
}
void Render::stop()
{
- kDebug()<<"///////////// RENDER STOP-------";
if (m_mltConsumer && !m_mltConsumer->is_stopped()) {
+ kDebug()<<"///////////// RENDER STOPPED: "<<m_name;
m_mltConsumer->set("refresh", 0);
- // m_mltConsumer->stop();
+ m_mltConsumer->stop();
}
kDebug()<<"///////////// RENDER STOP2-------";
isBlocked = true;
int width = 1940; //KdenliveSettings::displaywidth();
QPixmap pix(width, height);
-
- Mlt::Filter m_convert("avcolour_space");
+ Mlt::Filter m_convert(*m_mltProfile, "avcolour_space");
m_convert.set("forced", mlt_image_rgb24a);
m_mltProducer->attach(m_convert);
Mlt::Frame * frame = m_mltProducer->get_frame();
Mlt::Producer trackProducer(tractor.track(track));
Mlt::Playlist trackPlaylist(( mlt_playlist ) trackProducer.get_service());
char *tmp = decodedString(resource);
- Mlt::Producer clip("westley-xml", tmp);
+ Mlt::Producer clip(*m_mltProfile, "westley-xml", tmp);
//clip.set_in_and_out(in.frames(m_fps), out.frames(m_fps));
delete[] tmp;
void Render::mltAddEffect(int track, GenTime position, QString id, QString tag, QMap <QString, QString> args)
{
Mlt::Service service(m_mltProducer->parent().get_service());
-
Mlt::Tractor tractor(service);
Mlt::Producer trackProducer(tractor.track(track));
Mlt::Playlist trackPlaylist(( mlt_playlist ) trackProducer.get_service());
kDebug()<<" / / INSERTING EFFECT: "<<id;
if (tag.startsWith("ladspa")) tag = "ladspa";
char *filterId = decodedString(tag);
- Mlt::Filter *filter = new Mlt::Filter(filterId);
+ Mlt::Filter *filter = new Mlt::Filter(*m_mltProfile, filterId);
filter->set("kdenlive_id", filterId);
QMap<QString, QString>::Iterator it;
if (currentKeyFrameNumber != keyFrameNumber) {
// attach filter to the clip
clipService.attach(*filter);
- filter = new Mlt::Filter(filterId);
+ filter = new Mlt::Filter(*m_mltProfile, filterId);
filter->set("kdenlive_id", filterId);
keyFrameNumber = currentKeyFrameNumber;
}
Mlt::Tractor tractor(service);
Mlt::Field *field = tractor.field();
-
char *transId = decodedString(tag);
- Mlt::Transition *transition = new Mlt::Transition(transId);
+ Mlt::Transition *transition = new Mlt::Transition(*m_mltProfile, transId);
transition->set_in_and_out((int) in.frames(m_fps), (int) out.frames(m_fps));
QMap<QString, QString>::Iterator it;
QString key;
void Render::mltSavePlaylist()
{
kWarning()<<"// UPDATING PLAYLIST TO DISK++++++++++++++++";
- Mlt::Consumer *fileConsumer = new Mlt::Consumer("westley");
+ Mlt::Consumer *fileConsumer = new Mlt::Consumer(*m_mltProfile, "westley");
fileConsumer->set("resource", "/home/one/playlist.xml");
Mlt::Service service(m_mltProducer->get_service());
#include "effectdesc.h"
#include "effectparamdescfactory.h"*/
+#include <mlt++/Mlt.h>
+
/**Render encapsulates the client side of the interface to a renderer.
From Kdenlive's point of view, you treat the Render object as the
renderer, and simply use it as if it was local. Calls are asyncrhonous -
class Frame;
class Producer;
class Filter;
-
+ class Profile;
class Multitrack;
};
APP_NOEXIST
};
- Render(const QString & rendererName, QWidget *parent = 0);
+ Render(const QString & rendererName, int winid, int extid, QWidget *parent = 0);
~Render();
/** Wraps the VEML command of the same name; requests that the renderer
void seek(GenTime time);
void seekToFrame(int pos);
- static QPixmap getVideoThumbnail(QString file, int frame, int width, int height);
+ static QPixmap getVideoThumbnail(char *profile, QString file, int frame, int width, int height);
QPixmap getImageThumbnail(KUrl url, int width, int height);
/** Return thumbnail for color clip */
Mlt::Producer * m_mltProducer;
Mlt::Producer *m_mltTextProducer;
Mlt::Filter *m_osdInfo;
+ Mlt::Profile *m_mltProfile;
double m_framePosition;
double m_fps;
uint m_monitorId;
#include <KDebug>
-#define LITTLE_MARK_X2 15
-#define LITTLE_MARK_X1 13
-#define MIDDLE_MARK_X1 9
-#define MIDDLE_MARK_X2 15
+#define LITTLE_MARK_X2 8
+#define LITTLE_MARK_X1 5
+#define MIDDLE_MARK_X1 3
+#define MIDDLE_MARK_X2 8
#define LABEL_SIZE 8
}
// virtual
-void SmallRuler::paintEvent(QPaintEvent * /*e*/)
+void SmallRuler::paintEvent(QPaintEvent *e)
{
// debug ("KRuler::drawContents, %s",(horizontal==dir)?"horizontal":"vertical");
QStylePainter p(this);
-
+ p.fillRect(e->rect(), QBrush(QColor(Qt::white)));
+
int value = this->value(),
minval = minimum(),
maxval;
// draw pointer
if (showPointer()) {
- QPolygon pa(4);
- pa.setPoints(3, value-6, 9, value+6, 9, value/*+0*/, 16);
+ QPolygon pa(3);
+ pa.setPoints(3, value-6, 0, value+6, 0, value/*+0*/, 8);
p.setBrush( QBrush(Qt::yellow) );
p.drawPolygon( pa );
}
view->setupUi(this);
m_ruler = new CustomRuler(doc->timecode());
QVBoxLayout *layout = new QVBoxLayout;
- layout->addWidget(m_ruler);
view->ruler_frame->setLayout(layout);
+ layout->addWidget(m_ruler);
m_scene = new QGraphicsScene();
m_trackview = new CustomTrackView(m_doc->commandStack(), m_scene, this);
tracksLayout->addWidget(m_trackview);
parseDocument(doc->toXml());
-
+/*
TrackPanelClipMoveFunction *m_moveFunction = new TrackPanelClipMoveFunction(this);
registerFunction("move", m_moveFunction);
- setEditMode("move");
+ setEditMode("move");*/
connect(view->horizontalSlider, SIGNAL(valueChanged ( int )), this, SLOT(slotChangeZoom( int )));
connect(m_ruler, SIGNAL(cursorMoved ( int )), m_trackview, SLOT(setCursorPos( int )));
{
kDebug()<<"************* ADD AUDIO TRACK "<<ix;
m_trackview->addTrack();
- DocumentTrack *track = new DocumentAudioTrack(xml, this, m_trackview);
+ //DocumentTrack *track = new DocumentAudioTrack(xml, this, m_trackview);
HeaderTrack *header = new HeaderTrack();
//m_tracksAreaLayout->addWidget(track); //, ix, Qt::AlignTop);
m_headersLayout->addWidget(header); //, ix, Qt::AlignTop);
- documentTracks.insert(ix, track);
+ //documentTracks.insert(ix, track);
return 0;
//track->show();
}
int TrackView::slotAddVideoTrack(int ix, QDomElement xml)
{
m_trackview->addTrack();
- DocumentTrack *track = new DocumentVideoTrack(xml, this, m_trackview);
+ //DocumentTrack *track = new DocumentVideoTrack(xml, this, m_trackview);
HeaderTrack *header = new HeaderTrack();
int trackTop = 50 * ix;
int trackBottom = trackTop + 50;
int in = elem.attribute("in", 0).toInt();
int out = elem.attribute("out", 0).toInt() - in;
//kDebug()<<"++++++++++++++\n\n / / /ADDING CLIP: "<<clip.cropTime<<", out: "<<clip.duration<<", Producer: "<<clip.producer<<"\n\n++++++++++++++++++++";
- ClipItem *item = new ClipItem(elem, ix, in, QRectF(position * m_scale, trackTop + 1, out * m_scale, 49), out);
+ ClipItem *item = new ClipItem(elem, ix, position, QRectF(position * m_scale, trackTop + 1, out * m_scale, 49), out);
m_scene->addItem(item);
position += out;
//m_tracksAreaLayout->addWidget(track); //, ix, Qt::AlignTop);
m_headersLayout->addWidget(header); //, ix, Qt::AlignTop);
- documentTracks.insert(ix, track);
+ //documentTracks.insert(ix, track);
kDebug()<<"************* ADD VIDEO TRACK "<<ix<<", DURATION: "<<position;
return position;
//track->show();
<rect>
<x>0</x>
<y>0</y>
- <width>320</width>
- <height>238</height>
+ <width>339</width>
+ <height>216</height>
</rect>
</property>
<property name="windowTitle" >
<string>Form</string>
</property>
<layout class="QGridLayout" >
+ <property name="leftMargin" >
+ <number>0</number>
+ </property>
+ <property name="topMargin" >
+ <number>0</number>
+ </property>
+ <property name="rightMargin" >
+ <number>0</number>
+ </property>
+ <property name="bottomMargin" >
+ <number>0</number>
+ </property>
+ <property name="horizontalSpacing" >
+ <number>0</number>
+ </property>
<property name="verticalSpacing" >
<number>0</number>
</property>
<item row="0" column="0" colspan="2" >
<widget class="QFrame" name="video_frame" >
- <property name="frameShape" >
- <enum>QFrame::StyledPanel</enum>
- </property>
- <property name="frameShadow" >
- <enum>QFrame::Raised</enum>
+ <property name="lineWidth" >
+ <number>0</number>
</property>
</widget>
</item>
<verstretch>0</verstretch>
</sizepolicy>
</property>
- <property name="frameShape" >
- <enum>QFrame::StyledPanel</enum>
+ <property name="minimumSize" >
+ <size>
+ <width>16</width>
+ <height>15</height>
+ </size>
+ </property>
+ <property name="maximumSize" >
+ <size>
+ <width>16777215</width>
+ <height>15</height>
+ </size>
</property>
- <property name="frameShadow" >
- <enum>QFrame::Raised</enum>
+ <property name="lineWidth" >
+ <number>0</number>
</property>
</widget>
</item>