Skip to content

Commit bf8f351

Browse files
author
Clement Champetier
committed
AudioFrameDesc: can set all parameters from a given profile
1 parent a934263 commit bf8f351

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

src/AvTranscoder/frame/AudioFrame.cpp

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#include "AudioFrame.hpp"
22

33
#include <stdexcept>
4+
#include <stdlib.h>
45

56
namespace avtranscoder
67
{
@@ -44,8 +45,18 @@ void AudioFrameDesc::setSampleFormat( const std::string& sampleFormatName )
4445

4546
void AudioFrameDesc::setParameters( const ProfileLoader::Profile& profile )
4647
{
47-
if( profile.find( constants::avProfileSampleFormat ) != profile.end() )
48+
// sample rate
49+
if( profile.count( constants::avProfileSampleRate ) )
50+
setSampleRate( atoi( profile.find( constants::avProfileSampleRate )->second.c_str() ) );
51+
// channel
52+
if( profile.count( constants::avProfileChannel ) )
53+
setChannels( atoi( profile.find( constants::avProfileChannel )->second.c_str() ) );
54+
// sample format
55+
if( profile.count( constants::avProfileSampleFormat ) )
4856
setSampleFormat( profile.find( constants::avProfileSampleFormat )->second );
57+
// fps
58+
if( profile.count( constants::avProfileFrameRate ) )
59+
setFps( atof( profile.find( constants::avProfileFrameRate )->second.c_str() ) );
4960
}
5061

5162
}

0 commit comments

Comments
 (0)