File tree Expand file tree Collapse file tree 3 files changed +25
-2
lines changed Expand file tree Collapse file tree 3 files changed +25
-2
lines changed Original file line number Diff line number Diff line change @@ -49,7 +49,7 @@ void AudioDesc::setAudioCodec( const AVCodecID codecId )
49
49
initCodecContext ();
50
50
}
51
51
52
- void AudioDesc::setAudioParameters ( const size_t sampleRate, const size_t channels, const AVSampleFormat& sampleFormat )
52
+ void AudioDesc::setAudioParameters ( const size_t sampleRate, const size_t channels, const AVSampleFormat sampleFormat )
53
53
{
54
54
m_codecContext->sample_rate = sampleRate;
55
55
m_codecContext->channels = channels;
@@ -193,4 +193,21 @@ AVCodecID AudioDesc::getAudioCodecId() const
193
193
return m_codecContext->codec_id ;
194
194
}
195
195
196
+
197
+ const size_t AudioDesc::getSampleRate () const
198
+ {
199
+ return m_codecContext->sample_rate ;
200
+ }
201
+
202
+ const size_t AudioDesc::getChannels () const
203
+ {
204
+ return m_codecContext->channels ;
205
+ }
206
+
207
+ const AVSampleFormat AudioDesc::getSampleFormat () const
208
+ {
209
+ return m_codecContext->sample_fmt ;
210
+ }
211
+
212
+
196
213
}
Original file line number Diff line number Diff line change @@ -27,7 +27,7 @@ class AvExport AudioDesc
27
27
void setAudioCodec ( const std::string& codecName );
28
28
void setAudioCodec ( const AVCodecID codecId );
29
29
30
- void setAudioParameters ( const size_t sampleRate, const size_t channels, const AVSampleFormat& sampleFormat );
30
+ void setAudioParameters ( const size_t sampleRate, const size_t channels, const AVSampleFormat sampleFormat );
31
31
32
32
void set ( const std::string& key, const std::string& flag, const bool enable );
33
33
void set ( const std::string& key, const bool value );
@@ -38,6 +38,10 @@ class AvExport AudioDesc
38
38
39
39
std::string getAudioCodec () const ;
40
40
AVCodecID getAudioCodecId () const ;
41
+
42
+ const size_t getSampleRate () const ;
43
+ const size_t getChannels () const ;
44
+ const AVSampleFormat getSampleFormat () const ;
41
45
42
46
#ifndef SWIG
43
47
AVCodec* getCodec () const { return m_codec; }
Original file line number Diff line number Diff line change @@ -39,6 +39,8 @@ InputStreamAudio::InputStreamAudio( const InputStream& inputStream )
39
39
{
40
40
throw std::runtime_error ( " unable to find context for codec" );
41
41
}
42
+
43
+ m_codecContext->channels = m_inputStream->getAudioDesc ().getChannels ();
42
44
43
45
std::cout << " Audio codec Id : " << m_codecContext->codec_id << std::endl;
44
46
std::cout << " Audio codec Id : " << m_codec->long_name << std::endl;
You can’t perform that action at this time.
0 commit comments