Theora Playback Library  1.1.0
TheoraVideoManager.h
Go to the documentation of this file.
1 /************************************************************************************
2 This source file is part of the Theora Video Playback Library
3 For latest info, see http://libtheoraplayer.googlecode.com
4 *************************************************************************************
5 Copyright (c) 2008-2014 Kresimir Spes (kspes@cateia.com)
6 This program is free software; you can redistribute it and/or modify it under
7 the terms of the BSD license: http://opensource.org/licenses/BSD-3-Clause
8 *************************************************************************************/
9 
10 #ifndef _TheoraVideoManager_h
11 #define _TheoraVideoManager_h
12 
13 #include <vector>
14 #include <list>
15 #include <string>
16 #include "TheoraExport.h"
17 #include "TheoraVideoClip.h"
18 #ifdef _WIN32
19 #pragma warning( disable: 4251 ) // MSVC++
20 #endif
21 // forward class declarations
22 class TheoraWorkerThread;
23 class TheoraMutex;
24 class TheoraDataSource;
30 {
31 protected:
32  friend class TheoraWorkerThread;
33  typedef std::vector<TheoraVideoClip*> ClipList;
34  typedef std::vector<TheoraWorkerThread*> ThreadList;
35 
37  ThreadList mWorkerThreads;
39  ClipList mClips;
40 
42  std::list<TheoraVideoClip*> mWorkLog;
43 
45 
48 
49  void createWorkerThreads(int n);
50  void destroyWorkerThreads();
51 
52  float calcClipWorkTime(TheoraVideoClip* clip);
53 
57  TheoraVideoClip* requestWork(TheoraWorkerThread* caller);
58 public:
59  TheoraVideoManager(int num_worker_threads = 1);
60  virtual ~TheoraVideoManager();
61 
63  static TheoraVideoManager& getSingleton();
65  static TheoraVideoManager* getSingletonPtr();
66 
68  TheoraVideoClip* getVideoClipByName(std::string name);
69 
70  TheoraVideoClip* createVideoClip(std::string filename,TheoraOutputMode output_mode=TH_RGB,int numPrecachedOverride=0,bool usePower2Stride=0);
71  TheoraVideoClip* createVideoClip(TheoraDataSource* data_source,TheoraOutputMode output_mode=TH_RGB,int numPrecachedOverride=0,bool usePower2Stride=0);
72 
73  void update(float timeDelta);
74 
75  void destroyVideoClip(TheoraVideoClip* clip);
76 
77  void setAudioInterfaceFactory(TheoraAudioInterfaceFactory* factory);
78  TheoraAudioInterfaceFactory* getAudioInterfaceFactory();
79 
80  int getNumWorkerThreads();
81  void setNumWorkerThreads(int n);
82 
83  void setDefaultNumPrecachedFrames(int n) { mDefaultNumPrecachedFrames=n; }
84  int getDefaultNumPrecachedFrames() { return mDefaultNumPrecachedFrames; }
85 
87  void logMessage(std::string msg);
88 
95  static void setLogFunction(void (*fn)(std::string));
96 
98  std::string getVersionString();
104  void getVersion(int* a,int* b,int* c);
105 
107  std::vector<std::string> getSupportedDecoders();
108 };
109 #endif
110 
TheoraOutputMode
Definition: TheoraVideoClip.h:28
Definition: TheoraVideoManager.h:29
ClipList mClips
stores pointers to created video clips
Definition: TheoraVideoManager.h:39
Definition: TheoraAsync.h:18
Definition: TheoraAudioInterface.h:42
std::vector< TheoraVideoClip * > ClipList
Definition: TheoraVideoManager.h:33
int mDefaultNumPrecachedFrames
Definition: TheoraVideoManager.h:44
Definition: TheoraVideoClip.h:61
TheoraMutex * mWorkMutex
Definition: TheoraVideoManager.h:46
ThreadList mWorkerThreads
stores pointers to worker threads which are decoding video and audio
Definition: TheoraVideoManager.h:37
Definition: TheoraVideoClip.h:34
std::vector< TheoraWorkerThread * > ThreadList
Definition: TheoraVideoManager.h:34
std::list< TheoraVideoClip * > mWorkLog
stores pointer to clips that were docoded in the past in order to achieve fair scheduling ...
Definition: TheoraVideoManager.h:42
#define TheoraPlayerExport
Definition: TheoraExport.h:25
Definition: TheoraDataSource.h:23
int getDefaultNumPrecachedFrames()
Definition: TheoraVideoManager.h:84
TheoraAudioInterfaceFactory * mAudioFactory
Definition: TheoraVideoManager.h:47
void setDefaultNumPrecachedFrames(int n)
Definition: TheoraVideoManager.h:83
Definition: TheoraWorkerThread.h:20