From Javier Taibo, "I have found that since version 1.1, FFMPEG changed the way audio streams are retrieved, from packed to planar format. SDL interprets packed audio, as is used in the osgmovie example. To make the audio work when the OSGffmpeg plug-in is compiled against recent FFMPEG versions, FFmpegDecoderAudio must check for planar formats and in these cases request the samples as packed. This way all works as before. It can be checked with osgmovie example application.
$ osgmovie --audio movie.avi.ffmpeg FFmpegImageStream::open audio failed, audio stream will be disabled: unknown audio format With the attached FFmpegDecoderAudio.cpp, audio sounds correctly. I am also attaching a modified version of FindFFmpeg.cmake that allows to set as FFMPEG_DIR the ffmpeg compiled in the source directory structure. It should not break anything as it only adds some additional search paths. " git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14654 16af8721-9629-0410-8352-f15c8da7e697
This commit is contained in:
@@ -8,6 +8,7 @@
|
||||
|
||||
#include <memory>
|
||||
|
||||
#define STREAM_TIMEOUT_IN_SECONDS_TO_CONSIDER_IT_DEAD 10
|
||||
|
||||
|
||||
namespace osgFFmpeg {
|
||||
@@ -17,7 +18,8 @@ namespace osgFFmpeg {
|
||||
FFmpegImageStream::FFmpegImageStream() :
|
||||
m_decoder(0),
|
||||
m_commands(0),
|
||||
m_frame_published_flag(false)
|
||||
m_frame_published_flag(false),
|
||||
_lastUpdateTS(0.)
|
||||
{
|
||||
setOrigin(osg::Image::TOP_LEFT);
|
||||
|
||||
@@ -219,6 +221,14 @@ void FFmpegImageStream::run()
|
||||
}
|
||||
else
|
||||
done = ! handleCommand(cmd);
|
||||
|
||||
// Security check to detect (and stop) dead streams
|
||||
if ( _lastUpdateTS > 0. &&
|
||||
osg::Timer::instance()->delta_s(_lastUpdateTS, osg::Timer::instance()->tick()) > STREAM_TIMEOUT_IN_SECONDS_TO_CONSIDER_IT_DEAD )
|
||||
{
|
||||
_status = INVALID;
|
||||
done = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -238,6 +248,8 @@ void FFmpegImageStream::run()
|
||||
}
|
||||
|
||||
OSG_NOTICE<<"Finished FFmpegImageStream::run()"<<std::endl;
|
||||
|
||||
// _status = INVALID;
|
||||
}
|
||||
|
||||
|
||||
@@ -337,6 +349,9 @@ void FFmpegImageStream::publishNewFrame(const FFmpegDecoderVideo &, void * user_
|
||||
this_->dirty();
|
||||
#endif
|
||||
|
||||
// Store the timestamp of this update. Needed to check dead streams
|
||||
this_->_lastUpdateTS = osg::Timer::instance()->tick();
|
||||
|
||||
OpenThreads::ScopedLock<Mutex> lock(this_->m_mutex);
|
||||
|
||||
if (! this_->m_frame_published_flag)
|
||||
|
||||
Reference in New Issue
Block a user