Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Multimedia
Kdenlive
Commits
8d2970ef
Commit
8d2970ef
authored
Jan 24, 2020
by
Jean-Baptiste Mardelle
Browse files
Adapt to MLT's updated consumer scaling feature
parent
05f058a0
Changes
14
Hide whitespace changes
Inline
Side-by-side
src/bin/binplaylist.cpp
View file @
8d2970ef
...
...
@@ -30,7 +30,7 @@
QString
BinPlaylist
::
binPlaylistId
=
QString
(
"main_bin"
);
BinPlaylist
::
BinPlaylist
()
:
m_binPlaylist
(
new
Mlt
::
Playlist
(
*
pCore
->
get
ProjectP
rofile
()))
:
m_binPlaylist
(
new
Mlt
::
Playlist
(
pCore
->
get
CurrentProfile
()
->
p
rofile
()))
{
m_binPlaylist
->
set
(
"id"
,
binPlaylistId
.
toUtf8
().
constData
());
}
...
...
@@ -54,7 +54,7 @@ void BinPlaylist::manageBinItemInsertion(const std::shared_ptr<AbstractProjectIt
m_binPlaylist
->
append
(
*
clip
->
originalProducer
().
get
());
}
else
{
// if clip is not loaded yet, we insert a dummy producer
Mlt
::
Producer
dummy
(
*
pCore
->
get
ProjectP
rofile
(),
"color:blue"
);
Mlt
::
Producer
dummy
(
pCore
->
get
CurrentProfile
()
->
p
rofile
(),
"color:blue"
);
dummy
.
set
(
"kdenlive:id"
,
id
.
toUtf8
().
constData
());
m_binPlaylist
->
append
(
dummy
);
}
...
...
src/bin/projectclip.cpp
View file @
8d2970ef
...
...
@@ -763,7 +763,7 @@ std::shared_ptr<Mlt::Producer> ProjectClip::timelineProducer(PlaylistState::Clip
std
::
shared_ptr
<
Mlt
::
Producer
>
ProjectClip
::
cloneProducer
(
bool
removeEffects
)
{
Mlt
::
Consumer
c
(
*
pCore
->
get
ProjectP
rofile
(),
"xml"
,
"string"
);
Mlt
::
Consumer
c
(
pCore
->
get
CurrentProfile
()
->
p
rofile
(),
"xml"
,
"string"
);
Mlt
::
Service
s
(
m_masterProducer
->
get_service
());
int
ignore
=
s
.
get_int
(
"ignore_points"
);
if
(
ignore
)
{
...
...
@@ -782,7 +782,7 @@ std::shared_ptr<Mlt::Producer> ProjectClip::cloneProducer(bool removeEffects)
}
const
QByteArray
clipXml
=
c
.
get
(
"string"
);
std
::
shared_ptr
<
Mlt
::
Producer
>
prod
;
prod
.
reset
(
new
Mlt
::
Producer
(
*
pCore
->
get
ProjectP
rofile
(),
"xml-string"
,
clipXml
.
constData
()));
prod
.
reset
(
new
Mlt
::
Producer
(
pCore
->
get
CurrentProfile
()
->
p
rofile
(),
"xml-string"
,
clipXml
.
constData
()));
if
(
strcmp
(
prod
->
get
(
"mlt_service"
),
"avformat"
)
==
0
)
{
prod
->
set
(
"mlt_service"
,
"avformat-novalidate"
);
...
...
src/core.cpp
View file @
8d2970ef
...
...
@@ -133,7 +133,6 @@ void Core::initGUI(const QUrl &Url, const QString &clipsToLoad)
profileChanged
();
KdenliveSettings
::
setDefault_profile
(
m_profile
);
}
updatePreviewProfile
();
if
(
!
ProfileRepository
::
get
()
->
profileExists
(
m_profile
))
{
KMessageBox
::
sorry
(
m_mainWindow
,
i18n
(
"The default profile of Kdenlive is not set or invalid, press OK to set it to a correct value."
));
...
...
@@ -313,11 +312,11 @@ std::unique_ptr<ProfileModel> &Core::getCurrentProfile() const
Mlt
::
Profile
*
Core
::
getProjectProfile
()
{
if
(
!
m_pr
eview
Profile
)
{
m_pr
eview
Profile
=
std
::
make_unique
<
Mlt
::
Profile
>
(
m_currentProfile
.
toStdString
().
c_str
());
updatePreviewProfile
(
);
if
(
!
m_pr
oject
Profile
)
{
m_pr
oject
Profile
=
std
::
make_unique
<
Mlt
::
Profile
>
(
m_currentProfile
.
toStdString
().
c_str
());
m_projectProfile
->
set_explicit
(
1
);
}
return
m_pr
eview
Profile
.
get
();
return
m_pr
oject
Profile
.
get
();
}
const
QString
&
Core
::
getCurrentProfilePath
()
const
...
...
@@ -333,8 +332,8 @@ bool Core::setCurrentProfile(const QString &profilePath)
}
if
(
ProfileRepository
::
get
()
->
profileExists
(
profilePath
))
{
m_currentProfile
=
profilePath
;
updatePreviewProfile
();
m_thumbProfile
.
reset
();
m_projectProfile
.
reset
();
// inform render widget
profileChanged
();
m_mainWindow
->
updateRenderWidgetProfile
();
...
...
@@ -347,24 +346,6 @@ bool Core::setCurrentProfile(const QString &profilePath)
return
false
;
}
void
Core
::
updatePreviewProfile
()
{
int
newWidth
=
getCurrentProfile
()
->
width
()
/
KdenliveSettings
::
previewScaling
();
int
newHeight
=
getCurrentProfile
()
->
height
()
/
KdenliveSettings
::
previewScaling
();
if
(
newWidth
%
8
>
0
)
{
newWidth
+=
8
-
newWidth
%
8
;
}
newHeight
+=
newHeight
%
2
;
m_previewProfile
->
set_colorspace
(
getCurrentProfile
()
->
colorspace
());
m_previewProfile
->
set_frame_rate
(
getCurrentProfile
()
->
frame_rate_num
(),
getCurrentProfile
()
->
frame_rate_den
());
m_previewProfile
->
set_width
(
newWidth
);
m_previewProfile
->
set_height
(
newHeight
);
m_previewProfile
->
set_progressive
(
getCurrentProfile
()
->
progressive
());
m_previewProfile
->
set_sample_aspect
(
getCurrentProfile
()
->
sample_aspect_num
(),
getCurrentProfile
()
->
sample_aspect_den
());
m_previewProfile
->
set_display_aspect
(
getCurrentProfile
()
->
display_aspect_num
(),
getCurrentProfile
()
->
display_aspect_den
());
m_previewProfile
->
set_explicit
(
true
);
}
void
Core
::
checkProfileValidity
()
{
int
offset
=
(
getCurrentProfile
()
->
profile
().
width
()
%
8
)
+
(
getCurrentProfile
()
->
profile
().
height
()
%
2
);
...
...
src/core.h
View file @
8d2970ef
...
...
@@ -203,9 +203,9 @@ public:
void
processInvalidFilter
(
const
QString
service
,
const
QString
id
,
const
QString
message
);
/** @brief Update current project's tags */
void
updateProjectTags
(
QMap
<
QString
,
QString
>
tags
);
/** @brief Returns the consumer profile, that will be scaled
* according to preview settings. Should only be used on the consumer */
Mlt
::
Profile
*
getProjectProfile
();
/** @brief Update MLT's preview profile */
void
updatePreviewProfile
();
private:
explicit
Core
();
...
...
@@ -227,8 +227,8 @@ private:
QString
m_profile
;
std
::
unique_ptr
<
Mlt
::
Profile
>
m_thumbProfile
;
/** @brief Mlt profile used in
project /
monitors */
std
::
unique_ptr
<
Mlt
::
Profile
>
m_pr
eview
Profile
;
/** @brief Mlt profile used in
the consumer 's
monitors */
std
::
unique_ptr
<
Mlt
::
Profile
>
m_pr
oject
Profile
;
bool
m_guiConstructed
=
false
;
/** @brief Check that the profile is valid (width is a multiple of 8 and height a multiple of 2 */
void
checkProfileValidity
();
...
...
src/effects/effectsrepository.cpp
View file @
8d2970ef
...
...
@@ -182,7 +182,7 @@ std::unique_ptr<Mlt::Filter> EffectsRepository::getEffect(const QString &effectI
Q_ASSERT
(
exists
(
effectId
));
QString
service_name
=
m_assets
.
at
(
effectId
).
mltId
;
// We create the Mlt element from its name
auto
filter
=
std
::
make_unique
<
Mlt
::
Filter
>
(
*
pCore
->
get
ProjectP
rofile
(),
service_name
.
toLatin1
().
constData
(),
nullptr
);
auto
filter
=
std
::
make_unique
<
Mlt
::
Filter
>
(
pCore
->
get
CurrentProfile
()
->
p
rofile
(),
service_name
.
toLatin1
().
constData
(),
nullptr
);
return
filter
;
}
...
...
src/jobs/loadjob.cpp
View file @
8d2970ef
...
...
@@ -121,7 +121,7 @@ std::shared_ptr<Mlt::Producer> LoadJob::loadResource(QString resource, const QSt
if
(
!
resource
.
startsWith
(
type
))
{
resource
.
prepend
(
type
);
}
return
std
::
make_shared
<
Mlt
::
Producer
>
(
*
pCore
->
get
ProjectP
rofile
(),
nullptr
,
resource
.
toUtf8
().
constData
());
return
std
::
make_shared
<
Mlt
::
Producer
>
(
pCore
->
get
CurrentProfile
()
->
p
rofile
(),
nullptr
,
resource
.
toUtf8
().
constData
());
}
std
::
shared_ptr
<
Mlt
::
Producer
>
LoadJob
::
loadPlaylist
(
QString
&
resource
)
...
...
@@ -146,10 +146,10 @@ std::shared_ptr<Mlt::Producer> LoadJob::loadPlaylist(QString &resource)
QString
loader
=
resource
;
loader
.
prepend
(
QStringLiteral
(
"consumer:"
));
pCore
->
getCurrentProfile
()
->
set_explicit
(
1
);
return
std
::
make_shared
<
Mlt
::
Producer
>
(
*
pCore
->
get
ProjectP
rofile
(),
loader
.
toUtf8
().
constData
());
return
std
::
make_shared
<
Mlt
::
Producer
>
(
pCore
->
get
CurrentProfile
()
->
p
rofile
(),
loader
.
toUtf8
().
constData
());
}
pCore
->
getCurrentProfile
()
->
set_explicit
(
1
);
return
std
::
make_shared
<
Mlt
::
Producer
>
(
*
pCore
->
get
ProjectP
rofile
(),
"xml"
,
resource
.
toUtf8
().
constData
());
return
std
::
make_shared
<
Mlt
::
Producer
>
(
pCore
->
get
CurrentProfile
()
->
p
rofile
(),
"xml"
,
resource
.
toUtf8
().
constData
());
}
void
LoadJob
::
checkProfile
(
const
QString
&
clipId
,
const
QDomElement
&
xml
,
const
std
::
shared_ptr
<
Mlt
::
Producer
>
&
producer
)
...
...
@@ -202,13 +202,13 @@ void LoadJob::processSlideShow()
int
ttl
=
Xml
::
getXmlProperty
(
m_xml
,
QStringLiteral
(
"ttl"
)).
toInt
();
QString
anim
=
Xml
::
getXmlProperty
(
m_xml
,
QStringLiteral
(
"animation"
));
if
(
!
anim
.
isEmpty
())
{
auto
*
filter
=
new
Mlt
::
Filter
(
*
pCore
->
get
ProjectP
rofile
(),
"affine"
);
auto
*
filter
=
new
Mlt
::
Filter
(
pCore
->
get
CurrentProfile
()
->
p
rofile
(),
"affine"
);
if
((
filter
!=
nullptr
)
&&
filter
->
is_valid
())
{
int
cycle
=
ttl
;
QString
geometry
=
SlideshowClip
::
animationToGeometry
(
anim
,
cycle
);
if
(
!
geometry
.
isEmpty
())
{
if
(
anim
.
contains
(
QStringLiteral
(
"low-pass"
)))
{
auto
*
blur
=
new
Mlt
::
Filter
(
*
pCore
->
get
ProjectP
rofile
(),
"boxblur"
);
auto
*
blur
=
new
Mlt
::
Filter
(
pCore
->
get
CurrentProfile
()
->
p
rofile
(),
"boxblur"
);
if
((
blur
!=
nullptr
)
&&
blur
->
is_valid
())
{
m_producer
->
attach
(
*
blur
);
}
...
...
@@ -222,7 +222,7 @@ void LoadJob::processSlideShow()
QString
fade
=
Xml
::
getXmlProperty
(
m_xml
,
QStringLiteral
(
"fade"
));
if
(
fade
==
QLatin1String
(
"1"
))
{
// user wants a fade effect to slideshow
auto
*
filter
=
new
Mlt
::
Filter
(
*
pCore
->
get
ProjectP
rofile
(),
"luma"
);
auto
*
filter
=
new
Mlt
::
Filter
(
pCore
->
get
CurrentProfile
()
->
p
rofile
(),
"luma"
);
if
((
filter
!=
nullptr
)
&&
filter
->
is_valid
())
{
if
(
ttl
!=
0
)
{
filter
->
set
(
"cycle"
,
ttl
);
...
...
@@ -246,7 +246,7 @@ void LoadJob::processSlideShow()
QString
crop
=
Xml
::
getXmlProperty
(
m_xml
,
QStringLiteral
(
"crop"
));
if
(
crop
==
QLatin1String
(
"1"
))
{
// user wants to center crop the slides
auto
*
filter
=
new
Mlt
::
Filter
(
*
pCore
->
get
ProjectP
rofile
(),
"crop"
);
auto
*
filter
=
new
Mlt
::
Filter
(
pCore
->
get
CurrentProfile
()
->
p
rofile
(),
"crop"
);
if
((
filter
!=
nullptr
)
&&
filter
->
is_valid
())
{
filter
->
set
(
"center"
,
1
);
m_producer
->
attach
(
*
filter
);
...
...
@@ -379,14 +379,14 @@ bool LoadJob::startJob()
break
;
}
case
ClipType
::
SlideShow
:
m_producer
=
std
::
make_shared
<
Mlt
::
Producer
>
(
*
pCore
->
get
ProjectP
rofile
(),
nullptr
,
m_resource
.
toUtf8
().
constData
());
m_producer
=
std
::
make_shared
<
Mlt
::
Producer
>
(
pCore
->
get
CurrentProfile
()
->
p
rofile
(),
nullptr
,
m_resource
.
toUtf8
().
constData
());
break
;
default:
if
(
!
service
.
isEmpty
())
{
service
.
append
(
QChar
(
':'
));
m_producer
=
loadResource
(
m_resource
,
service
);
}
else
{
m_producer
=
std
::
make_shared
<
Mlt
::
Producer
>
(
*
pCore
->
get
ProjectP
rofile
(),
nullptr
,
m_resource
.
toUtf8
().
constData
());
m_producer
=
std
::
make_shared
<
Mlt
::
Producer
>
(
pCore
->
get
CurrentProfile
()
->
p
rofile
(),
nullptr
,
m_resource
.
toUtf8
().
constData
());
}
break
;
}
...
...
src/mainwindow.cpp
View file @
8d2970ef
...
...
@@ -1258,22 +1258,26 @@ void MainWindow::setupActions()
m_scaleGroup
=
new
QActionGroup
(
this
);
m_scaleGroup
->
setExclusive
(
true
);
m_scaleGroup
->
setEnabled
(
!
KdenliveSettings
::
external_display
());
QAction
*
scale_no
=
new
QAction
(
i18n
(
"Full Resolution
Preview
"
),
m_scaleGroup
);
QAction
*
scale_no
=
new
QAction
(
i18n
(
"Full Resolution"
),
m_scaleGroup
);
addAction
(
QStringLiteral
(
"scale_no_preview"
),
scale_no
);
scale_no
->
setCheckable
(
true
);
scale_no
->
setData
(
1
);
QAction
*
scale_2
=
new
QAction
(
i18n
(
"
1/2 Resolution Preview
"
),
m_scaleGroup
);
QAction
*
scale_2
=
new
QAction
(
i18n
(
"
720p
"
),
m_scaleGroup
);
addAction
(
QStringLiteral
(
"scale_2_preview"
),
scale_2
);
scale_2
->
setCheckable
(
true
);
scale_2
->
setData
(
2
);
QAction
*
scale_4
=
new
QAction
(
i18n
(
"
1/4 Resolution Preview
"
),
m_scaleGroup
);
QAction
*
scale_4
=
new
QAction
(
i18n
(
"
540p
"
),
m_scaleGroup
);
addAction
(
QStringLiteral
(
"scale_4_preview"
),
scale_4
);
scale_4
->
setCheckable
(
true
);
scale_4
->
setData
(
4
);
QAction
*
scale_8
=
new
QAction
(
i18n
(
"
1/8 Resolution Preview
"
),
m_scaleGroup
);
QAction
*
scale_8
=
new
QAction
(
i18n
(
"
360p
"
),
m_scaleGroup
);
addAction
(
QStringLiteral
(
"scale_8_preview"
),
scale_8
);
scale_8
->
setCheckable
(
true
);
scale_8
->
setData
(
8
);
QAction
*
scale_16
=
new
QAction
(
i18n
(
"270p"
),
m_scaleGroup
);
addAction
(
QStringLiteral
(
"scale_16_preview"
),
scale_16
);
scale_16
->
setCheckable
(
true
);
scale_16
->
setData
(
16
);
switch
(
KdenliveSettings
::
previewScaling
())
{
case
2
:
scale_2
->
setChecked
(
true
);
...
...
@@ -1284,6 +1288,9 @@ void MainWindow::setupActions()
case
8
:
scale_8
->
setChecked
(
true
);
break
;
case
16
:
scale_16
->
setChecked
(
true
);
break
;
default:
scale_no
->
setChecked
(
true
);
break
;
...
...
src/mltcontroller/clipcontroller.cpp
View file @
8d2970ef
...
...
@@ -810,7 +810,7 @@ void ClipController::mirrorOriginalProperties(Mlt::Properties &props)
// This is a proxy, we need to use the real source properties
if
(
m_properties
->
get_int
(
"kdenlive:original.backup"
)
==
0
)
{
// We have a proxy clip, load original source producer
std
::
shared_ptr
<
Mlt
::
Producer
>
prod
=
std
::
make_shared
<
Mlt
::
Producer
>
(
*
pCore
->
get
ProjectP
rofile
(),
nullptr
,
m_path
.
toUtf8
().
constData
());
std
::
shared_ptr
<
Mlt
::
Producer
>
prod
=
std
::
make_shared
<
Mlt
::
Producer
>
(
pCore
->
get
CurrentProfile
()
->
p
rofile
(),
nullptr
,
m_path
.
toUtf8
().
constData
());
// Get frame to make sure we retrieve all original props
std
::
shared_ptr
<
Mlt
::
Frame
>
fr
(
prod
->
get_frame
());
if
(
!
prod
->
is_valid
())
{
...
...
@@ -850,7 +850,7 @@ void ClipController::mirrorOriginalProperties(Mlt::Properties &props)
QScopedPointer
<
Mlt
::
Producer
>
tmpProd
(
nullptr
);
if
(
KdenliveSettings
::
gpu_accel
())
{
QString
service
=
m_masterProducer
->
get
(
"mlt_service"
);
tmpProd
.
reset
(
new
Mlt
::
Producer
(
*
pCore
->
get
ProjectP
rofile
(),
service
.
toUtf8
().
constData
(),
m_masterProducer
->
get
(
"resource"
)));
tmpProd
.
reset
(
new
Mlt
::
Producer
(
pCore
->
get
CurrentProfile
()
->
p
rofile
(),
service
.
toUtf8
().
constData
(),
m_masterProducer
->
get
(
"resource"
)));
}
std
::
shared_ptr
<
Mlt
::
Frame
>
fr
(
tmpProd
?
tmpProd
->
get_frame
()
:
m_masterProducer
->
get_frame
());
mlt_image_format
format
=
mlt_image_none
;
...
...
src/monitor/glwidget.cpp
View file @
8d2970ef
...
...
@@ -116,7 +116,7 @@ GLWidget::GLWidget(int id, QObject *parent)
m_refreshTimer
.
setSingleShot
(
true
);
m_refreshTimer
.
setInterval
(
50
);
m_blackClip
.
reset
(
new
Mlt
::
Producer
(
*
pCore
->
get
ProjectP
rofile
(),
"color:0"
));
m_blackClip
.
reset
(
new
Mlt
::
Producer
(
pCore
->
get
CurrentProfile
()
->
p
rofile
(),
"color:0"
));
m_blackClip
->
set
(
"kdenlive:id"
,
"black"
);
m_blackClip
->
set
(
"out"
,
3
);
connect
(
&
m_refreshTimer
,
&
QTimer
::
timeout
,
this
,
&
GLWidget
::
refresh
);
...
...
@@ -455,7 +455,7 @@ bool GLWidget::initGPUAccel()
{
if
(
!
KdenliveSettings
::
gpu_accel
())
return
false
;
m_glslManager
=
new
Mlt
::
Filter
(
*
pCore
->
get
ProjectP
rofile
(),
"glsl.manager"
);
m_glslManager
=
new
Mlt
::
Filter
(
pCore
->
get
CurrentProfile
()
->
p
rofile
(),
"glsl.manager"
);
return
m_glslManager
->
is_valid
();
}
...
...
@@ -898,10 +898,6 @@ int GLWidget::setProducer(const std::shared_ptr<Mlt::Producer> &producer, bool i
m_consumer
->
stop
();
}
}
if
(
m_id
==
Kdenlive
::
ProjectMonitor
)
{
// Make sure we apply preview scaling
pCore
->
updatePreviewProfile
();
}
error
=
reconfigure
();
if
(
error
==
0
)
{
// The profile display aspect ratio may have changed.
...
...
@@ -1058,13 +1054,6 @@ int GLWidget::reconfigure()
m_consumer
.
reset
(
new
Mlt
::
FilteredConsumer
(
*
pCore
->
getProjectProfile
(),
audioBackend
.
toLatin1
().
constData
()));
if
(
m_consumer
->
is_valid
())
{
serviceName
=
audioBackend
;
setProperty
(
"mlt_service"
,
serviceName
);
if
(
KdenliveSettings
::
external_display
())
{
m_consumer
->
set
(
"terminate_on_pause"
,
0
);
}
m_profileSize
=
QSize
(
pCore
->
getProjectProfile
()
->
width
(),
pCore
->
getProjectProfile
()
->
height
());
m_colorSpace
=
pCore
->
getCurrentProfile
()
->
colorspace
();
m_dar
=
pCore
->
getCurrentDar
();
}
else
{
// Warning, audio backend unavailable on system
m_consumer
.
reset
();
...
...
@@ -1083,17 +1072,24 @@ int GLWidget::reconfigure()
qDebug
()
<<
"++++++++
\n
Switching audio backend to: "
<<
bk
<<
"
\n
++++++++++"
;
KdenliveSettings
::
setAudiobackend
(
bk
);
serviceName
=
bk
;
setProperty
(
"mlt_service"
,
serviceName
);
break
;
}
else
{
m_consumer
.
reset
();
}
}
if
(
!
m_consumer
)
{
qWarning
()
<<
"WARNING, NO AUDIO BACKEND FOUND"
;
return
-
1
;
}
}
if
(
!
m_consumer
||
!
m_consumer
->
is_valid
())
{
qWarning
()
<<
"WARNING, NO AUDIO BACKEND FOUND"
;
return
-
1
;
}
setProperty
(
"mlt_service"
,
serviceName
);
if
(
KdenliveSettings
::
external_display
())
{
m_consumer
->
set
(
"terminate_on_pause"
,
0
);
}
m_consumer
->
set
(
"width"
,
m_profileSize
.
width
());
m_consumer
->
set
(
"height"
,
m_profileSize
.
height
());
m_colorSpace
=
pCore
->
getCurrentProfile
()
->
colorspace
();
m_dar
=
pCore
->
getCurrentDar
();
}
delete
m_threadStartEvent
;
m_threadStartEvent
=
nullptr
;
...
...
@@ -1205,7 +1201,7 @@ void GLWidget::reloadProfile()
m_consumer
.
reset
();
existingConsumer
=
true
;
}
m_blackClip
.
reset
(
new
Mlt
::
Producer
(
*
pCore
->
get
ProjectP
rofile
(),
"color:0"
));
m_blackClip
.
reset
(
new
Mlt
::
Producer
(
pCore
->
get
CurrentProfile
()
->
p
rofile
(),
"color:0"
));
m_blackClip
->
set
(
"kdenlive:id"
,
"black"
);
if
(
existingConsumer
)
{
reconfigure
();
...
...
@@ -1807,13 +1803,38 @@ void GLWidget::setConsumerProperty(const QString &name, const QString &value)
void
GLWidget
::
updateScaling
()
{
#if LIBMLT_VERSION_INT >= MLT_VERSION_PREVIEW_SCALE
bool
hasConsumer
=
m_consumer
!=
nullptr
;
if
(
hasConsumer
)
{
m_consumer
->
stop
();
m_consumer
.
reset
();
QSize
profileSize
=
pCore
->
getCurrentFrameSize
();
int
previewHeight
=
profileSize
.
height
();
switch
(
KdenliveSettings
::
previewScaling
())
{
case
2
:
previewHeight
=
qMin
(
previewHeight
,
720
);
break
;
case
4
:
previewHeight
=
qMin
(
previewHeight
,
540
);
break
;
case
8
:
previewHeight
=
qMin
(
previewHeight
,
360
);
break
;
case
16
:
previewHeight
=
qMin
(
previewHeight
,
270
);
break
;
default:
break
;
}
if
(
previewHeight
==
profileSize
.
height
())
{
m_profileSize
=
profileSize
;
}
else
{
int
width
=
previewHeight
*
pCore
->
getCurrentDar
()
/
pCore
->
getCurrentSar
();
if
(
width
%
8
>
0
)
{
width
+=
8
-
width
%
8
;
}
m_profileSize
=
QSize
(
width
,
previewHeight
);
}
qDebug
()
<<
"==== SWITCHED PROFILE WIDTH TO : "
<<
m_profileSize
.
width
()
<<
" = "
<<
profileSize
.
width
();
if
(
m_consumer
)
{
m_consumer
->
set
(
"width"
,
m_profileSize
.
width
());
m_consumer
->
set
(
"height"
,
m_profileSize
.
height
());
resizeGL
(
width
(),
height
());
}
pCore
->
updatePreviewProfile
();
reconfigure
();
resizeGL
(
width
(),
height
());
#endif
}
src/monitor/monitor.cpp
View file @
8d2970ef
...
...
@@ -48,6 +48,7 @@
#include
<KRecentDirs>
#include
<KSelectAction>
#include
<KWindowConfig>
#include
<KColorScheme>
#include
<kio_version.h>
#include
"kdenlive_debug.h"
...
...
@@ -163,6 +164,24 @@ Monitor::Monitor(Kdenlive::MonitorId id, MonitorManager *manager, QWidget *paren
connect
(
m_glMonitor
,
&
GLWidget
::
activateMonitor
,
this
,
&
AbstractMonitor
::
slotActivateMonitor
,
Qt
::
DirectConnection
);
connect
(
manager
,
&
MonitorManager
::
updatePreviewScaling
,
[
this
]()
{
m_glMonitor
->
updateScaling
();
switch
(
KdenliveSettings
::
previewScaling
())
{
case
2
:
m_scalingLabel
->
setText
(
i18n
(
"720p"
));
break
;
case
4
:
m_scalingLabel
->
setText
(
i18n
(
"540p"
));
break
;
case
8
:
m_scalingLabel
->
setText
(
i18n
(
"360p"
));
break
;
case
16
:
m_scalingLabel
->
setText
(
i18n
(
"270p"
));
break
;
default:
m_scalingLabel
->
setText
(
QString
());
break
;
}
m_scalingLabel
->
setFixedWidth
(
m_scalingLabel
->
text
().
isEmpty
()
?
0
:
QWIDGETSIZE_MAX
);
refreshMonitorIfActive
();
});
m_videoWidget
=
QWidget
::
createWindowContainer
(
qobject_cast
<
QWindow
*>
(
m_glMonitor
));
...
...
@@ -207,6 +226,12 @@ Monitor::Monitor(Kdenlive::MonitorId id, MonitorManager *manager, QWidget *paren
int
size
=
style
()
->
pixelMetric
(
QStyle
::
PM_SmallIconSize
);
QSize
iconSize
(
size
,
size
);
m_toolbar
->
setIconSize
(
iconSize
);
m_scalingLabel
=
new
QLabel
(
this
);
m_scalingLabel
->
setFont
(
QFontDatabase
::
systemFont
(
QFontDatabase
::
SmallestReadableFont
));
KColorScheme
scheme
(
palette
().
currentColorGroup
(),
KColorScheme
::
Button
);
QColor
bg
=
scheme
.
background
(
KColorScheme
::
LinkBackground
).
color
();
m_scalingLabel
->
setStyleSheet
(
QString
(
"padding-left: %4; padding-right: %4;background-color: rgb(%1,%2,%3);"
).
arg
(
bg
.
red
()).
arg
(
bg
.
green
()).
arg
(
bg
.
blue
()).
arg
(
m_scalingLabel
->
sizeHint
().
height
()
/
4
));
m_toolbar
->
addWidget
(
m_scalingLabel
);
QWidget
*
sp1
=
new
QWidget
(
this
);
sp1
->
setSizePolicy
(
QSizePolicy
::
MinimumExpanding
,
QSizePolicy
::
Preferred
);
m_toolbar
->
addWidget
(
sp1
);
...
...
@@ -1734,6 +1759,9 @@ void Monitor::setPalette(const QPalette &p)
if
(
root
)
{
QMetaObject
::
invokeMethod
(
root
,
"updatePalette"
);
}
KColorScheme
scheme
(
palette
().
currentColorGroup
(),
KColorScheme
::
Button
);
QColor
bg
=
scheme
.
background
(
KColorScheme
::
LinkBackground
).
color
();
m_scalingLabel
->
setStyleSheet
(
QString
(
"padding-left: %4; padding-right: %4;background-color: rgb(%1,%2,%3);"
).
arg
(
bg
.
red
()).
arg
(
bg
.
green
()).
arg
(
bg
.
blue
()).
arg
(
m_scalingLabel
->
sizeHint
().
height
()
/
4
));
m_audioMeterWidget
->
refreshPixmap
();
}
...
...
@@ -1775,7 +1803,7 @@ void Monitor::slotSwitchCompare(bool enable)
// Split scene is already active
return
;
}
m_splitEffect
.
reset
(
new
Mlt
::
Filter
(
*
pCore
->
get
ProjectP
rofile
(),
"frei0r.alphagrad"
));
m_splitEffect
.
reset
(
new
Mlt
::
Filter
(
pCore
->
get
CurrentProfile
()
->
p
rofile
(),
"frei0r.alphagrad"
));
if
((
m_splitEffect
!=
nullptr
)
&&
m_splitEffect
->
is_valid
())
{
m_splitEffect
->
set
(
"0"
,
0.5
);
// 0 is the Clip left parameter
m_splitEffect
->
set
(
"1"
,
0
);
// 1 is gradient width
...
...
@@ -1827,7 +1855,7 @@ void Monitor::slotSwitchCompare(bool enable)
void
Monitor
::
buildSplitEffect
(
Mlt
::
Producer
*
original
)
{
m_splitEffect
.
reset
(
new
Mlt
::
Filter
(
*
pCore
->
get
ProjectP
rofile
(),
"frei0r.alphagrad"
));
m_splitEffect
.
reset
(
new
Mlt
::
Filter
(
pCore
->
get
CurrentProfile
()
->
p
rofile
(),
"frei0r.alphagrad"
));
if
((
m_splitEffect
!=
nullptr
)
&&
m_splitEffect
->
is_valid
())
{
m_splitEffect
->
set
(
"0"
,
0.5
);
// 0 is the Clip left parameter
m_splitEffect
->
set
(
"1"
,
0
);
// 1 is gradient width
...
...
@@ -1838,13 +1866,13 @@ void Monitor::buildSplitEffect(Mlt::Producer *original)
return
;
}
QString
splitTransition
=
TransitionsRepository
::
get
()
->
getCompositingTransition
();
Mlt
::
Transition
t
(
*
pCore
->
get
ProjectP
rofile
(),
splitTransition
.
toUtf8
().
constData
());
Mlt
::
Transition
t
(
pCore
->
get
CurrentProfile
()
->
p
rofile
(),
splitTransition
.
toUtf8
().
constData
());
if
(
!
t
.
is_valid
())
{
m_splitEffect
.
reset
();
pCore
->
displayMessage
(
i18n
(
"The cairoblend transition is required for that feature, please install frei0r and restart Kdenlive"
),
ErrorMessage
);
return
;
}
Mlt
::
Tractor
trac
(
*
pCore
->
get
ProjectP
rofile
());
Mlt
::
Tractor
trac
(
pCore
->
get
CurrentProfile
()
->
p
rofile
());
std
::
shared_ptr
<
Mlt
::
Producer
>
clone
=
ProjectClip
::
cloneProducer
(
std
::
make_shared
<
Mlt
::
Producer
>
(
original
));
// Delete all effects
int
ct
=
0
;
...
...
src/monitor/monitor.h
View file @
8d2970ef
...
...
@@ -43,6 +43,7 @@ class KMessageWidget;
class
QScrollBar
;
class
RecManager
;
class
QmlManager
;
class
QLabel
;
class
GLWidget
;
class
MonitorAudioLevel
;
class
MonitorProxy
;
...
...
@@ -222,6 +223,7 @@ private:
MonitorAudioLevel
*
m_audioMeterWidget
;
QElapsedTimer
m_droppedTimer
;
double
m_displayedFps
;
QLabel
*
m_scalingLabel
;
void
adjustScrollBars
(
float
horizontal
,
float
vertical
);
void
loadQmlScene
(
MonitorSceneType
type
);
...
...
src/project/projectmanager.cpp
View file @
8d2970ef
...
...
@@ -839,7 +839,7 @@ bool ProjectManager::updateTimeline(int pos, int scrollPos)
}*/
pCore
->
window
()
->
getMainTimeline
()
->
loading
=
true
;
pCore
->
window
()
->
slotSwitchTimelineZone
(
m_project
->
getDocumentProperty
(
QStringLiteral
(
"enableTimelineZone"
)).
toInt
()
==
1
);
QScopedPointer
<
Mlt
::
Producer
>
xmlProd
(
new
Mlt
::
Producer
(
*
pCore
->
get
ProjectP
rofile
(),
"xml-string"
,
m_project
->
getProjectXml
().
constData
()));
QScopedPointer
<
Mlt
::
Producer
>
xmlProd
(
new
Mlt
::
Producer
(
pCore
->
get
CurrentProfile
()
->
p
rofile
(),
"xml-string"
,
m_project
->
getProjectXml
().
constData
()));
Mlt
::
Service
s
(
*
xmlProd
);
Mlt
::
Tractor
tractor
(
s
);
if
(
tractor
.
count
()
==
0
)
{
...
...
@@ -874,6 +874,7 @@ bool ProjectManager::updateTimeline(int pos, int scrollPos)
m_mainTimelineModel
->
loadGroups
(
groupsData
);
}
connect
(
pCore
->
window
()
->
getMainTimeline
()
->
controller
(),
&
TimelineController
::
durationChanged
,
this
,
&
ProjectManager
::
adjustProjectDuration
);
pCore
->
monitorManager
()
->
updatePreviewScaling
();
pCore
->
monitorManager
()
->
projectMonitor
()
->
slotActivateMonitor
();
pCore
->
monitorManager
()
->
projectMonitor
()
->
setProducer
(
m_mainTimelineModel
->
producer
(),
pos
);
pCore
->
monitorManager
()
->
projectMonitor
()
->
adjustRulerSize
(
m_mainTimelineModel
->
duration
()
-
1
,
m_project
->
getGuideModel
());
...
...
src/timeline2/view/previewmanager.cpp
View file @
8d2970ef
...
...
@@ -132,7 +132,7 @@ bool PreviewManager::buildPreviewTrack()
}
// Create overlay track
qDebug
()
<<
"/// BUILDING PREVIEW TRACK
\n
----------------------
\n
----------------__"
;
m_previewTrack
=
new
Mlt
::
Playlist
(
*
pCore
->
get
ProjectP
rofile
());
m_previewTrack
=
new
Mlt
::
Playlist
(
pCore
->
get
CurrentProfile
()
->
p
rofile
());
m_previewTrack
->
set
(
"id"
,
"timeline_preview"
);
m_tractor
->
lock
();
reconnectTrack
();
...
...
@@ -682,7 +682,7 @@ void PreviewManager::reloadChunks(const QVariantList chunks)
if
(
m_previewTrack
->
is_blank_at
(
ix
.
toInt
()))
{
QString
fileName
=
m_cacheDir
.
absoluteFilePath
(
QStringLiteral
(
"%1.%2"
).
arg
(
ix
.
toInt
()).
arg
(
m_extension
));
fileName
.
prepend
(
QStringLiteral
(
"avformat:"
));
Mlt
::
Producer
prod
(
*
pCore
->
get
ProjectP
rofile
(),
fileName
.
toUtf8
().
constData
());
Mlt
::
Producer
prod
(
pCore
->
get
CurrentProfile
()
->
p
rofile
(),
fileName
.
toUtf8
().
constData
());
if
(
prod
.
is_valid
())
{
// m_ruler->updatePreview(ix, true);
prod
.
set
(
"mlt_service"
,
"avformat-novalidate"
);
...
...
@@ -715,7 +715,7 @@ void PreviewManager::gotPreviewRender(int frame, const QString &file, int progre
return
;
}
if
(
m_previewTrack
->
is_blank_at
(
frame
))
{
Mlt
::
Producer
prod
(
*
pCore
->
get
ProjectP
rofile
(),
QString
(
"avformat:%1"
).
arg
(
file
).
toUtf8
().
constData
());
Mlt
::
Producer
prod
(
pCore
->
get
CurrentProfile
()
->
p
rofile
(),
QString
(
"avformat:%1"
).
arg
(
file
).
toUtf8
().
constData
());
if
(
prod
.
is_valid
())
{
m_dirtyChunks
.
removeAll
(
frame
);
m_renderedChunks
<<
frame
;
...
...
src/transitions/transitionsrepository.cpp
View file @
8d2970ef
...
...
@@ -156,7 +156,7 @@ std::unique_ptr<Mlt::Transition> TransitionsRepository::getTransition(const QStr
Q_ASSERT
(
exists
(
transitionId
));
QString
service_name
=
m_assets
.
at
(
transitionId
).
mltId
;
// We create the Mlt element from its name
auto
transition
=
std
::
make_unique
<
Mlt
::
Transition
>
(
*
pCore
->
get
ProjectP
rofile
(),
service_name
.
toLatin1
().
constData
(),
nullptr
);
auto
transition
=
std
::
make_unique
<
Mlt
::
Transition
>
(
pCore
->
get
CurrentProfile
()
->
p
rofile
(),
service_name
.
toLatin1
().
constData
(),
nullptr
);
transition
->
set
(
"kdenlive_id"
,
transitionId
.
toUtf8
().
constData
());
return
transition
;
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment