Miam-Player  0.8.0
A nice music player
AVEncoder_p.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 QTAV_AVENCODER_P_H
23 #define QTAV_AVENCODER_P_H
24 
25 #include <QtCore/QVariant>
26 #include "QtAV/AudioFormat.h"
27 #include "QtAV/Packet.h"
28 #include "QtAV/VideoFormat.h"
29 #include "QtAV/private/AVCompat.h"
30 
31 namespace QtAV {
32 
34 {
35 public:
37  avctx(0)
38  , is_open(false)
39  , bit_rate(0)
40  , timestamp_mode(0)
41  , dict(0)
42  {
43  }
44  virtual ~AVEncoderPrivate() {
45  if (dict) {
46  av_dict_free(&dict);
47  }
48  if (avctx) {
49  avcodec_free_context(&avctx);
50  }
51  }
52  virtual bool open() {return true;}
53  virtual bool close() {return true;}
54  // used iff avctx != null
55  void applyOptionsForDict();
56  void applyOptionsForContext();
57 
58  AVCodecContext *avctx; // null if not avcodec. allocated in ffmpeg based encoders
59  bool is_open;
60  int bit_rate;
62  QString codec_name;
63  QVariantHash options;
64  AVDictionary *dict; // null if not avcodec
66 };
67 
68 class AudioResampler;
70 {
71 public:
74  {
75  bit_rate = 64000;
76  }
77 
78  virtual ~AudioEncoderPrivate() {}
79 
82 };
83 
85 {
86 public:
89  , width(0)
90  , height(0)
91  , frame_rate(-1)
92  , format_used(VideoFormat::Format_Invalid)
93  , format(format_used)
94  {
95  bit_rate = 400000;
96  }
97  virtual ~VideoEncoderPrivate() {}
98  int width, height;
99  qreal frame_rate;
102 };
103 } //namespace QtAV
104 #endif // QTAV_AVENCODER_P_H
virtual ~AVEncoderPrivate()
Definition: AVEncoder_p.h:44
qreal frame_rate
Definition: AVEncoder_p.h:99
The VideoFormat class Describes the layout of video data.
Definition: VideoFormat.h:39
virtual ~VideoEncoderPrivate()
Definition: AVEncoder_p.h:97
#define Q_AV_PRIVATE_EXPORT
Definition: QtAV_Global.h:43
Packet packet
Definition: AVEncoder_p.h:65
AVEncoderPrivate()
Definition: AVEncoder_p.h:36
bool is_open
Definition: AVEncoder_p.h:59
Definition: AVEncoder_p.h:69
struct AVDictionary AVDictionary
Definition: dict.h:90
void av_dict_free(AVDictionary **m)
Definition: AVEncoder_p.h:84
PixelFormat
The PixelFormat enum 32 bit rgba format enum name indicates it&#39;s channel layout.
Definition: VideoFormat.h:51
Definition: AudioFormat.h:35
VideoFormat format
Definition: AVEncoder_p.h:101
QVariantHash options
Definition: AVEncoder_p.h:63
Definition: AVEncoder_p.h:33
virtual bool close()
Definition: AVEncoder_p.h:53
AVDictionary * dict
Definition: AVEncoder_p.h:64
Definition: AudioResampler.h:32
Definition: Packet.h:33
virtual bool open()
Definition: AVEncoder_p.h:52
void avcodec_free_context(AVCodecContext **avctx)
Definition: avcodec.h:1676
AudioEncoderPrivate()
Definition: AVEncoder_p.h:72
Definition: dptr.h:123
int timestamp_mode
Definition: AVEncoder_p.h:61
int width
Definition: AVEncoder_p.h:98
QString codec_name
Definition: AVEncoder_p.h:62
int bit_rate
Definition: AVEncoder_p.h:60
AudioFormat format_used
Definition: AVEncoder_p.h:81
AudioOutput ao; ao.setAudioFormat(fmt); ao.open(); while (has_data) { data = read_data(ao->bufferSize...
Definition: AudioDecoder.h:31
VideoFormat::PixelFormat format_used
Definition: AVEncoder_p.h:100
AudioResampler * resampler
Definition: AVEncoder_p.h:80
VideoEncoderPrivate()
Definition: AVEncoder_p.h:87
virtual ~AudioEncoderPrivate()
Definition: AVEncoder_p.h:78
AVCodecContext * avctx
Definition: AVEncoder_p.h:58