QtGStreamer  1.2.0
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Pages
message.h
1 /*
2  Copyright (C) 2009-2010 George Kiagiadakis <kiagiadakis.george@gmail.com>
3 
4  This library is free software; you can redistribute it and/or modify
5  it under the terms of the GNU Lesser General Public License as published
6  by the Free Software Foundation; either version 2.1 of the License, or
7  (at your option) any later version.
8 
9  This program is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  GNU Lesser General Public License for more details.
13 
14  You should have received a copy of the GNU Lesser General Public License
15  along with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17 #ifndef QGST_MESSAGE_H
18 #define QGST_MESSAGE_H
19 
20 #include "clocktime.h"
21 #include "miniobject.h"
22 #include "structure.h"
23 #include "taglist.h"
24 
25 namespace QGst {
26 
48 class QTGSTREAMER_EXPORT Message : public MiniObject
49 {
50  QGST_WRAPPER(Message)
51 public:
52  ObjectPtr source() const;
53  quint64 timestamp() const;
54  QString typeName() const;
55  MessageType type() const;
56 
57  StructureConstPtr internalStructure();
58 
59  quint32 sequenceNumber() const;
60  void setSequenceNumber(quint32 num);
61 };
62 
66 class QTGSTREAMER_EXPORT EosMessage : public Message
67 {
68  QGST_WRAPPER_FAKE_SUBCLASS(Eos, Message)
69 public:
70  static EosMessagePtr create(const ObjectPtr & source);
71 };
72 
76 class QTGSTREAMER_EXPORT ErrorMessage : public Message
77 {
78  QGST_WRAPPER_FAKE_SUBCLASS(Error, Message)
79 public:
80  static ErrorMessagePtr create(const ObjectPtr & source,
81  const QGlib::Error & error, const char *debug);
82 
83  QGlib::Error error() const;
84  QString debugMessage() const;
85 };
86 
90 class QTGSTREAMER_EXPORT WarningMessage : public Message
91 {
92  QGST_WRAPPER_FAKE_SUBCLASS(Warning, Message)
93 public:
94  static WarningMessagePtr create(const ObjectPtr & source,
95  const QGlib::Error & error, const char *debug);
96 
97  QGlib::Error error() const;
98  QString debugMessage() const;
99 };
100 
104 class QTGSTREAMER_EXPORT InfoMessage : public Message
105 {
106  QGST_WRAPPER_FAKE_SUBCLASS(Info, Message)
107 public:
108  static InfoMessagePtr create(const ObjectPtr & source,
109  const QGlib::Error & error, const char *debug);
110 
111  QGlib::Error error() const;
112  QString debugMessage() const;
113 };
114 
118 class QTGSTREAMER_EXPORT TagMessage : public Message
119 {
120  QGST_WRAPPER_FAKE_SUBCLASS(Tag, Message)
121 public:
122  static TagMessagePtr create(const ObjectPtr & source, const TagList & taglist);
123 
124  TagList taglist() const;
125 };
126 
130 class QTGSTREAMER_EXPORT BufferingMessage : public Message
131 {
132  QGST_WRAPPER_FAKE_SUBCLASS(Buffering, Message)
133 public:
134  static BufferingMessagePtr create(const ObjectPtr & source, int percent);
135 
136  int percent() const;
137  BufferingMode mode() const;
138  int averageInputRate() const;
139  int averageOutputRate() const;
140  qint64 bufferingTimeLeft() const;
141 
142  void setStats(BufferingMode mode, int avgIn, int avgOut, qint64 bufferingLeft);
143 };
144 
148 class QTGSTREAMER_EXPORT StateChangedMessage : public Message
149 {
150  QGST_WRAPPER_FAKE_SUBCLASS(StateChanged, Message)
151 public:
152  static StateChangedMessagePtr create(const ObjectPtr & source,
153  State oldState, State newState, State pending);
154 
155  State oldState() const;
156  State newState() const;
157  State pendingState() const;
158 };
159 
160 //won't do: STATE_DIRTY (deprecated)
161 
165 class QTGSTREAMER_EXPORT StepDoneMessage : public Message
166 {
167  QGST_WRAPPER_FAKE_SUBCLASS(StepDone, Message)
168 public:
169  static StepDoneMessagePtr create(const ObjectPtr & source, Format format, quint64 amount,
170  double rate, bool flush, bool intermediate, quint64 duration, bool eos);
171 
172  Format format() const;
173  quint64 amount() const;
174  double rate() const;
175  bool isFlushingStep() const;
176  bool isIntermediateStep() const;
177  quint64 duration() const;
178  bool causedEos() const;
179 };
180 
181 //TODO CLOCK_PROVIDE, CLOCK_LOST, NEW_CLOCK
182 //maybe do: STRUCTURE_CHANGE (internal)
183 
187 class QTGSTREAMER_EXPORT StreamStatusMessage : public Message
188 {
189  QGST_WRAPPER_FAKE_SUBCLASS(StreamStatus, Message)
190 public:
191  static StreamStatusMessagePtr create(const ObjectPtr & source,
192  StreamStatusType type, const ElementPtr & owner);
193 
194  StreamStatusType statusType() const;
195  ElementPtr owner() const;
196  QGlib::Value streamStatusObject() const;
197  void setStreamStatusObject(const QGlib::Value & object);
198 };
199 
203 class QTGSTREAMER_EXPORT ApplicationMessage : public Message
204 {
205  QGST_WRAPPER_FAKE_SUBCLASS(Application, Message)
206 public:
207  static ApplicationMessagePtr create(const ObjectPtr & source,
208  const Structure & structure = Structure());
209 };
210 
214 class QTGSTREAMER_EXPORT ElementMessage : public Message
215 {
216  QGST_WRAPPER_FAKE_SUBCLASS(Element, Message)
217 public:
218  static ElementMessagePtr create(const ObjectPtr & source,
219  const Structure & structure = Structure());
220 };
221 
222 //maybe do: SEGMENT_START (internal)
223 
227 class QTGSTREAMER_EXPORT SegmentDoneMessage : public Message
228 {
229  QGST_WRAPPER_FAKE_SUBCLASS(SegmentDone, Message)
230 public:
231  static SegmentDoneMessagePtr create(const ObjectPtr & source, Format format, qint64 position);
232 
233  Format format() const;
234  qint64 position() const;
235 };
236 
240 class QTGSTREAMER_EXPORT DurationChangedMessage : public Message
241 {
242  QGST_WRAPPER_FAKE_SUBCLASS(DurationChanged, Message)
243 public:
244  static DurationChangedMessagePtr create(const ObjectPtr & source);
245 
246 };
247 
251 class QTGSTREAMER_EXPORT LatencyMessage : public Message
252 {
253  QGST_WRAPPER_FAKE_SUBCLASS(Latency, Message)
254 public:
255  static LatencyMessagePtr create(const ObjectPtr & source);
256 };
257 
258 //maybe do: ASYNC_START (internal)
259 
263 class QTGSTREAMER_EXPORT AsyncDoneMessage : public Message
264 {
265  QGST_WRAPPER_FAKE_SUBCLASS(AsyncDone, Message)
266 public:
267  static AsyncDoneMessagePtr create(const ObjectPtr & source, ClockTime running_time);
268 
269  ClockTime runningTime() const;
270 };
271 
275 class QTGSTREAMER_EXPORT RequestStateMessage : public Message
276 {
277  QGST_WRAPPER_FAKE_SUBCLASS(RequestState, Message)
278 public:
279  static RequestStateMessagePtr create(const ObjectPtr & source, State state);
280 
281  State state() const;
282 };
283 
287 class QTGSTREAMER_EXPORT StepStartMessage : public Message
288 {
289  QGST_WRAPPER_FAKE_SUBCLASS(StepStart, Message)
290 public:
291  static StepStartMessagePtr create(const ObjectPtr & source, bool active, Format format,
292  quint64 amount, double rate, bool flush, bool intermediate);
293  bool isActive() const;
294  Format format() const;
295  quint64 amount() const;
296  double rate() const;
297  bool isFlushingStep() const;
298  bool isIntermediateStep() const;
299 };
300 
304 class QTGSTREAMER_EXPORT QosMessage : public Message
305 {
306  QGST_WRAPPER_FAKE_SUBCLASS(Qos, Message)
307 public:
308  static QosMessagePtr create(const ObjectPtr & source, bool live, quint64 runningTime,
309  quint64 streamTime, quint64 timestamp, quint64 duration);
310 
311  bool live() const;
312  quint64 runningTime() const;
313  quint64 streamTime() const;
314  quint64 timestamp() const;
315  quint64 duration() const;
316 
317  qint64 jitter() const;
318  double proportion() const;
319  int quality() const;
320  void setValues(qint64 jitter, double proportion, int quality);
321 
322  Format format() const;
323  quint64 processed() const;
324  quint64 dropped() const;
325  void setStats(Format format, quint64 processed, quint64 dropped);
326 };
327 
328 } //namespace QGst
329 
330 QGST_REGISTER_TYPE(QGst::Message)
331 QGST_REGISTER_SUBCLASS(Message, Eos)
332 QGST_REGISTER_SUBCLASS(Message, Error)
333 QGST_REGISTER_SUBCLASS(Message, Warning)
334 QGST_REGISTER_SUBCLASS(Message, Info)
335 QGST_REGISTER_SUBCLASS(Message, Tag)
336 QGST_REGISTER_SUBCLASS(Message, Buffering)
337 QGST_REGISTER_SUBCLASS(Message, StateChanged)
338 QGST_REGISTER_SUBCLASS(Message, StepDone)
339 QGST_REGISTER_SUBCLASS(Message, StreamStatus)
340 QGST_REGISTER_SUBCLASS(Message, Application)
341 QGST_REGISTER_SUBCLASS(Message, Element)
342 QGST_REGISTER_SUBCLASS(Message, SegmentDone)
343 QGST_REGISTER_SUBCLASS(Message, DurationChanged)
344 QGST_REGISTER_SUBCLASS(Message, Latency)
345 QGST_REGISTER_SUBCLASS(Message, AsyncDone)
346 QGST_REGISTER_SUBCLASS(Message, RequestState)
347 QGST_REGISTER_SUBCLASS(Message, StepStart)
348 QGST_REGISTER_SUBCLASS(Message, Qos)
349 
350 #endif
Wrapper class for messages of type QGst::MessageSegmentDone.
Definition: message.h:227
Wrapper class for messages of type QGst::MessageLatency.
Definition: message.h:251
Wrapper class for GstMiniObject.
Definition: miniobject.h:29
Wrapper class for messages of type QGst::MessageDuration.
Definition: message.h:240
Smart pointer class for working with wrapper classes that support reference counting.
Definition: global.h:56
Wrapper class for messages of type QGst::MessageBuffering.
Definition: message.h:130
Wrapper class for GValue.
Definition: value.h:74
Wrapper for GstStructure.
Definition: structure.h:49
A datatype to hold a time, measured in nanoseconds.
Definition: clocktime.h:37
Wrapper class for messages of type QGst::MessageStepDone.
Definition: message.h:165
Wrapper class for messages of type QGst::MessageApplication.
Definition: message.h:203
Wrapper class for GstTagList.
Definition: taglist.h:70
Wrapper class for messages of type QGst::MessageStreamStatus.
Definition: message.h:187
Wrapper class for GstMessage.
Definition: message.h:48
Wrapper class for messages of type QGst::MessageStateChanged.
Definition: message.h:148
Wrapper class for messages of type QGst::MessageQos.
Definition: message.h:304
Wrapper class for GstElement.
Definition: element.h:33
Wrapper class for messages of type QGst::MessageAsyncDone.
Definition: message.h:263
Wrapper class for messages of type QGst::MessageWarning.
Definition: message.h:90
Wrapper class for messages of type QGst::MessageRequestState.
Definition: message.h:275
Wrapper class for messages of type QGst::MessageTag.
Definition: message.h:118
Wrapper class for messages of type QGst::MessageError.
Definition: message.h:76
Wrapper class for messages of type QGst::MessageStepStart.
Definition: message.h:287
Wrapper class for messages of type QGst::MessageEos.
Definition: message.h:66
Wrapper class for messages of type QGst::MessageElement.
Definition: message.h:214
Wrapper class for messages of type QGst::MessageInfo.
Definition: message.h:104
Wrapper class for GError.
Definition: error.h:30