enum OPERATIONTYPE { NONE = 0, MOVE = 1, RESIZESTART = 2, RESIZEEND = 3, FADEIN = 4, FADEOUT = 5};
enum CLIPTYPE { UNKNOWN = 0, AUDIO = 1, VIDEO = 2, AV = 3, COLOR = 4, IMAGE = 5, TEXT = 6, SLIDESHOW = 7, VIRTUAL = 8, PLAYLIST = 9};
-struct TrackViewClip {
- int startTime;
- int duration;
- int cropTime;
- QString producer;
+struct MltVideoProfile {
+ QString path;
+ QString description;
+ int frame_rate_num;
+ int frame_rate_den;
+ int width;
+ int height;
+ bool progressive;
+ int sample_aspect_num;
+ int sample_aspect_den;
+ int display_aspect_num;
+ int display_aspect_den;
};
#endif
}
DocClipBase::~DocClipBase() {
- //if (m_thumbProd) delete m_thumbProd;
+ if (m_thumbProd) delete m_thumbProd;
}
void DocClipBase::slotRequestAudioThumbs() {
#include "kdenlivedoc.h"
#include "docclipbase.h"
-KdenliveDoc::KdenliveDoc(const KUrl &url, double fps, int width, int height, QWidget *parent): QObject(parent), m_render(NULL), m_url(url), m_fps(fps), m_width(width), m_height(height), m_projectName(NULL), m_commandStack(new KUndoStack()) {
+KdenliveDoc::KdenliveDoc(const KUrl &url, MltVideoProfile profile, QWidget *parent): QObject(parent), m_render(NULL), m_url(url), m_profile(profile), m_fps((double)profile.frame_rate_num / profile.frame_rate_den), m_width(profile.width), m_height(profile.height), m_projectName(NULL), m_commandStack(new KUndoStack()) {
m_clipManager = new ClipManager(this);
if (!url.isEmpty()) {
QString tmpFile;
doc.appendChild(tractor);
}
- if (fps == 30000.0 / 1001.0) m_timecode.setFormat(30, true);
- else m_timecode.setFormat((int) fps);
+ if (m_fps == 30000.0 / 1001.0) m_timecode.setFormat(30, true);
+ else m_timecode.setFormat((int) m_fps);
}
KdenliveDoc::~KdenliveDoc() {
return m_clipManager;
}
+QString KdenliveDoc::profilePath() {
+ return m_profile.path;
+}
+
void KdenliveDoc::setThumbsProgress(KUrl url, int progress) {
emit thumbsProgress(url, progress);
}
#include "timecode.h"
#include "renderer.h"
#include "clipmanager.h"
+#include "definitions.h"
class KdenliveDoc: public QObject {
Q_OBJECT public:
- KdenliveDoc(const KUrl &url, double fps, int width, int height, QWidget *parent = 0);
+ KdenliveDoc(const KUrl &url, MltVideoProfile profile, QWidget *parent = 0);
~KdenliveDoc();
QString documentName();
QDomNodeList producersList();
void deleteProjectClip(const uint clipId);
/** Inform application of the audio thumbnails generation progress */
void setThumbsProgress(KUrl url, int progress);
+ QString profilePath();
private:
KUrl m_url;
KUndoStack *m_commandStack;
QDomDocument generateSceneList();
ClipManager *m_clipManager;
+ MltVideoProfile m_profile;
public slots:
}
void MainWindow::newFile() {
- KdenliveDoc *doc = new KdenliveDoc(KUrl(), 25, 720, 576);
+ MltVideoProfile prof = ProfilesDialog::getVideoProfile(KdenliveSettings::default_profile());
+ if (prof.width == 0) prof = ProfilesDialog::getVideoProfile("dv_pal");
+ KdenliveDoc *doc = new KdenliveDoc(KUrl(), prof);
TrackView *trackView = new TrackView(doc);
- m_timelineArea->addTab(trackView, i18n("Untitled") + " / " + ProfilesDialog::getProfileDescription(KdenliveSettings::default_profile()));
+ m_timelineArea->addTab(trackView, i18n("Untitled") + " / " + prof.description);
if (m_timelineArea->count() == 1)
connectDocument(trackView, doc);
else m_timelineArea->setTabBarHidden(false);
}
void MainWindow::openFile(const KUrl &url) { //new
- KdenliveDoc *doc = new KdenliveDoc(url, 25, 720, 576);
+ //TODO: get video profile from url before opening it
+ MltVideoProfile prof = ProfilesDialog::getVideoProfile(KdenliveSettings::default_profile());
+ if (prof.width == 0) prof = ProfilesDialog::getVideoProfile("dv_pal");
+ KdenliveDoc *doc = new KdenliveDoc(url, prof);
TrackView *trackView = new TrackView(doc);
- m_timelineArea->setCurrentIndex(m_timelineArea->addTab(trackView, QIcon(), doc->documentName()));
+ m_timelineArea->setCurrentIndex(m_timelineArea->addTab(trackView, QIcon(), doc->documentName() + " / " + prof.description));
m_timelineArea->setTabToolTip(m_timelineArea->currentIndex(), doc->url().path());
if (m_timelineArea->count() > 1) m_timelineArea->setTabBarHidden(false);
//connectDocument(trackView, doc);
m_projectList->setDocument(doc);
m_monitorManager->setTimecode(doc->timecode());
+ m_monitorManager->resetProfiles(doc->profilePath());
doc->setRenderer(m_projectMonitor->render);
//m_undoView->setStack(0);
m_commandStack = doc->commandStack();
render->setSceneList(doc, 0);
}
+void Monitor::resetProfile(QString prof) {
+ if (render == NULL) return;
+ render->resetProfile(prof);
+}
#include "monitor.moc"
public:
Monitor(QString name, MonitorManager *manager, QWidget *parent = 0);
Render *render;
+ void resetProfile(QString prof);
+
virtual void resizeEvent(QResizeEvent * event);
protected:
virtual void mousePressEvent(QMouseEvent * event);
else m_projectMonitor->slotPlay();
}
+void MonitorManager::resetProfiles(QString prof) {
+ m_clipMonitor->resetProfile(prof);
+ m_projectMonitor->resetProfile(prof);
+}
+
#include "monitormanager.moc"
void initMonitors(Monitor *clipMonitor, Monitor *projectMonitor);
Timecode timecode();
void setTimecode(Timecode tc);
+ void resetProfiles(QString prof);
public slots:
void activateMonitor(QString name = QString::null);
connect(m_view.profiles_list, SIGNAL(currentIndexChanged(int)), this, SLOT(slotUpdateDisplay()));
}
+// static
+MltVideoProfile ProfilesDialog::getVideoProfile(QString name) {
+ MltVideoProfile result;
+ QStringList profilesNames;
+ QStringList profilesFiles;
+ QStringList profilesFilter;
+ profilesFilter << "*";
+ QString path;
+
+ // List the Mlt profiles
+ profilesFiles = QDir(KdenliveSettings::mltpath()).entryList(profilesFilter, QDir::Files);
+ if (profilesFiles.contains(name)) path = KdenliveSettings::mltpath() + "/" + name;
+
+ if (path.isEmpty()) {
+ // List custom profiles
+ QStringList customProfiles = KGlobal::dirs()->findDirs("appdata", "profiles");
+ for (int i = 0; i < customProfiles.size(); ++i) {
+ profilesFiles = QDir(customProfiles.at(i)).entryList(profilesFilter, QDir::Files);
+ if (profilesFiles.contains(name)) {
+ path = customProfiles.at(i) + "/" + name;
+ break;
+ }
+ }
+ }
+
+ if (path.isEmpty()) return result;
+ KConfig confFile(path);
+ result.path = path;
+ result.description = confFile.entryMap().value("description");
+ result.frame_rate_num = confFile.entryMap().value("frame_rate_num").toInt();
+ result.frame_rate_den = confFile.entryMap().value("frame_rate_den").toInt();
+ result.width = confFile.entryMap().value("width").toInt();
+ result.height = confFile.entryMap().value("height").toInt();
+ result.progressive = confFile.entryMap().value("progressive").toInt();
+ result.sample_aspect_num = confFile.entryMap().value("sample_aspect_num").toInt();
+ result.sample_aspect_den = confFile.entryMap().value("sample_aspect_den").toInt();
+ result.display_aspect_num = confFile.entryMap().value("display_aspect_num").toInt();
+ result.display_aspect_den = confFile.entryMap().value("display_aspect_den").toInt();
+ return result;
+}
// static
QString ProfilesDialog::getProfileDescription(QString name) {
#include <QDialog>
+#include "definitions.h"
#include "ui_profiledialog_ui.h"
class ProfilesDialog : public QDialog {
static QString getProfileDescription(QString name);
static QMap< QString, QString > getSettingsForProfile(const QString profileName);
static QMap< QString, QString > getSettingsFromFile(const QString path);
+ static MltVideoProfile getVideoProfile(QString name);
private slots:
void slotUpdateDisplay();
-int Render::resetRendererProfile(char * profile) {
+int Render::resetProfile(QString profile) {
if (!m_mltConsumer) return 0;
if (!m_mltConsumer->is_stopped()) m_mltConsumer->stop();
m_mltConsumer->set("refresh", 0);
- //m_mltConsumer->set("profile", profile);
+ //TODO: we should also rebuild filters and delete existing m_mltProfile
+ m_mltProfile = new Mlt::Profile((char*) qstrdup(profile.toUtf8()));
kDebug() << " + + RESET CONSUMER WITH PROFILE: " << profile;
mlt_properties properties = MLT_CONSUMER_PROPERTIES(m_mltConsumer->get_consumer());
-// apply_profile_properties( m_profile, m_mltConsumer->get_consumer(), properties );
+ mlt_properties_set_data(properties, "profile", m_mltProfile->get_profile(), 0, 0, NULL);
+ //apply_profile_properties( m_mltProfile, m_mltConsumer->get_consumer(), properties );
refresh();
return 1;
}
void refreshDisplay();
/** returns the current scenelist */
QDomDocument sceneList() const;
- int resetRendererProfile(char * profile);
+ int resetProfile(QString profile);
const double fps() const;
/** Playlist manipulation */