Skip to content

Commit

Permalink
Use default channel layout if zero
Browse files Browse the repository at this point in the history
libav 11 reports an invalid channel layout for mp3 files. This is a
work-around. The problem is fixed with libav 11.1.
  • Loading branch information
iamcsr authored and PromyLOPh committed Jan 5, 2015
1 parent 32151ea commit d888d0a
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/player.c
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,13 @@ static bool openFilter (player_t * const player) {

/* abuffer */
AVRational time_base = player->st->time_base;

/* Workaround for a bug in libav-11, which reports an invalid channel
* layout mp3 files */
if (cctx->channel_layout == 0) {
cctx->channel_layout = av_get_default_channel_layout (cctx->channels);
}

snprintf (strbuf, sizeof (strbuf),
"time_base=%d/%d:sample_rate=%d:sample_fmt=%s:channel_layout=0x%"PRIx64,
time_base.num, time_base.den, cctx->sample_rate,
Expand Down

0 comments on commit d888d0a

Please sign in to comment.