Fixed handling of web cams

This commit is contained in:
Robert Osfield 2013-11-06 09:49:51 +00:00
parent 6f6c44446c
commit 2ebe81cb0e
2 changed files with 8 additions and 9 deletions

View File

@ -71,8 +71,6 @@ bool FFmpegDecoder::open(const std::string & filename, FFmpegParameters* paramet
#else #else
avdevice_register_all(); avdevice_register_all();
OSG_NOTICE<<"Attempting to stream "<<filename<<std::endl;
if (parameters) if (parameters)
{ {
av_dict_set(parameters->getOptions(), "video_size", "640x480", 0); av_dict_set(parameters->getOptions(), "video_size", "640x480", 0);
@ -84,11 +82,11 @@ bool FFmpegDecoder::open(const std::string & filename, FFmpegParameters* paramet
if (iformat) if (iformat)
{ {
OSG_NOTICE<<"Found input format: "<<format<<std::endl; OSG_INFO<<"Found input format: "<<format<<std::endl;
} }
else else
{ {
OSG_NOTICE<<"Failed to find input format: "<<format<<std::endl; OSG_INFO<<"Failed to find input format: "<<format<<std::endl;
} }
#endif #endif

View File

@ -130,13 +130,14 @@ public:
const std::string ext = osgDB::getLowerCaseFileExtension(filename); const std::string ext = osgDB::getLowerCaseFileExtension(filename);
if (ext=="ffmpeg") return readImage(osgDB::getNameLessExtension(filename),options); if (ext=="ffmpeg") return readImage(osgDB::getNameLessExtension(filename),options);
if (filename.compare(0, 5, "/dev/")==0)
{
return readImageStream(filename, NULL);
}
osg::ref_ptr<osgFFmpeg::FFmpegParameters> parameters(new osgFFmpeg::FFmpegParameters); osg::ref_ptr<osgFFmpeg::FFmpegParameters> parameters(new osgFFmpeg::FFmpegParameters);
parseOptions(parameters.get(), options); parseOptions(parameters.get(), options);
if (filename.compare(0, 5, "/dev/")==0)
{
return readImageStream(filename, parameters.get());
}
if (parameters->isFormatAvailable()) if (parameters->isFormatAvailable())
{ {
return readImageStream(filename, parameters.get()); return readImageStream(filename, parameters.get());