Gnash  0.8.11dev
StreamingSound.h
Go to the documentation of this file.
1 // StreamingSound.h - instance of an embedded sound, for gnash
2 //
3 // Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
4 // Free Software Foundation, Inc
5 //
6 // This program is free software; you can redistribute it and/or modify
7 // it under the terms of the GNU General Public License as published by
8 // the Free Software Foundation; either version 3 of the License, or
9 // (at your option) any later version.
10 //
11 // This program is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
15 //
16 // You should have received a copy of the GNU General Public License
17 // along with this program; if not, write to the Free Software
18 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 
20 #ifndef SOUND_STREAMINGSOUND_H
21 #define SOUND_STREAMINGSOUND_H
22 
23 #include <memory>
24 #include <cassert>
25 #include <cstdint> // For C99 int types
26 
27 #include "LiveSound.h"
28 #include "StreamingSoundData.h"
29 #include "sound_handler.h"
30 
31 // Forward declarations
32 namespace gnash {
33  namespace sound {
34  class StreamingSoundData;
35  }
36  namespace media {
37  class MediaHandler;
38  }
39 }
40 
41 namespace gnash {
42 namespace sound {
43 
45 //
48 class StreamingSound : public LiveSound
49 {
50 public:
51 
53  //
60 
61  // See dox in sound_handler.h (InputStream)
62  virtual bool eof() const;
63 
65  //
67  ~StreamingSound();
68 
69  size_t currentBlock() const {
70  return _currentBlock;
71  }
72 
73 private:
74 
76  //
79  virtual bool moreData();
80 
82  virtual bool decodingCompleted() const {
83  return _positionInBlock == 0 &&
84  _currentBlock >= _soundDef.blockCount();
85  }
86 
88  //
90  void decodeNextBlock();
91 
92  // The current block of sound.
93  size_t _currentBlock;
94 
95  // The position within the current block.
96  size_t _positionInBlock;
97 
99  //
103  StreamingSoundData& _soundDef;
104 };
105 
106 
107 } // gnash.sound namespace
108 } // namespace gnash
109 
110 #endif
Instance of a defined sound (LiveSoundData)
Definition: LiveSound.h:46
Anonymous namespace for callbacks, local functions, event handlers etc.
Definition: dbus_ext.cpp:40
size_t currentBlock() const
Definition: StreamingSound.h:69
Definition of an embedded sound.
Definition: StreamingSoundData.h:47
The MediaHandler class acts as a factory to provide parser and decoders.
Definition: MediaHandler.h:69
unsigned long StreamBlockId
Identifier of a streaming sound block.
Definition: sound_handler.h:97
Instance of a defined sound (StreamingSoundData)
Definition: StreamingSound.h:48