Miam-Player  0.8.0
A nice music player
AVMuxer.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_AVMUXER_H
23 #define QAV_AVMUXER_H
24 
25 #include <QtAV/AVError.h>
26 #include <QtAV/Packet.h>
27 #include <QtCore/QObject>
28 #include <QtCore/QIODevice>
29 #include <QtCore/QScopedPointer>
30 #include <QtCore/QStringList>
31 #include <QtCore/QVariant>
32 
33 namespace QtAV {
34 
35 class MediaIO;
36 class VideoEncoder;
37 class AudioEncoder;
38 class Q_AV_EXPORT AVMuxer : public QObject
39 {
40  Q_OBJECT
41 public:
42  static const QStringList& supportedFormats();
43  static const QStringList& supportedExtensions();
45  static const QStringList& supportedProtocols();
46 
47  AVMuxer(QObject *parent = 0);
48  ~AVMuxer();
49  QString fileName() const;
50  QIODevice* ioDevice() const;
52  MediaIO *mediaIO() const;
57  bool setMedia(const QString& fileName);
58  bool setMedia(QIODevice* dev);
59  bool setMedia(MediaIO* io);
67  void setFormat(const QString& fmt);
68  QString formatForced() const;
69 
70  bool open();
71  bool close();
72  bool isOpen() const;
73 
74  // TODO: copyAudioContext(void* avctx) for copy encoding without decoding
75  void copyProperties(VideoEncoder* enc); //rename to setEncoder
76  void copyProperties(AudioEncoder* enc);
77 
78  void setOptions(const QVariantHash &dict);
79  QVariantHash options() const;
80 
81 public Q_SLOTS:
82  // TODO: multiple streams. Packet.type,stream
83  bool writeAudio(const QtAV::Packet& packet);
84  bool writeVideo(const QtAV::Packet& packet);
85 
86  //void writeHeader();
87  //void writeTrailer();
88 private:
89  class Private;
90  QScopedPointer<Private> d;
91 };
92 } //namespace QtAV
93 #endif //QAV_AVMUXER_H
#define Q_AV_EXPORT
Definition: QtAV_Global.h:40
Definition: AudioEncoder.h:32
Definition: MediaIO.h:43
Definition: Packet.h:33
AudioOutput ao; ao.setAudioFormat(fmt); ao.open(); while (has_data) { data = read_data(ao->bufferSize...
Definition: AudioDecoder.h:31
Definition: VideoEncoder.h:32
Definition: AVMuxer.h:38