Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Open sidebar
VideoLAN
VLMC
Commits
bac02b66
Commit
bac02b66
authored
Feb 06, 2010
by
Hugo Beauzee-Luyssen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Removing old and ugly flags from TrackWorkflow
parent
5e048989
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
40 additions
and
34 deletions
+40
-34
src/LibVLCpp/VLCInstance.h
src/LibVLCpp/VLCInstance.h
+3
-0
src/Workflow/ClipWorkflow.cpp
src/Workflow/ClipWorkflow.cpp
+17
-0
src/Workflow/ClipWorkflow.h
src/Workflow/ClipWorkflow.h
+16
-0
src/Workflow/TrackHandler.cpp
src/Workflow/TrackHandler.cpp
+0
-6
src/Workflow/TrackWorkflow.cpp
src/Workflow/TrackWorkflow.cpp
+4
-21
src/Workflow/TrackWorkflow.h
src/Workflow/TrackWorkflow.h
+0
-7
No files found.
src/LibVLCpp/VLCInstance.h
View file @
bac02b66
...
...
@@ -32,6 +32,9 @@ struct libvlc_instance_t;
namespace
LibVLCpp
{
/**
* \warning This class should be released after every other LibVLCpp classes.
*/
class
Instance
:
public
QObject
,
public
Internal
<
libvlc_instance_t
>
,
public
QSingleton
<
Instance
>
...
...
src/Workflow/ClipWorkflow.cpp
View file @
bac02b66
...
...
@@ -293,3 +293,20 @@ ClipWorkflow::unmute()
{
setState
(
Stopped
);
}
void
ClipWorkflow
::
requireResync
()
{
m_resyncRequired
=
1
;
}
bool
ClipWorkflow
::
isResyncRequired
()
{
if
(
m_resyncRequired
==
1
)
{
m_resyncRequired
=
0
;
return
true
;
}
return
false
;
}
src/Workflow/ClipWorkflow.h
View file @
bac02b66
...
...
@@ -174,6 +174,15 @@ class ClipWorkflow : public QObject
void
mute
();
void
unmute
();
void
requireResync
();
/**
* \return true if a resync is required.
*
* If a resync is required, true will be returned, and the flag will be
* set back to false
*/
bool
isResyncRequired
();
private:
void
setState
(
State
state
);
void
adjustBegin
();
...
...
@@ -198,6 +207,13 @@ class ClipWorkflow : public QObject
private:
WaitCondition
*
m_initWaitCond
;
WaitCondition
*
m_pausingStateWaitCond
;
/**
* \brief Used by the trackworkflow to query a clipworkflow resync.
*
* Basically, this will be used when a clip is moved, and therefore has to be
* updated.
*/
QAtomicInt
m_resyncRequired
;
protected:
LibVLCpp
::
MediaPlayer
*
m_mediaPlayer
;
...
...
src/Workflow/TrackHandler.cpp
View file @
bac02b66
...
...
@@ -200,14 +200,8 @@ TrackHandler::moveClip(const QUuid &clipUuid, unsigned int oldTrack,
}
else
{
bool
needRepo
;
if
(
m_tracks
[
oldTrack
]
->
getClipPosition
(
clipUuid
)
!=
startingFrame
)
needRepo
=
true
;
ClipWorkflow
*
cw
=
m_tracks
[
oldTrack
]
->
removeClipWorkflow
(
clipUuid
);
m_tracks
[
newTrack
]
->
addClip
(
cw
,
startingFrame
);
if
(
needRepo
==
true
)
m_tracks
[
newTrack
]
->
forceRepositionning
();
activateTrack
(
oldTrack
);
activateTrack
(
newTrack
);
}
...
...
src/Workflow/TrackWorkflow.cpp
View file @
bac02b66
...
...
@@ -36,13 +36,11 @@
TrackWorkflow
::
TrackWorkflow
(
unsigned
int
trackId
,
MainWorkflow
::
TrackType
type
)
:
m_trackId
(
trackId
),
m_length
(
0
),
m_forceRepositionning
(
false
),
m_trackType
(
type
),
m_lastFrame
(
0
),
m_videoStackedBuffer
(
NULL
),
m_audioStackedBuffer
(
NULL
)
{
m_forceRepositionningMutex
=
new
QMutex
;
m_renderOneFrameMutex
=
new
QMutex
;
m_clipsLock
=
new
QReadWriteLock
;
}
...
...
@@ -60,7 +58,6 @@ TrackWorkflow::~TrackWorkflow()
}
delete
m_clipsLock
;
delete
m_renderOneFrameMutex
;
delete
m_forceRepositionningMutex
;
}
void
TrackWorkflow
::
addClip
(
Clip
*
clip
,
qint64
start
)
...
...
@@ -146,10 +143,9 @@ TrackWorkflow::renderClip( ClipWorkflow* cw, qint64 currentFrame,
cw
->
getState
()
==
ClipWorkflow
::
UnpauseRequired
)
{
cw
->
getStateLock
()
->
unlock
();
if
(
needRepositioning
==
true
)
{
if
(
cw
->
isResyncRequired
()
==
true
||
needRepositioning
==
true
)
adjustClipTime
(
currentFrame
,
start
,
cw
);
}
return
cw
->
getOutput
(
mode
);
}
else
if
(
cw
->
getState
()
==
ClipWorkflow
::
Stopped
)
...
...
@@ -273,19 +269,13 @@ TrackWorkflow::getOutput( qint64 currentFrame, qint64 subFrame, bool paused )
}
}
{
QMutexLocker
lock2
(
m_forceRepositionningMutex
);
if
(
m_forceRepositionning
==
true
)
{
needRepositioning
=
true
;
m_forceRepositionning
=
false
;
}
// This is a bit hackish : when we want to pop a frame in renderOneFrame mode,
// we also set the position to avoid the stream to be missynchronized.
// this frame setting will most likely toggle the next condition as true
// If this condition is true, the clipworkflow will flush all its buffer
// as we need to resynchronize after a setTime, so this condition has to remain
// false. Easy ain't it ?
else
if
(
paused
==
true
&&
subFrame
!=
m_lastFrame
&&
renderOneFrame
==
false
)
if
(
paused
==
true
&&
subFrame
!=
m_lastFrame
&&
renderOneFrame
==
false
)
needRepositioning
=
true
;
else
needRepositioning
=
(
abs
(
subFrame
-
m_lastFrame
)
>
1
)
?
true
:
false
;
...
...
@@ -335,8 +325,7 @@ void TrackWorkflow::moveClip( const QUuid& id, qint64 startingFrame )
ClipWorkflow
*
cw
=
it
.
value
();
m_clips
.
erase
(
it
);
m_clips
[
startingFrame
]
=
cw
;
QMutexLocker
lock
(
m_forceRepositionningMutex
);
m_forceRepositionning
=
true
;
cw
->
requireResync
();
computeLength
();
return
;
}
...
...
@@ -470,12 +459,6 @@ void TrackWorkflow::adjustClipTime( qint64 currentFrame, qint64 start, ClipWo
cw
->
setTime
(
startFrame
);
}
void
TrackWorkflow
::
forceRepositionning
()
{
QMutexLocker
lock
(
m_forceRepositionningMutex
);
m_forceRepositionning
=
true
;
}
void
TrackWorkflow
::
renderOneFrame
()
{
...
...
src/Workflow/TrackWorkflow.h
View file @
bac02b66
...
...
@@ -76,7 +76,6 @@ class TrackWorkflow : public QObject
void
save
(
QDomDocument
&
doc
,
QDomElement
&
trackNode
)
const
;
void
clear
();
void
forceRepositionning
();
void
renderOneFrame
();
/**
...
...
@@ -115,12 +114,6 @@ class TrackWorkflow : public QObject
*/
qint64
m_length
;
/**
* \brief If a clip was moved, we may have to force repositionning.
* If this flag is set to true, we will force it anyway.
*/
bool
m_forceRepositionning
;
QMutex
*
m_forceRepositionningMutex
;
bool
m_renderOneFrame
;
QMutex
*
m_renderOneFrameMutex
;
...
...
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