Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Open sidebar
VideoLAN
VLMC
Commits
59d07523
Commit
59d07523
authored
Mar 17, 2010
by
Hugo Beauzee-Luyssen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Workflow: Making frame rendering synchrone
IE wait for a frame to be ready when calling getOutput
parent
d6d55f59
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
9 deletions
+24
-9
src/Workflow/ClipWorkflow.cpp
src/Workflow/ClipWorkflow.cpp
+4
-2
src/Workflow/ClipWorkflow.h
src/Workflow/ClipWorkflow.h
+3
-2
src/Workflow/VideoClipWorkflow.cpp
src/Workflow/VideoClipWorkflow.cpp
+17
-5
No files found.
src/Workflow/ClipWorkflow.cpp
View file @
59d07523
...
@@ -45,16 +45,18 @@ ClipWorkflow::ClipWorkflow( Clip::Clip* clip ) :
...
@@ -45,16 +45,18 @@ ClipWorkflow::ClipWorkflow( Clip::Clip* clip ) :
m_renderLock
=
new
QMutex
;
m_renderLock
=
new
QMutex
;
m_availableBuffersMutex
=
new
QMutex
;
m_availableBuffersMutex
=
new
QMutex
;
m_computedBuffersMutex
=
new
QMutex
;
m_computedBuffersMutex
=
new
QMutex
;
m_renderWaitCond
=
new
WaitCondition
;
}
}
ClipWorkflow
::~
ClipWorkflow
()
ClipWorkflow
::~
ClipWorkflow
()
{
{
delete
m_renderWaitCond
;
delete
m_computedBuffersMutex
;
delete
m_availableBuffersMutex
;
delete
m_renderLock
;
delete
m_renderLock
;
delete
m_pausingStateWaitCond
;
delete
m_pausingStateWaitCond
;
delete
m_initWaitCond
;
delete
m_initWaitCond
;
delete
m_stateLock
;
delete
m_stateLock
;
delete
m_availableBuffersMutex
;
delete
m_computedBuffersMutex
;
}
}
void
ClipWorkflow
::
initialize
()
void
ClipWorkflow
::
initialize
()
...
...
src/Workflow/ClipWorkflow.h
View file @
59d07523
...
@@ -210,8 +210,8 @@ class ClipWorkflow : public QObject
...
@@ -210,8 +210,8 @@ class ClipWorkflow : public QObject
virtual
void
releasePrealocated
()
=
0
;
virtual
void
releasePrealocated
()
=
0
;
private:
private:
WaitCondition
*
m_initWaitCond
;
WaitCondition
*
m_initWaitCond
;
WaitCondition
*
m_pausingStateWaitCond
;
WaitCondition
*
m_pausingStateWaitCond
;
/**
/**
* \brief Used by the trackworkflow to query a clipworkflow resync.
* \brief Used by the trackworkflow to query a clipworkflow resync.
*
*
...
@@ -243,6 +243,7 @@ class ClipWorkflow : public QObject
...
@@ -243,6 +243,7 @@ class ClipWorkflow : public QObject
qint64
m_pauseDuration
;
qint64
m_pauseDuration
;
bool
m_fullSpeedRender
;
bool
m_fullSpeedRender
;
int
debugType
;
int
debugType
;
WaitCondition
*
m_renderWaitCond
;
private
slots
:
private
slots
:
void
loadingComplete
();
void
loadingComplete
();
...
...
src/Workflow/VideoClipWorkflow.cpp
View file @
59d07523
...
@@ -20,12 +20,13 @@
...
@@ -20,12 +20,13 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
*****************************************************************************/
#include "VideoClipWorkflow.h"
#include "Clip.h"
#include "LightVideoFrame.h"
#include "MainWorkflow.h"
#include "MainWorkflow.h"
#include "StackedBuffer.hpp"
#include "StackedBuffer.hpp"
#include "LightVideoFrame.h"
#include "VideoClipWorkflow.h"
#include "Clip.h"
#include "VLCMedia.h"
#include "VLCMedia.h"
#include "WaitCondition.hpp"
#include <QReadWriteLock>
#include <QReadWriteLock>
...
@@ -113,10 +114,19 @@ VideoClipWorkflow::getOutput( ClipWorkflow::GetMode mode )
...
@@ -113,10 +114,19 @@ VideoClipWorkflow::getOutput( ClipWorkflow::GetMode mode )
QMutexLocker
lock
(
m_renderLock
);
QMutexLocker
lock
(
m_renderLock
);
QMutexLocker
lock2
(
m_computedBuffersMutex
);
QMutexLocker
lock2
(
m_computedBuffersMutex
);
if
(
preGetOutput
()
==
false
)
return
NULL
;
if
(
isEndReached
()
==
true
)
if
(
isEndReached
()
==
true
)
return
NULL
;
return
NULL
;
if
(
preGetOutput
()
==
false
)
{
QMutexLocker
waitLock
(
m_renderWaitCond
->
getMutex
()
);
m_computedBuffersMutex
->
unlock
();
m_renderLock
->
unlock
();
m_renderWaitCond
->
waitLocked
();
m_renderLock
->
lock
();
m_computedBuffersMutex
->
lock
();
}
::
StackedBuffer
<
LightVideoFrame
*>*
buff
;
::
StackedBuffer
<
LightVideoFrame
*>*
buff
;
if
(
mode
==
ClipWorkflow
::
Pop
)
if
(
mode
==
ClipWorkflow
::
Pop
)
buff
=
new
StackedBuffer
(
m_computedBuffers
.
dequeue
(),
this
,
true
);
buff
=
new
StackedBuffer
(
m_computedBuffers
.
dequeue
(),
this
,
true
);
...
@@ -161,6 +171,8 @@ VideoClipWorkflow::unlock( VideoClipWorkflow *cw, void *buffer, int width,
...
@@ -161,6 +171,8 @@ VideoClipWorkflow::unlock( VideoClipWorkflow *cw, void *buffer, int width,
cw
->
commonUnlock
();
cw
->
commonUnlock
();
cw
->
m_renderLock
->
unlock
();
cw
->
m_renderLock
->
unlock
();
cw
->
m_computedBuffersMutex
->
unlock
();
cw
->
m_computedBuffersMutex
->
unlock
();
QMutexLocker
lock
(
cw
->
m_renderWaitCond
->
getMutex
()
);
cw
->
m_renderWaitCond
->
wake
();
}
}
uint32_t
uint32_t
...
...
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