Miam-Player  0.8.0
A nice music player
AVEncoder.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 2015)
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_ENCODER_H
23 #define QAV_ENCODER_H
24 
25 #include <QtAV/QtAV_Global.h>
26 #include <QtAV/AVError.h>
27 #include <QtAV/Packet.h>
28 #include <QtCore/QVariant>
29 #include <QtCore/QObject>
30 
31 namespace QtAV {
32 class AVEncoderPrivate;
33 class Q_AV_EXPORT AVEncoder : public QObject
34 {
35  Q_OBJECT
37  Q_PROPERTY(int bitRate READ bitRate WRITE setBitRate NOTIFY bitRateChanged)
38  Q_PROPERTY(QString codecName READ codecName WRITE setCodecName NOTIFY codecNameChanged)
39  Q_PROPERTY(TimestampMode timestampMode READ timestampMode WRITE setTimestampMode NOTIFY timestampModeChanged)
40  Q_ENUMS(TimestampMode)
41 public:
45  };
46 
47  virtual ~AVEncoder();
48  virtual QString name() const = 0;
49  virtual QString description() const;
54  void setCodecName(const QString& name);
55  QString codecName() const;
56  bool open();
57  bool close();
58  bool isOpen() const;
59  virtual void flush();
60  Packet encoded() const;
61 
65  virtual void copyAVCodecContext(void* ctx);
66  void* codecContext() const; // TODO: always have a avctx like decoder?
72  void setBitRate(int value);
73  int bitRate() const;
74 
75  TimestampMode timestampMode() const;
76  void setTimestampMode(TimestampMode value);
86  void setOptions(const QVariantHash &dict);
87  QVariantHash options() const;
88 
89 Q_SIGNALS:
90  void error(const QtAV::AVError& e); //explictly use QtAV::AVError in connection for Qt4 syntax
91  void codecNameChanged();
92  void bitRateChanged();
93  void timestampModeChanged(TimestampMode mode);
94 protected:
97 private:
98  Q_DISABLE_COPY(AVEncoder)
99  AVEncoder(); // base class, not direct create. only final class has is enough
100 };
101 } //namespace QtAV
102 #endif // QAV_ENCODER_H
Definition: AVEncoder.h:33
Definition: AVError.h:28
#define Q_AV_EXPORT
Definition: QtAV_Global.h:40
#define DPTR_DECLARE_PRIVATE(Class)
Definition: dptr.h:107
Definition: AVEncoder.h:43
TimestampMode
Definition: AVEncoder.h:42
Definition: AVEncoder.h:44
Definition: AVEncoder_p.h:33
Definition: Packet.h:33
#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