mirror of
https://github.com/tuxbox-fork-migrations/recycled-ni-libstb-hal.git
synced 2025-08-27 07:22:44 +02:00
libeplayer3/container_ffmpeg: fix mono->stereo conversion
Origin commit data
------------------
Branch: master
Commit: 5db41a87e3
Author: martii <m4rtii@gmx.de>
Date: 2013-07-21 (Sun, 21 Jul 2013)
------------------
No further description and justification available within origin commit message!
------------------
This commit was generated by Migit
This commit is contained in:
@@ -339,6 +339,7 @@ static void FFMPEGThread(Context_t *context) {
|
||||
SwrContext *swr = NULL;
|
||||
AVFrame *decoded_frame = NULL;
|
||||
int out_sample_rate = 44100;
|
||||
int out_channels = 2;
|
||||
uint64_t out_channel_layout = AV_CH_LAYOUT_STEREO;
|
||||
|
||||
ffmpeg_printf(10, "\n");
|
||||
@@ -564,6 +565,7 @@ static void FFMPEGThread(Context_t *context) {
|
||||
rate++;
|
||||
out_sample_rate = *rate ? *rate : 44100;
|
||||
swr = swr_alloc();
|
||||
out_channels = c->channels;
|
||||
if (c->channel_layout == 0) {
|
||||
// FIXME -- need to guess, looks pretty much like a bug in the FFMPEG WMA decoder
|
||||
c->channel_layout = AV_CH_LAYOUT_STEREO;
|
||||
@@ -571,7 +573,10 @@ static void FFMPEGThread(Context_t *context) {
|
||||
|
||||
out_channel_layout = c->channel_layout;
|
||||
// player2 won't play mono
|
||||
out_channel_layout = (c->channel_layout == AV_CH_LAYOUT_MONO) ? AV_CH_LAYOUT_STEREO : c->channel_layout;
|
||||
if (out_channel_layout == AV_CH_LAYOUT_MONO) {
|
||||
out_channel_layout = AV_CH_LAYOUT_STEREO;
|
||||
out_channels = 2;
|
||||
}
|
||||
|
||||
av_opt_set_int(swr, "in_channel_layout", c->channel_layout, 0);
|
||||
av_opt_set_int(swr, "out_channel_layout", out_channel_layout, 0);
|
||||
@@ -616,7 +621,7 @@ static void FFMPEGThread(Context_t *context) {
|
||||
extradata.bLittleEndian = 1;
|
||||
|
||||
avOut.data = output;
|
||||
avOut.len = out_samples * sizeof(short) * c->channels;
|
||||
avOut.len = out_samples * sizeof(short) * out_channels;
|
||||
|
||||
avOut.pts = pts;
|
||||
avOut.extradata = (unsigned char *) &extradata;
|
||||
|
Reference in New Issue
Block a user