forked from avTranscoder/avTranscoder
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAudioCodec.cpp
More file actions
38 lines (30 loc) · 953 Bytes
/
Copy pathAudioCodec.cpp
File metadata and controls
38 lines (30 loc) · 953 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#include "AudioCodec.hpp"
#include <AvTranscoder/util.hpp>
#include <cmath>
#include <cassert>
namespace avtranscoder
{
AudioCodec::AudioCodec(const ECodecType type, const std::string& codecName)
: ICodec(type, codecName)
{
}
AudioCodec::AudioCodec(const ECodecType type, const AVCodecID codecId)
: ICodec(type, codecId)
{
}
AudioCodec::AudioCodec(const ECodecType type, AVCodecContext& avCodecContext)
: ICodec(type, avCodecContext)
{
}
AudioFrameDesc AudioCodec::getAudioFrameDesc() const
{
assert(_avCodecContext != NULL);
return AudioFrameDesc(_avCodecContext->sample_rate, _avCodecContext->channels, getSampleFormatName(_avCodecContext->sample_fmt));
}
void AudioCodec::setAudioParameters(const AudioFrameDesc& audioFrameDesc)
{
_avCodecContext->sample_rate = audioFrameDesc._sampleRate;
_avCodecContext->channels = audioFrameDesc._nbChannels;
_avCodecContext->sample_fmt = audioFrameDesc._sampleFormat;
}
}