QtGStreamer  1.2.0
discoverer.h
1 /*
2  Copyright (C) 2012 Openismus GmbH
3  @author Mathias Hasselmann <mathias@openismus.com>
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_DISCOVERER_H
19 #define QGST_DISCOVERER_H
20 
21 #include <QGst/ClockTime>
22 #include <QGst/Fraction>
23 #include <QGst/MiniObject>
24 #include <QGst/Object>
25 #include <QGst/Structure>
26 #include <QGst/TagList>
27 
28 #include <QtCore/QUrl>
29 
30 #include "global.h"
31 
32 namespace QGst {
33 
34 class QTGSTREAMER_EXPORT DiscovererStreamInfo : public QGlib::Object
35 {
36  QGST_WRAPPER(DiscovererStreamInfo)
37 
38 public:
39  DiscovererStreamInfoPtr previous() const;
40  DiscovererStreamInfoPtr next() const;
41  QString streamTypeNick() const;
42  CapsPtr caps() const;
43  TagList tags() const;
44  Structure misc() const;
45 };
46 
47 class QTGSTREAMER_EXPORT DiscovererContainerInfo : public DiscovererStreamInfo
48 {
49  QGST_WRAPPER(DiscovererContainerInfo)
50 
51 public:
52  QList<DiscovererStreamInfoPtr> streams() const;
53 };
54 
55 class QTGSTREAMER_EXPORT DiscovererAudioInfo : public DiscovererStreamInfo
56 {
57  QGST_WRAPPER(DiscovererAudioInfo)
58 
59 public:
60  uint channels() const;
61  uint sampleRate() const;
62  uint depth() const;
63  uint bitrate() const;
64  uint maxBitrate() const;
65  QString language() const;
66 };
67 
68 class QTGSTREAMER_EXPORT DiscovererVideoInfo : public DiscovererStreamInfo
69 {
70  QGST_WRAPPER(DiscovererVideoInfo)
71 
72 public:
73  uint width() const;
74  uint height() const;
75  uint depth() const;
76  Fraction framerate() const;
77  Fraction pixelAspectRatio() const;
78  uint bitrate() const;
79  uint maxBitrate() const;
80  bool isInterlaced() const;
81  bool isImage() const;
82 };
83 
84 class QTGSTREAMER_EXPORT DiscovererSubtitleInfo : public DiscovererStreamInfo
85 {
86  QGST_WRAPPER(DiscovererSubtitleInfo)
87 
88 public:
89  QString language() const;
90 };
91 
92 class QTGSTREAMER_EXPORT DiscovererInfo : public QGlib::Object
93 {
94  QGST_WRAPPER(DiscovererInfo)
95 
96 public:
97  QUrl uri() const;
98  DiscovererResult result() const;
99 
100  ClockTime duration() const;
101  bool seekable() const;
102  Structure misc() const;
103  TagList tags() const;
104 
105  DiscovererStreamInfoPtr streamInfo() const;
106  QList<DiscovererStreamInfoPtr> streams() const;
107  QList<DiscovererStreamInfoPtr> streams(QGlib::Type streamType) const;
108  QList<DiscovererStreamInfoPtr> audioStreams() const;
109  QList<DiscovererStreamInfoPtr> videoStreams() const;
110  QList<DiscovererStreamInfoPtr> subtitleStreams() const;
111  QList<DiscovererStreamInfoPtr> containerStreams() const;
112 };
113 
114 class QTGSTREAMER_EXPORT Discoverer : public QGlib::Object
115 {
116  QGST_WRAPPER(Discoverer)
117 
118 public:
122  static DiscovererPtr create(ClockTime timeout);
123 
130  void start();
131 
135  void stop();
136 
141  bool discoverUriAsync(const char *uri);
142 
144  inline bool discoverUriAsync(const QUrl &uri);
145 
150  DiscovererInfoPtr discoverUri(const char *uri);
151 
153  inline DiscovererInfoPtr discoverUri(const QUrl &uri);
154 };
155 
156 inline bool Discoverer::discoverUriAsync(const QUrl &uri)
157 {
158  return discoverUriAsync(uri.toEncoded().constData());
159 }
160 
161 inline DiscovererInfoPtr Discoverer::discoverUri(const QUrl &uri)
162 {
163  return discoverUri(uri.toEncoded().constData());
164 }
165 
166 QTGSTREAMER_EXPORT QDebug operator<<(QDebug debug, DiscovererResult result);
167 QTGSTREAMER_EXPORT QDebug operator<<(QDebug debug, const DiscovererStreamInfoPtr &info);
168 QTGSTREAMER_EXPORT QDebug operator<<(QDebug debug, const DiscovererInfoPtr &info);
169 
170 } // namespace QGst
171 
172 QGST_REGISTER_TYPE(QGst::DiscovererStreamInfo)
173 QGST_REGISTER_TYPE(QGst::DiscovererContainerInfo)
174 QGST_REGISTER_TYPE(QGst::DiscovererAudioInfo)
175 QGST_REGISTER_TYPE(QGst::DiscovererVideoInfo)
176 QGST_REGISTER_TYPE(QGst::DiscovererSubtitleInfo)
177 QGST_REGISTER_TYPE(QGst::DiscovererInfo)
178 QGST_REGISTER_TYPE(QGst::Discoverer)
179 
180 #endif // QGST_DISCOVERER_H
Wrapper class for GObject.
Definition: object.h:90
Wrapper class for GType.
Definition: type.h:64
Wrappers for GStreamer classes.