2.8 branch: This adds the new ffmpeh plugin, up to a point. Further changes look messy, but will try to merge them. Revisions merged in this commit: 9816-9818, 9826-9827, 9837-9843, 9847, 9850, 9854, 9856-9857, 9860-9861, 9865, 9869, and 9885.

This commit is contained in:
Paul MARTZ
2010-03-17 17:41:14 +00:00
parent cfa9c3682f
commit bdcba7220c
30 changed files with 3299 additions and 4 deletions

View File

@@ -1,7 +1,9 @@
#this file is automatically generated
# INCLUDE_DIRECTORIES( ${OPENAL_INCLUDE_DIR} )
SET(TARGET_SRC osgmovie.cpp )
SET(TARGET_ADDED_LIBRARIES osgGA )
# SET(TARGET_EXTERNAL_LIBRARIES ${OPENAL_LIBRARY} alut)
#### end var setup ###
SETUP_EXAMPLE(osgmovie)

View File

@@ -320,6 +320,30 @@ osg::Geometry* myCreateTexturedQuadGeometry(const osg::Vec3& pos,float width,flo
}
}
class CustomAudioSink : public osg::AudioSink
{
public:
CustomAudioSink(osg::AudioStream* audioStream):
_playing(false),
_audioStream(audioStream) {}
virtual void startPlaying()
{
_playing = true;
osg::notify(osg::NOTICE)<<"CustomAudioSink()::startPlaying()"<<std::endl;
osg::notify(osg::NOTICE)<<" audioFrequency()="<<_audioStream->audioFrequency()<<std::endl;
osg::notify(osg::NOTICE)<<" audioNbChannels()="<<_audioStream->audioNbChannels()<<std::endl;
osg::notify(osg::NOTICE)<<" audioSampleFormat()="<<_audioStream->audioSampleFormat()<<std::endl;
}
virtual bool playing() const { return _playing; }
bool _playing;
osg::observer_ptr<osg::AudioStream> _audioStream;
};
int main(int argc, char** argv)
{
// use an ArgumentParser object to manage the program arguments.
@@ -425,6 +449,9 @@ int main(int argc, char** argv)
osg::Vec3 bottomright = pos;
bool xyPlane = fullscreen;
bool useOpenALAudio = false;
while(arguments.read("--OpenAL")) { useOpenALAudio = true; }
for(int i=1;i<arguments.argc();++i)
{
@@ -432,7 +459,19 @@ int main(int argc, char** argv)
{
osg::Image* image = osgDB::readImageFile(arguments[i]);
osg::ImageStream* imagestream = dynamic_cast<osg::ImageStream*>(image);
if (imagestream) imagestream->play();
if (imagestream)
{
osg::ImageStream::AudioStreams& audioStreams = imagestream->getAudioStreams();
if (useOpenALAudio && !audioStreams.empty())
{
osg::AudioStream* audioStream = audioStreams[0].get();
osg::notify(osg::NOTICE)<<"AudioStream read ["<<audioStream->getName()<<"]"<<std::endl;
audioStream->setAudioSink(new CustomAudioSink(audioStream));
}
imagestream->play();
}
if (image)
{