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
44cae0f8
Commit
44cae0f8
authored
Oct 05, 2022
by
Jean-Baptiste Mardelle
Browse files
Fix pasting clip from a project with different fps causes image freeze.
Should fix
#1500
parent
01b125f5
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/timeline2/model/timelinefunctions.cpp
View file @
44cae0f8
...
...
@@ -1858,6 +1858,7 @@ bool TimelineFunctions::pasteClips(const std::shared_ptr<TimelineItemModel> &tim
// Check if the fps matches
QString
currentFps
=
QString
::
number
(
pCore
->
getCurrentFps
());
QString
sourceFps
=
copiedItems
.
documentElement
().
attribute
(
QStringLiteral
(
"fps"
));
double
ratio
=
1.
;
if
(
currentFps
!=
sourceFps
&&
!
sourceFps
.
isEmpty
())
{
if
(
KMessageBox
::
questionYesNo
(
pCore
->
window
(),
...
...
@@ -1867,7 +1868,8 @@ bool TimelineFunctions::pasteClips(const std::shared_ptr<TimelineItemModel> &tim
semaphore
.
release
(
1
);
return
false
;
}
copiedItems
.
documentElement
().
setAttribute
(
QStringLiteral
(
"fps-ratio"
),
pCore
->
getCurrentFps
()
/
sourceFps
.
toDouble
());
ratio
=
pCore
->
getCurrentFps
()
/
sourceFps
.
toDouble
();
copiedItems
.
documentElement
().
setAttribute
(
QStringLiteral
(
"fps-ratio"
),
ratio
);
}
QString
folderId
=
pCore
->
projectItemModel
()
->
getFolderIdByName
(
i18n
(
"Pasted clips"
));
if
(
folderId
.
isEmpty
())
{
...
...
@@ -1879,6 +1881,12 @@ bool TimelineFunctions::pasteClips(const std::shared_ptr<TimelineItemModel> &tim
QDomNodeList
binClips
=
copiedItems
.
documentElement
().
elementsByTagName
(
QStringLiteral
(
"producer"
));
for
(
int
i
=
0
;
i
<
binClips
.
count
();
++
i
)
{
QDomElement
currentProd
=
binClips
.
item
(
i
).
toElement
();
if
(
ratio
!=
1.
)
{
int
out
=
currentProd
.
attribute
(
QStringLiteral
(
"out"
)).
toInt
()
*
ratio
;
int
length
=
Xml
::
getXmlProperty
(
currentProd
,
QStringLiteral
(
"length"
)).
toInt
()
*
ratio
;
currentProd
.
setAttribute
(
QStringLiteral
(
"out"
),
out
);
Xml
::
setXmlProperty
(
currentProd
,
QStringLiteral
(
"length"
),
QString
::
number
(
length
));
}
QString
clipId
=
Xml
::
getXmlProperty
(
currentProd
,
QStringLiteral
(
"kdenlive:id"
));
QString
clipHash
=
Xml
::
getXmlProperty
(
currentProd
,
QStringLiteral
(
"kdenlive:file_hash"
));
// Check if we already have a clip with same hash in pasted clips folder
...
...
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