annotate libao2/afmt.c @ 12107:bc89ddda34b8

Developers should subscribe to mplayer-cvslog, mention mplayer-docs.
author diego
date Fri, 02 Apr 2004 23:36:06 +0000
parents c8677169cc2c
children 131b6c682863
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2812
2c3ab498ac90 audio_out_format_name moved from audio_out.c to afmt.c
alex
parents:
diff changeset
1 #include <stdio.h>
2c3ab498ac90 audio_out_format_name moved from audio_out.c to afmt.c
alex
parents:
diff changeset
2 #include <stdlib.h>
2c3ab498ac90 audio_out_format_name moved from audio_out.c to afmt.c
alex
parents:
diff changeset
3
2c3ab498ac90 audio_out_format_name moved from audio_out.c to afmt.c
alex
parents:
diff changeset
4 #include "../config.h"
2c3ab498ac90 audio_out_format_name moved from audio_out.c to afmt.c
alex
parents:
diff changeset
5 #include "afmt.h"
2c3ab498ac90 audio_out_format_name moved from audio_out.c to afmt.c
alex
parents:
diff changeset
6
2c3ab498ac90 audio_out_format_name moved from audio_out.c to afmt.c
alex
parents:
diff changeset
7 char *audio_out_format_name(int format)
2c3ab498ac90 audio_out_format_name moved from audio_out.c to afmt.c
alex
parents:
diff changeset
8 {
2c3ab498ac90 audio_out_format_name moved from audio_out.c to afmt.c
alex
parents:
diff changeset
9 switch (format)
2c3ab498ac90 audio_out_format_name moved from audio_out.c to afmt.c
alex
parents:
diff changeset
10 {
2c3ab498ac90 audio_out_format_name moved from audio_out.c to afmt.c
alex
parents:
diff changeset
11 case AFMT_MU_LAW:
2c3ab498ac90 audio_out_format_name moved from audio_out.c to afmt.c
alex
parents:
diff changeset
12 return("Mu-Law");
2c3ab498ac90 audio_out_format_name moved from audio_out.c to afmt.c
alex
parents:
diff changeset
13 case AFMT_A_LAW:
2c3ab498ac90 audio_out_format_name moved from audio_out.c to afmt.c
alex
parents:
diff changeset
14 return("A-Law");
2c3ab498ac90 audio_out_format_name moved from audio_out.c to afmt.c
alex
parents:
diff changeset
15 case AFMT_IMA_ADPCM:
2c3ab498ac90 audio_out_format_name moved from audio_out.c to afmt.c
alex
parents:
diff changeset
16 return("Ima-ADPCM");
2c3ab498ac90 audio_out_format_name moved from audio_out.c to afmt.c
alex
parents:
diff changeset
17 case AFMT_S8:
2c3ab498ac90 audio_out_format_name moved from audio_out.c to afmt.c
alex
parents:
diff changeset
18 return("Signed 8-bit");
2c3ab498ac90 audio_out_format_name moved from audio_out.c to afmt.c
alex
parents:
diff changeset
19 case AFMT_U8:
2c3ab498ac90 audio_out_format_name moved from audio_out.c to afmt.c
alex
parents:
diff changeset
20 return("Unsigned 8-bit");
2c3ab498ac90 audio_out_format_name moved from audio_out.c to afmt.c
alex
parents:
diff changeset
21 case AFMT_U16_LE:
2c3ab498ac90 audio_out_format_name moved from audio_out.c to afmt.c
alex
parents:
diff changeset
22 return("Unsigned 16-bit (Little-Endian)");
2c3ab498ac90 audio_out_format_name moved from audio_out.c to afmt.c
alex
parents:
diff changeset
23 case AFMT_U16_BE:
2c3ab498ac90 audio_out_format_name moved from audio_out.c to afmt.c
alex
parents:
diff changeset
24 return("Unsigned 16-bit (Big-Endian)");
2c3ab498ac90 audio_out_format_name moved from audio_out.c to afmt.c
alex
parents:
diff changeset
25 case AFMT_S16_LE:
2c3ab498ac90 audio_out_format_name moved from audio_out.c to afmt.c
alex
parents:
diff changeset
26 return("Signed 16-bit (Little-Endian)");
2c3ab498ac90 audio_out_format_name moved from audio_out.c to afmt.c
alex
parents:
diff changeset
27 case AFMT_S16_BE:
2c3ab498ac90 audio_out_format_name moved from audio_out.c to afmt.c
alex
parents:
diff changeset
28 return("Signed 16-bit (Big-Endian)");
2c3ab498ac90 audio_out_format_name moved from audio_out.c to afmt.c
alex
parents:
diff changeset
29 case AFMT_MPEG:
2c3ab498ac90 audio_out_format_name moved from audio_out.c to afmt.c
alex
parents:
diff changeset
30 return("MPEG (2) audio");
2c3ab498ac90 audio_out_format_name moved from audio_out.c to afmt.c
alex
parents:
diff changeset
31 case AFMT_AC3:
2c3ab498ac90 audio_out_format_name moved from audio_out.c to afmt.c
alex
parents:
diff changeset
32 return("AC3");
2c3ab498ac90 audio_out_format_name moved from audio_out.c to afmt.c
alex
parents:
diff changeset
33 /*
2c3ab498ac90 audio_out_format_name moved from audio_out.c to afmt.c
alex
parents:
diff changeset
34 the following two formats are not available with old linux kernel
2c3ab498ac90 audio_out_format_name moved from audio_out.c to afmt.c
alex
parents:
diff changeset
35 headers (e.g. in 2.2.16)
2c3ab498ac90 audio_out_format_name moved from audio_out.c to afmt.c
alex
parents:
diff changeset
36 */
2c3ab498ac90 audio_out_format_name moved from audio_out.c to afmt.c
alex
parents:
diff changeset
37 #ifdef AFMT_S32_LE
2c3ab498ac90 audio_out_format_name moved from audio_out.c to afmt.c
alex
parents:
diff changeset
38 case AFMT_S32_LE:
2c3ab498ac90 audio_out_format_name moved from audio_out.c to afmt.c
alex
parents:
diff changeset
39 return("Signed 32-bit (Little-Endian)");
2c3ab498ac90 audio_out_format_name moved from audio_out.c to afmt.c
alex
parents:
diff changeset
40 #endif
2c3ab498ac90 audio_out_format_name moved from audio_out.c to afmt.c
alex
parents:
diff changeset
41 #ifdef AFMT_S32_BE
2c3ab498ac90 audio_out_format_name moved from audio_out.c to afmt.c
alex
parents:
diff changeset
42 case AFMT_S32_BE:
2c3ab498ac90 audio_out_format_name moved from audio_out.c to afmt.c
alex
parents:
diff changeset
43 return("Signed 32-bit (Big-Endian)");
2c3ab498ac90 audio_out_format_name moved from audio_out.c to afmt.c
alex
parents:
diff changeset
44 #endif
8222
c8677169cc2c added float
alex
parents: 6335
diff changeset
45 case AFMT_FLOAT:
c8677169cc2c added float
alex
parents: 6335
diff changeset
46 return("Floating Point");
2812
2c3ab498ac90 audio_out_format_name moved from audio_out.c to afmt.c
alex
parents:
diff changeset
47 }
2c3ab498ac90 audio_out_format_name moved from audio_out.c to afmt.c
alex
parents:
diff changeset
48 return("Unknown");
2c3ab498ac90 audio_out_format_name moved from audio_out.c to afmt.c
alex
parents:
diff changeset
49 }
6026
16e33d66b813 added audio_out_format_bits to calc len alignment
iive
parents: 2812
diff changeset
50
16e33d66b813 added audio_out_format_bits to calc len alignment
iive
parents: 2812
diff changeset
51 // return number of bits for 1 sample in one channel, or 8 bits for compressed
16e33d66b813 added audio_out_format_bits to calc len alignment
iive
parents: 2812
diff changeset
52 int audio_out_format_bits(int format){
16e33d66b813 added audio_out_format_bits to calc len alignment
iive
parents: 2812
diff changeset
53 switch (format)
16e33d66b813 added audio_out_format_bits to calc len alignment
iive
parents: 2812
diff changeset
54 {
8222
c8677169cc2c added float
alex
parents: 6335
diff changeset
55 case AFMT_S16_LE:
c8677169cc2c added float
alex
parents: 6335
diff changeset
56 case AFMT_S16_BE:
c8677169cc2c added float
alex
parents: 6335
diff changeset
57 case AFMT_U16_LE:
c8677169cc2c added float
alex
parents: 6335
diff changeset
58 case AFMT_U16_BE:
c8677169cc2c added float
alex
parents: 6335
diff changeset
59 return 16;//16 bits
c8677169cc2c added float
alex
parents: 6335
diff changeset
60
6026
16e33d66b813 added audio_out_format_bits to calc len alignment
iive
parents: 2812
diff changeset
61 /*
16e33d66b813 added audio_out_format_bits to calc len alignment
iive
parents: 2812
diff changeset
62 the following two formats are not available with old linux kernel
16e33d66b813 added audio_out_format_bits to calc len alignment
iive
parents: 2812
diff changeset
63 headers (e.g. in 2.2.16)
16e33d66b813 added audio_out_format_bits to calc len alignment
iive
parents: 2812
diff changeset
64 */
16e33d66b813 added audio_out_format_bits to calc len alignment
iive
parents: 2812
diff changeset
65 #ifdef AFMT_S32_LE
16e33d66b813 added audio_out_format_bits to calc len alignment
iive
parents: 2812
diff changeset
66 case AFMT_S32_LE:
16e33d66b813 added audio_out_format_bits to calc len alignment
iive
parents: 2812
diff changeset
67 return 32;
16e33d66b813 added audio_out_format_bits to calc len alignment
iive
parents: 2812
diff changeset
68 #endif
16e33d66b813 added audio_out_format_bits to calc len alignment
iive
parents: 2812
diff changeset
69 #ifdef AFMT_S32_BE
16e33d66b813 added audio_out_format_bits to calc len alignment
iive
parents: 2812
diff changeset
70 case AFMT_S32_BE:
16e33d66b813 added audio_out_format_bits to calc len alignment
iive
parents: 2812
diff changeset
71 return 32;
16e33d66b813 added audio_out_format_bits to calc len alignment
iive
parents: 2812
diff changeset
72 #endif
8222
c8677169cc2c added float
alex
parents: 6335
diff changeset
73 case AFMT_FLOAT:
c8677169cc2c added float
alex
parents: 6335
diff changeset
74 return 32;
6026
16e33d66b813 added audio_out_format_bits to calc len alignment
iive
parents: 2812
diff changeset
75
16e33d66b813 added audio_out_format_bits to calc len alignment
iive
parents: 2812
diff changeset
76 case AFMT_MU_LAW:
16e33d66b813 added audio_out_format_bits to calc len alignment
iive
parents: 2812
diff changeset
77 case AFMT_A_LAW:
16e33d66b813 added audio_out_format_bits to calc len alignment
iive
parents: 2812
diff changeset
78 case AFMT_IMA_ADPCM:
16e33d66b813 added audio_out_format_bits to calc len alignment
iive
parents: 2812
diff changeset
79 case AFMT_S8:
16e33d66b813 added audio_out_format_bits to calc len alignment
iive
parents: 2812
diff changeset
80 case AFMT_U8:
16e33d66b813 added audio_out_format_bits to calc len alignment
iive
parents: 2812
diff changeset
81 case AFMT_MPEG:
16e33d66b813 added audio_out_format_bits to calc len alignment
iive
parents: 2812
diff changeset
82 case AFMT_AC3:
16e33d66b813 added audio_out_format_bits to calc len alignment
iive
parents: 2812
diff changeset
83 default:
16e33d66b813 added audio_out_format_bits to calc len alignment
iive
parents: 2812
diff changeset
84 return 8;//default 1 byte
16e33d66b813 added audio_out_format_bits to calc len alignment
iive
parents: 2812
diff changeset
85
16e33d66b813 added audio_out_format_bits to calc len alignment
iive
parents: 2812
diff changeset
86 }
16e33d66b813 added audio_out_format_bits to calc len alignment
iive
parents: 2812
diff changeset
87 return 8;
6335
e9bd97d5c5cc warning & newline fixes by Dominik Mierzejewski <dominik@rangers.eu.org>
arpi
parents: 6026
diff changeset
88 }