Miam-Player  0.8.0
A nice music player
AVDecoder.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_DECODER_H
23 #define QAV_DECODER_H
24 
25 #include <QtAV/AVError.h>
26 #include <QtCore/QVariant>
27 #include <QtCore/QObject>
28 
29 namespace QtAV {
30 
31 class Packet;
32 class AVDecoderPrivate;
33 class Q_AV_EXPORT AVDecoder : public QObject
34 {
35  Q_OBJECT
37  //Q_PROPERTY(QString description READ description NOTIFY descriptionChanged)
38 public:
39  virtual ~AVDecoder();
40  virtual QString name() const;
41  virtual QString description() const;
47  virtual bool open();
48  virtual bool close();
49  bool isOpen() const;
50  virtual void flush();
51  void setCodecContext(void* codecCtx); //protected
52  void* codecContext() const;
53  /*not available if AVCodecContext == 0*/
54  bool isAvailable() const;
55  virtual bool decode(const Packet& packet) = 0;
56  int undecodedSize() const; //TODO: remove. always decode whole input data completely
57 
58  // avcodec_open2
72  void setOptions(const QVariantHash &dict);
73  QVariantHash options() const;
74 
75 Q_SIGNALS:
76  void error(const QtAV::AVError& e); //explictly use QtAV::AVError in connection for Qt4 syntax
77  void descriptionChanged();
78 protected:
81  // force a codec. only used by avcodec sw decoders. TODO: move to public? profile set?
82  void setCodecName(const QString& name);
83  QString codecName() const;
84  virtual void codecNameChanged() {}//signals can not be decared virtual (winrt)
85 private:
86  Q_DISABLE_COPY(AVDecoder)
87  AVDecoder(); // base class, not direct create. only final class has is enough
88 };
89 
90 } //namespace QtAV
91 #endif // QAV_DECODER_H
Definition: AVError.h:28
#define Q_AV_EXPORT
Definition: QtAV_Global.h:40
#define DPTR_DECLARE_PRIVATE(Class)
Definition: dptr.h:107
Definition: AVDecoder.h:33
Definition: AVDecoder_p.h:77
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
TAGLIB_EXPORT ByteVector decode(const ByteVector &input)
Convert the data from unsynchronized data to its original format.
virtual void codecNameChanged()
Definition: AVDecoder.h:84