Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
Multimedia
Kdenlive
Commits
546d6b46
Commit
546d6b46
authored
Jun 12, 2020
by
Jean-Baptiste Mardelle
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Ensure project clip backup url is correctly updated on replace clip
parent
08485f1b
Pipeline
#23298
passed with stage
in 9 minutes and 38 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
46 additions
and
55 deletions
+46
-55
src/bin/projectclip.cpp
src/bin/projectclip.cpp
+15
-12
src/mltcontroller/clipcontroller.cpp
src/mltcontroller/clipcontroller.cpp
+31
-43
No files found.
src/bin/projectclip.cpp
View file @
546d6b46
...
...
@@ -1003,6 +1003,21 @@ void ProjectClip::setProperties(const QMap<QString, QString> &properties, bool r
passProperties
.
insert
(
i
.
key
(),
i
.
value
());
}
}
if
(
properties
.
contains
(
QStringLiteral
(
"resource"
)))
{
// Clip source was changed, update important stuff
refreshPanel
=
true
;
reload
=
true
;
if
(
m_clipType
==
ClipType
::
Color
)
{
refreshOnly
=
true
;
updateRoles
<<
TimelineModel
::
ResourceRole
;
}
else
{
// Clip resource changed, update thumbnail, name, clear hash
refreshOnly
=
false
;
resetProducerProperty
(
QStringLiteral
(
"kdenlive:file_hash"
));
getInfoForProducer
();
updateRoles
<<
TimelineModel
::
ResourceRole
<<
TimelineModel
::
MaxDurationRole
<<
TimelineModel
::
NameRole
;
}
}
if
(
properties
.
contains
(
QStringLiteral
(
"kdenlive:proxy"
)))
{
QString
value
=
properties
.
value
(
QStringLiteral
(
"kdenlive:proxy"
));
// If value is "-", that means user manually disabled proxy on this clip
...
...
@@ -1028,18 +1043,6 @@ void ProjectClip::setProperties(const QMap<QString, QString> &properties, bool r
if
(
forceReloadProperties
.
contains
(
k
))
{
refreshPanel
=
true
;
reload
=
true
;
if
(
m_clipType
==
ClipType
::
Color
)
{
refreshOnly
=
true
;
updateRoles
<<
TimelineModel
::
ResourceRole
;
}
else
{
// Clip resource changed, update thumbnail, name, clear hash
refreshOnly
=
false
;
if
(
propKeys
.
contains
(
QStringLiteral
(
"resource"
)))
{
resetProducerProperty
(
QStringLiteral
(
"kdenlive:file_hash"
));
setProducerProperty
(
QStringLiteral
(
"kdenlive:originalurl"
),
url
());
updateRoles
<<
TimelineModel
::
ResourceRole
<<
TimelineModel
::
MaxDurationRole
<<
TimelineModel
::
NameRole
;
}
}
break
;
}
}
...
...
src/mltcontroller/clipcontroller.cpp
View file @
546d6b46
...
...
@@ -62,33 +62,6 @@ ClipController::ClipController(const QString &clipId, const std::shared_ptr<Mlt:
}
if
(
m_properties
)
{
setProducerProperty
(
QStringLiteral
(
"kdenlive:id"
),
m_controllerBinId
);
m_service
=
m_properties
->
get
(
"mlt_service"
);
if
(
m_service
==
QLatin1String
(
"qtext"
))
{
// Placeholder clip, find real service
QString
originalService
=
m_properties
->
get
(
"kdenlive:orig_service"
);
if
(
!
originalService
.
isEmpty
())
{
m_service
=
originalService
;
}
}
QString
proxy
=
m_properties
->
get
(
"kdenlive:proxy"
);
QString
path
=
m_properties
->
get
(
"resource"
);
if
(
proxy
.
length
()
>
2
)
{
if
(
QFileInfo
(
path
).
isRelative
())
{
path
.
prepend
(
pCore
->
currentDoc
()
->
documentRoot
());
m_properties
->
set
(
"resource"
,
path
.
toUtf8
().
constData
());
}
// This is a proxy producer, read original url from kdenlive property
path
=
m_properties
->
get
(
"kdenlive:originalurl"
);
if
(
QFileInfo
(
path
).
isRelative
())
{
path
.
prepend
(
pCore
->
currentDoc
()
->
documentRoot
());
}
m_usesProxy
=
true
;
}
else
if
(
m_service
!=
QLatin1String
(
"color"
)
&&
m_service
!=
QLatin1String
(
"colour"
)
&&
!
path
.
isEmpty
()
&&
QFileInfo
(
path
).
isRelative
()
&&
path
!=
QLatin1String
(
"<producer>"
))
{
path
.
prepend
(
pCore
->
currentDoc
()
->
documentRoot
());
m_properties
->
set
(
"resource"
,
path
.
toUtf8
().
constData
());
}
m_path
=
path
.
isEmpty
()
?
QString
()
:
QFileInfo
(
path
).
absoluteFilePath
();
getInfoForProducer
();
checkAudioVideo
();
}
else
{
...
...
@@ -115,7 +88,6 @@ const std::unique_ptr<AudioStreamInfo> &ClipController::audioInfo() const
void
ClipController
::
addMasterProducer
(
const
std
::
shared_ptr
<
Mlt
::
Producer
>
&
producer
)
{
qDebug
()
<<
"################### ClipController::addmasterproducer"
;
QString
documentRoot
=
pCore
->
currentDoc
()
->
documentRoot
();
m_masterProducer
=
producer
;
m_properties
=
new
Mlt
::
Properties
(
m_masterProducer
->
get_properties
());
m_producerLock
.
unlock
();
...
...
@@ -144,21 +116,6 @@ void ClipController::addMasterProducer(const std::shared_ptr<Mlt::Producer> &pro
}
else
{
checkAudioVideo
();
setProducerProperty
(
QStringLiteral
(
"kdenlive:id"
),
m_controllerBinId
);
QString
proxy
=
m_properties
->
get
(
"kdenlive:proxy"
);
m_service
=
m_properties
->
get
(
"mlt_service"
);
QString
path
=
m_properties
->
get
(
"resource"
);
m_usesProxy
=
false
;
if
(
proxy
.
length
()
>
2
)
{
// This is a proxy producer, read original url from kdenlive property
path
=
m_properties
->
get
(
"kdenlive:originalurl"
);
if
(
QFileInfo
(
path
).
isRelative
())
{
path
.
prepend
(
documentRoot
);
}
m_usesProxy
=
true
;
}
else
if
(
m_service
!=
QLatin1String
(
"color"
)
&&
m_service
!=
QLatin1String
(
"colour"
)
&&
!
path
.
isEmpty
()
&&
QFileInfo
(
path
).
isRelative
())
{
path
.
prepend
(
documentRoot
);
}
m_path
=
path
.
isEmpty
()
?
QString
()
:
QFileInfo
(
path
).
absoluteFilePath
();
getInfoForProducer
();
emitProducerChanged
(
m_controllerBinId
,
producer
);
}
...
...
@@ -215,6 +172,37 @@ void ClipController::getProducerXML(QDomDocument &document, bool includeMeta, bo
void
ClipController
::
getInfoForProducer
()
{
QReadLocker
lock
(
&
m_producerLock
);
m_service
=
m_properties
->
get
(
"mlt_service"
);
if
(
m_service
==
QLatin1String
(
"qtext"
))
{
// Placeholder clip, find real service
QString
originalService
=
m_properties
->
get
(
"kdenlive:orig_service"
);
if
(
!
originalService
.
isEmpty
())
{
m_service
=
originalService
;
}
}
QString
proxy
=
m_properties
->
get
(
"kdenlive:proxy"
);
QString
path
=
m_properties
->
get
(
"resource"
);
if
(
proxy
.
length
()
>
2
)
{
if
(
QFileInfo
(
path
).
isRelative
())
{
path
.
prepend
(
pCore
->
currentDoc
()
->
documentRoot
());
m_properties
->
set
(
"resource"
,
path
.
toUtf8
().
constData
());
}
// This is a proxy producer, read original url from kdenlive property
path
=
m_properties
->
get
(
"kdenlive:originalurl"
);
if
(
QFileInfo
(
path
).
isRelative
())
{
path
.
prepend
(
pCore
->
currentDoc
()
->
documentRoot
());
}
m_usesProxy
=
true
;
}
else
if
(
m_service
!=
QLatin1String
(
"color"
)
&&
m_service
!=
QLatin1String
(
"colour"
)
&&
!
path
.
isEmpty
()
&&
QFileInfo
(
path
).
isRelative
()
&&
path
!=
QLatin1String
(
"<producer>"
))
{
path
.
prepend
(
pCore
->
currentDoc
()
->
documentRoot
());
m_properties
->
set
(
"resource"
,
path
.
toUtf8
().
constData
());
}
m_path
=
path
.
isEmpty
()
?
QString
()
:
QFileInfo
(
path
).
absoluteFilePath
();
QString
origurl
=
m_properties
->
get
(
"kdenlive:originalurl"
);
if
(
!
origurl
.
isEmpty
())
{
m_properties
->
set
(
"kdenlive:originalurl"
,
m_path
.
toUtf8
().
constData
());
}
date
=
QFileInfo
(
m_path
).
lastModified
();
m_videoIndex
=
-
1
;
int
audioIndex
=
-
1
;
...
...
Write
Preview
Markdown
is supported
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