sipxmedialib  Version 3.3
StreamBufferDataSource.h
Go to the documentation of this file.
1 //
2 // Copyright (C) 2006 SIPez LLC.
3 // Licensed to SIPfoundry under a Contributor Agreement.
4 //
5 // Copyright (C) 2004-2006 SIPfoundry Inc.
6 // Licensed by SIPfoundry under the LGPL license.
7 //
8 // Copyright (C) 2004-2006 Pingtel Corp. All rights reserved.
9 // Licensed to SIPfoundry under a Contributor Agreement.
10 //
11 // $$
13 
14 #ifndef DISABLE_STREAM_PLAYER // [
15 
16 #ifndef _StreamBufferDataSource_h_
17 #define _StreamBufferDataSource_h_
18 
19 // SYSTEM INCLUDES
20 // APPLICATION INCLUDES
22 #include "mp/StreamDataSource.h"
23 #include "os/OsDefs.h"
24 #include "os/OsStatus.h"
25 
26 // DEFINES
27 // MACROS
28 #ifndef __min
29 #define __min(a,b) (((a) < (b)) ? (a) : (b))
30 #endif
31 
32 // EXTERNAL FUNCTIONS
33 // EXTERNAL VARIABLES
34 // CONSTANTS
35 // STRUCTS
36 // TYPEDEFS
37 // FORWARD DECLARATIONS
38 class UtlString;
39 
40 //:Defines a stream data source built ontop of a UtlString
42 {
43 /* //////////////////////////// PUBLIC //////////////////////////////////// */
44 public:
45 
46 /* ============================ CREATORS ================================== */
48 
49  StreamBufferDataSource(UtlString *pBuffer, int iFlags);
50  //:Default constructor
51 
52  virtual
54  //:Destructor
55 
57 
58 /* ============================ MANIPULATORS ============================== */
60 
61  virtual OsStatus open() ;
62  //:Opens the data source
63 
64  virtual OsStatus close() ;
65  //:Closes the data source
66 
67  virtual OsStatus destroyAndDelete() ;
68  //:Destroys and deletes the data source object
69 
70  virtual OsStatus read(char *szBuffer, int iLength, int& iLengthRead) ;
71  //:Reads iLength bytes of data from the data source and places the
72  //:data into the passed szBuffer buffer.
73  //
77 
78  virtual OsStatus peek(char* szBuffer, int iLength, int& iLengthRead) ;
79  //:Identical to read, except the stream pointer is not advanced.
80  //
84 
85  virtual OsStatus seek(unsigned int iLocation) ;
86  //:Moves the stream pointer to the an absolute location.
87  //
89 
91 
92 /* ============================ ACCESSORS ================================= */
94 
95 
96  virtual OsStatus getLength(int& iLength) ;
97  //:Gets the length of the stream (if available)
98 
99  virtual OsStatus getPosition(int& iPosition) ;
100  //:Gets the current position within the stream.
101 
102 
103  virtual OsStatus toString(UtlString& string) ;
104  //:Renders a string describing this data source.
105  // This is often used for debugging purposes.
106 
108 
109 /* ============================ INQUIRY =================================== */
111 
112 
113 
114 
116 
117 /* //////////////////////////// PROTECTED ///////////////////////////////// */
118 protected:
119 
121  //:Assignment operator (not supported)
122 
123  StreamBufferDataSource(const StreamBufferDataSource& rStreamBufferDataSource);
124  //:Copy constructor (not supported)
125 
126 
127 /* //////////////////////////// PRIVATE /////////////////////////////////// */
128 private:
129  UtlString* mpBuffer ; // buffer -- the data source
130  int miPosition ; // the current position within the data source
131 };
132 
133 /* ============================ INLINE METHODS ============================ */
134 
135 #endif // _StreamBufferDataSource_h_
136 
137 #endif // DISABLE_STREAM_PLAYER ]
StreamBufferDataSource(UtlString *pBuffer, int iFlags)
Definition: StreamBufferDataSource.cpp:27
An abstraction definition of a stream data source.
Definition: StreamDataSource.h:47
UtlString * mpBuffer
Definition: StreamBufferDataSource.h:129
virtual OsStatus getPosition(int &iPosition)
Gets the current position within the stream.
Definition: StreamBufferDataSource.cpp:171
virtual OsStatus destroyAndDelete()
Destroys and deletes the data source object.
Definition: StreamBufferDataSource.cpp:72
virtual OsStatus close()
Closes the data source.
Definition: StreamBufferDataSource.cpp:66
virtual OsStatus seek(unsigned int iLocation)
Definition: StreamBufferDataSource.cpp:135
virtual OsStatus read(char *szBuffer, int iLength, int &iLengthRead)
Definition: StreamBufferDataSource.cpp:85
virtual ~StreamBufferDataSource()
Definition: StreamBufferDataSource.cpp:36
virtual OsStatus open()
Opens the data source.
Definition: StreamBufferDataSource.cpp:48
virtual OsStatus peek(char *szBuffer, int iLength, int &iLengthRead)
Definition: StreamBufferDataSource.cpp:110
StreamBufferDataSource & operator=(const StreamBufferDataSource &rhs)
Definition: StreamBufferDataSource.cpp:205
virtual OsStatus getLength(int &iLength)
Gets the length of the stream (if available)
Definition: StreamBufferDataSource.cpp:156
virtual OsStatus toString(UtlString &string)
Renders a string describing this data source.
Definition: StreamBufferDataSource.cpp:186
int miPosition
Definition: StreamBufferDataSource.h:130
Definition: StreamBufferDataSource.h:41