36 |
36 |
37 gint TMSMemBuffer::Create(guint size, TMSBuffer*& bodyimpl) |
37 gint TMSMemBuffer::Create(guint size, TMSBuffer*& bodyimpl) |
38 { |
38 { |
39 gint ret(TMS_RESULT_INSUFFICIENT_MEMORY); |
39 gint ret(TMS_RESULT_INSUFFICIENT_MEMORY); |
40 TRACE_PRN_FN_ENT; |
40 TRACE_PRN_FN_ENT; |
41 TMSMemBuffer* self = new TMSMemBuffer; |
41 TMSMemBuffer* self = new TMSMemBuffer(); |
42 if (self) |
42 if (self) |
43 { |
43 { |
44 ret = self->PostConstruct(size); |
44 ret = self->PostConstruct(size); |
45 if (ret != TMS_RESULT_SUCCESS) |
45 if (ret != TMS_RESULT_SUCCESS) |
46 { |
46 { |
55 |
55 |
56 gint TMSMemBuffer::Create(guint size, guint8* dataptr, TMSBuffer*& tmsbuffer) |
56 gint TMSMemBuffer::Create(guint size, guint8* dataptr, TMSBuffer*& tmsbuffer) |
57 { |
57 { |
58 gint ret(TMS_RESULT_INSUFFICIENT_MEMORY); |
58 gint ret(TMS_RESULT_INSUFFICIENT_MEMORY); |
59 TRACE_PRN_FN_ENT; |
59 TRACE_PRN_FN_ENT; |
60 TMSMemBuffer* self = new TMSMemBuffer; |
60 TMSMemBuffer* self = new TMSMemBuffer(); |
61 if (self) |
61 if (self) |
62 { |
62 { |
63 self->iDataPtr = dataptr; |
63 self->iDataPtr = dataptr; |
64 ret = TMS_RESULT_SUCCESS; |
64 ret = TMS_RESULT_SUCCESS; |
65 } |
65 } |
90 gint ret(TMS_RESULT_SUCCESS); |
90 gint ret(TMS_RESULT_SUCCESS); |
91 buffertype = TMS_BUFFER_MEMORY; |
91 buffertype = TMS_BUFFER_MEMORY; |
92 return ret; |
92 return ret; |
93 } |
93 } |
94 |
94 |
95 // Implementation of TMSBuffer interface begins |
|
96 /** |
95 /** |
97 Gets the timestamp on the Buffer so that the framework can |
96 * Gets the timestamp on the Buffer so that the framework can |
98 determine the time at which this buffer has to be rendered |
97 * determine the time at which this buffer has to be rendered |
99 by the output device sink. |
98 * by the output device sink. |
100 |
99 * |
101 @param ts |
100 * @param ts timestamp in microseconds |
102 timestamp in microseconds |
101 * |
103 |
|
104 */ |
102 */ |
105 gint TMSMemBuffer::GetTimeStamp(guint64& ts) |
103 gint TMSMemBuffer::GetTimeStamp(guint64& ts) |
106 { |
104 { |
107 gint ret(TMS_RESULT_SUCCESS); |
105 gint ret(TMS_RESULT_SUCCESS); |
108 ts = iTimeStamp; |
106 ts = iTimeStamp; |
109 return ret; |
107 return ret; |
110 } |
108 } |
111 |
109 |
112 /** |
110 /** |
113 Sets the timestamp on the Buffer so that the framework can |
111 * Sets the timestamp on the Buffer so that the framework can |
114 determine the time at which this buffer has to be rendered |
112 * determine the time at which this buffer has to be rendered |
115 by the output device sink. |
113 * by the output device sink. |
116 |
114 * |
117 @param ts |
115 * @param ts timestamp in milliseconds |
118 timestamp in milliseconds |
116 * |
119 |
|
120 */ |
117 */ |
121 gint TMSMemBuffer::SetTimeStamp(const guint64 ts) |
118 gint TMSMemBuffer::SetTimeStamp(const guint64 ts) |
122 { |
119 { |
123 gint ret(TMS_RESULT_SUCCESS); |
120 gint ret(TMS_RESULT_SUCCESS); |
124 iTimeStamp = ts; |
121 iTimeStamp = ts; |
125 return ret; |
122 return ret; |
126 } |
123 } |
127 |
124 |
128 /** |
125 /** |
129 Gets the size of data in the buffer specified by the client. |
126 * Gets the size of data in the buffer specified by the client. |
130 |
127 * |
131 @param size |
128 * @param size size of data in bytes |
132 size of data in bytes |
129 * |
133 |
|
134 */ |
130 */ |
135 gint TMSMemBuffer::GetDataSize(guint& size) |
131 gint TMSMemBuffer::GetDataSize(guint& size) |
136 { |
132 { |
137 gint ret(TMS_RESULT_SUCCESS); |
133 gint ret(TMS_RESULT_SUCCESS); |
138 size = iBufferSize; |
134 size = iBufferSize; |
139 return ret; |
135 return ret; |
140 } |
136 } |
141 |
137 |
142 /** |
138 /** |
143 Sets the size of data in the buffer after the client |
139 * Sets the size of data in the buffer after the client fill it. |
144 fill it. |
140 * |
145 |
141 * @param size size of data in bytes |
146 @param size |
142 * |
147 size of data in bytes |
|
148 |
|
149 */ |
143 */ |
150 gint TMSMemBuffer::SetDataSize(const guint size) |
144 gint TMSMemBuffer::SetDataSize(const guint size) |
151 { |
145 { |
152 gint ret(TMS_RESULT_SUCCESS); |
146 gint ret(TMS_RESULT_SUCCESS); |
153 iBufferSize = size; |
147 iBufferSize = size; //TODO: should realloc when new size > old size (?) |
154 return ret; |
148 return ret; |
155 } |
149 } |
156 |
150 |
157 /** |
151 /** |
158 Gets the pointer to the memory location associated with this |
152 * Gets the pointer to the memory location associated with this |
159 buffer where the data is stored. |
153 * buffer where the data is stored. |
160 |
154 * |
161 @param bufptr |
155 * @param bufptr ptr to the data stored in the buffer. |
162 ptr to the data stored in the buffer. |
156 * |
163 |
|
164 */ |
157 */ |
165 gint TMSMemBuffer::GetDataPtr(guint8*& bufptr) |
158 gint TMSMemBuffer::GetDataPtr(guint8*& bufptr) |
166 { |
159 { |
167 gint ret(TMS_RESULT_SUCCESS); |
160 gint ret(TMS_RESULT_SUCCESS); |
168 bufptr = iDataPtr; |
161 bufptr = iDataPtr; |