Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
VLMC
Manage
Activity
Members
Labels
Plan
Issues
26
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
VideoLAN
VLMC
Commits
518ed4cb
Commit
518ed4cb
authored
8 years ago
by
Hugo Beauzée-Luyssen
Browse files
Options
Downloads
Patches
Plain Diff
Media: Lazy load base clip
Mostly because sharedFromThis cannot be called from a constructor
parent
772fbe65
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/Media/Media.cpp
+10
-1
10 additions, 1 deletion
src/Media/Media.cpp
src/Media/Media.h
+4
-2
4 additions, 2 deletions
src/Media/Media.h
with
14 additions
and
3 deletions
src/Media/Media.cpp
+
10
−
1
View file @
518ed4cb
...
...
@@ -62,6 +62,8 @@ const QString Media::streamPrefix = "stream://";
Media
::
Media
(
medialibrary
::
MediaPtr
media
,
const
QUuid
&
uuid
/* = QUuid() */
)
:
m_input
(
nullptr
)
,
m_mlMedia
(
media
)
,
m_baseClipUuid
(
uuid
)
,
m_baseClip
(
nullptr
)
{
auto
files
=
media
->
files
();
Q_ASSERT
(
files
.
size
()
>
0
);
...
...
@@ -77,7 +79,6 @@ Media::Media( medialibrary::MediaPtr media, const QUuid& uuid /* = QUuid() */ )
if
(
m_mlFile
==
nullptr
)
vlmcFatal
(
"No file representing media %s"
,
media
->
title
().
c_str
(),
"was found"
);
m_input
.
reset
(
new
Backend
::
MLT
::
MLTInput
(
m_mlFile
->
mrl
().
c_str
()
)
);
m_baseClip
=
new
Clip
(
sharedFromThis
(),
0
,
Backend
::
IInput
::
EndOfMedia
,
uuid
);
}
QString
...
...
@@ -113,6 +114,14 @@ Media::id() const
return
m_mlMedia
->
id
();
}
Clip
*
Media
::
baseClip
()
{
if
(
m_baseClip
==
nullptr
)
m_baseClip
=
new
Clip
(
sharedFromThis
(),
0
,
Backend
::
IInput
::
EndOfMedia
,
m_baseClipUuid
);
return
m_baseClip
;
}
QSharedPointer
<
Clip
>
Media
::
cut
(
qint64
begin
,
qint64
end
)
{
...
...
This diff is collapsed.
Click to expand it.
src/Media/Media.h
+
4
−
2
View file @
518ed4cb
...
...
@@ -86,7 +86,8 @@ public:
QString
title
()
const
;
qint64
id
()
const
;
Clip
*
baseClip
()
{
return
m_baseClip
;
}
Clip
*
baseClip
();
/**
* @brief cut Creates a clip to represent a cut of a media
* @param begin The first frame of the cut
...
...
@@ -112,7 +113,8 @@ protected:
std
::
unique_ptr
<
Backend
::
IInput
>
m_input
;
medialibrary
::
MediaPtr
m_mlMedia
;
medialibrary
::
FilePtr
m_mlFile
;
Clip
*
m_baseClip
;
QUuid
m_baseClipUuid
;
mutable
Clip
*
m_baseClip
;
QHash
<
QUuid
,
QSharedPointer
<
Clip
>>
m_clips
;
signals
:
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment