[MPlayer-cvslog] r32993 - trunk/libmpcodecs/ad_ffmpeg.c

reimar subversion at mplayerhq.hu
Tue Mar 1 22:48:04 CET 2011


Author: reimar
Date: Tue Mar  1 22:48:04 2011
New Revision: 32993

Log:
Use samplefmt2affmt helper function in ad_ffmpeg.c

Modified:
   trunk/libmpcodecs/ad_ffmpeg.c

Modified: trunk/libmpcodecs/ad_ffmpeg.c
==============================================================================
--- trunk/libmpcodecs/ad_ffmpeg.c	Tue Mar  1 22:44:15 2011	(r32992)
+++ trunk/libmpcodecs/ad_ffmpeg.c	Tue Mar  1 22:48:04 2011	(r32993)
@@ -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 @@ static int setup_format(sh_audio_t *sh_a
 {
     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;


More information about the MPlayer-cvslog mailing list