Gnash 0.8.9

MediaHandler.h

Go to the documentation of this file.
00001 // MediaHandler.h: Base class for media handlers
00002 // 
00003 //   Copyright (C) 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
00004 // 
00005 // This program is free software; you can redistribute it and/or modify
00006 // it under the terms of the GNU General Public License as published by
00007 // the Free Software Foundation; either version 3 of the License, or
00008 // (at your option) any later version.
00009 // 
00010 // This program is distributed in the hope that it will be useful,
00011 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00012 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013 // GNU General Public License for more details.
00014 //
00015 // You should have received a copy of the GNU General Public License
00016 // along with this program; if not, write to the Free Software
00017 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
00018 
00019 
00020 #ifndef GNASH_MEDIAHANDLER_H
00021 #define GNASH_MEDIAHANDLER_H
00022 
00023 #include "MediaParser.h" // for videoCodecType and audioCodecType enums
00024 #include "dsodefs.h" // DSOEXPORT
00025 #include "VideoConverter.h"
00026 #include "GnashFactory.h"
00027 
00028 #include <vector>
00029 #include <memory>
00030 #include <map>
00031 #include <string>
00032 
00033 // Forward declarations
00034 namespace gnash {
00035     class IOChannel;
00036     namespace media {
00037         class VideoDecoder;
00038         class AudioDecoder;
00039         class AudioInfo;
00040         class VideoInfo;
00041         class VideoInput;
00042         class AudioInput;
00043         class MediaHandler;
00044     }
00045 }
00046 
00047 namespace gnash {
00048 
00050 //
00058 namespace media {
00059 
00060 struct DSOEXPORT RegisterAllHandlers
00061 {
00062     RegisterAllHandlers();
00063 };
00064 
00065 typedef GnashFactory<MediaHandler, RegisterAllHandlers> MediaFactory;
00066 
00068 class DSOEXPORT MediaHandler
00069 {
00070 public:
00071 
00072     virtual ~MediaHandler() {}
00073 
00075     virtual std::string description() const = 0;
00076 
00078     //
00087     virtual std::auto_ptr<MediaParser>
00088         createMediaParser(std::auto_ptr<IOChannel> stream);
00089 
00091     //
00096     virtual std::auto_ptr<VideoDecoder>
00097         createVideoDecoder(const VideoInfo& info)=0;
00098 
00100     //
00105     virtual std::auto_ptr<AudioDecoder>
00106         createAudioDecoder(const AudioInfo& info)=0;
00107 
00109     //
00115     virtual std::auto_ptr<VideoConverter>
00116         createVideoConverter(ImgBuf::Type4CC srcFormat,
00117                 ImgBuf::Type4CC dstFormat)=0;
00118 
00120     //
00123     //
00127     virtual VideoInput* getVideoInput(size_t index) = 0;
00128 
00129     virtual AudioInput* getAudioInput(size_t index) = 0;
00130 
00132     //
00134     virtual void cameraNames(std::vector<std::string>& names) const = 0;
00135 
00137     //
00140     virtual size_t getInputPaddingSize() const { return 0; }
00141 
00142 protected:
00143 
00145     //
00147     MediaHandler() {}
00148 
00150     //
00162     std::auto_ptr<AudioDecoder> createFlashAudioDecoder(const AudioInfo& info);
00163 
00165     //
00167     bool isFLV(IOChannel& stream);
00168 
00169 };
00170 
00171 
00172 } // gnash.media namespace 
00173 } // namespace gnash
00174 
00175 #endif