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
a8f591ea
Commit
a8f591ea
authored
Jan 02, 2022
by
Jean-Baptiste Mardelle
Browse files
Minor optimization on project load (don't unnecessarily request a frame)
parent
b5f95255
Pipeline
#117274
passed with stage
in 6 minutes and 43 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/jobs/cliploadtask.cpp
View file @
a8f591ea
...
...
@@ -564,7 +564,19 @@ void ClipLoadTask::run()
int
h
=
frameSize
.
height
();
std
::
unique_ptr
<
Mlt
::
Frame
>
frame
(
producer
->
get_frame
());
frame
->
get_image
(
format
,
w
,
h
);
// Check audio / video
bool
hasAudio
=
frame
->
get_int
(
"test_audio"
)
==
0
;
bool
hasVideo
=
frame
->
get_int
(
"test_image"
)
==
0
;
frame
.
reset
();
if
(
hasAudio
)
{
if
(
hasVideo
)
{
producer
->
set
(
"kdenlive:clip_type"
,
0
);
}
else
{
producer
->
set
(
"kdenlive:clip_type"
,
1
);
}
}
else
if
(
hasVideo
)
{
producer
->
set
(
"kdenlive:clip_type"
,
2
);
}
// Check if file is seekable
seekable
=
producer
->
get_int
(
"seekable"
);
vindex
=
producer
->
get_int
(
"video_index"
);
...
...
src/mltcontroller/clipcontroller.cpp
View file @
a8f591ea
...
...
@@ -672,14 +672,41 @@ void ClipController::checkAudioVideo()
}
return
;
}
QScopedPointer
<
Mlt
::
Frame
>
frame
(
m_masterProducer
->
get_frame
());
if
(
frame
->
is_valid
())
{
// test_audio returns 1 if there is NO audio (strange but true at the time this code is written)
m_hasAudio
=
frame
->
get_int
(
"test_audio"
)
==
0
;
m_hasVideo
=
frame
->
get_int
(
"test_image"
)
==
0
;
m_masterProducer
->
seek
(
0
);
if
(
m_masterProducer
->
property_exists
(
"kdenlive:clip_type"
))
{
int
clipType
=
m_masterProducer
->
get_int
(
"kdenlive:clip_type"
);
switch
(
clipType
)
{
case
1
:
m_hasAudio
=
true
;
m_hasVideo
=
false
;
break
;
case
2
:
m_hasAudio
=
false
;
m_hasVideo
=
true
;
break
;
default:
m_hasAudio
=
true
;
m_hasVideo
=
true
;
break
;
}
}
else
{
qDebug
()
<<
"* * * *ERROR INVALID FRAME On test"
;
QScopedPointer
<
Mlt
::
Frame
>
frame
(
m_masterProducer
->
get_frame
());
if
(
frame
->
is_valid
())
{
// test_audio returns 1 if there is NO audio (strange but true at the time this code is written)
m_hasAudio
=
frame
->
get_int
(
"test_audio"
)
==
0
;
m_hasVideo
=
frame
->
get_int
(
"test_image"
)
==
0
;
if
(
m_hasAudio
)
{
if
(
m_hasVideo
)
{
m_masterProducer
->
set
(
"kdenlive:clip_type"
,
0
);
}
else
{
m_masterProducer
->
set
(
"kdenlive:clip_type"
,
1
);
}
}
else
if
(
m_hasVideo
)
{
m_masterProducer
->
set
(
"kdenlive:clip_type"
,
2
);
}
m_masterProducer
->
seek
(
0
);
}
else
{
qDebug
()
<<
"* * * *ERROR INVALID FRAME On test"
;
}
}
}
bool
ClipController
::
hasVideo
()
const
...
...
@@ -832,8 +859,7 @@ void ClipController::mirrorOriginalProperties(Mlt::Properties &props)
}
else
{
if
(
m_clipType
==
ClipType
::
AV
||
m_clipType
==
ClipType
::
Video
||
m_clipType
==
ClipType
::
Audio
)
{
// Make sure that a frame / image was fetched to initialize all meta properties
QString
progressive
=
m_properties
->
get
(
"meta.media.progressive"
);
if
(
progressive
.
isEmpty
())
{
if
(
!
m_properties
->
property_exists
(
"meta.media.progressive"
))
{
// Fetch a frame to initialize required properties
QScopedPointer
<
Mlt
::
Producer
>
tmpProd
(
nullptr
);
if
(
KdenliveSettings
::
gpu_accel
())
{
...
...
Eugen Mohr
@emohr
mentioned in issue
#1266 (closed)
·
Jan 03, 2022
mentioned in issue
#1266 (closed)
mentioned in issue #1266
Toggle commit list
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