21 lines
751 B
Diff
21 lines
751 B
Diff
diff --git a/src/audio/ffmpeg_audio_reader.h b/src/audio/ffmpeg_audio_reader.h
|
|
index 35b2934..0b032e5 100644
|
|
--- a/src/audio/ffmpeg_audio_reader.h
|
|
+++ b/src/audio/ffmpeg_audio_reader.h
|
|
@@ -118,8 +118,13 @@ inline bool FFmpegAudioReader::SetInputSampleRate(int sample_rate) {
|
|
|
|
inline bool FFmpegAudioReader::SetInputChannels(int channels) {
|
|
char buf[64];
|
|
- sprintf(buf, "%d", channels);
|
|
- return av_dict_set(&m_input_opts, "channels", buf, 0) >= 0;
|
|
+ if (channels == 1)
|
|
+ sprintf(buf, "%s", "mono");
|
|
+ else if (channels == 2)
|
|
+ sprintf(buf, "%s", "stereo");
|
|
+ else
|
|
+ return false;
|
|
+ return av_dict_set(&m_input_opts, "ch_layout", buf, 0) >= 0;
|
|
}
|
|
|
|
inline bool FFmpegAudioReader::Open(const std::string &file_name) {
|