summaryrefslogtreecommitdiff
path: root/decoders
diff options
context:
space:
mode:
Diffstat (limited to 'decoders')
-rw-r--r--decoders/ffmpeg_decoder.cpp2
-rw-r--r--decoders/mpg123_decoder.cpp9
2 files changed, 10 insertions, 1 deletions
diff --git a/decoders/ffmpeg_decoder.cpp b/decoders/ffmpeg_decoder.cpp
index 630e38e..7b7397f 100644
--- a/decoders/ffmpeg_decoder.cpp
+++ b/decoders/ffmpeg_decoder.cpp
@@ -14,6 +14,8 @@ DecoderFFmpeg::DecoderFFmpeg(const std::string& filename) {
av_dump_format(lavf_ctx, 0, filename.c_str(), 0);
lavc_ctx = lavf_ctx->streams[0]->codec;
+ samplerate = lavc_ctx->sample_rate;
+ channels = lavc_ctx->channels;
codec = avcodec_find_decoder(lavc_ctx->codec_id);
std::cerr << "Opening decoder: " << avcodec_open(lavc_ctx, codec) << std::endl;
diff --git a/decoders/mpg123_decoder.cpp b/decoders/mpg123_decoder.cpp
index ec6f490..13e9861 100644
--- a/decoders/mpg123_decoder.cpp
+++ b/decoders/mpg123_decoder.cpp
@@ -17,8 +17,15 @@ DecoderMpg123::DecoderMpg123(const std::string& filename) {
throw std::runtime_error(mpg123_plain_strerror(error));
}
+ long rate;
+ int channels, enc;
+ mpg123_getformat(handle, &rate, &channels, &enc);
+ std::cout << boost::format("mpg123: %li Hz, %i channels, encoding value %i") % rate % channels % enc << std::endl;
+ this->samplerate = rate;
+ this->channels = channels;
+
mpg123_format_none(handle);
- mpg123_format(handle, 44100, 2, MPG123_ENC_SIGNED_16);
+ mpg123_format(handle, rate, channels, MPG123_ENC_SIGNED_16);
}
DecoderMpg123::~DecoderMpg123() {