Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Kdenlive
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
261
Issues
261
List
Boards
Labels
Service Desk
Milestones
Merge Requests
16
Merge Requests
16
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Multimedia
Kdenlive
Commits
6fdaf01d
Commit
6fdaf01d
authored
Jul 16, 2015
by
Jean-Baptiste Mardelle
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cleanup profile handling, fix crash when opening some project files
parent
593e6d48
Changes
22
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
22 changed files
with
236 additions
and
318 deletions
+236
-318
src/bin/bin.cpp
src/bin/bin.cpp
+2
-0
src/bin/bin.h
src/bin/bin.h
+2
-0
src/dialogs/profilesdialog.cpp
src/dialogs/profilesdialog.cpp
+19
-0
src/dialogs/profilesdialog.h
src/dialogs/profilesdialog.h
+3
-0
src/doc/documentvalidator.cpp
src/doc/documentvalidator.cpp
+1
-0
src/doc/kdenlivedoc.cpp
src/doc/kdenlivedoc.cpp
+59
-26
src/doc/kdenlivedoc.h
src/doc/kdenlivedoc.h
+5
-1
src/doc/kthumb.cpp
src/doc/kthumb.cpp
+0
-1
src/mainwindow.cpp
src/mainwindow.cpp
+3
-48
src/mainwindow.h
src/mainwindow.h
+0
-2
src/mltcontroller/bincontroller.cpp
src/mltcontroller/bincontroller.cpp
+9
-32
src/mltcontroller/bincontroller.h
src/mltcontroller/bincontroller.h
+1
-9
src/monitor/glwidget.cpp
src/monitor/glwidget.cpp
+41
-18
src/monitor/glwidget.h
src/monitor/glwidget.h
+5
-0
src/monitor/monitor.cpp
src/monitor/monitor.cpp
+11
-12
src/monitor/monitor.h
src/monitor/monitor.h
+1
-1
src/monitor/monitormanager.cpp
src/monitor/monitormanager.cpp
+3
-18
src/monitor/monitormanager.h
src/monitor/monitormanager.h
+1
-2
src/project/projectmanager.cpp
src/project/projectmanager.cpp
+8
-4
src/project/projectmanager.h
src/project/projectmanager.h
+3
-0
src/renderer.cpp
src/renderer.cpp
+57
-133
src/renderer.h
src/renderer.h
+2
-11
No files found.
src/bin/bin.cpp
View file @
6fdaf01d
...
...
@@ -198,6 +198,7 @@ bool EventEater::eventFilter(QObject *obj, QEvent *event)
Bin
::
Bin
(
QWidget
*
parent
)
:
QWidget
(
parent
)
,
isLoading
(
false
)
,
m_itemModel
(
NULL
)
,
m_itemView
(
NULL
)
,
m_rootFolder
(
NULL
)
...
...
@@ -847,6 +848,7 @@ void Bin::rowsRemoved(const QModelIndex &/*parent*/, int start, int /*end*/)
void
Bin
::
selectProxyModel
(
const
QModelIndex
&
id
)
{
if
(
isLoading
)
return
;
if
(
id
.
isValid
())
{
AbstractProjectItem
*
currentItem
=
static_cast
<
AbstractProjectItem
*>
(
m_proxyModel
->
mapToSource
(
id
).
internalPointer
());
if
(
currentItem
)
{
...
...
src/bin/bin.h
View file @
6fdaf01d
...
...
@@ -297,6 +297,8 @@ class Bin : public QWidget
public:
explicit
Bin
(
QWidget
*
parent
=
0
);
~
Bin
();
bool
isLoading
;
/** @brief Sets the document for the bin and initialize some stuff */
void
setDocument
(
KdenliveDoc
*
project
);
...
...
src/dialogs/profilesdialog.cpp
View file @
6fdaf01d
...
...
@@ -238,6 +238,25 @@ void ProfilesDialog::slotDeleteProfile()
if
(
!
success
)
qDebug
()
<<
"//// Cannot delete profile "
<<
path
<<
", does not seem to be custom one"
;
}
// static
MltVideoProfile
ProfilesDialog
::
getVideoProfileFromXml
(
const
QDomElement
&
element
)
{
MltVideoProfile
result
;
result
.
description
=
element
.
attribute
(
"description"
);
result
.
frame_rate_num
=
element
.
attribute
(
"frame_rate_num"
).
toInt
();
result
.
frame_rate_den
=
element
.
attribute
(
"frame_rate_den"
).
toInt
();
result
.
width
=
element
.
attribute
(
"width"
).
toInt
();
result
.
height
=
element
.
attribute
(
"height"
).
toInt
();
result
.
progressive
=
element
.
attribute
(
"progressive"
).
toInt
();
result
.
sample_aspect_num
=
element
.
attribute
(
"sample_aspect_num"
).
toInt
();
result
.
sample_aspect_den
=
element
.
attribute
(
"sample_aspect_den"
).
toInt
();
result
.
display_aspect_num
=
element
.
attribute
(
"display_aspect_num"
).
toInt
();
result
.
display_aspect_den
=
element
.
attribute
(
"display_aspect_den"
).
toInt
();
result
.
colorspace
=
element
.
attribute
(
"colorspace"
).
toInt
();
result
.
path
=
existingProfile
(
result
);
return
result
;
}
// static
MltVideoProfile
ProfilesDialog
::
getVideoProfile
(
const
QString
&
name
)
{
...
...
src/dialogs/profilesdialog.h
View file @
6fdaf01d
...
...
@@ -37,10 +37,13 @@ public:
void
fillList
(
const
QString
&
selectedProfile
=
QString
());
static
QMap
<
QString
,
QString
>
getSettingsFromFile
(
const
QString
&
path
);
/** @brief Create profile from xml in MLT project file */
static
MltVideoProfile
getVideoProfileFromXml
(
const
QDomElement
&
element
);
static
MltVideoProfile
getVideoProfile
(
const
QString
&
name
);
static
MltVideoProfile
getVideoProfile
(
Mlt
::
Profile
&
profile
);
static
QMap
<
QString
,
QString
>
getProfilesInfo
();
static
void
saveProfile
(
MltVideoProfile
&
profile
,
QString
profilePath
=
QString
());
/** @brief Check if a given profile has a profile file describing it */
static
QString
existingProfile
(
const
MltVideoProfile
&
profile
);
static
bool
existingProfileDescription
(
const
QString
&
desc
);
...
...
src/doc/documentvalidator.cpp
View file @
6fdaf01d
...
...
@@ -1238,6 +1238,7 @@ bool DocumentValidator::upgrade(double version, const double currentVersion)
EffectsList
::
setProperty
(
playlist
,
"kdenlive:customeffects"
,
d2
.
toString
());
}
EffectsList
::
setProperty
(
playlist
,
"kdenlive:docproperties.version"
,
QString
::
number
(
currentVersion
));
if
(
!
infoXml
.
isNull
())
EffectsList
::
setProperty
(
playlist
,
"kdenlive:docproperties.projectfolder"
,
infoXml
.
attribute
(
"projectfolder"
));
}
m_modified
=
true
;
return
true
;
...
...
src/doc/kdenlivedoc.cpp
View file @
6fdaf01d
...
...
@@ -106,7 +106,6 @@ KdenliveDoc::KdenliveDoc(const QUrl &url, const QUrl &projectFolder, QUndoGroup
connect
(
&
m_fileWatcher
,
&
KDirWatch
::
deleted
,
this
,
&
KdenliveDoc
::
slotClipMissing
);
connect
(
&
m_modifiedTimer
,
&
QTimer
::
timeout
,
this
,
&
KdenliveDoc
::
slotProcessModifiedClips
);
// init default document properties
m_documentProperties
[
"zoom"
]
=
'7'
;
m_documentProperties
[
"verticalzoom"
]
=
'1'
;
...
...
@@ -127,7 +126,7 @@ KdenliveDoc::KdenliveDoc(const QUrl &url, const QUrl &projectFolder, QUndoGroup
i
.
next
();
m_documentProperties
[
i
.
key
()]
=
i
.
value
();
}
// Load metadata
QMapIterator
<
QString
,
QString
>
j
(
metadata
);
while
(
j
.
hasNext
())
{
...
...
@@ -302,8 +301,10 @@ KdenliveDoc::KdenliveDoc(const QUrl &url, const QUrl &projectFolder, QUndoGroup
// Something went wrong, or a new file was requested: create a new project
if
(
!
success
)
{
m_url
.
clear
();
setProfilePath
(
profileName
);
//setProfilePath(profileName);
m_profile
=
ProfilesDialog
::
getVideoProfile
(
profileName
);
m_document
=
createEmptyDocument
(
tracks
.
x
(),
tracks
.
y
());
updateProjectProfile
();
}
// Ask to create the project directory if it does not exist
...
...
@@ -357,11 +358,13 @@ KdenliveDoc::~KdenliveDoc()
int
KdenliveDoc
::
setSceneList
()
{
m_render
->
resetProfile
(
KdenliveSettings
::
current_profile
(),
true
);
//m_render->resetProfile(m_profile);
pCore
->
bin
()
->
isLoading
=
true
;
if
(
m_render
->
setSceneList
(
m_document
.
toString
(),
m_documentProperties
.
value
(
"position"
).
toInt
())
==
-
1
)
{
// INVALID MLT Consumer, something is wrong
return
-
1
;
}
pCore
->
bin
()
->
isLoading
=
false
;
pCore
->
binController
()
->
checkThumbnails
(
projectFolder
().
path
()
+
"/thumbs/"
);
m_documentProperties
.
remove
(
"position"
);
return
0
;
...
...
@@ -410,6 +413,20 @@ QDomDocument KdenliveDoc::createEmptyDocument(const QList <TrackInfo> &tracks)
// Create black producer
// For some unknown reason, we have to build the black producer here and not in renderer.cpp, otherwise
// the composite transitions with the black track are corrupted.
/*QDomElement pro = doc.createElement("profile");
pro.setAttribute("frame_rate_den", QString::number(m_profile.frame_rate_den));
pro.setAttribute("frame_rate_num", QString::number(m_profile.frame_rate_num));
pro.setAttribute("display_aspect_den", QString::number(m_profile.display_aspect_den));
pro.setAttribute("display_aspect_num", QString::number(m_profile.display_aspect_num));
pro.setAttribute("sample_aspect_den", QString::number(m_profile.sample_aspect_den));
pro.setAttribute("sample_aspect_num", QString::number(m_profile.sample_aspect_num));
pro.setAttribute("width", QString::number(m_profile.width));
pro.setAttribute("height", QString::number(m_profile.height));
pro.setAttribute("progressive", QString::number((int) m_profile.progressive));
pro.setAttribute("colorspace", QString::number(m_profile.colorspace));
pro.setAttribute("description", m_profile.description);
mlt.appendChild(pro);*/
QDomElement
blk
=
doc
.
createElement
(
"producer"
);
blk
.
setAttribute
(
"in"
,
0
);
blk
.
setAttribute
(
"out"
,
500
);
...
...
@@ -842,16 +859,8 @@ bool KdenliveDoc::setProfilePath(QString path)
setModified
(
true
);
}
}
KdenliveSettings
::
setProject_display_ratio
((
double
)
m_profile
.
display_aspect_num
/
m_profile
.
display_aspect_den
);
double
fps
=
(
double
)
m_profile
.
frame_rate_num
/
m_profile
.
frame_rate_den
;
KdenliveSettings
::
setProject_fps
(
fps
);
m_width
=
m_profile
.
width
;
m_height
=
m_profile
.
height
;
//qDebug() << "Kdenlive document, init timecode from path: " << path << ", " << m_fps;
m_timecode
.
setFormat
(
fps
);
KdenliveSettings
::
setCurrent_profile
(
m_profile
.
path
);
return
(
current_fps
!=
fps
);
updateProjectProfile
();
return
(
current_fps
!=
KdenliveSettings
::
project_fps
());
}
double
KdenliveDoc
::
dar
()
const
...
...
@@ -1645,19 +1654,43 @@ const QMap <QString, QString> KdenliveDoc::documentProperties()
void
KdenliveDoc
::
loadDocumentProperties
()
{
QDomElement
pl
=
m_document
.
firstChildElement
(
"playlist"
);
if
(
pl
.
isNull
())
return
;
QDomNodeList
props
=
pl
.
elementsByTagName
(
"property"
);
QString
name
;
QDomElement
e
;
for
(
int
i
=
0
;
i
<
props
.
count
();
i
++
)
{
e
=
props
.
at
(
i
).
toElement
();
name
=
e
.
attribute
(
"name"
);
if
(
name
.
startsWith
(
"kdenlive:docproperties."
))
{
name
=
name
.
section
(
"."
,
1
);
m_documentProperties
.
insert
(
name
,
e
.
firstChild
().
nodeValue
());
QDomNodeList
list
=
m_document
.
elementsByTagName
(
"playlist"
);
if
(
!
list
.
isEmpty
())
{
QDomElement
pl
=
list
.
at
(
0
).
toElement
();
if
(
pl
.
isNull
())
return
;
QDomNodeList
props
=
pl
.
elementsByTagName
(
"property"
);
QString
name
;
QDomElement
e
;
for
(
int
i
=
0
;
i
<
props
.
count
();
i
++
)
{
e
=
props
.
at
(
i
).
toElement
();
name
=
e
.
attribute
(
"name"
);
if
(
name
.
startsWith
(
"kdenlive:docproperties."
))
{
name
=
name
.
section
(
"."
,
1
);
m_documentProperties
.
insert
(
name
,
e
.
firstChild
().
nodeValue
());
}
}
}
m_projectFolder
=
QUrl
::
fromLocalFile
(
m_documentProperties
.
value
(
"projectfolder"
));
//setProfilePath(m_documentProperties.value("profile"));
list
=
m_document
.
elementsByTagName
(
"profile"
);
if
(
!
list
.
isEmpty
())
{
m_profile
=
ProfilesDialog
::
getVideoProfileFromXml
(
list
.
at
(
0
).
toElement
());
}
updateProjectProfile
();
}
void
KdenliveDoc
::
updateProjectProfile
()
{
KdenliveSettings
::
setProject_display_ratio
((
double
)
m_profile
.
display_aspect_num
/
m_profile
.
display_aspect_den
);
double
fps
=
(
double
)
m_profile
.
frame_rate_num
/
m_profile
.
frame_rate_den
;
KdenliveSettings
::
setProject_fps
(
fps
);
m_width
=
m_profile
.
width
;
m_height
=
m_profile
.
height
;
m_timecode
.
setFormat
(
fps
);
KdenliveSettings
::
setCurrent_profile
(
m_profile
.
path
);
}
void
KdenliveDoc
::
resetProfile
()
{
m_profile
=
ProfilesDialog
::
getVideoProfile
(
KdenliveSettings
::
current_profile
());
updateProjectProfile
();
}
src/doc/kdenlivedoc.h
View file @
6fdaf01d
...
...
@@ -105,7 +105,8 @@ public:
/** @brief Informs Kdenlive of the audio thumbnails generation progress. */
void
setThumbsProgress
(
const
QString
&
message
,
int
progress
);
const
QString
&
profilePath
()
const
;
Q_DECL_DEPRECATED
MltVideoProfile
mltProfile
()
const
;
/** @brief Returns current project profile. */
MltVideoProfile
mltProfile
()
const
;
ProfileInfo
getProfileInfo
()
const
;
//Mlt::Profile *profile();
const
QString
description
()
const
;
...
...
@@ -159,6 +160,7 @@ public:
QString
documentNotes
()
const
;
/** @brief Saves effects embedded in project file. */
void
saveCustomEffects
(
const
QDomNodeList
&
customeffects
);
void
resetProfile
();
private:
QUrl
m_url
;
...
...
@@ -207,6 +209,8 @@ private:
void
cleanupBackupFiles
();
/** @brief Load document properties from the xml file */
void
loadDocumentProperties
();
/** @brief update document properties to reflect a change in the current profile */
void
updateProjectProfile
();
public
slots
:
void
slotCreateXmlClip
(
const
QString
&
name
,
const
QDomElement
&
xml
,
const
QString
&
group
,
const
QString
&
groupId
);
...
...
src/doc/kthumb.cpp
View file @
6fdaf01d
...
...
@@ -210,7 +210,6 @@ QImage KThumb::getFrame(Mlt::Frame *frame, int width, int height)
QImage
p
(
width
,
height
,
QImage
::
Format_ARGB32_Premultiplied
);
/*p.fill(QColor(Qt::red).rgb());
return p;*/
if
(
frame
==
NULL
||
!
frame
->
is_valid
())
{
p
.
fill
(
QColor
(
Qt
::
red
).
rgb
());
return
p
;
...
...
src/mainwindow.cpp
View file @
6fdaf01d
...
...
@@ -1356,7 +1356,8 @@ void MainWindow::slotEditProjectSettings()
slotSwitchAudioThumbs
();
}
if
(
project
->
profilePath
()
!=
profile
)
{
slotUpdateProjectProfile
(
profile
);
KdenliveSettings
::
setCurrent_profile
(
profile
);
pCore
->
projectManager
()
->
slotResetProfiles
();
}
if
(
project
->
getDocumentProperty
(
"proxyparams"
)
!=
w
->
proxyParams
())
{
project
->
setModified
();
...
...
@@ -1405,48 +1406,6 @@ void MainWindow::slotDisableProxies()
slotUpdateProxySettings
();
}
void
MainWindow
::
slotUpdateProjectProfile
(
const
QString
&
profile
)
{
KdenliveDoc
*
project
=
pCore
->
projectManager
()
->
current
();
// Recreate the stopmotion widget if profile changes
if
(
m_stopmotion
)
{
delete
m_stopmotion
;
m_stopmotion
=
NULL
;
}
// Deselect current effect / transition
m_effectStack
->
slotClipItemSelected
(
NULL
);
m_transitionConfig
->
slotTransitionItemSelected
(
NULL
,
0
,
QPoint
(),
false
);
m_clipMonitor
->
openClip
(
NULL
);
bool
updateFps
=
project
->
setProfilePath
(
profile
);
project
->
renderer
()
->
resetBinProfile
(
profile
);
KdenliveSettings
::
setProject_fps
(
project
->
fps
());
setWindowTitle
(
project
->
description
());
setWindowModified
(
project
->
isModified
());
pCore
->
monitorManager
()
->
resetProfiles
(
project
->
timecode
());
m_transitionConfig
->
updateProjectFormat
();
m_effectStack
->
updateProjectFormat
(
project
->
timecode
());
if
(
m_renderWidget
)
{
m_renderWidget
->
setProfile
(
project
->
mltProfile
());
}
if
(
updateFps
)
{
pCore
->
projectManager
()
->
currentTimeline
()
->
updateProjectFps
();
}
project
->
clipManager
()
->
clearCache
();
pCore
->
projectManager
()
->
currentTimeline
()
->
updateProfile
();
project
->
setModified
(
true
);
m_commandStack
->
activeStack
()
->
clear
();
//Update the mouse position display so it will display in DF/NDF format by default based on the project setting.
slotUpdateMousePosition
(
0
);
//TODO
//m_projectList->slotReloadClip();
// We need to desactivate & reactivate monitors to get a refresh
//pCore->monitorManager()->switchMonitors();
}
void
MainWindow
::
slotRenderProject
()
{
KdenliveDoc
*
project
=
pCore
->
projectManager
()
->
current
();
...
...
@@ -1539,12 +1498,8 @@ void MainWindow::connectDocument()
{
KdenliveDoc
*
project
=
pCore
->
projectManager
()
->
current
();
Timeline
*
trackView
=
pCore
->
projectManager
()
->
currentTimeline
();
qDebug
()
<<
"------------------------- CONNECT DOCUMENT
\n
"
<<
project
->
profilePath
()
<<
"
\n
- - - - -- - - -- -"
;
pCore
->
binController
()
->
resetProfile
(
project
->
profilePath
());
connect
(
project
,
SIGNAL
(
startAutoSave
()),
pCore
->
projectManager
(),
SLOT
(
slotStartAutoSave
()));
connect
(
project
,
SIGNAL
(
reloadEffects
()),
this
,
SLOT
(
slotReloadEffects
()));
// Resetting monitor profiles should now be handled by binController
//pCore->monitorManager()->resetProfiles(project->timecode());
KdenliveSettings
::
setProject_fps
(
project
->
fps
());
m_clipMonitorDock
->
raise
();
m_transitionConfig
->
updateProjectFormat
();
...
...
@@ -1702,7 +1657,7 @@ void MainWindow::slotPreferences(int page, int option)
KdenliveSettingsDialog
*
dialog
=
new
KdenliveSettingsDialog
(
actions
,
m_gpuAllowed
,
this
);
connect
(
dialog
,
SIGNAL
(
settingsChanged
(
QString
)),
this
,
SLOT
(
updateConfiguration
()));
connect
(
dialog
,
SIGNAL
(
settingsChanged
(
QString
)),
SIGNAL
(
configurationChanged
()));
connect
(
dialog
,
SIGNAL
(
doResetProfile
()),
pCore
->
monitor
Manager
(),
SLOT
(
slotResetProfiles
()));
connect
(
dialog
,
SIGNAL
(
doResetProfile
()),
pCore
->
project
Manager
(),
SLOT
(
slotResetProfiles
()));
connect
(
dialog
,
SIGNAL
(
restartKdenlive
()),
this
,
SLOT
(
slotRestart
()));
if
(
m_recMonitor
)
{
connect
(
dialog
,
SIGNAL
(
updateCaptureFolder
()),
this
,
SLOT
(
slotUpdateCaptureFolder
()));
...
...
src/mainwindow.h
View file @
6fdaf01d
...
...
@@ -274,8 +274,6 @@ private slots:
void
slotAddEffect
(
const
QDomElement
&
effect
);
void
slotEditProfiles
();
void
slotEditProjectSettings
();
/** @brief Change current document MLT profile. */
void
slotUpdateProjectProfile
(
const
QString
&
profile
);
void
slotDisplayActionMessage
(
QAction
*
a
);
/** @brief Turns automatic splitting of audio and video on/off. */
...
...
src/mltcontroller/bincontroller.cpp
View file @
6fdaf01d
...
...
@@ -29,7 +29,6 @@ static const char* kPlaylistTrackId = "main bin";
BinController
::
BinController
(
QString
profileName
)
:
QObject
()
{
m_mltProfile
=
NULL
;
m_binPlaylist
=
NULL
;
// Disable VDPAU that crashes in multithread environment.
//TODO: make configurable
...
...
@@ -38,12 +37,11 @@ BinController::BinController(QString profileName) :
if
(
profileName
.
isEmpty
())
{
profileName
=
KdenliveSettings
::
current_profile
();
}
resetProfile
(
profileName
);
//
resetProfile(profileName);
}
BinController
::~
BinController
()
{
delete
m_mltProfile
;
}
Mlt
::
Repository
*
BinController
::
mltRepository
()
...
...
@@ -51,30 +49,9 @@ Mlt::Repository *BinController::mltRepository()
return
m_repository
;
}
void
BinController
::
resetProfile
(
const
QString
&
newProfile
)
{
m_activeProfile
=
newProfile
;
if
(
m_mltProfile
)
{
Mlt
::
Profile
tmpProfile
(
m_activeProfile
.
toUtf8
().
constData
());
m_mltProfile
->
set_colorspace
(
tmpProfile
.
colorspace
());
m_mltProfile
->
set_frame_rate
(
tmpProfile
.
frame_rate_num
(),
tmpProfile
.
frame_rate_den
());
m_mltProfile
->
set_height
(
tmpProfile
.
height
());
m_mltProfile
->
set_width
(
tmpProfile
.
width
());
m_mltProfile
->
set_progressive
(
tmpProfile
.
progressive
());
m_mltProfile
->
set_sample_aspect
(
tmpProfile
.
sample_aspect_num
(),
tmpProfile
.
sample_aspect_den
());
m_mltProfile
->
get_profile
()
->
display_aspect_num
=
tmpProfile
.
display_aspect_num
();
m_mltProfile
->
get_profile
()
->
display_aspect_den
=
tmpProfile
.
display_aspect_den
();
}
else
{
m_mltProfile
=
new
Mlt
::
Profile
(
m_activeProfile
.
toUtf8
().
constData
());
}
setenv
(
"MLT_PROFILE"
,
m_activeProfile
.
toUtf8
().
constData
(),
1
);
m_mltProfile
->
set_explicit
(
true
);
KdenliveSettings
::
setCurrent_profile
(
m_activeProfile
);
}
Mlt
::
Profile
*
BinController
::
profile
()
{
return
m_
mltProfile
;
return
m_
binPlaylist
->
profile
()
;
}
void
BinController
::
destroyBin
()
...
...
@@ -180,10 +157,10 @@ QMap<double,QString> BinController::takeGuidesData()
return
guidesData
;
}
void
BinController
::
createIfNeeded
()
void
BinController
::
createIfNeeded
(
Mlt
::
Profile
*
profile
)
{
if
(
m_binPlaylist
)
return
;
m_binPlaylist
=
new
Mlt
::
Playlist
(
*
m_mltP
rofile
);
m_binPlaylist
=
new
Mlt
::
Playlist
(
*
p
rofile
);
m_binPlaylist
->
set
(
"id"
,
kPlaylistTrackId
);
}
...
...
@@ -304,7 +281,7 @@ bool BinController::removeBinClip(const QString &id)
Mlt
::
Producer
*
BinController
::
cloneProducer
(
Mlt
::
Producer
&
original
)
{
QString
xml
=
getProducerXML
(
original
);
Mlt
::
Producer
*
clone
=
new
Mlt
::
Producer
(
*
m_mltProfile
,
"xml-string"
,
xml
.
toUtf8
().
constData
());
Mlt
::
Producer
*
clone
=
new
Mlt
::
Producer
(
*
original
.
profile
()
,
"xml-string"
,
xml
.
toUtf8
().
constData
());
return
clone
;
}
...
...
@@ -335,12 +312,12 @@ Mlt::Producer *BinController::getBinVideoProducer(const QString &id)
double
BinController
::
fps
()
const
{
return
m_
mltProfile
->
fps
();
return
m_
binPlaylist
->
profile
()
->
fps
();
}
double
BinController
::
dar
()
const
{
return
m_
mltProfile
->
dar
();
return
m_
binPlaylist
->
profile
()
->
dar
();
}
void
BinController
::
duplicateFilters
(
Mlt
::
Producer
original
,
Mlt
::
Producer
clone
)
...
...
@@ -357,7 +334,7 @@ void BinController::duplicateFilters(Mlt::Producer original, Mlt::Producer clone
if
(
filter
->
is_valid
()
/* && strcmp(filter->get("kdenlive_id"), "") && strcmp(filter->get("kdenlive_id"), "fadein") && strcmp(filter->get("kdenlive_id"), "fade_from_black")*/
)
{
// looks like there is no easy way to duplicate a filter,
// so we will create a new one and duplicate its properties
Mlt
::
Filter
*
dup
=
new
Mlt
::
Filter
(
*
m_mltProfile
,
filter
->
get
(
"mlt_service"
));
Mlt
::
Filter
*
dup
=
new
Mlt
::
Filter
(
*
original
.
profile
()
,
filter
->
get
(
"mlt_service"
));
if
(
dup
&&
dup
->
is_valid
())
{
Mlt
::
Properties
entries
(
filter
->
get_properties
());
for
(
int
i
=
0
;
i
<
entries
.
count
();
++
i
)
{
...
...
@@ -394,7 +371,7 @@ QString BinController::xmlFromId(const QString & id)
QString
BinController
::
getProducerXML
(
Mlt
::
Producer
&
producer
)
{
QString
filename
=
"string"
;
Mlt
::
Consumer
c
(
*
m_mltProfile
,
"xml"
,
filename
.
toUtf8
().
constData
());
Mlt
::
Consumer
c
(
*
producer
.
profile
()
,
"xml"
,
filename
.
toUtf8
().
constData
());
Mlt
::
Service
s
(
producer
.
get_service
());
if
(
!
s
.
is_valid
())
return
""
;
...
...
src/mltcontroller/bincontroller.h
View file @
6fdaf01d
...
...
@@ -61,11 +61,6 @@ public:
/** @brief Returns the project's dar. */
double
dar
()
const
;
/** @brief Reset the profile to a new one, for example when loading a document with another profile.
* @param newProfile The file name for the new MLT profile
* */
void
resetProfile
(
const
QString
&
newProfile
);
/** @brief Returns the service for the Bin's playlist, used to make sure MLT will save it correctly in its XML. */
mlt_service
service
();
...
...
@@ -93,7 +88,7 @@ public:
void
initializeBin
(
Mlt
::
Playlist
playlist
);
/** @brief If our bin's playlist does not exist, create a new one */
void
createIfNeeded
();
void
createIfNeeded
(
Mlt
::
Profile
*
profile
);
/** @brief Returns true if a clip with that id is in our bin's playlist
* @param id The clip's id as stored in DocClipBase
...
...
@@ -174,9 +169,6 @@ private:
/** @brief The current MLT profile's filename */
QString
m_activeProfile
;
/** @brief The MLT profile */
Mlt
::
Profile
*
m_mltProfile
;
/** @brief The MLT repository, useful for filter/producer requests */
Mlt
::
Repository
*
m_repository
;
...
...
src/monitor/glwidget.cpp
View file @
6fdaf01d
...
...
@@ -88,9 +88,10 @@ GLWidget::GLWidget()
importPath.cd("modules");
engine()->addImportPath(importPath.path());
QmlUtilities::setCommonProperties((QQuickView*)this);*/
m_monitorProfile
=
new
Mlt
::
Profile
();
if
(
KdenliveSettings
::
gpu_accel
())
m_glslManager
=
new
Mlt
::
Filter
(
*
pCore
->
binController
()
->
profile
()
,
"glsl.manager"
);
m_glslManager
=
new
Mlt
::
Filter
(
*
m_monitorProfile
,
"glsl.manager"
);
if
((
m_glslManager
&&
!
m_glslManager
->
is_valid
()))
{
delete
m_glslManager
;
m_glslManager
=
0
;
...
...
@@ -172,7 +173,7 @@ void GLWidget::resizeGL(int width, int height)
{
int
x
,
y
,
w
,
h
;
double
this_aspect
=
(
double
)
width
/
height
;
double
video_aspect
=
m_
consumer
->
profile
()
->
dar
();
double
video_aspect
=
m_
monitorProfile
->
dar
();
// Special case optimisation to negate odd effect of sample aspect ratio
// not corresponding exactly with image resolution.
...
...
@@ -195,7 +196,7 @@ void GLWidget::resizeGL(int width, int height)
x
=
(
width
-
w
)
/
2
;
y
=
(
height
-
h
)
/
2
;
m_rect
.
setRect
(
x
,
y
,
w
,
h
);
double
scale
=
(
double
)
m_rect
.
width
()
/
m_
consumer
->
profile
()
->
width
()
*
m_zoom
;
double
scale
=
(
double
)
m_rect
.
width
()
/
m_
monitorProfile
->
width
()
*
m_zoom
;
QPoint
center
=
m_rect
.
center
();
QQuickItem
*
rootQml
=
rootObject
();
if
(
rootQml
)
{
...
...
@@ -307,7 +308,7 @@ void GLWidget::paintGL()
m_shader
->
setUniformValue
(
m_textureLocation
[
0
],
0
);
m_shader
->
setUniformValue
(
m_textureLocation
[
1
],
1
);
m_shader
->
setUniformValue
(
m_textureLocation
[
2
],
2
);
m_shader
->
setUniformValue
(
m_colorspaceLocation
,
pCore
->
binController
()
->
profile
()
->
colorspace
());
m_shader
->
setUniformValue
(
m_colorspaceLocation
,
m_monitorProfile
->
colorspace
());
}
check_error
();
...
...
@@ -612,7 +613,7 @@ void GLWidget::createAudioOverlay(bool isAudio)
// Audiowaveform filter crashes on Movit + audio clips)
return
;
}
Mlt
::
Filter
f
(
*
pCore
->
binController
()
->
profile
()
,
"audiowaveform"
);
Mlt
::
Filter
f
(
*
m_monitorProfile
,
"audiowaveform"
);
if
(
f
.
is_valid
())
{
//f.set("show_channel", 1);
f
.
set
(
"color.1"
,
"0xffff0099"
);
...
...
@@ -676,7 +677,7 @@ int GLWidget::reconfigure(bool isMulti)
QString
serviceName
=
property
(
"mlt_service"
).
toString
();
if
(
!
m_consumer
||
!
m_consumer
->
is_valid
())
{
if
(
serviceName
.
isEmpty
())
{
m_consumer
=
new
Mlt
::
FilteredConsumer
(
*
pCore
->
binController
()
->
profile
()
,
"sdl_audio"
);
m_consumer
=
new
Mlt
::
FilteredConsumer
(
*
m_monitorProfile
,
"sdl_audio"
);
if
(
m_consumer
->
is_valid
())
serviceName
=
"sdl_audio"
;
else
{
...
...
@@ -687,9 +688,9 @@ int GLWidget::reconfigure(bool isMulti)
setProperty
(
"mlt_service"
,
serviceName
);
}
if
(
isMulti
)
m_consumer
=
new
Mlt
::
FilteredConsumer
(
*
pCore
->
binController
()
->
profile
()
,
"multi"
);
m_consumer
=
new
Mlt
::
FilteredConsumer
(
*
m_monitorProfile
,
"multi"
);
else
if
(
!
m_consumer
)
m_consumer
=
new
Mlt
::
FilteredConsumer
(
*
pCore
->
binController
()
->
profile
()
,
serviceName
.
toLatin1
().
constData
());
m_consumer
=
new
Mlt
::
FilteredConsumer
(
*
m_monitorProfile
,
serviceName
.
toLatin1
().
constData
());
delete
m_threadStartEvent
;
m_threadStartEvent
=
0
;
...
...
@@ -727,7 +728,7 @@ int GLWidget::reconfigure(bool isMulti)
#else
m_consumer
->
set
(
"0.audio_buffer"
,
512
);
#endif
/*if (!m_
consumer->profile()
->progressive())
/*if (!m_
monitorProfile
->progressive())
m_consumer->set("0.progressive", property("progressive").toBool());*/
m_consumer
->
set
(
"0.deinterlace_method"
,
KdenliveSettings
::
mltdeinterlacer
().
toUtf8
().
constData
());
...
...
@@ -744,7 +745,7 @@ int GLWidget::reconfigure(bool isMulti)
#else
m_consumer
->
set
(
"audio_buffer"
,
512
);
#endif
/*if (!m_
consumer->profile()
->progressive())
/*if (!m_
monitorProfile
->progressive())
m_consumer->set("progressive", property("progressive").toBool());*/
m_consumer
->
set
(
"progressive"
,
1
);
m_consumer
->
set
(
"rescale"
,
KdenliveSettings
::
mltinterpolation
().
toUtf8
().
constData
());
...
...
@@ -789,9 +790,9 @@ void GLWidget::slotShowEffectScene()
QObject
*
item
=
rootObject
();
if
(
!
item
)
return
;
QObject
::
connect
(
item
,
SIGNAL
(
effectChanged
()),
this
,
SLOT
(
effectRectChanged
()),
Qt
::
UniqueConnection
);
item
->
setProperty
(
"profile"
,
QPoint
(
m_
consumer
->
profile
()
->
width
(),
m_consumer
->
profile
()
->
height
()));
item
->
setProperty
(
"framesize"
,
QRect
(
0
,
0
,
m_
consumer
->
profile
()
->
width
(),
m_consumer
->
profile
()
->
height
()));
item
->
setProperty
(
"scale"
,
(
double
)
m_rect
.
width
()
/
m_
consumer
->
profile
()
->
width
()
*
m_zoom
);
item
->
setProperty
(
"profile"
,
QPoint
(
m_
monitorProfile
->
width
(),
m_monitorProfile
->
height
()));
item
->
setProperty
(
"framesize"
,
QRect
(
0
,
0
,
m_
monitorProfile
->
width
(),
m_monitorProfile
->
height
()));
item
->
setProperty
(
"scale"
,
(
double
)
m_rect
.
width
()
/
m_
monitorProfile
->
width
()
*
m_zoom
);
item
->
setProperty
(
"center"
,
m_rect
.
center
());
}
...
...
@@ -799,24 +800,46 @@ void GLWidget::slotShowRootScene()
{
QObject
*
item
=
rootObject
();
if
(
!
item
)
return
;
item
->
setProperty
(
"scale"
,
(
double
)
m_rect
.
width
()
/
m_
consumer
->
profile
()
->
width
()
*
m_zoom
);
item
->
setProperty
(
"scale"
,
(
double
)
m_rect
.
width
()
/
m_
monitorProfile
->
width
()
*
m_zoom
);
item
->
setProperty
(
"center"
,
m_rect
.
center
());
}
float
GLWidget
::
zoom
()
const
{
return
m_zoom
;
// * m_consumer->profile()->width() / m_rect.width();
return
m_zoom
;
// * m_monitorProfile->width() / m_rect.width();
}
Mlt
::
Profile
*
GLWidget
::
profile
()
{
return
m_monitorProfile
;
}
void
GLWidget
::
resetProfile
(
MltVideoProfile
profile
)
{
if
(
m_consumer
&&
!
m_consumer
->
is_stopped
())
{
m_consumer
->
stop
();
m_consumer
->
purge
();
}
//m_monitorProfile->get_profile()->description = profile.description.toUtf8().data();
m_monitorProfile
->
set_colorspace
(
profile
.
colorspace
);
m_monitorProfile
->
set_frame_rate
(
profile
.
frame_rate_num
,
profile
.
frame_rate_den
);
m_monitorProfile
->
set_height
(
profile
.
height
);