Gnash  0.8.10
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, 2012
00004 //   Free Software Foundation, Inc.
00005 // 
00006 // This program is free software; you can redistribute it and/or modify
00007 // it under the terms of the GNU General Public License as published by
00008 // the Free Software Foundation; either version 3 of the License, or
00009 // (at your option) any later version.
00010 // 
00011 // This program is distributed in the hope that it will be useful,
00012 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014 // GNU General Public License for more details.
00015 //
00016 // You should have received a copy of the GNU General Public License
00017 // along with this program; if not, write to the Free Software
00018 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
00019 
00020 
00021 #ifndef GNASH_MEDIAHANDLER_H
00022 #define GNASH_MEDIAHANDLER_H
00023 
00024 #include "MediaParser.h" // for videoCodecType and audioCodecType enums
00025 #include "dsodefs.h" // DSOEXPORT
00026 #include "VideoConverter.h"
00027 #include "GnashFactory.h"
00028 
00029 #include <vector>
00030 #include <memory>
00031 #include <map>
00032 #include <string>
00033 
00034 // Forward declarations
00035 namespace gnash {
00036     class IOChannel;
00037     namespace media {
00038         class VideoDecoder;
00039         class AudioDecoder;
00040         class AudioInfo;
00041         class VideoInfo;
00042         class VideoInput;
00043         class AudioInput;
00044         class MediaHandler;
00045     }
00046 }
00047 
00048 namespace gnash {
00049 
00051 //
00059 namespace media {
00060 
00061 struct DSOEXPORT RegisterAllHandlers
00062 {
00063     RegisterAllHandlers();
00064 };
00065 
00066 typedef GnashFactory<MediaHandler, RegisterAllHandlers> MediaFactory;
00067 
00069 class DSOEXPORT MediaHandler
00070 {
00071 public:
00072 
00073     virtual ~MediaHandler() {}
00074 
00076     virtual std::string description() const = 0;
00077 
00079     //
00088     virtual std::auto_ptr<MediaParser>
00089         createMediaParser(std::auto_ptr<IOChannel> stream);
00090 
00092     //
00097     virtual std::auto_ptr<VideoDecoder>
00098         createVideoDecoder(const VideoInfo& info)=0;
00099 
00101     //
00106     virtual std::auto_ptr<AudioDecoder>
00107         createAudioDecoder(const AudioInfo& info)=0;
00108 
00110     //
00116     virtual std::auto_ptr<VideoConverter>
00117         createVideoConverter(ImgBuf::Type4CC srcFormat,
00118                 ImgBuf::Type4CC dstFormat)=0;
00119 
00121     //
00124     //
00128     virtual VideoInput* getVideoInput(size_t index) = 0;
00129 
00130     virtual AudioInput* getAudioInput(size_t index) = 0;
00131 
00133     //
00135     virtual void cameraNames(std::vector<std::string>& names) const = 0;
00136 
00138     //
00141     virtual size_t getInputPaddingSize() const { return 0; }
00142 
00143 protected:
00144 
00146     //
00148     MediaHandler() {}
00149 
00151     //
00163     std::auto_ptr<AudioDecoder> createFlashAudioDecoder(const AudioInfo& info);
00164 
00166     //
00168     bool isFLV(IOChannel& stream);
00169 
00170 };
00171 
00172 
00173 } // gnash.media namespace 
00174 } // namespace gnash
00175 
00176 #endif