svvitch
digital signage player
|
00001 #pragma once 00002 00003 #include "FFmpeg.h" 00004 00005 #include <Poco/Mutex.h> 00006 #include <Poco/Thread.h> 00007 #include <Poco/Runnable.h> 00008 #include "FFAudioDecoder.h" 00009 #include "FFVideoDecoder.h" 00010 00011 #include "Content.h" 00012 #include "FPSCounter.h" 00013 #include "MediaItem.h" 00014 #include "PerformanceTimer.h" 00015 #include "Renderer.h" 00016 00017 using std::string; 00018 using std::wstring; 00019 00020 00025 class FFMovieContent: public Content, Poco::Runnable 00026 { 00027 private: 00028 Poco::FastMutex _lock; 00029 Poco::FastMutex _openLock; 00030 Poco::FastMutex _frameLock; 00031 00032 Poco::Thread _thread; 00033 Poco::Runnable* _worker; 00034 00035 AVFormatContext* _ic; 00036 int _fps; 00037 int _video; 00038 int _audio; 00039 FFAudioDecoder* _audioDecoder; 00040 FFVideoDecoder* _videoDecoder; 00041 VideoFrame* _vf; 00042 VideoFrame* _prepareVF; 00043 00044 bool _starting; 00045 int _frameOddEven; 00046 bool _finished; 00047 bool _seeking; 00048 PerformanceTimer _playTimer; 00049 FPSCounter _fpsCounter; 00050 float _avgTime; 00051 00052 public: 00053 FFMovieContent(Renderer& renderer, int splitType); 00054 00055 virtual ‾FFMovieContent(); 00056 00057 00058 void initialize(); 00059 00061 bool open(const MediaItemPtr media, const int offset = 0); 00062 00063 void run(); 00064 00068 void play(); 00069 00070 void pause(); 00071 00075 void stop(); 00076 00088 const bool seek(const int64_t timestamp); 00089 00090 const bool finished(); 00091 00093 void close(); 00094 00095 virtual void process(const DWORD& frame); 00096 00097 virtual void draw(const DWORD& frame); 00098 00102 const Uint32 getFPS(); 00103 00107 const float getAvgTime() const; 00108 00112 const DWORD currentTime(); 00113 00117 const DWORD timeLeft(); 00118 }; 00119 00120 typedef FFMovieContent* FFMovieContentPtr;