changeset 14263:bc80d39d19e8

af_fmt2str_short
author alex
date Tue, 28 Dec 2004 18:13:09 +0000
parents 04ed193d1e32
children cb5fbade8a5c
files libaf/af_format.c libaf/af_format.h
diffstat 2 files changed, 34 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/libaf/af_format.c	Tue Dec 28 11:16:23 2004 +0000
+++ b/libaf/af_format.c	Tue Dec 28 18:13:09 2004 +0000
@@ -130,6 +130,8 @@
       i+=snprintf(&str[i],size-i,"MPEG 2 "); break;
     case(AF_FORMAT_AC3): 
       i+=snprintf(&str[i],size-i,"AC3 "); break;
+    case(AF_FORMAT_IMA_ADPCM): 
+      i+=snprintf(&str[i],size-i,"IMA ADPCM "); break;
     default:
       printf("Unknown special\n");
     }
@@ -155,6 +157,37 @@
   return str;
 }
 
+char *af_fmt2str_short(int format)
+{
+    switch(format)
+    {
+	// special
+	case AF_FORMAT_MU_LAW: return "mulaw";
+	case AF_FORMAT_A_LAW: return "alaw";
+	case AF_FORMAT_MPEG2: return "mpeg2";
+	case AF_FORMAT_AC3: return "ac3";
+	case AF_FORMAT_IMA_ADPCM: return "imaadpcm";
+	// ordinary
+	case AF_FORMAT_U8: return "u8";
+	case AF_FORMAT_S8: return "s8";
+	case AF_FORMAT_U16_LE: return "u16le";
+	case AF_FORMAT_U16_BE: return "u16be";
+	case AF_FORMAT_S16_LE: return "s16le";
+	case AF_FORMAT_S16_BE: return "s16be";
+	case AF_FORMAT_U24_LE: return "u24le";
+	case AF_FORMAT_U24_BE: return "u24be";
+	case AF_FORMAT_S24_LE: return "s24le";
+	case AF_FORMAT_S24_BE: return "s24be";
+	case AF_FORMAT_U32_LE: return "u32le";
+	case AF_FORMAT_U32_BE: return "u32be";
+	case AF_FORMAT_S32_LE: return "s32le";
+	case AF_FORMAT_S32_BE: return "s32be";
+	case AF_FORMAT_FLOAT_LE: return "floatle";
+	case AF_FORMAT_FLOAT_BE: return "floatbe";
+    }
+    return "??";
+}
+
 // Helper functions to check sanity for input arguments
 
 // Sanity check for bytes per sample
--- a/libaf/af_format.h	Tue Dec 28 11:16:23 2004 +0000
+++ b/libaf/af_format.h	Tue Dec 28 18:13:09 2004 +0000
@@ -83,5 +83,6 @@
 extern int af_str2fmt(char *str);
 extern int af_fmt2bits(int format);
 extern char* af_fmt2str(int format, char* str, int size);
+extern char* af_fmt2str_short(int format);
 
 #endif /* __af_format_h__ */