20 #ifndef GNASH_NETSTREAM_H
21 #define GNASH_NETSTREAM_H
24 #ifndef __STDC_CONSTANT_MACROS
25 #define __STDC_CONSTANT_MACROS
28 #include <boost/intrusive_ptr.hpp>
30 #include <boost/ptr_container/ptr_deque.hpp>
31 #include <boost/scoped_ptr.hpp>
32 #include <boost/thread/mutex.hpp>
40 class InterruptableVirtualClock;
44 class NetConnection_as;
154 unsigned int fetch(boost::int16_t* samples,
unsigned int nSamples,
158 static unsigned int fetchWrapper(
void* owner, boost::int16_t* samples,
159 unsigned int nSamples,
bool& eof);
238 void seek(boost::uint32_t pos);
244 boost::int32_t
time();
304 std::auto_ptr<image::GnashImage>
get_video();
309 _invalidatedVideoCharacter = ch;
321 static unsigned int audio_streamer(
void *udata, boost::int16_t* samples,
322 unsigned int nSamples,
bool& eof);
364 typedef std::pair<std::string, std::string> NetStreamStatus;
371 void getStatusCodeInfo(StatusCode
code, NetStreamStatus& info);
374 as_object* getStatusObject(StatusCode
code);
380 void initVideoDecoder(
const media::VideoInfo& info);
386 void initAudioDecoder(
const media::AudioInfo& parser);
389 bool startPlayback();
398 void pausePlayback();
408 void unpausePlayback();
424 void refreshVideoFrame(
bool alsoIfPaused =
false);
428 void refreshAudioBuffer();
434 std::auto_ptr<image::GnashImage> decodeNextVideoFrame();
440 BufferedAudioStreamer::CursoredBuffer* decodeNextAudioFrame();
445 void pushDecodedAudioFrames(boost::uint32_t
ts);
457 std::auto_ptr<image::GnashImage> getDecodedVideoFrame(boost::uint32_t
ts);
459 DecodingState decodingStatus(DecodingState newstate = DEC_NONE);
464 void parseNextChunk();
484 void setStatus(StatusCode
code);
496 void processStatusNotifications();
499 void stopAdvanceTimer();
502 void startAdvanceTimer();
504 NetConnection_as* _netCon;
506 boost::scoped_ptr<CharacterProxy> _audioController;
509 boost::uint32_t _bufferTime;
512 boost::mutex image_mutex;
515 std::auto_ptr<image::GnashImage> _imageframe;
521 std::auto_ptr<media::MediaParser> _parser;
527 DisplayObject* _invalidatedVideoCharacter;
529 DecodingState _decoding_state;
533 boost::mutex _state_mutex;
536 std::auto_ptr<media::VideoDecoder> _videoDecoder;
539 bool _videoInfoKnown;
542 std::auto_ptr<media::AudioDecoder> _audioDecoder;
545 bool _audioInfoKnown;
548 boost::scoped_ptr<InterruptableVirtualClock> _playbackClock;
554 sound::sound_handler* _soundHandler;
557 media::MediaHandler* _mediaHandler;
564 std::auto_ptr<IOChannel> _inputStream;
567 BufferedAudioStreamer _audioStreamer;
570 StatusCode _statusCode;
573 boost::mutex _statusMutex;