Added virtual pause() method into osg::AudioSink to support pausing of a movie thread and it's associated audio.

Updated osgmovie plugin to use the pause support.
This commit is contained in:
Robert Osfield
2010-01-07 14:35:17 +00:00
parent 47af634399
commit 5d9bf9f4d5
4 changed files with 82 additions and 34 deletions

View File

@@ -91,10 +91,15 @@ void FFmpegDecoderAudio::open(AVStream * const stream)
void FFmpegDecoderAudio::pause(bool pause)
{
if(pause)
m_paused = true;
else
m_paused = false;
if (pause != m_paused)
{
m_paused = pause;
if (m_audio_sink.valid())
{
if (m_paused) m_audio_sink->pause();
else m_audio_sink->play();
}
}
}
void FFmpegDecoderAudio::close(bool waitForThreadToExit)
@@ -183,7 +188,7 @@ void FFmpegDecoderAudio::decodeLoop()
if (! skip_audio && ! m_audio_sink->playing())
{
m_clocks.audioSetDelay(m_audio_sink->getDelay());
m_audio_sink->startPlaying();
m_audio_sink->play();
}
else
{

View File

@@ -28,9 +28,29 @@ BEGIN_ABSTRACT_OBJECT_REFLECTOR(osg::AudioSink)
I_Constructor0(____AudioSink,
"",
"");
I_Method0(void, startPlaying,
I_Method0(const char *, libraryName,
Properties::VIRTUAL,
__C5_char_P1__libraryName,
"return the name of the object's library. ",
"Must be defined by derived classes. The OpenSceneGraph convention is that the namespace of a library is the same as the library name. ");
I_Method0(const char *, className,
Properties::VIRTUAL,
__C5_char_P1__className,
"return the name of the object's class type. ",
"Must be defined by derived classes. ");
I_Method0(void, play,
Properties::PURE_VIRTUAL,
__void__startPlaying,
__void__play,
"",
"");
I_Method0(void, pause,
Properties::PURE_VIRTUAL,
__void__pause,
"",
"");
I_Method0(void, stop,
Properties::PURE_VIRTUAL,
__void__stop,
"",
"");
I_Method0(bool, playing,
@@ -48,16 +68,6 @@ BEGIN_ABSTRACT_OBJECT_REFLECTOR(osg::AudioSink)
__void__setDelay__C5_double,
"",
"");
I_Method0(const char *, libraryName,
Properties::VIRTUAL,
__C5_char_P1__libraryName,
"return the name of the object's library. ",
"Must be defined by derived classes. The OpenSceneGraph convention is that the namespace of a library is the same as the library name. ");
I_Method0(const char *, className,
Properties::VIRTUAL,
__C5_char_P1__className,
"return the name of the object's class type. ",
"Must be defined by derived classes. ");
I_SimpleProperty(double, Delay,
__double__getDelay,
0);