Skip to content

Commit 3e81855

Browse files
author
Clement Champetier
committed
Transcoder: getProfileFromFile copy the correct number of channels
We manage the demultiplexing after calling this more generic function.
1 parent c214cce commit 3e81855

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

src/AvTranscoder/transcoder/Transcoder.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -342,6 +342,11 @@ void Transcoder::addTranscodeStream( const std::string& filename, const size_t s
342342
InputFile* referenceFile = addInputFile( filename, streamIndex );
343343
ProfileLoader::Profile profile = getProfileFromFile( *referenceFile, streamIndex );
344344

345+
// override channels parameter to manage demultiplexing
346+
ProfileLoader::Profile::iterator it = profile.find( constants::avProfileChannel );
347+
if( it != profile.end() )
348+
it->second = "1";
349+
345350
addTranscodeStream( filename, streamIndex, subStreamIndex, profile, offset );
346351
}
347352

@@ -465,7 +470,9 @@ ProfileLoader::Profile Transcoder::getProfileFromFile( InputFile& inputFile, con
465470
std::stringstream ss;
466471
ss << audioProperties->getSampleRate();
467472
profile[ constants::avProfileSampleRate ] = ss.str();
468-
profile[ constants::avProfileChannel ] = "1";
473+
ss.clear();
474+
ss << audioProperties->getChannels();
475+
profile[ constants::avProfileChannel ] = ss.str();
469476
}
470477

471478
return profile;

src/AvTranscoder/transcoder/Transcoder.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ class AvExport Transcoder
141141
private:
142142
void addRewrapStream( const std::string& filename, const size_t streamIndex );
143143

144-
void addTranscodeStream( const std::string& filename, const size_t streamIndex, const size_t subStreamIndex, const double offset ); ///< Get profile from input
144+
void addTranscodeStream( const std::string& filename, const size_t streamIndex, const size_t subStreamIndex, const double offset );
145145
void addTranscodeStream( const std::string& filename, const size_t streamIndex, const size_t subStreamIndex, ProfileLoader::Profile& profile, const double offset = 0 );
146146

147147
void addDummyStream( const ProfileLoader::Profile& profile, const ICodec& codec );

0 commit comments

Comments
 (0)