QtGStreamer  1.2.0
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Pages
applicationsource.h
1 /*
2  Copyright (C) 2011 Collabora Ltd. <info@collabora.co.uk>
3  @author George Kiagiadakis <george.kiagiadakis@collabora.co.uk>
4 
5  This library is free software; you can redistribute it and/or modify
6  it under the terms of the GNU Lesser General Public License as published
7  by the Free Software Foundation; either version 2.1 of the License, or
8  (at your option) any later version.
9 
10  This program is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU Lesser General Public License for more details.
14 
15  You should have received a copy of the GNU Lesser General Public License
16  along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18 #ifndef QGST_UTILS_APPLICATIONSOURCE_H
19 #define QGST_UTILS_APPLICATIONSOURCE_H
20 
21 #include "global.h"
22 #include "../element.h"
23 #include "../buffer.h"
24 
25 namespace QGst {
26 namespace Utils {
27 
89 class QTGSTREAMERUTILS_EXPORT ApplicationSource
90 {
91 public:
93  virtual ~ApplicationSource();
94 
96  ElementPtr element() const;
97 
99  void setElement(const ElementPtr & appsrc);
100 
101 
103  CapsPtr caps() const;
104 
109  void setCaps(const CapsPtr & caps);
110 
111 
113  quint64 minLatency() const;
114 
116  quint64 maxLatency() const;
117 
120  void setLatency(quint64 min, quint64 max);
121 
122 
125  qint64 size() const;
126 
129  void setSize(qint64 size);
130 
131 
133  AppStreamType streamType() const;
134 
137  void setStreamType(AppStreamType type);
138 
139 
141  quint64 maxBytes() const;
142 
146  void setMaxBytes(quint64 max);
147 
148 
151  bool blockEnabled() const;
152 
155  void enableBlock(bool enable);
156 
157 
159  bool isLive() const;
160 
162  void setLive(bool islive);
163 
164 
167  uint minPercent() const;
168 
171  void setMinPercent(uint min);
172 
173 
174  Format format() const;
175  void setFormat(Format f);
176 
177 
185  FlowReturn pushBuffer(const BufferPtr & buffer);
186 
193  FlowReturn endOfStream();
194 
195 protected:
199  virtual void needData(uint length);
200 
204  virtual void enoughData();
205 
209  virtual bool seekData(quint64 offset);
210 
211 private:
212  /* vtable padding */
213  virtual void reservedVirtual1() {}
214  virtual void reservedVirtual2() {}
215  virtual void reservedVirtual3() {}
216  virtual void reservedVirtual4() {}
217 
218 private:
219  struct Priv;
220  friend struct Priv;
221  Priv *const d;
222  Q_DISABLE_COPY(ApplicationSource)
223 };
224 
225 } //namespace Utils
226 } //namespace QGst
227 
228 #endif // QGST_UTILS_APPLICATIONSOURCE_H
Helper class for using a GstAppSrc.