Gnash  0.8.11dev
MediaHandler.h
Go to the documentation of this file.
1 // MediaHandler.h: Base class for media handlers
2 //
3 // Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012
4 // Free Software Foundation, Inc.
5 //
6 // This program is free software; you can redistribute it and/or modify
7 // it under the terms of the GNU General Public License as published by
8 // the Free Software Foundation; either version 3 of the License, or
9 // (at your option) any later version.
10 //
11 // This program is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
15 //
16 // You should have received a copy of the GNU General Public License
17 // along with this program; if not, write to the Free Software
18 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 
20 
21 #ifndef GNASH_MEDIAHANDLER_H
22 #define GNASH_MEDIAHANDLER_H
23 
24 #include "dsodefs.h" // DSOEXPORT
25 #include "VideoConverter.h"
26 #include "GnashFactory.h"
27 
28 #include <vector>
29 #include <memory>
30 #include <string>
31 
32 // Forward declarations
33 namespace gnash {
34  class IOChannel;
35  namespace media {
36  class VideoDecoder;
37  class AudioDecoder;
38  class AudioInfo;
39  class VideoInfo;
40  class VideoInput;
41  class AudioInput;
42  class MediaHandler;
43  class MediaParser;
44  }
45 }
46 
47 namespace gnash {
48 
50 //
58 namespace media {
59 
61 {
63 };
64 
66 
69 {
70 public:
71 
72  virtual ~MediaHandler() {}
73 
75  virtual std::string description() const = 0;
76 
78  //
87  virtual std::auto_ptr<MediaParser>
88  createMediaParser(std::auto_ptr<IOChannel> stream);
89 
91  //
96  virtual std::auto_ptr<VideoDecoder>
97  createVideoDecoder(const VideoInfo& info)=0;
98 
100  //
105  virtual std::auto_ptr<AudioDecoder>
106  createAudioDecoder(const AudioInfo& info)=0;
107 
109  //
115  virtual std::auto_ptr<VideoConverter>
116  createVideoConverter(ImgBuf::Type4CC srcFormat,
117  ImgBuf::Type4CC dstFormat)=0;
118 
120  //
123  //
127  virtual VideoInput* getVideoInput(size_t index) = 0;
128 
129  virtual AudioInput* getAudioInput(size_t index) = 0;
130 
132  //
134  virtual void cameraNames(std::vector<std::string>& names) const = 0;
135 
137  //
140  virtual size_t getInputPaddingSize() const { return 0; }
141 
142 protected:
143 
145  //
148 
150  //
162  std::auto_ptr<AudioDecoder> createFlashAudioDecoder(const AudioInfo& info);
163 
165  //
167  bool isFLV(IOChannel& stream);
168 
169 };
170 
171 
172 } // gnash.media namespace
173 } // namespace gnash
174 
175 #endif