Mercurial > mplayer.hg
changeset 28955:ee06f3a8b0d5
Support FFmpeg codecs that decode to other formats than S16.
Double format is currently not supported.
author | reimar |
---|---|
date | Wed, 18 Mar 2009 12:50:17 +0000 |
parents | f4a3c2c39bdf |
children | 6d0da4fd4544 |
files | libmpcodecs/ad_ffmpeg.c |
diffstat | 1 files changed, 10 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/libmpcodecs/ad_ffmpeg.c Wed Mar 18 09:17:15 2009 +0000 +++ b/libmpcodecs/ad_ffmpeg.c Wed Mar 18 12:50:17 2009 +0000 @@ -112,6 +112,15 @@ sh_audio->channels=lavc_context->channels; sh_audio->samplerate=lavc_context->sample_rate; sh_audio->i_bps=lavc_context->bit_rate/8; + switch (lavc_context->sample_fmt) { + case SAMPLE_FMT_U8: sh_audio->sample_format = AF_FORMAT_U8; break; + case SAMPLE_FMT_S16: sh_audio->sample_format = AF_FORMAT_S16_NE; break; + case SAMPLE_FMT_S32: sh_audio->sample_format = AF_FORMAT_S32_NE; break; + case SAMPLE_FMT_FLT: sh_audio->sample_format = AF_FORMAT_FLOAT_NE; break; + default: + mp_msg(MSGT_DECAUDIO, MSGL_FATAL, "Unsupported sample format\n"); + return 0; + } if(sh_audio->wf){ // If the decoder uses the wrong number of channels all is lost anyway. // sh_audio->channels=sh_audio->wf->nChannels; @@ -120,7 +129,7 @@ if (sh_audio->wf->nAvgBytesPerSec) sh_audio->i_bps=sh_audio->wf->nAvgBytesPerSec; } - sh_audio->samplesize=2; + sh_audio->samplesize=af_fmt2bits(sh_audio->sample_format)/ 8; return 1; }