Sirikata
liboh/plugins/sdlaudio/FFmpegMemoryProtocol.hpp
Go to the documentation of this file.
00001 // Copyright (c) 2011 Sirikata Authors. All rights reserved.
00002 // Use of this source code is governed by a BSD-style license that can
00003 // be found in the LICENSE file.
00004 
00005 #ifndef _SIRIKATA_SDLAUDIO_FFMPEG_MEMORY_PROTOCOL_HPP_
00006 #define _SIRIKATA_SDLAUDIO_FFMPEG_MEMORY_PROTOCOL_HPP_
00007 
00008 #include "FFmpegGlue.hpp"
00009 #include <sirikata/core/transfer/TransferData.hpp>
00010 
00011 namespace Sirikata {
00012 namespace SDL {
00013 
00015 class FFmpegMemoryProtocol : public FFmpegURLProtocol {
00016 public:
00017     FFmpegMemoryProtocol(String name, Transfer::DenseDataPtr data)
00018      : mName(name),
00019        mData(data),
00020        mPosition(0)
00021     {}
00022     virtual ~FFmpegMemoryProtocol() {}
00023 
00024 
00025     virtual String name() const;
00026     virtual size_t read(size_t size, uint8* data);
00027     virtual bool getPosition(int64* position_out);
00028     virtual bool setPosition(int64 position);
00029     virtual bool getSize(int64* size_out);
00030     virtual bool isStreaming();
00031 
00032 private:
00033     FFmpegMemoryProtocol(const FFmpegMemoryProtocol&);
00034     FFmpegMemoryProtocol& operator=(const FFmpegMemoryProtocol&);
00035 
00036     String mName;
00037     Transfer::DenseDataPtr mData;
00038     int64 mPosition;
00039 };
00040 
00041 
00042 } // namespace SDL
00043 } // namespace Sirikata
00044 
00045 #endif //_SIRIKATA_SDLAUDIO_FFMPEG_MEMORY_PROTOCOL_HPP_