# HG changeset patch # User reimar # Date 1299016084 0 # Node ID b623edea8e3cc5b3ff1df61994b243db670da313 # Parent fd60388d370aac7d4548e56daa72b979c01ae54c Use samplefmt2affmt helper function in ad_ffmpeg.c diff -r fd60388d370a -r b623edea8e3c libmpcodecs/ad_ffmpeg.c --- a/libmpcodecs/ad_ffmpeg.c Tue Mar 01 21:44:15 2011 +0000 +++ b/libmpcodecs/ad_ffmpeg.c Tue Mar 01 21:48:04 2011 +0000 @@ -28,6 +28,7 @@ #include "dec_audio.h" #include "vd_ffmpeg.h" #include "libaf/reorder_ch.h" +#include "fmt-conversion.h" #include "mpbswap.h" @@ -57,15 +58,9 @@ { int broken_srate = 0; int samplerate = lavc_context->sample_rate; - int sample_format = sh_audio->sample_format; - switch (lavc_context->sample_fmt) { - case AV_SAMPLE_FMT_U8: sample_format = AF_FORMAT_U8; break; - case AV_SAMPLE_FMT_S16: sample_format = AF_FORMAT_S16_NE; break; - case AV_SAMPLE_FMT_S32: sample_format = AF_FORMAT_S32_NE; break; - case AV_SAMPLE_FMT_FLT: sample_format = AF_FORMAT_FLOAT_NE; break; - default: - mp_msg(MSGT_DECAUDIO, MSGL_FATAL, "Unsupported sample format\n"); - } + int sample_format = samplefmt2affmt(lavc_context->sample_fmt); + if (!sample_format) + sample_format = sh_audio->sample_format; if(sh_audio->wf){ // If the decoder uses the wrong number of channels all is lost anyway. // sh_audio->channels=sh_audio->wf->nChannels;