QtGStreamer 0.10.1
|
00001 /* 00002 Copyright (C) 2009-2010 George Kiagiadakis <kiagiadakis.george@gmail.com> 00003 00004 This library is free software; you can redistribute it and/or modify 00005 it under the terms of the GNU Lesser General Public License as published 00006 by the Free Software Foundation; either version 2.1 of the License, or 00007 (at your option) any later version. 00008 00009 This program is distributed in the hope that it will be useful, 00010 but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 GNU General Public License for more details. 00013 00014 You should have received a copy of the GNU Lesser General Public License 00015 along with this program. If not, see <http://www.gnu.org/licenses/>. 00016 */ 00017 #ifndef QGST_MESSAGE_H 00018 #define QGST_MESSAGE_H 00019 00020 #include "miniobject.h" 00021 #include "structure.h" 00022 #include "taglist.h" 00023 00024 namespace QGst { 00025 00047 class QTGSTREAMER_EXPORT Message : public MiniObject 00048 { 00049 QGST_WRAPPER(Message) 00050 public: 00051 ObjectPtr source() const; 00052 quint64 timestamp() const; 00053 QString typeName() const; 00054 MessageType type() const; 00055 00056 StructurePtr internalStructure(); 00057 00058 quint32 sequenceNumber() const; 00059 void setSequenceNumber(quint32 num); 00060 }; 00061 00065 class QTGSTREAMER_EXPORT EosMessage : public Message 00066 { 00067 QGST_WRAPPER_FAKE_SUBCLASS(Eos, Message) 00068 public: 00069 static EosMessagePtr create(const ObjectPtr & source); 00070 }; 00071 00075 class QTGSTREAMER_EXPORT ErrorMessage : public Message 00076 { 00077 QGST_WRAPPER_FAKE_SUBCLASS(Error, Message) 00078 public: 00079 static ErrorMessagePtr create(const ObjectPtr & source, 00080 const QGlib::Error & error, const char *debug); 00081 00082 QGlib::Error error() const; 00083 QString debugMessage() const; 00084 }; 00085 00089 class QTGSTREAMER_EXPORT WarningMessage : public Message 00090 { 00091 QGST_WRAPPER_FAKE_SUBCLASS(Warning, Message) 00092 public: 00093 static WarningMessagePtr create(const ObjectPtr & source, 00094 const QGlib::Error & error, const char *debug); 00095 00096 QGlib::Error error() const; 00097 QString debugMessage() const; 00098 }; 00099 00103 class QTGSTREAMER_EXPORT InfoMessage : public Message 00104 { 00105 QGST_WRAPPER_FAKE_SUBCLASS(Info, Message) 00106 public: 00107 static InfoMessagePtr create(const ObjectPtr & source, 00108 const QGlib::Error & error, const char *debug); 00109 00110 QGlib::Error error() const; 00111 QString debugMessage() const; 00112 }; 00113 00117 class QTGSTREAMER_EXPORT TagMessage : public Message 00118 { 00119 QGST_WRAPPER_FAKE_SUBCLASS(Tag, Message) 00120 public: 00121 static TagMessagePtr create(const ObjectPtr & source, const TagList & taglist); 00122 00123 TagList taglist() const; 00124 }; 00125 00129 class QTGSTREAMER_EXPORT BufferingMessage : public Message 00130 { 00131 QGST_WRAPPER_FAKE_SUBCLASS(Buffering, Message) 00132 public: 00133 static BufferingMessagePtr create(const ObjectPtr & source, int percent); 00134 00135 int percent() const; 00136 BufferingMode mode() const; 00137 int averageInputRate() const; 00138 int averageOutputRate() const; 00139 qint64 bufferingTimeLeft() const; 00140 00141 void setStats(BufferingMode mode, int avgIn, int avgOut, qint64 bufferingLeft); 00142 }; 00143 00147 class QTGSTREAMER_EXPORT StateChangedMessage : public Message 00148 { 00149 QGST_WRAPPER_FAKE_SUBCLASS(StateChanged, Message) 00150 public: 00151 static StateChangedMessagePtr create(const ObjectPtr & source, 00152 State oldState, State newState, State pending); 00153 00154 State oldState() const; 00155 State newState() const; 00156 State pendingState() const; 00157 }; 00158 00159 //won't do: STATE_DIRTY (deprecated) 00160 00164 class QTGSTREAMER_EXPORT StepDoneMessage : public Message 00165 { 00166 QGST_WRAPPER_FAKE_SUBCLASS(StepDone, Message) 00167 public: 00168 static StepDoneMessagePtr create(const ObjectPtr & source, Format format, quint64 amount, 00169 double rate, bool flush, bool intermediate, quint64 duration, bool eos); 00170 00171 Format format() const; 00172 quint64 amount() const; 00173 double rate() const; 00174 bool isFlushingStep() const; 00175 bool isIntermediateStep() const; 00176 quint64 duration() const; 00177 bool causedEos() const; 00178 }; 00179 00180 //TODO CLOCK_PROVIDE, CLOCK_LOST, NEW_CLOCK 00181 //maybe do: STRUCTURE_CHANGE (internal) 00182 00186 class QTGSTREAMER_EXPORT StreamStatusMessage : public Message 00187 { 00188 QGST_WRAPPER_FAKE_SUBCLASS(StreamStatus, Message) 00189 public: 00190 static StreamStatusMessagePtr create(const ObjectPtr & source, 00191 StreamStatusType type, const ElementPtr & owner); 00192 00193 StreamStatusType statusType() const; 00194 ElementPtr owner() const; 00195 QGlib::Value streamStatusObject() const; 00196 void setStreamStatusObject(const QGlib::Value & object); 00197 }; 00198 00202 class QTGSTREAMER_EXPORT ApplicationMessage : public Message 00203 { 00204 QGST_WRAPPER_FAKE_SUBCLASS(Application, Message) 00205 public: 00206 static ApplicationMessagePtr create(const ObjectPtr & source, 00207 const Structure & structure = Structure()); 00208 }; 00209 00213 class QTGSTREAMER_EXPORT ElementMessage : public Message 00214 { 00215 QGST_WRAPPER_FAKE_SUBCLASS(Element, Message) 00216 public: 00217 static ElementMessagePtr create(const ObjectPtr & source, 00218 const Structure & structure = Structure()); 00219 }; 00220 00221 //maybe do: SEGMENT_START (internal) 00222 00226 class QTGSTREAMER_EXPORT SegmentDoneMessage : public Message 00227 { 00228 QGST_WRAPPER_FAKE_SUBCLASS(SegmentDone, Message) 00229 public: 00230 static SegmentDoneMessagePtr create(const ObjectPtr & source, Format format, qint64 position); 00231 00232 Format format() const; 00233 qint64 position() const; 00234 }; 00235 00239 class QTGSTREAMER_EXPORT DurationMessage : public Message 00240 { 00241 QGST_WRAPPER_FAKE_SUBCLASS(Duration, Message) 00242 public: 00243 static DurationMessagePtr create(const ObjectPtr & source, Format format, qint64 duration); 00244 00245 Format format() const; 00246 qint64 duration() const; 00247 }; 00248 00252 class QTGSTREAMER_EXPORT LatencyMessage : public Message 00253 { 00254 QGST_WRAPPER_FAKE_SUBCLASS(Latency, Message) 00255 public: 00256 static LatencyMessagePtr create(const ObjectPtr & source); 00257 }; 00258 00259 //maybe do: ASYNC_START (internal) 00260 00264 class QTGSTREAMER_EXPORT AsyncDoneMessage : public Message 00265 { 00266 QGST_WRAPPER_FAKE_SUBCLASS(AsyncDone, Message) 00267 public: 00268 static AsyncDoneMessagePtr create(const ObjectPtr & source); 00269 }; 00270 00274 class QTGSTREAMER_EXPORT RequestStateMessage : public Message 00275 { 00276 QGST_WRAPPER_FAKE_SUBCLASS(RequestState, Message) 00277 public: 00278 static RequestStateMessagePtr create(const ObjectPtr & source, State state); 00279 00280 State state() const; 00281 }; 00282 00286 class QTGSTREAMER_EXPORT StepStartMessage : public Message 00287 { 00288 QGST_WRAPPER_FAKE_SUBCLASS(StepStart, Message) 00289 public: 00290 static StepStartMessagePtr create(const ObjectPtr & source, bool active, Format format, 00291 quint64 amount, double rate, bool flush, bool intermediate); 00292 bool isActive() const; 00293 Format format() const; 00294 quint64 amount() const; 00295 double rate() const; 00296 bool isFlushingStep() const; 00297 bool isIntermediateStep() const; 00298 }; 00299 00303 class QTGSTREAMER_EXPORT QosMessage : public Message 00304 { 00305 QGST_WRAPPER_FAKE_SUBCLASS(Qos, Message) 00306 public: 00307 static QosMessagePtr create(const ObjectPtr & source, bool live, quint64 runningTime, 00308 quint64 streamTime, quint64 timestamp, quint64 duration); 00309 00310 bool live() const; 00311 quint64 runningTime() const; 00312 quint64 streamTime() const; 00313 quint64 timestamp() const; 00314 quint64 duration() const; 00315 00316 qint64 jitter() const; 00317 double proportion() const; 00318 int quality() const; 00319 void setValues(qint64 jitter, double proportion, int quality); 00320 00321 Format format() const; 00322 quint64 processed() const; 00323 quint64 dropped() const; 00324 void setStats(Format format, quint64 processed, quint64 dropped); 00325 }; 00326 00327 } //namespace QGst 00328 00329 QGST_REGISTER_TYPE(QGst::Message) 00330 QGST_REGISTER_SUBCLASS(Message, Eos) 00331 QGST_REGISTER_SUBCLASS(Message, Error) 00332 QGST_REGISTER_SUBCLASS(Message, Warning) 00333 QGST_REGISTER_SUBCLASS(Message, Info) 00334 QGST_REGISTER_SUBCLASS(Message, Tag) 00335 QGST_REGISTER_SUBCLASS(Message, Buffering) 00336 QGST_REGISTER_SUBCLASS(Message, StateChanged) 00337 QGST_REGISTER_SUBCLASS(Message, StepDone) 00338 QGST_REGISTER_SUBCLASS(Message, StreamStatus) 00339 QGST_REGISTER_SUBCLASS(Message, Application) 00340 QGST_REGISTER_SUBCLASS(Message, Element) 00341 QGST_REGISTER_SUBCLASS(Message, SegmentDone) 00342 QGST_REGISTER_SUBCLASS(Message, Duration) 00343 QGST_REGISTER_SUBCLASS(Message, Latency) 00344 QGST_REGISTER_SUBCLASS(Message, AsyncDone) 00345 QGST_REGISTER_SUBCLASS(Message, RequestState) 00346 QGST_REGISTER_SUBCLASS(Message, StepStart) 00347 QGST_REGISTER_SUBCLASS(Message, Qos) 00348 00349 #endif