Miam-Player  0.8.0
A nice music player
AVOutput.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
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 
22 #ifndef QAV_AVOUTPUT_H
23 #define QAV_AVOUTPUT_H
24 
25 #include <QtCore/QByteArray>
26 #include <QtAV/QtAV_Global.h>
27 
32 namespace QtAV {
33 
34 class AVDecoder;
35 class AVOutputPrivate;
36 class Filter;
37 class Statistics;
38 class OutputSet;
40 {
42 public:
43  AVOutput();
44  virtual ~AVOutput();
45  bool isAvailable() const;
46 
47  //void addSource(AVPlayer* player); //call player.addVideoRenderer(this)
48  //void removeSource(AVPlayer* player);
49  //Demuxer thread automatically paused because packets will be full
50  //only pause the renderering, the thread going on. If all outputs are paused, then pause the thread(OutputSet.tryPause)
51  //TODO: what about audio's pause api?
52  void pause(bool p); //processEvents when waiting?
53  bool isPaused() const;
54  QList<Filter*>& filters();
62  bool installFilter(Filter *filter, int index = 0x7fffffff);
63  bool uninstallFilter(Filter *filter);
64 protected:
66  /*
67  * If the pause state is true setted by pause(true), then block the thread and wait for pause state changed, i.e. pause(false)
68  * and return true. Otherwise, return false immediatly.
69  */
70  Q_DECL_DEPRECATED bool tryPause(); //move to OutputSet
71  //TODO: we need an active set
72  void addOutputSet(OutputSet *set);
73  void removeOutputSet(OutputSet *set);
74  void attach(OutputSet *set); //add this to set
75  void detach(OutputSet *set = 0); //detatch from (all, if 0) output set(s)
76  // for thread safe
77  void hanlePendingTasks();
78 
80 
81 private:
82  // for proxy VideoOutput
83  virtual void setStatistics(Statistics* statistics); //called by friend AVPlayer
84  virtual bool onInstallFilter(Filter *filter, int index);
85  virtual bool onUninstallFilter(Filter *filter);
86  // only called in handlePaintEvent. But filters may change. so required by proxy to update it's filters
87  virtual bool onHanlePendingTasks(); //return true: proxy update filters
88  friend class AVPlayer;
89  friend class OutputSet;
90  friend class VideoOutput;
91 };
92 
93 } //namespace QtAV
94 #endif //QAV_AVOUTPUT_H
#define Q_AV_EXPORT
Definition: QtAV_Global.h:40
#define DPTR_DECLARE_PRIVATE(Class)
Definition: dptr.h:107
The VideoOutput class A VideoRenderer wrapper with QObject features.
Definition: VideoOutput.h:35
Definition: AVOutput_p.h:38
Definition: Filter.h:36
Definition: AVOutput.h:39
The AVPlayer class Preload:
Definition: AVPlayer.h:62
Definition: Statistics.h:35
#define DPTR_DECLARE(Class)
Definition: dptr.h:105
AudioOutput ao; ao.setAudioFormat(fmt); ao.open(); while (has_data) { data = read_data(ao->bufferSize...
Definition: AudioDecoder.h:31