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 "MediaParser.h" // for videoCodecType and audioCodecType enums
25 #include "dsodefs.h" // DSOEXPORT
26 #include "VideoConverter.h"
27 #include "GnashFactory.h"
28 
29 #include <vector>
30 #include <memory>
31 #include <map>
32 #include <string>
33 
34 // Forward declarations
35 namespace gnash {
36  class IOChannel;
37  namespace media {
38  class VideoDecoder;
39  class AudioDecoder;
40  class AudioInfo;
41  class VideoInfo;
42  class VideoInput;
43  class AudioInput;
44  class MediaHandler;
45  }
46 }
47 
48 namespace gnash {
49 
51 //
59 namespace media {
60 
62 {
64 };
65 
67 
70 {
71 public:
72 
73  virtual ~MediaHandler() {}
74 
76  virtual std::string description() const = 0;
77 
79  //
88  virtual std::auto_ptr<MediaParser>
89  createMediaParser(std::auto_ptr<IOChannel> stream);
90 
92  //
97  virtual std::auto_ptr<VideoDecoder>
98  createVideoDecoder(const VideoInfo& info)=0;
99 
101  //
106  virtual std::auto_ptr<AudioDecoder>
107  createAudioDecoder(const AudioInfo& info)=0;
108 
110  //
116  virtual std::auto_ptr<VideoConverter>
117  createVideoConverter(ImgBuf::Type4CC srcFormat,
118  ImgBuf::Type4CC dstFormat)=0;
119 
121  //
124  //
128  virtual VideoInput* getVideoInput(size_t index) = 0;
129 
130  virtual AudioInput* getAudioInput(size_t index) = 0;
131 
133  //
135  virtual void cameraNames(std::vector<std::string>& names) const = 0;
136 
138  //
141  virtual size_t getInputPaddingSize() const { return 0; }
142 
143 protected:
144 
146  //
149 
151  //
163  std::auto_ptr<AudioDecoder> createFlashAudioDecoder(const AudioInfo& info);
164 
166  //
168  bool isFLV(IOChannel& stream);
169 
170 };
171 
172 
173 } // gnash.media namespace
174 } // namespace gnash
175 
176 #endif