Sirikata
|
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_STREAM_HPP_ 00006 #define _SIRIKATA_SDLAUDIO_FFMPEG_STREAM_HPP_ 00007 00008 #include <sirikata/proxyobject/Platform.hpp> 00009 #include <sirikata/core/util/SelfWeakPtr.hpp> 00010 00011 extern "C" { 00012 struct AVFormatContext; 00013 } 00014 00015 namespace Sirikata { 00016 namespace SDL { 00017 00018 class FFmpegURLProtocol; 00019 00020 class FFmpegStream; 00021 typedef std::tr1::shared_ptr<FFmpegStream> FFmpegStreamPtr; 00022 00023 class FFmpegAudioStream; 00024 typedef std::tr1::shared_ptr<FFmpegAudioStream> FFmpegAudioStreamPtr; 00025 00030 class FFmpegStream : public SelfWeakPtr<FFmpegStream> { 00031 public: 00035 FFmpegStream(FFmpegURLProtocol* raw); 00036 ~FFmpegStream(); 00037 00038 uint32 numAudioStreams(); 00039 FFmpegAudioStreamPtr getAudioStream(uint32 idx, uint8 nchannels); 00040 00041 // Reloads the stream to start parsing from the beginning. 00042 void reload(); 00043 private: 00044 00045 // Helpers for cleanup/init used by both constructor/destructor and reload(). 00046 void initDecode(); 00047 void cleanupDecode(); 00048 00049 friend class FFmpegAudioStream; 00050 00051 FFmpegURLProtocol* mData; 00052 AVFormatContext* mFormatCtx; 00053 }; 00054 00055 00056 } // namespace SDL 00057 } // namespace Sirikata 00058 00059 #endif //_SIRIKATA_SDLAUDIO_FFMPEG_STREAM_HPP_