Changeset 9865
- Timestamp:
- 03/05/09 11:57:54 (4 years ago)
- Location:
- OpenSceneGraph/trunk/src/osgPlugins/ffmpeg
- Files:
-
- 3 modified
-
FFmpegDecoder.cpp (modified) (2 diffs)
-
FFmpegHeaders.hpp (modified) (1 diff)
-
ReaderWriterFFmpeg.cpp (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
OpenSceneGraph/trunk/src/osgPlugins/ffmpeg/FFmpegDecoder.cpp
r9826 r9865 36 36 37 37 38 39 38 bool FFmpegDecoder::open(const std::string & filename) 40 39 { … … 44 43 AVFormatContext * p_format_context = 0; 45 44 46 if (av_open_input_file(&p_format_context, filename.c_str(), 0, 0, 0) != 0) 47 throw std::runtime_error("av_open_input_file() failed"); 48 45 if (filename.compare(0, 5, "/dev/")==0) 46 { 47 avdevice_register_all(); 48 49 osg::notify(osg::NOTICE)<<"Attempting to stream "<<filename<<std::endl; 50 51 AVFormatParameters formatParams; 52 memset(&formatParams, 0, sizeof(AVFormatParameters)); 53 AVInputFormat *iformat; 54 55 formatParams.channel = 0; 56 formatParams.standard = 0; 57 formatParams.width = 640; 58 formatParams.height = 480; 59 formatParams.time_base.num = 1; 60 formatParams.time_base.den = 50; 61 62 iformat = av_find_input_format("video4linux2"); 63 64 if (iformat) 65 { 66 osg::notify(osg::NOTICE)<<"Found input format"<<std::endl; 67 } 68 else 69 { 70 osg::notify(osg::NOTICE)<<"Failed to find input_format"<<std::endl; 71 } 72 73 if (av_open_input_file(&p_format_context, filename.c_str(), iformat, 0, &formatParams) != 0) 74 throw std::runtime_error("av_open_input_file() failed"); 75 } 76 else 77 { 78 if (av_open_input_file(&p_format_context, filename.c_str(), 0, 0, 0) !=0 ) 79 throw std::runtime_error("av_open_input_file() failed"); 80 } 81 49 82 m_format_context.reset(p_format_context); 50 83 -
OpenSceneGraph/trunk/src/osgPlugins/ffmpeg/FFmpegHeaders.hpp
r9854 r9865 10 10 #include <avcodec.h> 11 11 #include <avformat.h> 12 #include <avdevice.h> 12 13 13 14 #ifdef USE_SWSCALE -
OpenSceneGraph/trunk/src/osgPlugins/ffmpeg/ReaderWriterFFmpeg.cpp
r9854 r9865 41 41 virtual ReadResult readImage(const std::string & filename, const osgDB::ReaderWriter::Options * options) const 42 42 { 43 if (filename.compare(0, 5, "/dev/")==0) 44 { 45 return readImageStream(filename, options); 46 } 47 43 48 const std::string ext = osgDB::getLowerCaseFileExtension(filename); 44 45 49 if (! acceptsExtension(ext)) 46 50 return ReadResult::FILE_NOT_HANDLED; … … 53 57 return ReadResult::FILE_NOT_FOUND; 54 58 55 osg::notify(osg::INFO) << "ReaderWriterFFmpeg::readImage " << path << std::endl; 59 return readImageStream(filename, options); 60 } 61 62 ReadResult readImageStream(const std::string& filename, const osgDB::ReaderWriter::Options * options) const 63 { 64 osg::notify(osg::INFO) << "ReaderWriterFFmpeg::readImage " << filename << std::endl; 56 65 57 66 osg::ref_ptr<osgFFmpeg::FFmpegImageStream> image_stream(new osgFFmpeg::FFmpegImageStream); 58 67 59 if (! image_stream->open( path))68 if (! image_stream->open(filename)) 60 69 return ReadResult::FILE_NOT_HANDLED; 61 70
