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
2cf317db
Commit
2cf317db
authored
Nov 16, 2021
by
Jean-Baptiste Mardelle
Browse files
Extract frame from timeline monitor now correctly disables proxy to create a full res image
Fixes
#870
parent
ea176292
Changes
7
Hide whitespace changes
Inline
Side-by-side
src/bin/projectclip.cpp
View file @
2cf317db
...
...
@@ -1273,6 +1273,11 @@ void ProjectClip::setProperties(const QMap<QString, QString> &properties, bool r
}
else
{
reload
=
true
;
refreshOnly
=
false
;
// Restore original url
QString
resource
=
getProducerProperty
(
QStringLiteral
(
"kdenlive:originalurl"
));
if
(
!
resource
.
isEmpty
())
{
setProducerProperty
(
QStringLiteral
(
"resource"
),
resource
);
}
}
}
else
{
// A proxy was requested, make sure to keep original url
...
...
src/doc/kdenlivedoc.cpp
View file @
2cf317db
...
...
@@ -1162,6 +1162,24 @@ void KdenliveDoc::setMetadata(const QMap<QString, QString> &meta)
m_documentMetadata
=
meta
;
}
QMap
<
QString
,
QString
>
KdenliveDoc
::
proxyClipsById
(
const
QStringList
&
ids
,
bool
proxy
,
QMap
<
QString
,
QString
>
proxyPath
)
{
QMap
<
QString
,
QString
>
existingProxies
;
QList
<
std
::
shared_ptr
<
ProjectClip
>>
clipList
;
for
(
auto
&
id
:
ids
)
{
auto
clip
=
pCore
->
projectItemModel
()
->
getClipByBinID
(
id
);
QMap
<
QString
,
QString
>
newProps
;
if
(
!
proxy
)
{
newProps
.
insert
(
QStringLiteral
(
"kdenlive:proxy"
),
QStringLiteral
(
"-"
));
existingProxies
.
insert
(
id
,
clip
->
getProducerProperty
(
QStringLiteral
(
"kdenlive:proxy"
)));
}
else
if
(
proxyPath
.
contains
(
id
))
{
newProps
.
insert
(
QStringLiteral
(
"kdenlive:proxy"
),
proxyPath
.
value
(
id
));
}
clip
->
setProperties
(
newProps
);
}
return
existingProxies
;
}
void
KdenliveDoc
::
slotProxyCurrentItem
(
bool
doProxy
,
QList
<
std
::
shared_ptr
<
ProjectClip
>>
clipList
,
bool
force
,
QUndoCommand
*
masterCommand
)
{
if
(
clipList
.
isEmpty
())
{
...
...
src/doc/kdenlivedoc.h
View file @
2cf317db
...
...
@@ -228,6 +228,7 @@ public slots:
*
* @param mod (optional) true if the document has to be saved */
void
setModified
(
bool
mod
=
true
);
QMap
<
QString
,
QString
>
proxyClipsById
(
const
QStringList
&
ids
,
bool
proxy
,
QMap
<
QString
,
QString
>
proxyPath
=
QMap
<
QString
,
QString
>
());
void
slotProxyCurrentItem
(
bool
doProxy
,
QList
<
std
::
shared_ptr
<
ProjectClip
>>
clipList
=
QList
<
std
::
shared_ptr
<
ProjectClip
>>
(),
bool
force
=
false
,
QUndoCommand
*
masterCommand
=
nullptr
);
/** @brief Saves the current project at the autosave location.
...
...
src/monitor/monitor.cpp
View file @
2cf317db
...
...
@@ -1257,7 +1257,41 @@ void Monitor::slotExtractCurrentFrame(QString frameName, bool addToProject)
m_controller
->
getProducerProperty
(
QStringLiteral
(
"kdenlive:originalurl"
)),
-
1
,
-
1
,
b
!=
nullptr
?
b
->
isChecked
()
:
false
);
}
else
{
frame
=
m_glMonitor
->
getControllerProxy
()
->
extractFrame
(
m_glMonitor
->
getCurrentPos
(),
QString
(),
-
1
,
-
1
,
b
!=
nullptr
?
b
->
isChecked
()
:
false
);
if
(
m_id
==
Kdenlive
::
ProjectMonitor
)
{
// Check if we have proxied clips at position
QStringList
proxiedClips
=
pCore
->
window
()
->
getCurrentTimeline
()
->
model
()
->
getProxiesAt
(
m_glMonitor
->
getCurrentPos
());
// Temporarily disable proxy on those clips
QMap
<
QString
,
QString
>
existingProxies
;
if
(
!
proxiedClips
.
isEmpty
())
{
existingProxies
=
pCore
->
currentDoc
()
->
proxyClipsById
(
proxiedClips
,
false
);
}
disconnect
(
m_glMonitor
,
&
GLWidget
::
analyseFrame
,
this
,
&
Monitor
::
frameUpdated
);
bool
analysisStatus
=
m_glMonitor
->
sendFrameForAnalysis
;
m_glMonitor
->
sendFrameForAnalysis
=
true
;
if
(
m_captureConnection
)
{
QObject
::
disconnect
(
m_captureConnection
);
}
m_captureConnection
=
connect
(
m_glMonitor
,
&
GLWidget
::
analyseFrame
,
[
this
,
proxiedClips
,
selectedFile
,
existingProxies
,
addToProject
,
analysisStatus
](
const
QImage
&
img
)
{
m_glMonitor
->
sendFrameForAnalysis
=
analysisStatus
;
m_glMonitor
->
releaseAnalyse
();
img
.
save
(
selectedFile
);
// Re-enable proxy on those clips
if
(
!
proxiedClips
.
isEmpty
())
{
pCore
->
currentDoc
()
->
proxyClipsById
(
proxiedClips
,
true
,
existingProxies
);
}
QObject
::
disconnect
(
m_captureConnection
);
connect
(
m_glMonitor
,
&
GLWidget
::
analyseFrame
,
this
,
&
Monitor
::
frameUpdated
);
KRecentDirs
::
add
(
QStringLiteral
(
":KdenliveFramesFolder"
),
QUrl
::
fromLocalFile
(
selectedFile
).
adjusted
(
QUrl
::
RemoveFilename
).
toLocalFile
());
if
(
addToProject
)
{
QString
folderInfo
=
pCore
->
bin
()
->
getCurrentFolder
();
pCore
->
bin
()
->
droppedUrls
(
QList
<
QUrl
>
{
QUrl
::
fromLocalFile
(
selectedFile
)},
folderInfo
);
}
});
refreshMonitor
();
return
;
}
else
{
frame
=
m_glMonitor
->
getControllerProxy
()
->
extractFrame
(
m_glMonitor
->
getCurrentPos
(),
QString
(),
-
1
,
-
1
,
b
!=
nullptr
?
b
->
isChecked
()
:
false
);
}
}
frame
.
save
(
selectedFile
);
if
(
b
!=
nullptr
)
{
...
...
src/monitor/monitor.h
View file @
2cf317db
...
...
@@ -223,6 +223,7 @@ private:
double
m_displayedFps
;
int
m_speedIndex
;
QMetaObject
::
Connection
m_switchConnection
;
QMetaObject
::
Connection
m_captureConnection
;
void
adjustScrollBars
(
float
horizontal
,
float
vertical
);
void
loadQmlScene
(
MonitorSceneType
type
,
QVariant
sceneData
=
QVariant
());
...
...
src/timeline2/model/timelinemodel.cpp
View file @
2cf317db
...
...
@@ -6242,3 +6242,42 @@ const QSize TimelineModel::getCompositionSizeOnTrack(const ObjectId &id)
}
return
QSize
();
}
QStringList
TimelineModel
::
getProxiesAt
(
int
position
)
{
QStringList
done
;
QStringList
proxied
;
auto
it
=
m_allTracks
.
begin
();
while
(
it
!=
m_allTracks
.
end
())
{
if
((
*
it
)
->
isAudioTrack
())
{
++
it
;
continue
;
}
int
clip1
=
(
*
it
)
->
getClipByPosition
(
position
,
0
);
int
clip2
=
(
*
it
)
->
getClipByPosition
(
position
,
1
);
if
(
clip1
>
-
1
)
{
// Check if proxied
const
QString
binId
=
m_allClips
[
clip1
]
->
binId
();
if
(
!
done
.
contains
(
binId
))
{
done
<<
binId
;
std
::
shared_ptr
<
ProjectClip
>
binClip
=
pCore
->
projectItemModel
()
->
getClipByBinID
(
binId
);
if
(
binClip
->
hasProxy
())
{
proxied
<<
binId
;
}
}
}
if
(
clip2
>
-
1
)
{
// Check if proxied
const
QString
binId
=
m_allClips
[
clip2
]
->
binId
();
if
(
!
done
.
contains
(
binId
))
{
done
<<
binId
;
std
::
shared_ptr
<
ProjectClip
>
binClip
=
pCore
->
projectItemModel
()
->
getClipByBinID
(
binId
);
if
(
binClip
->
hasProxy
())
{
proxied
<<
binId
;
}
}
}
++
it
;
}
return
proxied
;
}
src/timeline2/model/timelinemodel.hpp
View file @
2cf317db
...
...
@@ -439,6 +439,9 @@ public:
/** @brief Returns a list of the master effects zones
*/
QVariantList
getMasterEffectZones
()
const
;
/** @brief Returns a list of proxied clips at position pos
*/
QStringList
getProxiesAt
(
int
position
);
protected:
/** @brief Creates a new clip instance without inserting it.
...
...
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