Cleaned up the xine plugin to better handle unsupported video files.
This commit is contained in:
@@ -29,6 +29,15 @@ ifeq ($(OS),Darwin)
|
||||
LIBS += ${CARBON_LIB}
|
||||
endif
|
||||
|
||||
ifeq ($(DARWIN_QUICKTIME),yes)
|
||||
DEF+= -DDARWIN_QUICKTIME
|
||||
endif
|
||||
|
||||
ifeq ($(XINE_INSTALLED),yes)
|
||||
DEF+= -DUSE_XINE
|
||||
endif
|
||||
|
||||
|
||||
DEF += -DOSGDB_LIBRARY
|
||||
|
||||
TARGET_BASENAME = osgDB
|
||||
|
||||
@@ -174,16 +174,13 @@ Registry::Registry()
|
||||
addFileExtensionAlias("tif", "tiff");
|
||||
|
||||
// really need to decide this at runtime...
|
||||
#define USE_XINE
|
||||
#if defined(USE_XINE)
|
||||
addFileExtensionAlias("mov", "xine");
|
||||
addFileExtensionAlias("mpg", "xine");
|
||||
addFileExtensionAlias("mpv", "xine");
|
||||
addFileExtensionAlias("dv", "xine");
|
||||
addFileExtensionAlias("avi", "xine");
|
||||
#else
|
||||
addFileExtensionAlias("mpg", "mpeg");
|
||||
addFileExtensionAlias("mpv", "mpeg");
|
||||
addFileExtensionAlias("wmv", "xine");
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -1725,8 +1722,6 @@ void Registry::updateTimeStampOfObjectsInCacheWithExtenalReferences(double curre
|
||||
|
||||
void Registry::removeExpiredObjectsInCache(double expiryTime)
|
||||
{
|
||||
return;
|
||||
|
||||
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(_objectCacheMutex);
|
||||
|
||||
typedef std::vector<std::string> ObjectsToRemove;
|
||||
|
||||
@@ -41,7 +41,7 @@ bool Program_readLocalData(Object& obj, Input& fr)
|
||||
{
|
||||
int index;
|
||||
fr[1].getInt(index);
|
||||
program.bindAttribLocation(index,fr[2].getStr());
|
||||
program.bindAttribLocation(index,fr[2].getStr());
|
||||
fr += 3;
|
||||
iteratorAdvanced = true;
|
||||
}
|
||||
@@ -80,9 +80,9 @@ bool Program_writeLocalData(const Object& obj,Output& fw)
|
||||
}
|
||||
|
||||
fw.indent() << "num_shaders " << program.getNumShaders() << std::endl;
|
||||
for(unsigned int i=0;i<program.getNumShaders();++i)
|
||||
for(unsigned int ic=0;ic<program.getNumShaders();++ic)
|
||||
{
|
||||
fw.writeObject(*program.getShader(i));
|
||||
fw.writeObject(*program.getShader(ic));
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@@ -72,7 +72,12 @@ class XineImageStream : public osg::ImageStream
|
||||
xine_event_create_listener_thread(_event_queue, event_listener, this);
|
||||
|
||||
int result = xine_open(_stream, filename.c_str());
|
||||
osg::notify(osg::INFO)<<"XineImageStream::open - xine_open"<<result<<std::endl;
|
||||
|
||||
if (result==0)
|
||||
{
|
||||
osg::notify(osg::NOTICE)<<"Error: could not ready movie file."<<std::endl;
|
||||
close();
|
||||
}
|
||||
|
||||
_ready = false;
|
||||
|
||||
@@ -93,15 +98,23 @@ class XineImageStream : public osg::ImageStream
|
||||
else
|
||||
{
|
||||
osg::notify(osg::INFO)<<"XineImageStream::play()"<<std::endl;
|
||||
xine_play(_stream, 0, 0);
|
||||
while (!_ready)
|
||||
if (xine_play(_stream, 0, 0))
|
||||
{
|
||||
osg::notify(osg::INFO)<<" waiting..."<<std::endl;
|
||||
usleep(10000);
|
||||
while (!_ready)
|
||||
{
|
||||
osg::notify(osg::INFO)<<" waiting..."<<std::endl;
|
||||
usleep(10000);
|
||||
}
|
||||
|
||||
_status=PLAYING;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
osg::notify(osg::NOTICE)<<"Error!!!"<<std::endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
_status=PLAYING;
|
||||
}
|
||||
|
||||
virtual void pause()
|
||||
@@ -155,7 +168,7 @@ class XineImageStream : public osg::ImageStream
|
||||
|
||||
imageStream->dirty();
|
||||
#else
|
||||
imageStream->setImage(width,height,1,
|
||||
imageStream->setImage(width,height,1,
|
||||
GL_RGB,
|
||||
pixelFormat,GL_UNSIGNED_BYTE,
|
||||
(unsigned char *)data,
|
||||
@@ -285,8 +298,11 @@ class ReaderWriterXine : public osgDB::ReaderWriter
|
||||
virtual bool acceptsExtension(const std::string& extension) const
|
||||
{
|
||||
return osgDB::equalCaseInsensitive(extension,"mpg") ||
|
||||
osgDB::equalCaseInsensitive(extension,"mpv") ||
|
||||
osgDB::equalCaseInsensitive(extension,"db") ||
|
||||
osgDB::equalCaseInsensitive(extension,"mov") ||
|
||||
osgDB::equalCaseInsensitive(extension,"avi") ||
|
||||
osgDB::equalCaseInsensitive(extension,"wmv") ||
|
||||
osgDB::equalCaseInsensitive(extension,"xine");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user