forked from mikrosimage/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) · 935 Bytes
/
Copy pathAudioCodec.cpp
File metadata and controls
38 lines (30 loc) · 935 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 <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 );
AudioFrameDesc audioFrameDesc( _avCodecContext->sample_rate, _avCodecContext->channels, _avCodecContext->sample_fmt );
return audioFrameDesc;
}
void AudioCodec::setAudioParameters( const AudioFrameDesc& audioFrameDesc )
{
_avCodecContext->sample_rate = audioFrameDesc.getSampleRate();
_avCodecContext->channels = audioFrameDesc.getChannels();
_avCodecContext->sample_fmt = audioFrameDesc.getSampleFormat();
}
}