Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
VLMC
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
21
Issues
21
List
Boards
Labels
Service Desk
Milestones
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
VideoLAN
VLMC
Commits
1b9b2e13
Commit
1b9b2e13
authored
Aug 08, 2017
by
luyikei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
SequenceWorkflow: Use Track
parent
b8ef77aa
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
31 deletions
+32
-31
src/Workflow/SequenceWorkflow.cpp
src/Workflow/SequenceWorkflow.cpp
+28
-29
src/Workflow/SequenceWorkflow.h
src/Workflow/SequenceWorkflow.h
+4
-2
No files found.
src/Workflow/SequenceWorkflow.cpp
View file @
1b9b2e13
...
...
@@ -29,6 +29,7 @@
#include "Backend/MLT/MLTTrack.h"
#include "Backend/MLT/MLTMultiTrack.h"
#include "EffectsEngine/EffectHelper.h"
#include "Track.h"
#include "Workflow/MainWorkflow.h"
#include "Main/Core.h"
#include "Library/Library.h"
...
...
@@ -41,17 +42,16 @@ SequenceWorkflow::SequenceWorkflow( size_t trackCount )
{
for
(
int
i
=
0
;
i
<
trackCount
;
++
i
)
{
auto
audioTrack
=
std
::
shared_ptr
<
Backend
::
ITrack
>
(
new
Backend
::
MLT
::
MLTTrack
);
audioTrack
->
hide
(
Backend
::
HideType
::
Video
);
auto
audioTrack
=
QSharedPointer
<
Track
>
(
new
Track
(
Workflow
::
AudioTrack
)
);
m_tracks
[
Workflow
::
AudioTrack
]
<<
audioTrack
;
auto
videoTrack
=
std
::
shared_ptr
<
Backend
::
ITrack
>
(
new
Backend
::
MLT
::
MLTTrack
);
videoTrack
->
hide
(
Backend
::
HideType
::
Audio
);
auto
videoTrack
=
QSharedPointer
<
Track
>
(
new
Track
(
Workflow
::
VideoTrack
)
);
m_tracks
[
Workflow
::
VideoTrack
]
<<
videoTrack
;
auto
multitrack
=
std
::
shared_ptr
<
Backend
::
IMultiTrack
>
(
new
Backend
::
MLT
::
MLTMultiTrack
);
multitrack
->
setTrack
(
*
videoTrack
,
0
);
multitrack
->
setTrack
(
*
audioTrack
,
1
);
multitrack
->
setTrack
(
audioTrack
->
input
(),
0
);
multitrack
->
hide
(
Backend
::
HideType
::
Video
,
0
);
multitrack
->
setTrack
(
videoTrack
->
input
(),
1
);
multitrack
->
hide
(
Backend
::
HideType
::
Audio
,
1
);
m_multiTracks
<<
multitrack
;
m_multitrack
->
setTrack
(
*
multitrack
,
i
);
...
...
@@ -68,12 +68,12 @@ QUuid
SequenceWorkflow
::
addClip
(
QSharedPointer
<::
Clip
>
clip
,
quint32
trackId
,
qint64
pos
,
const
QUuid
&
uuid
,
bool
isAudioClip
)
{
auto
t
=
track
(
trackId
,
isAudioClip
);
auto
ret
=
t
->
insertAt
(
*
clip
->
input
(),
pos
);
if
(
ret
==
false
)
return
{};
auto
c
=
QSharedPointer
<
ClipInstance
>::
create
(
clip
,
uuid
.
isNull
()
==
true
?
QUuid
::
createUuid
()
:
uuid
,
trackId
,
pos
,
isAudioClip
);
auto
ret
=
t
->
addClip
(
c
,
pos
);
if
(
ret
==
false
)
return
{};
vlmcDebug
()
<<
"adding"
<<
(
isAudioClip
?
"audio"
:
"video"
)
<<
"clip instance:"
<<
c
->
uuid
;
m_clips
.
insert
(
c
->
uuid
,
c
)
;
clip
->
setOnTimeline
(
true
);
...
...
@@ -91,7 +91,6 @@ SequenceWorkflow::moveClip( const QUuid& uuid, quint32 trackId, qint64 pos )
return
false
;
}
auto
&
c
=
it
.
value
();
auto
clip
=
c
->
clip
;
auto
oldTrackId
=
c
->
trackId
;
auto
oldPosition
=
c
->
pos
;
if
(
oldPosition
==
pos
&&
oldTrackId
==
trackId
)
...
...
@@ -101,19 +100,19 @@ SequenceWorkflow::moveClip( const QUuid& uuid, quint32 trackId, qint64 pos )
{
// Don't call removeClip/addClip as they would destroy & recreate clip instances for nothing.
// Simply fiddle with the track to move the clip around
t
->
remove
(
t
->
clipIndexAt
(
oldPosition
)
);
t
->
remove
Clip
(
uuid
);
auto
newTrack
=
track
(
trackId
,
c
->
isAudio
);
if
(
newTrack
->
insertAt
(
*
clip
->
input
()
,
pos
)
==
false
)
if
(
newTrack
->
addClip
(
c
,
pos
)
==
false
)
return
false
;
c
->
pos
=
pos
;
c
->
trackId
=
trackId
;
}
else
{
if
(
t
->
move
(
oldPosition
,
pos
)
==
false
)
bool
ret
=
t
->
moveClip
(
c
->
uuid
,
pos
);
if
(
ret
==
false
)
return
false
;
c
->
pos
=
pos
;
}
c
->
pos
=
pos
;
emit
clipMoved
(
uuid
.
toString
()
);
// CAUTION: You must not move a clip to a place where it would overlap another clip!
return
true
;
...
...
@@ -132,18 +131,19 @@ SequenceWorkflow::resizeClip( const QUuid& uuid, qint64 newBegin, qint64 newEnd,
auto
trackId
=
c
->
trackId
;
auto
position
=
c
->
pos
;
auto
t
=
track
(
trackId
,
c
->
isAudio
);
auto
clipIndex
=
t
->
clipIndexAt
(
position
)
;
bool
ret
;
// This will only duplicate the clip once; no need to panic about endless duplications
if
(
c
->
duplicateClipForResize
(
newBegin
,
newEnd
)
==
true
)
{
vlmcDebug
()
<<
"Duplicating clip for resize"
<<
c
->
uuid
<<
"is now using"
<<
c
->
clip
->
uuid
();
t
->
remove
(
clipIndex
);
t
->
insertAt
(
*
c
->
clip
->
input
()
,
position
);
t
->
remove
Clip
(
uuid
);
ret
=
t
->
addClip
(
c
,
position
);
}
auto
ret
=
t
->
resizeClip
(
clipIndex
,
newBegin
,
newEnd
);
else
ret
=
t
->
resizeClip
(
uuid
,
newBegin
,
newEnd
,
newPos
);
if
(
ret
==
false
)
return
false
;
ret
=
moveClip
(
uuid
,
trackId
,
newPos
)
;
c
->
pos
=
newPos
;
emit
clipResized
(
uuid
.
toString
()
);
return
ret
;
}
...
...
@@ -161,9 +161,8 @@ SequenceWorkflow::removeClip( const QUuid& uuid )
auto
c
=
it
.
value
();
auto
clip
=
c
->
clip
;
auto
trackId
=
c
->
trackId
;
auto
position
=
c
->
pos
;
auto
t
=
track
(
trackId
,
c
->
isAudio
);
t
->
remove
(
t
->
clipIndexAt
(
position
)
);
t
->
remove
Clip
(
uuid
);
m_clips
.
erase
(
it
);
clip
->
disconnect
(
this
);
bool
onTimeline
=
false
;
...
...
@@ -328,14 +327,14 @@ SequenceWorkflow::trackInput( quint32 trackId )
return
m_multiTracks
[
trackId
].
get
();
}
std
::
shared_ptr
<
Backend
::
I
Track
>
QSharedPointer
<
Track
>
SequenceWorkflow
::
track
(
quint32
trackId
,
bool
isAudio
)
{
if
(
trackId
>=
(
quint32
)
m_trackCount
)
return
nullptr
;
if
(
trackId
>=
m_trackCount
)
return
{}
;
if
(
isAudio
==
true
)
return
m_tracks
[
Workflow
::
AudioTrack
][
trackId
];
return
m_tracks
[
Workflow
::
VideoTrack
][
trackId
];
return
m_tracks
[
Workflow
::
AudioTrack
][
static_cast
<
int
>
(
trackId
)
];
return
m_tracks
[
Workflow
::
VideoTrack
][
static_cast
<
int
>
(
trackId
)
];
}
SequenceWorkflow
::
ClipInstance
::
ClipInstance
(
QSharedPointer
<::
Clip
>
c
,
const
QUuid
&
uuid
,
quint32
tId
,
qint64
p
,
bool
isAudio
)
...
...
src/Workflow/SequenceWorkflow.h
View file @
1b9b2e13
...
...
@@ -32,6 +32,8 @@
#include "Media/Clip.h"
#include "Types.h"
class
Track
;
namespace
Backend
{
class
IMultiTrack
;
...
...
@@ -113,12 +115,12 @@ class SequenceWorkflow : public QObject
private:
inline
std
::
shared_ptr
<
Backend
::
ITrack
>
track
(
quint32
trackId
,
bool
audio
);
inline
QSharedPointer
<
Track
>
track
(
quint32
trackId
,
bool
audio
);
QMap
<
QUuid
,
QSharedPointer
<
ClipInstance
>>
m_clips
;
Backend
::
IMultiTrack
*
m_multitrack
;
QList
<
std
::
shared_ptr
<
Backend
::
ITrack
>>
m_tracks
[
Workflow
::
NbTrackType
];
QList
<
QSharedPointer
<
Track
>>
m_tracks
[
Workflow
::
NbTrackType
];
QList
<
std
::
shared_ptr
<
Backend
::
IMultiTrack
>>
m_multiTracks
;
const
size_t
m_trackCount
;
...
...
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