Changeset 9869
- Timestamp:
- 03/08/09 17:48:48 (4 years ago)
- Location:
- OpenSceneGraph/trunk/src/osgPlugins/ffmpeg
- Files:
-
- 7 modified
-
FFmpegDecoder.cpp (modified) (2 diffs)
-
FFmpegDecoder.hpp (modified) (1 diff)
-
FFmpegDecoderAudio.cpp (modified) (3 diffs)
-
FFmpegDecoderAudio.hpp (modified) (1 diff)
-
FFmpegDecoderVideo.cpp (modified) (2 diffs)
-
FFmpegDecoderVideo.hpp (modified) (1 diff)
-
FFmpegImageStream.cpp (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
OpenSceneGraph/trunk/src/osgPlugins/ffmpeg/FFmpegDecoder.cpp
r9865 r9869 32 32 FFmpegDecoder::~FFmpegDecoder() 33 33 { 34 close( );34 close(true); 35 35 } 36 36 … … 124 124 125 125 126 void FFmpegDecoder::close( )126 void FFmpegDecoder::close(bool waitForThreadToExit) 127 127 { 128 128 flushAudioQueue(); 129 129 flushVideoQueue(); 130 131 m_audio_decoder.close(waitForThreadToExit); 132 m_video_decoder.close(waitForThreadToExit); 130 133 } 131 134 -
OpenSceneGraph/trunk/src/osgPlugins/ffmpeg/FFmpegDecoder.hpp
r9847 r9869 65 65 66 66 bool open(const std::string & filename); 67 void close( );67 void close(bool waitForThreadToExit); 68 68 69 69 bool readNextPacket(); -
OpenSceneGraph/trunk/src/osgPlugins/ffmpeg/FFmpegDecoderAudio.cpp
r9847 r9869 38 38 { 39 39 m_exit = true; 40 #if 0 41 while(isRunning()) { OpenThreads::YieldCurrentThread(); } 42 #else 40 43 join(); 44 #endif 41 45 } 42 46 } … … 86 90 87 91 92 void FFmpegDecoderAudio::close(bool waitForThreadToExit) 93 { 94 m_exit = true; 95 96 if (isRunning() && waitForThreadToExit) 97 { 98 while(isRunning()) { OpenThreads::Thread::YieldCurrentThread(); } 99 } 100 } 101 88 102 89 103 void FFmpegDecoderAudio::run() … … 104 118 } 105 119 } 106 107 120 108 121 -
OpenSceneGraph/trunk/src/osgPlugins/ffmpeg/FFmpegDecoderAudio.hpp
r9861 r9869 30 30 31 31 void open(AVStream * stream); 32 void close(bool waitForThreadToExit); 33 32 34 virtual void run(); 33 35 -
OpenSceneGraph/trunk/src/osgPlugins/ffmpeg/FFmpegDecoderVideo.cpp
r9861 r9869 35 35 osg::notify(osg::NOTICE)<<"Destructing FFmpegDecoderVideo..."<<std::endl; 36 36 37 37 38 if (isRunning()) 38 39 { 39 40 m_exit = true; 41 #if 0 42 while(isRunning()) { OpenThreads::YieldCurrentThread(); } 43 #else 40 44 join(); 45 #endif 41 46 } 42 47 … … 102 107 } 103 108 109 110 void FFmpegDecoderVideo::close(bool waitForThreadToExit) 111 { 112 m_exit = true; 113 114 if (isRunning() && waitForThreadToExit) 115 { 116 while(isRunning()) { OpenThreads::Thread::YieldCurrentThread(); } 117 } 118 } 104 119 105 120 -
OpenSceneGraph/trunk/src/osgPlugins/ffmpeg/FFmpegDecoderVideo.hpp
r9861 r9869 66 66 67 67 void open(AVStream * stream); 68 void close(bool waitForThreadToExit); 69 68 70 virtual void run(); 69 71 -
OpenSceneGraph/trunk/src/osgPlugins/ffmpeg/FFmpegImageStream.cpp
r9861 r9869 43 43 44 44 quit(true); 45 46 osg::notify(osg::NOTICE)<<"Have done quit"<<std::endl; 47 48 // release athe audio streams to make sure that the decoder doesn't retain any external 49 // refences. 50 getAudioStreams().clear(); 45 51 46 52 // destroy the decoder and associated threads … … 131 137 132 138 // Close the decoder (i.e. flush the decoder packet queues) 133 m_decoder->close( );139 m_decoder->close(waitForThreadToExit); 134 140 } 135 141 … … 198 204 osg::notify(osg::WARN) << "FFmpegImageStream::run : unhandled exception" << std::endl; 199 205 } 206 207 osg::notify(osg::NOTICE)<<"Finished FFmpegImageStream::run()"<<std::endl; 200 208 } 201 209
