Skip to content
GitLab
Menu
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
62ee15a6
Commit
62ee15a6
authored
Oct 21, 2019
by
Jean-Baptiste Mardelle
Browse files
Fix title clip created with incorrect duration. Fixes #383
parent
bd5c9b4f
Pipeline
#9266
passed with stage
in 15 minutes and 57 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/jobs/loadjob.cpp
View file @
62ee15a6
...
...
@@ -112,7 +112,7 @@ void processProducerProperties(const std::shared_ptr<Mlt::Producer> &prod, const
}
// namespace
// static
std
::
shared_ptr
<
Mlt
::
Producer
>
LoadJob
::
loadResource
(
QString
&
resource
,
const
QString
&
type
)
std
::
shared_ptr
<
Mlt
::
Producer
>
LoadJob
::
loadResource
(
QString
resource
,
const
QString
&
type
)
{
if
(
!
resource
.
startsWith
(
type
))
{
resource
.
prepend
(
type
);
...
...
@@ -268,14 +268,20 @@ bool LoadJob::startJob()
break
;
case
ClipType
::
Text
:
case
ClipType
::
TextTemplate
:
{
m_producer
=
loadResource
(
m_resource
,
QStringLiteral
(
"kdenlivetitle:"
));
bool
ok
;
int
producerLength
=
0
;
QString
pLength
=
Xml
::
getXmlProperty
(
m_xml
,
QStringLiteral
(
"length"
));
int
producerLength
=
pLength
.
toInt
(
&
ok
);
if
(
!
ok
)
{
producerLength
=
m_producer
->
time_to_frames
(
pLength
.
toUtf8
().
constData
());
if
(
pLength
.
isEmpty
())
{
producerLength
=
m_xml
.
attribute
(
QStringLiteral
(
"length"
)).
toInt
();
}
else
{
producerLength
=
pLength
.
toInt
(
&
ok
);
}
m_producer
=
loadResource
(
m_resource
,
QStringLiteral
(
"kdenlivetitle:"
));
if
(
!
m_resource
.
isEmpty
())
{
if
(
!
ok
)
{
producerLength
=
m_producer
->
time_to_frames
(
pLength
.
toUtf8
().
constData
());
}
// Title from .kdenlivetitle file
QFile
txtfile
(
m_resource
);
QDomDocument
txtdoc
(
QStringLiteral
(
"titledocument"
));
...
...
@@ -295,8 +301,13 @@ bool LoadJob::startJob()
duration
=
m_producer
->
time_to_frames
(
xmlDuration
.
toUtf8
().
constData
());
}
}
qDebug
()
<<
"===== GOT PRODUCER DURATION: "
<<
duration
<<
"; PROD: "
<<
producerLength
;
if
(
duration
<=
0
)
{
duration
=
pCore
->
currentDoc
()
->
getFramePos
(
KdenliveSettings
::
title_duration
());
if
(
producerLength
>
0
)
{
duration
=
producerLength
;
}
else
{
duration
=
pCore
->
currentDoc
()
->
getFramePos
(
KdenliveSettings
::
title_duration
());
}
}
if
(
producerLength
<=
0
)
{
producerLength
=
duration
;
...
...
src/jobs/loadjob.hpp
View file @
62ee15a6
...
...
@@ -59,7 +59,7 @@ public:
protected:
// helper to load some kind of resources such as color. This will modify resource if needs be (for eg., in the case of color, it will prepend "color:" if
// needed)
static
std
::
shared_ptr
<
Mlt
::
Producer
>
loadResource
(
QString
&
resource
,
const
QString
&
type
);
static
std
::
shared_ptr
<
Mlt
::
Producer
>
loadResource
(
QString
resource
,
const
QString
&
type
);
std
::
shared_ptr
<
Mlt
::
Producer
>
loadPlaylist
(
QString
&
resource
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a 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