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
6cd92916
Commit
6cd92916
authored
Jan 09, 2010
by
Hugo Beauzee-Luyssen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Audio does work !!!!
parent
3ede23cb
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
32 additions
and
17 deletions
+32
-17
src/LibVLCpp/VLCMediaPlayer.cpp
src/LibVLCpp/VLCMediaPlayer.cpp
+3
-3
src/Renderer/WorkflowRenderer.cpp
src/Renderer/WorkflowRenderer.cpp
+1
-1
src/Workflow/AudioClipWorkflow.cpp
src/Workflow/AudioClipWorkflow.cpp
+5
-1
src/Workflow/ClipWorkflow.cpp
src/Workflow/ClipWorkflow.cpp
+20
-12
src/Workflow/StackedBuffer.hpp
src/Workflow/StackedBuffer.hpp
+3
-0
No files found.
src/LibVLCpp/VLCMediaPlayer.cpp
View file @
6cd92916
...
...
@@ -85,15 +85,15 @@ void MediaPlayer::callbacks( const libvlc_event_t* ev
switch
(
event
->
type
)
{
case
libvlc_MediaPlayerPlaying
:
qDebug
()
<<
"Media player playing"
;
//
qDebug() << "Media player playing";
self
->
emit
playing
();
break
;
case
libvlc_MediaPlayerPaused
:
qDebug
()
<<
"Media player paused"
;
//
qDebug() << "Media player paused";
self
->
emit
paused
();
break
;
case
libvlc_MediaPlayerStopped
:
qDebug
()
<<
"Media player stopped"
;
//
qDebug() << "Media player stopped";
self
->
emit
stopped
();
break
;
case
libvlc_MediaPlayerEndReached
:
...
...
src/Renderer/WorkflowRenderer.cpp
View file @
6cd92916
...
...
@@ -167,7 +167,7 @@ int WorkflowRenderer::lockAudio( int64_t *pts, size_t *bufferSize, void **b
ptsDiff
=
m_pts
-
m_audioPts
;
}
m_audioPts
=
*
pts
=
m_audioPts
+
ptsDiff
;
qDebug
()
<<
"Audio pts"
<<
m_audioPts
<<
"diff"
<<
ptsDiff
;
qDebug
()
<<
"Audio pts"
<<
m_audioPts
<<
"debug id:"
<<
m_renderAudioSample
->
debugId
<<
"diff
:
"
<<
ptsDiff
;
//*pts = m_audioPts * 1000000.0f / m_rate;
//m_audioPts += nbSample * m_nbChannels;
return
0
;
...
...
src/Workflow/AudioClipWorkflow.cpp
View file @
6cd92916
...
...
@@ -140,13 +140,17 @@ void AudioClipWorkflow::unlock( AudioClipWorkflow* cw, uint8_t* pcm_buffe
cw
->
computePtsDiff
(
pts
);
AudioSample
*
as
=
cw
->
m_computedBuffers
.
last
();
// qWarning() << "Computing audio PTS: pts:" << pts << "m_currentPts:" << cw->m_currentPts << "m_previousPts:" << cw->m_previousPts << "for buffer#" << as->debugId;
if
(
as
->
buff
!=
NULL
)
{
as
->
nbSample
=
nb_samples
;
as
->
nbChannels
=
channels
;
as
->
ptsDiff
=
cw
->
m_currentPts
-
cw
->
m_previousPts
;
}
qWarning
()
<<
"::::Computing audio PTS: debugId:"
<<
as
->
debugId
<<
"ptsdiff:"
<<
as
->
ptsDiff
;
if
(
as
->
ptsDiff
>
100000
)
{
qWarning
()
<<
"Probably invalid pts diff."
;
}
cw
->
commonUnlock
();
cw
->
m_renderLock
->
unlock
();
cw
->
m_computedBuffersMutex
->
unlock
();
...
...
src/Workflow/ClipWorkflow.cpp
View file @
6cd92916
...
...
@@ -91,8 +91,8 @@ void ClipWorkflow::loadingComplete()
{
adjustBegin
();
disconnect
(
m_mediaPlayer
,
SIGNAL
(
playing
()
),
this
,
SLOT
(
loadingComplete
()
)
);
connect
(
m_mediaPlayer
,
SIGNAL
(
playing
()
),
this
,
SLOT
(
mediaPlayerUnpaused
()
)
);
connect
(
m_mediaPlayer
,
SIGNAL
(
paused
()
),
this
,
SLOT
(
mediaPlayerPaused
()
)
);
connect
(
m_mediaPlayer
,
SIGNAL
(
playing
()
),
this
,
SLOT
(
mediaPlayerUnpaused
()
)
,
Qt
::
DirectConnection
);
connect
(
m_mediaPlayer
,
SIGNAL
(
paused
()
),
this
,
SLOT
(
mediaPlayerPaused
()
)
,
Qt
::
DirectConnection
);
QMutexLocker
lock
(
m_initWaitCond
->
getMutex
()
);
setState
(
Rendering
);
m_initWaitCond
->
wake
();
...
...
@@ -150,6 +150,7 @@ void ClipWorkflow::stop()
void
ClipWorkflow
::
setTime
(
qint64
time
)
{
qDebug
()
<<
"setting clipworkflow time:"
<<
time
;
m_mediaPlayer
->
setTime
(
time
);
flushComputedBuffers
();
}
...
...
@@ -199,10 +200,12 @@ void ClipWorkflow::preGetOutput()
//Computed buffer mutex is already locked by underlying clipworkflow getoutput method
if
(
getNbComputedBuffers
()
==
0
)
{
qWarning
()
<<
"Waiting for buffer to be fed"
;
if
(
debugType
==
1
)
qWarning
()
<<
"Waiting for buffer to be fed"
;
m_renderLock
->
unlock
();
m_computedBuffersMutex
->
unlock
();
qDebug
()
<<
"Unlocked render lock, entering cond wait"
;
if
(
debugType
==
1
)
qDebug
()
<<
"Unlocked render lock, entering cond wait"
;
m_feedingCondWait
->
waitLocked
();
m_computedBuffersMutex
->
lock
();
m_renderLock
->
lock
();
...
...
@@ -212,19 +215,18 @@ void ClipWorkflow::preGetOutput()
void
ClipWorkflow
::
postGetOutput
()
{
//If we're running out of computed buffers, refill our stack.
if
(
debugType
==
1
)
qDebug
()
<<
"AudioClipWorkflow::postGetOutput"
;
if
(
getNbComputedBuffers
()
<
getMaxComputedBuffers
()
/
3
)
{
QWriteLocker
lock
(
m_stateLock
);
if
(
m_state
==
ClipWorkflow
::
Paused
)
{
qWarning
()
<<
"Unpausing media player. type:"
<<
debugType
;
if
(
debugType
==
1
)
qWarning
()
<<
"Unpausing media player. type:"
<<
debugType
;
m_state
=
ClipWorkflow
::
UnpauseRequired
;
// This will act like an "unpause";
m_mediaPlayer
->
pause
();
}
else
else
if
(
debugType
==
1
)
qCritical
()
<<
"Running out of computed buffers !"
;
}
}
...
...
@@ -262,7 +264,8 @@ void ClipWorkflow::computePtsDiff( qint64 pts )
m_currentPts
=
pts
;
if
(
m_pauseDuration
!=
-
1
)
{
// qDebug() << "In pause mode";
if
(
debugType
==
1
)
qDebug
()
<<
"In pause mode"
;
m_previousPts
=
m_currentPts
+
m_pauseDuration
;
m_pauseDuration
=
-
1
;
}
...
...
@@ -282,15 +285,20 @@ void ClipWorkflow::computePtsDiff( qint64 pts )
void
ClipWorkflow
::
mediaPlayerPaused
()
{
qWarning
()
<<
"
\n\n
Media player paused, waiting for buffers to be consumed.Type:"
<<
debugType
<<
"
\n\n
"
;
if
(
debugType
==
1
)
qWarning
()
<<
"
\n\n
Media player paused, waiting for buffers to be consumed.Type:"
<<
debugType
;
setState
(
ClipWorkflow
::
Paused
);
m_beginPausePts
=
mdate
();
// qDebug() << "got pause pts:" << m_beginPausePts;
if
(
debugType
==
1
)
qDebug
()
<<
"got pause pts:"
<<
m_beginPausePts
;
}
void
ClipWorkflow
::
mediaPlayerUnpaused
()
{
qWarning
()
<<
"Media player unpaused. Go back to rendering. Type:"
<<
debugType
;
if
(
debugType
==
1
)
qWarning
()
<<
"Media player unpaused. Go back to rendering. Type:"
<<
debugType
;
setState
(
ClipWorkflow
::
Rendering
);
m_pauseDuration
=
mdate
()
-
m_beginPausePts
;
if
(
debugType
==
1
)
qDebug
()
<<
"pause duration:"
<<
m_pauseDuration
;
}
src/Workflow/StackedBuffer.hpp
View file @
6cd92916
...
...
@@ -35,6 +35,9 @@ class StackedBuffer
m_mustRelease
(
mustBeReleased
)
{
}
virtual
~
StackedBuffer
()
{
}
/// \warning Calling this method will definitely invalidate the pointer;
virtual
void
release
()
=
0
;
...
...
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