Miam-Player  0.8.0
A nice music player
FrameReader.h
Go to the documentation of this file.
1 /******************************************************************************
2  QtAV: Multimedia framework based on Qt and FFmpeg
3  Copyright (C) 2012-2016 Wang Bin <wbsecg1@gmail.com>
4 
5 * This file is part of QtAV (from 2016)
6 
7  This library is free software; you can redistribute it and/or
8  modify it under the terms of the GNU Lesser General Public
9  License as published by the Free Software Foundation; either
10  version 2.1 of the License, or (at your option) any later version.
11 
12  This library is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  Lesser General Public License for more details.
16 
17  You should have received a copy of the GNU Lesser General Public
18  License along with this library; if not, write to the Free Software
19  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 ******************************************************************************/
21 #ifndef QTAV_FRAMEREADER_H
22 #define QTAV_FRAMEREADER_H
23 
24 #include <QtCore/QObject>
25 #include <QtAV/VideoFrame.h>
26 
27 namespace QtAV {
45 class Q_AV_EXPORT FrameReader : public QObject
46 {
47  Q_OBJECT
48 public:
49  // TODO: load and get info
50  // TODO: asnyc option
51  explicit FrameReader(QObject *parent = 0);
52  ~FrameReader();
53  void setMedia(const QString& url);
54  QString mediaUrl() const;
55  void setVideoDecoders(const QStringList& names);
56  QStringList videoDecoders() const;
57  VideoFrame getVideoFrame();
58  bool hasVideoFrame() const;
59  bool hasEnoughVideoFrames() const;
60  // return false if eof
61  bool readMore();
62  // TODO: tryLoad on seek even at eof
63  // TODO: compress seek requests
64  bool seek(qint64 pos);
65 
66 Q_SIGNALS:
67  void frameRead(const QtAV::VideoFrame& frame);
68  void readEnd();
69  void seekFinished(qint64 pos);
70 
71  // internal
72  void readMoreRequested();
73  void seekRequested(qint64);
74 
75 private Q_SLOTS:
76  void readMoreInternal();
77  bool seekInternal(qint64 value);
78 
79 private:
80  class Private;
81  QScopedPointer<Private> d;
82 };
83 } //namespace QtAV
84 #endif // QTAV_FRAMEREADER_H
#define Q_AV_EXPORT
Definition: QtAV_Global.h:40
Definition: VideoFrame.h:32
AudioOutput ao; ao.setAudioFormat(fmt); ao.open(); while (has_data) { data = read_data(ao->bufferSize...
Definition: AudioDecoder.h:31
The FrameReader class while (reader->readMore()) { while (reader->hasVideoFrame()) { //or hasEnoughVi...
Definition: FrameReader.h:45