Miam-Player  0.8.0
A nice music player
Filter.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 2013)
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 QTAV_FILTER_H
23 #define QTAV_FILTER_H
24 
25 #include <QtCore/QObject>
26 #include <QtAV/QtAV_Global.h>
27 #include <QtAV/FilterContext.h>
28 
29 namespace QtAV {
30 class AudioFormat;
31 class AVOutput;
32 class AVPlayer;
33 class FilterPrivate;
34 class Statistics;
35 class Frame;
36 class Q_AV_EXPORT Filter : public QObject
37 {
38  Q_OBJECT
40  Q_PROPERTY(bool enabled READ isEnabled WRITE setEnabled NOTIFY enabledChanged)
41 public:
42  virtual ~Filter();
43  bool isEnabled() const;
49  void setOwnedByTarget(bool value = true);
50  // default is false
51  bool isOwnedByTarget() const;
52  // setInput/Output: no need to call installTo
53  // bool setInput(Filter*);
54  // bool setOutput(Filter*);
60  virtual bool installTo(AVPlayer *player) = 0;
61  // called in destructor automatically
62  bool uninstall();
63 public Q_SLOTS:
64  void setEnabled(bool enabled = true);
65 signals:
66  void enabledChanged(bool);
67 protected:
68  /*
69  * If the filter is in AVThread, it's safe to operate on ref.
70  */
71  Filter(FilterPrivate& d, QObject *parent = 0);
72 
73  DPTR_DECLARE(Filter)
74 };
75 
76 class VideoFilterPrivate;
77 class Q_AV_EXPORT VideoFilter : public Filter
78 {
79  Q_OBJECT
81 public:
82  VideoFilter(QObject* parent = 0);
83 
84  VideoFilterContext* context();
85  virtual bool isSupported(VideoFilterContext::Type ct) const;
86  bool installTo(AVPlayer *player);
94  bool installTo(AVOutput *output); //only for video. move to video filter installToRenderer
95  void apply(Statistics* statistics, VideoFrame *frame = 0);
96 
97  bool prepareContext(VideoFilterContext*& ctx, Statistics* statistics = 0, VideoFrame* frame = 0); //internal use
98 protected:
99  VideoFilter(VideoFilterPrivate& d, QObject *parent = 0);
100  virtual void process(Statistics* statistics, VideoFrame* frame = 0) = 0;
101 };
102 
103 class AudioFrame;
104 class AudioFilterPrivate;
106 {
107  Q_OBJECT
109 public:
110  AudioFilter(QObject* parent = 0);
111  bool installTo(AVPlayer *player);
112  void apply(Statistics* statistics, AudioFrame *frame = 0);
113 protected:
114  AudioFilter(AudioFilterPrivate& d, QObject *parent = 0);
115  virtual void process(Statistics* statistics, AudioFrame* frame = 0) = 0;
116 };
117 
118 } //namespace QtAV
119 #endif // QTAV_FILTER_H
Definition: Filter.h:77
#define Q_AV_EXPORT
Definition: QtAV_Global.h:40
#define DPTR_DECLARE_PRIVATE(Class)
Definition: dptr.h:107
Definition: Filter.h:105
Definition: Filter.h:36
Definition: FilterContext.h:41
Definition: AudioFrame.h:31
Definition: VideoFrame.h:32
Definition: Filter_p.h:32
Definition: Filter_p.h:54
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
Type
Definition: FilterContext.h:44
Definition: Filter_p.h:45