- Timestamp:
- 03/21/12 18:36:20 (15 months ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
OpenSceneGraph/trunk/src/osgPlugins/xine/ReaderWriterXine.cpp
r12912 r13041 42 42 43 43 META_Object(osgXine,XineImageStream); 44 44 45 45 void setVolume(float volume) 46 46 { 47 47 _volume = osg::minimum(osg::maximum(volume,0.0f),1.0f); 48 if (_stream) 48 if (_stream) 49 49 { 50 50 xine_set_param(_stream, XINE_PARAM_AUDIO_VOLUME, static_cast<int>(_volume*100.0f)); … … 52 52 } 53 53 } 54 54 55 55 float getVolume() const 56 56 { … … 61 61 { 62 62 if (filename==getFileName()) return true; 63 63 64 64 _xine = xine; 65 65 66 66 // create visual 67 67 rgbout_visual_info_t* visual = new rgbout_visual_info_t; … … 83 83 return false; 84 84 } 85 85 86 86 87 87 // set up stream 88 88 _stream = xine_stream_new(_xine, _ao, _vo); 89 89 90 90 if (_stream) 91 91 { … … 104 104 105 105 int result = xine_open(_stream, filename.c_str()); 106 106 107 107 if (result==0) 108 108 { … … 111 111 return false; 112 112 } 113 114 113 114 115 115 _ready = false; 116 116 117 117 int width = xine_get_stream_info(_stream,XINE_STREAM_INFO_VIDEO_WIDTH); 118 118 int height = xine_get_stream_info(_stream,XINE_STREAM_INFO_VIDEO_HEIGHT); … … 122 122 123 123 // play(); 124 124 125 125 return true; 126 126 … … 163 163 164 164 _status=PAUSED; 165 165 166 166 if (_stream) 167 167 { … … 233 233 { 234 234 OSG_INFO<<" Closing stream"<<std::endl; 235 235 236 236 xine_close(_stream); 237 237 … … 252 252 OSG_INFO<<" Closing audio driver"<<std::endl; 253 253 254 xine_close_audio_driver(_xine, _ao); 255 254 xine_close_audio_driver(_xine, _ao); 255 256 256 _ao = 0; 257 257 } 258 258 259 259 if (_vo) 260 260 { 261 261 OSG_INFO<<" Closing video driver"<<std::endl; 262 262 263 xine_close_video_driver(_xine, _vo); 264 263 xine_close_video_driver(_xine, _vo); 264 265 265 _vo = 0; 266 266 } … … 306 306 supportsExtension("wmv",""); 307 307 supportsExtension("xine","Xine plugin Pseduo plugin"); 308 308 309 309 _xine = xine_new(); 310 310 … … 317 317 318 318 xine_init(_xine); 319 319 320 320 register_rgbout_plugin(_xine); 321 321 } 322 322 323 323 virtual ~ReaderWriterXine() 324 324 { 325 325 OSG_INFO<<"~ReaderWriterXine()"<<std::endl; 326 326 327 327 if (_xine) xine_exit(_xine); 328 328 _xine = NULL; 329 329 } 330 330 331 331 virtual const char* className() const { return "Xine ImageStream Reader"; } 332 332 … … 335 335 std::string ext = osgDB::getLowerCaseFileExtension(file); 336 336 if (!acceptsExtension(ext)) return ReadResult::FILE_NOT_HANDLED; 337 337 338 338 std::string fileName; 339 339 if (ext=="xine")
