Skip to content

Commit

Permalink
Move frame_size from AudioEncoderFFmpegPrivate to AudioEncoderPrivate…
Browse files Browse the repository at this point in the history
… and make it accessible via getter
  • Loading branch information
0xFelix committed Oct 13, 2017
1 parent 4959f40 commit ed1ac96
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 2 deletions.
2 changes: 2 additions & 0 deletions src/QtAV/AudioEncoder.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ class Q_AV_EXPORT AudioEncoder : public AVEncoder
*/
const AudioFormat& audioFormat() const;
void setAudioFormat(const AudioFormat& format);

int frameSize() const;
Q_SIGNALS:
void audioFormatChanged();
public:
Expand Down
3 changes: 3 additions & 0 deletions src/QtAV/private/AVEncoder_p.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ class AudioEncoderPrivate : public AVEncoderPrivate
public:
AudioEncoderPrivate()
: AVEncoderPrivate()
, frame_size(0)
{
bit_rate = 64000;
}
Expand All @@ -79,6 +80,8 @@ class AudioEncoderPrivate : public AVEncoderPrivate

AudioResampler *resampler;
AudioFormat format, format_used;

int frame_size; // used if avctx->frame_size == 0
};

class Q_AV_PRIVATE_EXPORT VideoEncoderPrivate : public AVEncoderPrivate
Expand Down
4 changes: 4 additions & 0 deletions src/codec/audio/AudioEncoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,4 +80,8 @@ const AudioFormat& AudioEncoder::audioFormat() const
return d_func().format_used;
}

int AudioEncoder::frameSize() const
{
return d_func().frame_size;
}
} //namespace QtAV
2 changes: 0 additions & 2 deletions src/codec/audio/AudioEncoderFFmpeg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ class AudioEncoderFFmpegPrivate Q_DECL_FINAL: public AudioEncoderPrivate
public:
AudioEncoderFFmpegPrivate()
: AudioEncoderPrivate()
, frame_size(0)
{
avcodec_register_all();
// NULL: codec-specific defaults won't be initialized, which may result in suboptimal default settings (this is important mainly for encoders, e.g. libx264).
Expand All @@ -62,7 +61,6 @@ class AudioEncoderFFmpegPrivate Q_DECL_FINAL: public AudioEncoderPrivate
bool open() Q_DECL_OVERRIDE;
bool close() Q_DECL_OVERRIDE;

int frame_size; // used if avctx->frame_size == 0
QByteArray buffer;
};

Expand Down

0 comments on commit ed1ac96

Please sign in to comment.