annotate libao2/pl_format.c @ 13004:8d5018102a48

nick, typo
author diego
date Wed, 11 Aug 2004 19:45:41 +0000
parents 12b1790038b0
children 815f03b7cee5
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3279
d6ea11bed983 Commandline interface to ao_plugin updated according to mplayers complex parameter format and plugin pl_format finished (alpha code needs testing)
anders
parents: 3195
diff changeset
1 /* This audio output plugin changes the format of a data block. Valid
d6ea11bed983 Commandline interface to ao_plugin updated according to mplayers complex parameter format and plugin pl_format finished (alpha code needs testing)
anders
parents: 3195
diff changeset
2 output formats are: AFMT_U8, AFMT_S8, AFMT_S16_LE, AFMT_S16_BE
d6ea11bed983 Commandline interface to ao_plugin updated according to mplayers complex parameter format and plugin pl_format finished (alpha code needs testing)
anders
parents: 3195
diff changeset
3 AFMT_U16_LE, AFMT_U16_BE, AFMT_S32_LE and AFMT_S32_BE. The output
d6ea11bed983 Commandline interface to ao_plugin updated according to mplayers complex parameter format and plugin pl_format finished (alpha code needs testing)
anders
parents: 3195
diff changeset
4 format is spedified using the cfg switch 'format=NR' where NR is
d6ea11bed983 Commandline interface to ao_plugin updated according to mplayers complex parameter format and plugin pl_format finished (alpha code needs testing)
anders
parents: 3195
diff changeset
5 the number as given in libao2/afmt.h
d6ea11bed983 Commandline interface to ao_plugin updated according to mplayers complex parameter format and plugin pl_format finished (alpha code needs testing)
anders
parents: 3195
diff changeset
6 */
d6ea11bed983 Commandline interface to ao_plugin updated according to mplayers complex parameter format and plugin pl_format finished (alpha code needs testing)
anders
parents: 3195
diff changeset
7
3194
1648d11fc36c commandline configuration of audio plugins now through struct, format conversion plugin added
anders
parents:
diff changeset
8 #define PLUGIN
1648d11fc36c commandline configuration of audio plugins now through struct, format conversion plugin added
anders
parents:
diff changeset
9
1648d11fc36c commandline configuration of audio plugins now through struct, format conversion plugin added
anders
parents:
diff changeset
10 #include <stdio.h>
1648d11fc36c commandline configuration of audio plugins now through struct, format conversion plugin added
anders
parents:
diff changeset
11 #include <stdlib.h>
6237
2eec40929570 warning fixes (string.h is required for memset)
pl
parents: 3309
diff changeset
12 #include <string.h>
3195
62d797a16f72 unistd.h required at least by FreeBSD
nexus
parents: 3194
diff changeset
13 #include <unistd.h>
3279
d6ea11bed983 Commandline interface to ao_plugin updated according to mplayers complex parameter format and plugin pl_format finished (alpha code needs testing)
anders
parents: 3195
diff changeset
14 #include <inttypes.h>
3194
1648d11fc36c commandline configuration of audio plugins now through struct, format conversion plugin added
anders
parents:
diff changeset
15
1648d11fc36c commandline configuration of audio plugins now through struct, format conversion plugin added
anders
parents:
diff changeset
16 #include "audio_out.h"
1648d11fc36c commandline configuration of audio plugins now through struct, format conversion plugin added
anders
parents:
diff changeset
17 #include "audio_plugin.h"
1648d11fc36c commandline configuration of audio plugins now through struct, format conversion plugin added
anders
parents:
diff changeset
18 #include "audio_plugin_internal.h"
1648d11fc36c commandline configuration of audio plugins now through struct, format conversion plugin added
anders
parents:
diff changeset
19 #include "afmt.h"
1648d11fc36c commandline configuration of audio plugins now through struct, format conversion plugin added
anders
parents:
diff changeset
20
1648d11fc36c commandline configuration of audio plugins now through struct, format conversion plugin added
anders
parents:
diff changeset
21 static ao_info_t info =
1648d11fc36c commandline configuration of audio plugins now through struct, format conversion plugin added
anders
parents:
diff changeset
22 {
1648d11fc36c commandline configuration of audio plugins now through struct, format conversion plugin added
anders
parents:
diff changeset
23 "Sample format conversion audio plugin",
1648d11fc36c commandline configuration of audio plugins now through struct, format conversion plugin added
anders
parents:
diff changeset
24 "format",
1648d11fc36c commandline configuration of audio plugins now through struct, format conversion plugin added
anders
parents:
diff changeset
25 "Anders",
1648d11fc36c commandline configuration of audio plugins now through struct, format conversion plugin added
anders
parents:
diff changeset
26 ""
1648d11fc36c commandline configuration of audio plugins now through struct, format conversion plugin added
anders
parents:
diff changeset
27 };
1648d11fc36c commandline configuration of audio plugins now through struct, format conversion plugin added
anders
parents:
diff changeset
28
1648d11fc36c commandline configuration of audio plugins now through struct, format conversion plugin added
anders
parents:
diff changeset
29 LIBAO_PLUGIN_EXTERN(format)
1648d11fc36c commandline configuration of audio plugins now through struct, format conversion plugin added
anders
parents:
diff changeset
30
1648d11fc36c commandline configuration of audio plugins now through struct, format conversion plugin added
anders
parents:
diff changeset
31 // local data
1648d11fc36c commandline configuration of audio plugins now through struct, format conversion plugin added
anders
parents:
diff changeset
32 typedef struct pl_format_s
1648d11fc36c commandline configuration of audio plugins now through struct, format conversion plugin added
anders
parents:
diff changeset
33 {
1648d11fc36c commandline configuration of audio plugins now through struct, format conversion plugin added
anders
parents:
diff changeset
34 void* data; // local audio data block
1648d11fc36c commandline configuration of audio plugins now through struct, format conversion plugin added
anders
parents:
diff changeset
35 int len; // local buffer length
3279
d6ea11bed983 Commandline interface to ao_plugin updated according to mplayers complex parameter format and plugin pl_format finished (alpha code needs testing)
anders
parents: 3195
diff changeset
36 int in; // input fomat
d6ea11bed983 Commandline interface to ao_plugin updated according to mplayers complex parameter format and plugin pl_format finished (alpha code needs testing)
anders
parents: 3195
diff changeset
37 int out; // output fomat
3194
1648d11fc36c commandline configuration of audio plugins now through struct, format conversion plugin added
anders
parents:
diff changeset
38 double sz_mult; // data size multiplier
1648d11fc36c commandline configuration of audio plugins now through struct, format conversion plugin added
anders
parents:
diff changeset
39 } pl_format_t;
1648d11fc36c commandline configuration of audio plugins now through struct, format conversion plugin added
anders
parents:
diff changeset
40
1648d11fc36c commandline configuration of audio plugins now through struct, format conversion plugin added
anders
parents:
diff changeset
41 static pl_format_t pl_format={NULL,0,0,0,1};
1648d11fc36c commandline configuration of audio plugins now through struct, format conversion plugin added
anders
parents:
diff changeset
42
1648d11fc36c commandline configuration of audio plugins now through struct, format conversion plugin added
anders
parents:
diff changeset
43 // Number of bits
3279
d6ea11bed983 Commandline interface to ao_plugin updated according to mplayers complex parameter format and plugin pl_format finished (alpha code needs testing)
anders
parents: 3195
diff changeset
44 #define B08 (0<<0)
d6ea11bed983 Commandline interface to ao_plugin updated according to mplayers complex parameter format and plugin pl_format finished (alpha code needs testing)
anders
parents: 3195
diff changeset
45 #define B16 (1<<0)
d6ea11bed983 Commandline interface to ao_plugin updated according to mplayers complex parameter format and plugin pl_format finished (alpha code needs testing)
anders
parents: 3195
diff changeset
46 #define B32 (2<<0)
d6ea11bed983 Commandline interface to ao_plugin updated according to mplayers complex parameter format and plugin pl_format finished (alpha code needs testing)
anders
parents: 3195
diff changeset
47 #define NBITS_MASK (3<<0)
3194
1648d11fc36c commandline configuration of audio plugins now through struct, format conversion plugin added
anders
parents:
diff changeset
48
1648d11fc36c commandline configuration of audio plugins now through struct, format conversion plugin added
anders
parents:
diff changeset
49 // Endianess
3279
d6ea11bed983 Commandline interface to ao_plugin updated according to mplayers complex parameter format and plugin pl_format finished (alpha code needs testing)
anders
parents: 3195
diff changeset
50 #define BE (0<<2) // Big Endian
d6ea11bed983 Commandline interface to ao_plugin updated according to mplayers complex parameter format and plugin pl_format finished (alpha code needs testing)
anders
parents: 3195
diff changeset
51 #define LE (1<<2) // Little Endian
d6ea11bed983 Commandline interface to ao_plugin updated according to mplayers complex parameter format and plugin pl_format finished (alpha code needs testing)
anders
parents: 3195
diff changeset
52 #define END_MASK (1<<2)
3194
1648d11fc36c commandline configuration of audio plugins now through struct, format conversion plugin added
anders
parents:
diff changeset
53
1648d11fc36c commandline configuration of audio plugins now through struct, format conversion plugin added
anders
parents:
diff changeset
54 // Signed
3279
d6ea11bed983 Commandline interface to ao_plugin updated according to mplayers complex parameter format and plugin pl_format finished (alpha code needs testing)
anders
parents: 3195
diff changeset
55 #define US (0<<3) // Un Signed
d6ea11bed983 Commandline interface to ao_plugin updated according to mplayers complex parameter format and plugin pl_format finished (alpha code needs testing)
anders
parents: 3195
diff changeset
56 #define SI (1<<3) // SIgned
d6ea11bed983 Commandline interface to ao_plugin updated according to mplayers complex parameter format and plugin pl_format finished (alpha code needs testing)
anders
parents: 3195
diff changeset
57 #define SIGN_MASK (1<<3)
3194
1648d11fc36c commandline configuration of audio plugins now through struct, format conversion plugin added
anders
parents:
diff changeset
58
1648d11fc36c commandline configuration of audio plugins now through struct, format conversion plugin added
anders
parents:
diff changeset
59 // to set/get/query special features/parameters
9633
12b1790038b0 64bit libao2 fix by Jens Axboe <mplayer-dev@kernel.dk>
alex
parents: 9217
diff changeset
60 static int control(int cmd,void *arg){
3194
1648d11fc36c commandline configuration of audio plugins now through struct, format conversion plugin added
anders
parents:
diff changeset
61 switch(cmd){
1648d11fc36c commandline configuration of audio plugins now through struct, format conversion plugin added
anders
parents:
diff changeset
62 case AOCONTROL_PLUGIN_SET_LEN:
1648d11fc36c commandline configuration of audio plugins now through struct, format conversion plugin added
anders
parents:
diff changeset
63 if(pl_format.data)
3309
28f2ebcb5c95 Format plugin now with working switch statements
anders
parents: 3279
diff changeset
64 free(pl_format.data);
3194
1648d11fc36c commandline configuration of audio plugins now through struct, format conversion plugin added
anders
parents:
diff changeset
65 pl_format.len = ao_plugin_data.len;
1648d11fc36c commandline configuration of audio plugins now through struct, format conversion plugin added
anders
parents:
diff changeset
66 pl_format.data=(void*)malloc(ao_plugin_data.len);
3309
28f2ebcb5c95 Format plugin now with working switch statements
anders
parents: 3279
diff changeset
67 if(!pl_format.data)
28f2ebcb5c95 Format plugin now with working switch statements
anders
parents: 3279
diff changeset
68 return CONTROL_ERROR;
28f2ebcb5c95 Format plugin now with working switch statements
anders
parents: 3279
diff changeset
69 ao_plugin_data.len=(int)(((double)ao_plugin_data.len)/pl_format.sz_mult);
3194
1648d11fc36c commandline configuration of audio plugins now through struct, format conversion plugin added
anders
parents:
diff changeset
70 return CONTROL_OK;
1648d11fc36c commandline configuration of audio plugins now through struct, format conversion plugin added
anders
parents:
diff changeset
71 }
1648d11fc36c commandline configuration of audio plugins now through struct, format conversion plugin added
anders
parents:
diff changeset
72 return -1;
1648d11fc36c commandline configuration of audio plugins now through struct, format conversion plugin added
anders
parents:
diff changeset
73 }
1648d11fc36c commandline configuration of audio plugins now through struct, format conversion plugin added
anders
parents:
diff changeset
74
1648d11fc36c commandline configuration of audio plugins now through struct, format conversion plugin added
anders
parents:
diff changeset
75 // open & setup audio device
1648d11fc36c commandline configuration of audio plugins now through struct, format conversion plugin added
anders
parents:
diff changeset
76 // return: 1=success 0=fail
1648d11fc36c commandline configuration of audio plugins now through struct, format conversion plugin added
anders
parents:
diff changeset
77 static int init(){
1648d11fc36c commandline configuration of audio plugins now through struct, format conversion plugin added
anders
parents:
diff changeset
78 // Sheck input format
1648d11fc36c commandline configuration of audio plugins now through struct, format conversion plugin added
anders
parents:
diff changeset
79 switch(ao_plugin_data.format){
1648d11fc36c commandline configuration of audio plugins now through struct, format conversion plugin added
anders
parents:
diff changeset
80 case(AFMT_U8):
1648d11fc36c commandline configuration of audio plugins now through struct, format conversion plugin added
anders
parents:
diff changeset
81 pl_format.in=LE|B08|US; break;
1648d11fc36c commandline configuration of audio plugins now through struct, format conversion plugin added
anders
parents:
diff changeset
82 case(AFMT_S8):
1648d11fc36c commandline configuration of audio plugins now through struct, format conversion plugin added
anders
parents:
diff changeset
83 pl_format.in=LE|B08|SI; break;
1648d11fc36c commandline configuration of audio plugins now through struct, format conversion plugin added
anders
parents:
diff changeset
84 case(AFMT_S16_LE):
3279
d6ea11bed983 Commandline interface to ao_plugin updated according to mplayers complex parameter format and plugin pl_format finished (alpha code needs testing)
anders
parents: 3195
diff changeset
85 pl_format.in=LE|B16|SI; break;
3194
1648d11fc36c commandline configuration of audio plugins now through struct, format conversion plugin added
anders
parents:
diff changeset
86 case(AFMT_S16_BE):
1648d11fc36c commandline configuration of audio plugins now through struct, format conversion plugin added
anders
parents:
diff changeset
87 pl_format.in=BE|B16|SI; break;
1648d11fc36c commandline configuration of audio plugins now through struct, format conversion plugin added
anders
parents:
diff changeset
88 case(AFMT_U16_LE):
1648d11fc36c commandline configuration of audio plugins now through struct, format conversion plugin added
anders
parents:
diff changeset
89 pl_format.in=LE|B16|US; break;
1648d11fc36c commandline configuration of audio plugins now through struct, format conversion plugin added
anders
parents:
diff changeset
90 case(AFMT_U16_BE):
1648d11fc36c commandline configuration of audio plugins now through struct, format conversion plugin added
anders
parents:
diff changeset
91 pl_format.in=BE|B16|US; break;
1648d11fc36c commandline configuration of audio plugins now through struct, format conversion plugin added
anders
parents:
diff changeset
92 case(AFMT_S32_LE):
1648d11fc36c commandline configuration of audio plugins now through struct, format conversion plugin added
anders
parents:
diff changeset
93 pl_format.in=LE|B32|SI; break;
1648d11fc36c commandline configuration of audio plugins now through struct, format conversion plugin added
anders
parents:
diff changeset
94 case(AFMT_S32_BE):
1648d11fc36c commandline configuration of audio plugins now through struct, format conversion plugin added
anders
parents:
diff changeset
95 pl_format.in=BE|B32|SI; break;
1648d11fc36c commandline configuration of audio plugins now through struct, format conversion plugin added
anders
parents:
diff changeset
96 case(AFMT_IMA_ADPCM):
1648d11fc36c commandline configuration of audio plugins now through struct, format conversion plugin added
anders
parents:
diff changeset
97 case(AFMT_MU_LAW):
1648d11fc36c commandline configuration of audio plugins now through struct, format conversion plugin added
anders
parents:
diff changeset
98 case(AFMT_A_LAW):
1648d11fc36c commandline configuration of audio plugins now through struct, format conversion plugin added
anders
parents:
diff changeset
99 case(AFMT_MPEG):
1648d11fc36c commandline configuration of audio plugins now through struct, format conversion plugin added
anders
parents:
diff changeset
100 case(AFMT_AC3):
3309
28f2ebcb5c95 Format plugin now with working switch statements
anders
parents: 3279
diff changeset
101 printf("[pl_format] Input audio format not yet suported \n");
3194
1648d11fc36c commandline configuration of audio plugins now through struct, format conversion plugin added
anders
parents:
diff changeset
102 return 0;
1648d11fc36c commandline configuration of audio plugins now through struct, format conversion plugin added
anders
parents:
diff changeset
103 default:
3279
d6ea11bed983 Commandline interface to ao_plugin updated according to mplayers complex parameter format and plugin pl_format finished (alpha code needs testing)
anders
parents: 3195
diff changeset
104 printf("[pl_format] Unrecognised input audio format\n"); //This can not happen ....
3194
1648d11fc36c commandline configuration of audio plugins now through struct, format conversion plugin added
anders
parents:
diff changeset
105 return 0;
1648d11fc36c commandline configuration of audio plugins now through struct, format conversion plugin added
anders
parents:
diff changeset
106 }
1648d11fc36c commandline configuration of audio plugins now through struct, format conversion plugin added
anders
parents:
diff changeset
107 // Sheck output format
1648d11fc36c commandline configuration of audio plugins now through struct, format conversion plugin added
anders
parents:
diff changeset
108 switch(ao_plugin_cfg.pl_format_type){
1648d11fc36c commandline configuration of audio plugins now through struct, format conversion plugin added
anders
parents:
diff changeset
109 case(AFMT_U8):
3279
d6ea11bed983 Commandline interface to ao_plugin updated according to mplayers complex parameter format and plugin pl_format finished (alpha code needs testing)
anders
parents: 3195
diff changeset
110 pl_format.out=LE|B08|US; break;
3194
1648d11fc36c commandline configuration of audio plugins now through struct, format conversion plugin added
anders
parents:
diff changeset
111 case(AFMT_S8):
3279
d6ea11bed983 Commandline interface to ao_plugin updated according to mplayers complex parameter format and plugin pl_format finished (alpha code needs testing)
anders
parents: 3195
diff changeset
112 pl_format.out=LE|B08|SI; break;
3194
1648d11fc36c commandline configuration of audio plugins now through struct, format conversion plugin added
anders
parents:
diff changeset
113 case(AFMT_S16_LE):
3279
d6ea11bed983 Commandline interface to ao_plugin updated according to mplayers complex parameter format and plugin pl_format finished (alpha code needs testing)
anders
parents: 3195
diff changeset
114 pl_format.out=LE|B16|SI; break;
3194
1648d11fc36c commandline configuration of audio plugins now through struct, format conversion plugin added
anders
parents:
diff changeset
115 case(AFMT_S16_BE):
3279
d6ea11bed983 Commandline interface to ao_plugin updated according to mplayers complex parameter format and plugin pl_format finished (alpha code needs testing)
anders
parents: 3195
diff changeset
116 pl_format.out=BE|B16|SI; break;
3194
1648d11fc36c commandline configuration of audio plugins now through struct, format conversion plugin added
anders
parents:
diff changeset
117 case(AFMT_U16_LE):
3279
d6ea11bed983 Commandline interface to ao_plugin updated according to mplayers complex parameter format and plugin pl_format finished (alpha code needs testing)
anders
parents: 3195
diff changeset
118 pl_format.out=LE|B16|US; break;
3194
1648d11fc36c commandline configuration of audio plugins now through struct, format conversion plugin added
anders
parents:
diff changeset
119 case(AFMT_U16_BE):
3279
d6ea11bed983 Commandline interface to ao_plugin updated according to mplayers complex parameter format and plugin pl_format finished (alpha code needs testing)
anders
parents: 3195
diff changeset
120 pl_format.out=BE|B16|US; break;
3194
1648d11fc36c commandline configuration of audio plugins now through struct, format conversion plugin added
anders
parents:
diff changeset
121 case(AFMT_S32_LE):
3279
d6ea11bed983 Commandline interface to ao_plugin updated according to mplayers complex parameter format and plugin pl_format finished (alpha code needs testing)
anders
parents: 3195
diff changeset
122 pl_format.out=LE|B32|SI; break;
3194
1648d11fc36c commandline configuration of audio plugins now through struct, format conversion plugin added
anders
parents:
diff changeset
123 case(AFMT_S32_BE):
3279
d6ea11bed983 Commandline interface to ao_plugin updated according to mplayers complex parameter format and plugin pl_format finished (alpha code needs testing)
anders
parents: 3195
diff changeset
124 pl_format.out=BE|B32|SI; break;
3194
1648d11fc36c commandline configuration of audio plugins now through struct, format conversion plugin added
anders
parents:
diff changeset
125 case(AFMT_IMA_ADPCM):
1648d11fc36c commandline configuration of audio plugins now through struct, format conversion plugin added
anders
parents:
diff changeset
126 case(AFMT_MU_LAW):
1648d11fc36c commandline configuration of audio plugins now through struct, format conversion plugin added
anders
parents:
diff changeset
127 case(AFMT_A_LAW):
1648d11fc36c commandline configuration of audio plugins now through struct, format conversion plugin added
anders
parents:
diff changeset
128 case(AFMT_MPEG):
1648d11fc36c commandline configuration of audio plugins now through struct, format conversion plugin added
anders
parents:
diff changeset
129 case(AFMT_AC3):
3309
28f2ebcb5c95 Format plugin now with working switch statements
anders
parents: 3279
diff changeset
130 printf("[pl_format] Output audio format not yet suported \n");
3194
1648d11fc36c commandline configuration of audio plugins now through struct, format conversion plugin added
anders
parents:
diff changeset
131 return 0;
1648d11fc36c commandline configuration of audio plugins now through struct, format conversion plugin added
anders
parents:
diff changeset
132 default:
3279
d6ea11bed983 Commandline interface to ao_plugin updated according to mplayers complex parameter format and plugin pl_format finished (alpha code needs testing)
anders
parents: 3195
diff changeset
133 printf("[pl_format] Unrecognised audio output format\n");
3194
1648d11fc36c commandline configuration of audio plugins now through struct, format conversion plugin added
anders
parents:
diff changeset
134 return 0;
1648d11fc36c commandline configuration of audio plugins now through struct, format conversion plugin added
anders
parents:
diff changeset
135 }
3279
d6ea11bed983 Commandline interface to ao_plugin updated according to mplayers complex parameter format and plugin pl_format finished (alpha code needs testing)
anders
parents: 3195
diff changeset
136
d6ea11bed983 Commandline interface to ao_plugin updated according to mplayers complex parameter format and plugin pl_format finished (alpha code needs testing)
anders
parents: 3195
diff changeset
137 // Tell the world what we are up to
d6ea11bed983 Commandline interface to ao_plugin updated according to mplayers complex parameter format and plugin pl_format finished (alpha code needs testing)
anders
parents: 3195
diff changeset
138 printf("[pl_format] Input format: %s, output format: %s \n",
d6ea11bed983 Commandline interface to ao_plugin updated according to mplayers complex parameter format and plugin pl_format finished (alpha code needs testing)
anders
parents: 3195
diff changeset
139 audio_out_format_name(ao_plugin_data.format),
d6ea11bed983 Commandline interface to ao_plugin updated according to mplayers complex parameter format and plugin pl_format finished (alpha code needs testing)
anders
parents: 3195
diff changeset
140 audio_out_format_name(ao_plugin_cfg.pl_format_type));
d6ea11bed983 Commandline interface to ao_plugin updated according to mplayers complex parameter format and plugin pl_format finished (alpha code needs testing)
anders
parents: 3195
diff changeset
141
3194
1648d11fc36c commandline configuration of audio plugins now through struct, format conversion plugin added
anders
parents:
diff changeset
142 // We are changing the format
1648d11fc36c commandline configuration of audio plugins now through struct, format conversion plugin added
anders
parents:
diff changeset
143 ao_plugin_data.format=ao_plugin_cfg.pl_format_type;
3279
d6ea11bed983 Commandline interface to ao_plugin updated according to mplayers complex parameter format and plugin pl_format finished (alpha code needs testing)
anders
parents: 3195
diff changeset
144
3309
28f2ebcb5c95 Format plugin now with working switch statements
anders
parents: 3279
diff changeset
145 // And perhaps the buffer size
3194
1648d11fc36c commandline configuration of audio plugins now through struct, format conversion plugin added
anders
parents:
diff changeset
146 pl_format.sz_mult=1;
3279
d6ea11bed983 Commandline interface to ao_plugin updated according to mplayers complex parameter format and plugin pl_format finished (alpha code needs testing)
anders
parents: 3195
diff changeset
147 if((pl_format.in&NBITS_MASK) > (pl_format.out&NBITS_MASK))
d6ea11bed983 Commandline interface to ao_plugin updated according to mplayers complex parameter format and plugin pl_format finished (alpha code needs testing)
anders
parents: 3195
diff changeset
148 pl_format.sz_mult/=(double)(1<<((pl_format.in&NBITS_MASK)-(pl_format.out&NBITS_MASK)));
3194
1648d11fc36c commandline configuration of audio plugins now through struct, format conversion plugin added
anders
parents:
diff changeset
149 if((pl_format.in&NBITS_MASK) < (pl_format.out&NBITS_MASK))
3279
d6ea11bed983 Commandline interface to ao_plugin updated according to mplayers complex parameter format and plugin pl_format finished (alpha code needs testing)
anders
parents: 3195
diff changeset
150 pl_format.sz_mult*=(double)(1<<((pl_format.out&NBITS_MASK)-(pl_format.in&NBITS_MASK)));
d6ea11bed983 Commandline interface to ao_plugin updated according to mplayers complex parameter format and plugin pl_format finished (alpha code needs testing)
anders
parents: 3195
diff changeset
151 ao_plugin_data.sz_mult/=pl_format.sz_mult;
d6ea11bed983 Commandline interface to ao_plugin updated according to mplayers complex parameter format and plugin pl_format finished (alpha code needs testing)
anders
parents: 3195
diff changeset
152
3194
1648d11fc36c commandline configuration of audio plugins now through struct, format conversion plugin added
anders
parents:
diff changeset
153 return 1;
1648d11fc36c commandline configuration of audio plugins now through struct, format conversion plugin added
anders
parents:
diff changeset
154 }
1648d11fc36c commandline configuration of audio plugins now through struct, format conversion plugin added
anders
parents:
diff changeset
155
1648d11fc36c commandline configuration of audio plugins now through struct, format conversion plugin added
anders
parents:
diff changeset
156 // close plugin
1648d11fc36c commandline configuration of audio plugins now through struct, format conversion plugin added
anders
parents:
diff changeset
157 static void uninit(){
1648d11fc36c commandline configuration of audio plugins now through struct, format conversion plugin added
anders
parents:
diff changeset
158 if(pl_format.data)
1648d11fc36c commandline configuration of audio plugins now through struct, format conversion plugin added
anders
parents:
diff changeset
159 free(pl_format.data);
3279
d6ea11bed983 Commandline interface to ao_plugin updated according to mplayers complex parameter format and plugin pl_format finished (alpha code needs testing)
anders
parents: 3195
diff changeset
160 pl_format.data=NULL;
3194
1648d11fc36c commandline configuration of audio plugins now through struct, format conversion plugin added
anders
parents:
diff changeset
161 }
1648d11fc36c commandline configuration of audio plugins now through struct, format conversion plugin added
anders
parents:
diff changeset
162
1648d11fc36c commandline configuration of audio plugins now through struct, format conversion plugin added
anders
parents:
diff changeset
163 // empty buffers
1648d11fc36c commandline configuration of audio plugins now through struct, format conversion plugin added
anders
parents:
diff changeset
164 static void reset(){
3309
28f2ebcb5c95 Format plugin now with working switch statements
anders
parents: 3279
diff changeset
165 memset(pl_format.data, 0, pl_format.len);
3194
1648d11fc36c commandline configuration of audio plugins now through struct, format conversion plugin added
anders
parents:
diff changeset
166 }
1648d11fc36c commandline configuration of audio plugins now through struct, format conversion plugin added
anders
parents:
diff changeset
167
1648d11fc36c commandline configuration of audio plugins now through struct, format conversion plugin added
anders
parents:
diff changeset
168 // processes 'ao_plugin_data.len' bytes of 'data'
1648d11fc36c commandline configuration of audio plugins now through struct, format conversion plugin added
anders
parents:
diff changeset
169 // called for every block of data
3279
d6ea11bed983 Commandline interface to ao_plugin updated according to mplayers complex parameter format and plugin pl_format finished (alpha code needs testing)
anders
parents: 3195
diff changeset
170 // FIXME: this routine needs to be optimized (it is probably possible to do a lot here)
3194
1648d11fc36c commandline configuration of audio plugins now through struct, format conversion plugin added
anders
parents:
diff changeset
171 static int play(){
1648d11fc36c commandline configuration of audio plugins now through struct, format conversion plugin added
anders
parents:
diff changeset
172 register int i=0;
1648d11fc36c commandline configuration of audio plugins now through struct, format conversion plugin added
anders
parents:
diff changeset
173 void* in_data=ao_plugin_data.data;
1648d11fc36c commandline configuration of audio plugins now through struct, format conversion plugin added
anders
parents:
diff changeset
174 void* out_data=pl_format.data;
3279
d6ea11bed983 Commandline interface to ao_plugin updated according to mplayers complex parameter format and plugin pl_format finished (alpha code needs testing)
anders
parents: 3195
diff changeset
175 int len=(ao_plugin_data.len)>>(pl_format.in&NBITS_MASK);
7075
b9f7aec2e07d Fixed *= bug in length calculation
anders
parents: 6237
diff changeset
176 ao_plugin_data.len=(int)(((double)ao_plugin_data.len)*pl_format.sz_mult);
3309
28f2ebcb5c95 Format plugin now with working switch statements
anders
parents: 3279
diff changeset
177
3279
d6ea11bed983 Commandline interface to ao_plugin updated according to mplayers complex parameter format and plugin pl_format finished (alpha code needs testing)
anders
parents: 3195
diff changeset
178 // Change to little endian (Is this true for sun ?)
d6ea11bed983 Commandline interface to ao_plugin updated according to mplayers complex parameter format and plugin pl_format finished (alpha code needs testing)
anders
parents: 3195
diff changeset
179 if((pl_format.in&END_MASK)!=LE){
3194
1648d11fc36c commandline configuration of audio plugins now through struct, format conversion plugin added
anders
parents:
diff changeset
180 switch(pl_format.in&NBITS_MASK){
1648d11fc36c commandline configuration of audio plugins now through struct, format conversion plugin added
anders
parents:
diff changeset
181 case(B16):{
3279
d6ea11bed983 Commandline interface to ao_plugin updated according to mplayers complex parameter format and plugin pl_format finished (alpha code needs testing)
anders
parents: 3195
diff changeset
182 register uint16_t s;
d6ea11bed983 Commandline interface to ao_plugin updated according to mplayers complex parameter format and plugin pl_format finished (alpha code needs testing)
anders
parents: 3195
diff changeset
183 for(i=1;i<len;i++){
d6ea11bed983 Commandline interface to ao_plugin updated according to mplayers complex parameter format and plugin pl_format finished (alpha code needs testing)
anders
parents: 3195
diff changeset
184 s=((uint16_t*)in_data)[i];
d6ea11bed983 Commandline interface to ao_plugin updated according to mplayers complex parameter format and plugin pl_format finished (alpha code needs testing)
anders
parents: 3195
diff changeset
185 ((uint16_t*)in_data)[i]=(uint16_t)(((s&0x00FF)<<8) | (s&0xFF00)>>8);
3194
1648d11fc36c commandline configuration of audio plugins now through struct, format conversion plugin added
anders
parents:
diff changeset
186 }
1648d11fc36c commandline configuration of audio plugins now through struct, format conversion plugin added
anders
parents:
diff changeset
187 }
3309
28f2ebcb5c95 Format plugin now with working switch statements
anders
parents: 3279
diff changeset
188 break;
3194
1648d11fc36c commandline configuration of audio plugins now through struct, format conversion plugin added
anders
parents:
diff changeset
189 case(B32):{
3279
d6ea11bed983 Commandline interface to ao_plugin updated according to mplayers complex parameter format and plugin pl_format finished (alpha code needs testing)
anders
parents: 3195
diff changeset
190 register uint32_t s;
d6ea11bed983 Commandline interface to ao_plugin updated according to mplayers complex parameter format and plugin pl_format finished (alpha code needs testing)
anders
parents: 3195
diff changeset
191 for(i=1;i<len;i++){
d6ea11bed983 Commandline interface to ao_plugin updated according to mplayers complex parameter format and plugin pl_format finished (alpha code needs testing)
anders
parents: 3195
diff changeset
192 s=((uint32_t*)in_data)[i];
d6ea11bed983 Commandline interface to ao_plugin updated according to mplayers complex parameter format and plugin pl_format finished (alpha code needs testing)
anders
parents: 3195
diff changeset
193 ((uint32_t*)in_data)[i]=(uint32_t)(((s&0x000000FF)<<24) | ((s&0x0000FF00)<<8) |
d6ea11bed983 Commandline interface to ao_plugin updated according to mplayers complex parameter format and plugin pl_format finished (alpha code needs testing)
anders
parents: 3195
diff changeset
194 ((s&0x00FF0000)>>8) | ((s&0xFF000000)>>24));
3194
1648d11fc36c commandline configuration of audio plugins now through struct, format conversion plugin added
anders
parents:
diff changeset
195 }
1648d11fc36c commandline configuration of audio plugins now through struct, format conversion plugin added
anders
parents:
diff changeset
196 }
3309
28f2ebcb5c95 Format plugin now with working switch statements
anders
parents: 3279
diff changeset
197 break;
3194
1648d11fc36c commandline configuration of audio plugins now through struct, format conversion plugin added
anders
parents:
diff changeset
198 }
1648d11fc36c commandline configuration of audio plugins now through struct, format conversion plugin added
anders
parents:
diff changeset
199 }
3279
d6ea11bed983 Commandline interface to ao_plugin updated according to mplayers complex parameter format and plugin pl_format finished (alpha code needs testing)
anders
parents: 3195
diff changeset
200 // Change signed/unsigned
d6ea11bed983 Commandline interface to ao_plugin updated according to mplayers complex parameter format and plugin pl_format finished (alpha code needs testing)
anders
parents: 3195
diff changeset
201 if((pl_format.in&SIGN_MASK) != (pl_format.out&SIGN_MASK)){
3309
28f2ebcb5c95 Format plugin now with working switch statements
anders
parents: 3279
diff changeset
202 switch((pl_format.in&NBITS_MASK)){
28f2ebcb5c95 Format plugin now with working switch statements
anders
parents: 3279
diff changeset
203 case(B08):
3279
d6ea11bed983 Commandline interface to ao_plugin updated according to mplayers complex parameter format and plugin pl_format finished (alpha code needs testing)
anders
parents: 3195
diff changeset
204 switch(pl_format.in&SIGN_MASK){
3309
28f2ebcb5c95 Format plugin now with working switch statements
anders
parents: 3279
diff changeset
205 case(US):
3279
d6ea11bed983 Commandline interface to ao_plugin updated according to mplayers complex parameter format and plugin pl_format finished (alpha code needs testing)
anders
parents: 3195
diff changeset
206 for(i=0;i<len;i++)
3309
28f2ebcb5c95 Format plugin now with working switch statements
anders
parents: 3279
diff changeset
207 ((int8_t*)in_data)[i]=(int8_t)(-127+((int)((uint8_t*)in_data)[i]));
3279
d6ea11bed983 Commandline interface to ao_plugin updated according to mplayers complex parameter format and plugin pl_format finished (alpha code needs testing)
anders
parents: 3195
diff changeset
208 break;
3309
28f2ebcb5c95 Format plugin now with working switch statements
anders
parents: 3279
diff changeset
209 case(SI):
3279
d6ea11bed983 Commandline interface to ao_plugin updated according to mplayers complex parameter format and plugin pl_format finished (alpha code needs testing)
anders
parents: 3195
diff changeset
210 for(i=0;i<len;i++)
3309
28f2ebcb5c95 Format plugin now with working switch statements
anders
parents: 3279
diff changeset
211 ((uint8_t*)in_data)[i]=(uint8_t)(+128+((int)((int8_t*)in_data)[i]));
3279
d6ea11bed983 Commandline interface to ao_plugin updated according to mplayers complex parameter format and plugin pl_format finished (alpha code needs testing)
anders
parents: 3195
diff changeset
212 break;
d6ea11bed983 Commandline interface to ao_plugin updated according to mplayers complex parameter format and plugin pl_format finished (alpha code needs testing)
anders
parents: 3195
diff changeset
213 }
d6ea11bed983 Commandline interface to ao_plugin updated according to mplayers complex parameter format and plugin pl_format finished (alpha code needs testing)
anders
parents: 3195
diff changeset
214 break;
3309
28f2ebcb5c95 Format plugin now with working switch statements
anders
parents: 3279
diff changeset
215 case(B16):
3279
d6ea11bed983 Commandline interface to ao_plugin updated according to mplayers complex parameter format and plugin pl_format finished (alpha code needs testing)
anders
parents: 3195
diff changeset
216 switch(pl_format.in&SIGN_MASK){
3309
28f2ebcb5c95 Format plugin now with working switch statements
anders
parents: 3279
diff changeset
217 case(US):
3279
d6ea11bed983 Commandline interface to ao_plugin updated according to mplayers complex parameter format and plugin pl_format finished (alpha code needs testing)
anders
parents: 3195
diff changeset
218 for(i=0;i<len;i++)
d6ea11bed983 Commandline interface to ao_plugin updated according to mplayers complex parameter format and plugin pl_format finished (alpha code needs testing)
anders
parents: 3195
diff changeset
219 ((int16_t*)in_data)[i]=(int16_t)(-32767+((int)((uint16_t*)in_data)[i]));
d6ea11bed983 Commandline interface to ao_plugin updated according to mplayers complex parameter format and plugin pl_format finished (alpha code needs testing)
anders
parents: 3195
diff changeset
220 break;
3309
28f2ebcb5c95 Format plugin now with working switch statements
anders
parents: 3279
diff changeset
221 case(SI):
3279
d6ea11bed983 Commandline interface to ao_plugin updated according to mplayers complex parameter format and plugin pl_format finished (alpha code needs testing)
anders
parents: 3195
diff changeset
222 for(i=0;i<len;i++)
3309
28f2ebcb5c95 Format plugin now with working switch statements
anders
parents: 3279
diff changeset
223 ((uint16_t*)in_data)[i]=(uint16_t)(+32768+((int)((int16_t*)in_data)[i]));
3279
d6ea11bed983 Commandline interface to ao_plugin updated according to mplayers complex parameter format and plugin pl_format finished (alpha code needs testing)
anders
parents: 3195
diff changeset
224 break;
d6ea11bed983 Commandline interface to ao_plugin updated according to mplayers complex parameter format and plugin pl_format finished (alpha code needs testing)
anders
parents: 3195
diff changeset
225 }
d6ea11bed983 Commandline interface to ao_plugin updated according to mplayers complex parameter format and plugin pl_format finished (alpha code needs testing)
anders
parents: 3195
diff changeset
226 break;
3309
28f2ebcb5c95 Format plugin now with working switch statements
anders
parents: 3279
diff changeset
227 case(B32):
3279
d6ea11bed983 Commandline interface to ao_plugin updated according to mplayers complex parameter format and plugin pl_format finished (alpha code needs testing)
anders
parents: 3195
diff changeset
228 switch(pl_format.in&SIGN_MASK){
3309
28f2ebcb5c95 Format plugin now with working switch statements
anders
parents: 3279
diff changeset
229 case(US):
3279
d6ea11bed983 Commandline interface to ao_plugin updated according to mplayers complex parameter format and plugin pl_format finished (alpha code needs testing)
anders
parents: 3195
diff changeset
230 for(i=0;i<len;i++)
9217
420e2b2f8e5a compiler warning fixes patch by Dominik Mierzejewski <dominik@rangers.eu.org>
arpi
parents: 7075
diff changeset
231 ((int32_t*)in_data)[i]=(int32_t)(((uint32_t*)in_data)[i]-0x80000000);
3279
d6ea11bed983 Commandline interface to ao_plugin updated according to mplayers complex parameter format and plugin pl_format finished (alpha code needs testing)
anders
parents: 3195
diff changeset
232 break;
3309
28f2ebcb5c95 Format plugin now with working switch statements
anders
parents: 3279
diff changeset
233 case(SI):
3279
d6ea11bed983 Commandline interface to ao_plugin updated according to mplayers complex parameter format and plugin pl_format finished (alpha code needs testing)
anders
parents: 3195
diff changeset
234 for(i=0;i<len;i++)
3309
28f2ebcb5c95 Format plugin now with working switch statements
anders
parents: 3279
diff changeset
235 ((uint32_t*)in_data)[i]=(uint32_t)(+(1<<31)+((int32_t*)in_data)[i]);
3279
d6ea11bed983 Commandline interface to ao_plugin updated according to mplayers complex parameter format and plugin pl_format finished (alpha code needs testing)
anders
parents: 3195
diff changeset
236 break;
d6ea11bed983 Commandline interface to ao_plugin updated according to mplayers complex parameter format and plugin pl_format finished (alpha code needs testing)
anders
parents: 3195
diff changeset
237 }
d6ea11bed983 Commandline interface to ao_plugin updated according to mplayers complex parameter format and plugin pl_format finished (alpha code needs testing)
anders
parents: 3195
diff changeset
238 break;
3309
28f2ebcb5c95 Format plugin now with working switch statements
anders
parents: 3279
diff changeset
239 }
3279
d6ea11bed983 Commandline interface to ao_plugin updated according to mplayers complex parameter format and plugin pl_format finished (alpha code needs testing)
anders
parents: 3195
diff changeset
240 }
d6ea11bed983 Commandline interface to ao_plugin updated according to mplayers complex parameter format and plugin pl_format finished (alpha code needs testing)
anders
parents: 3195
diff changeset
241 // Change the number of bits
d6ea11bed983 Commandline interface to ao_plugin updated according to mplayers complex parameter format and plugin pl_format finished (alpha code needs testing)
anders
parents: 3195
diff changeset
242 if((pl_format.in&NBITS_MASK) == (pl_format.out&NBITS_MASK)){
d6ea11bed983 Commandline interface to ao_plugin updated according to mplayers complex parameter format and plugin pl_format finished (alpha code needs testing)
anders
parents: 3195
diff changeset
243 int sz=(int)((double)ao_plugin_data.len/pl_format.sz_mult);
d6ea11bed983 Commandline interface to ao_plugin updated according to mplayers complex parameter format and plugin pl_format finished (alpha code needs testing)
anders
parents: 3195
diff changeset
244 for(i=0;i<sz;i++)
d6ea11bed983 Commandline interface to ao_plugin updated according to mplayers complex parameter format and plugin pl_format finished (alpha code needs testing)
anders
parents: 3195
diff changeset
245 ((char*)out_data)[i]=((char*)in_data)[i];
d6ea11bed983 Commandline interface to ao_plugin updated according to mplayers complex parameter format and plugin pl_format finished (alpha code needs testing)
anders
parents: 3195
diff changeset
246 } else {
d6ea11bed983 Commandline interface to ao_plugin updated according to mplayers complex parameter format and plugin pl_format finished (alpha code needs testing)
anders
parents: 3195
diff changeset
247 switch(pl_format.in&NBITS_MASK){
3309
28f2ebcb5c95 Format plugin now with working switch statements
anders
parents: 3279
diff changeset
248 case(B08):
3279
d6ea11bed983 Commandline interface to ao_plugin updated according to mplayers complex parameter format and plugin pl_format finished (alpha code needs testing)
anders
parents: 3195
diff changeset
249 switch(pl_format.out&NBITS_MASK){
3309
28f2ebcb5c95 Format plugin now with working switch statements
anders
parents: 3279
diff changeset
250 case(B16):
3279
d6ea11bed983 Commandline interface to ao_plugin updated according to mplayers complex parameter format and plugin pl_format finished (alpha code needs testing)
anders
parents: 3195
diff changeset
251 for(i=1;i<len;i++)
d6ea11bed983 Commandline interface to ao_plugin updated according to mplayers complex parameter format and plugin pl_format finished (alpha code needs testing)
anders
parents: 3195
diff changeset
252 ((uint16_t*)out_data)[i]=((uint16_t)((uint8_t*)in_data)[i])<<8;
d6ea11bed983 Commandline interface to ao_plugin updated according to mplayers complex parameter format and plugin pl_format finished (alpha code needs testing)
anders
parents: 3195
diff changeset
253 break;
3309
28f2ebcb5c95 Format plugin now with working switch statements
anders
parents: 3279
diff changeset
254 case(B32):
3279
d6ea11bed983 Commandline interface to ao_plugin updated according to mplayers complex parameter format and plugin pl_format finished (alpha code needs testing)
anders
parents: 3195
diff changeset
255 for(i=1;i<len;i++)
d6ea11bed983 Commandline interface to ao_plugin updated according to mplayers complex parameter format and plugin pl_format finished (alpha code needs testing)
anders
parents: 3195
diff changeset
256 ((uint32_t*)out_data)[i]=((uint32_t)((uint8_t*)in_data)[i])<<24;
d6ea11bed983 Commandline interface to ao_plugin updated according to mplayers complex parameter format and plugin pl_format finished (alpha code needs testing)
anders
parents: 3195
diff changeset
257 break;
d6ea11bed983 Commandline interface to ao_plugin updated according to mplayers complex parameter format and plugin pl_format finished (alpha code needs testing)
anders
parents: 3195
diff changeset
258 }
3309
28f2ebcb5c95 Format plugin now with working switch statements
anders
parents: 3279
diff changeset
259 break;
28f2ebcb5c95 Format plugin now with working switch statements
anders
parents: 3279
diff changeset
260 case(B16):
3279
d6ea11bed983 Commandline interface to ao_plugin updated according to mplayers complex parameter format and plugin pl_format finished (alpha code needs testing)
anders
parents: 3195
diff changeset
261 switch(pl_format.out&NBITS_MASK){
3309
28f2ebcb5c95 Format plugin now with working switch statements
anders
parents: 3279
diff changeset
262 case(B08):
3279
d6ea11bed983 Commandline interface to ao_plugin updated according to mplayers complex parameter format and plugin pl_format finished (alpha code needs testing)
anders
parents: 3195
diff changeset
263 for(i=0;i<len;i++)
d6ea11bed983 Commandline interface to ao_plugin updated according to mplayers complex parameter format and plugin pl_format finished (alpha code needs testing)
anders
parents: 3195
diff changeset
264 ((uint8_t*)out_data)[i]=(uint8_t)((((uint16_t*)in_data)[i])>>8);
d6ea11bed983 Commandline interface to ao_plugin updated according to mplayers complex parameter format and plugin pl_format finished (alpha code needs testing)
anders
parents: 3195
diff changeset
265 break;
3309
28f2ebcb5c95 Format plugin now with working switch statements
anders
parents: 3279
diff changeset
266 case(B32):
3279
d6ea11bed983 Commandline interface to ao_plugin updated according to mplayers complex parameter format and plugin pl_format finished (alpha code needs testing)
anders
parents: 3195
diff changeset
267 for(i=1;i<len;i++)
d6ea11bed983 Commandline interface to ao_plugin updated according to mplayers complex parameter format and plugin pl_format finished (alpha code needs testing)
anders
parents: 3195
diff changeset
268 ((uint32_t*)out_data)[i]=((uint32_t)((uint16_t*)in_data)[i])<<16;
d6ea11bed983 Commandline interface to ao_plugin updated according to mplayers complex parameter format and plugin pl_format finished (alpha code needs testing)
anders
parents: 3195
diff changeset
269 break;
d6ea11bed983 Commandline interface to ao_plugin updated according to mplayers complex parameter format and plugin pl_format finished (alpha code needs testing)
anders
parents: 3195
diff changeset
270 }
3309
28f2ebcb5c95 Format plugin now with working switch statements
anders
parents: 3279
diff changeset
271 break;
28f2ebcb5c95 Format plugin now with working switch statements
anders
parents: 3279
diff changeset
272 case(B32):
3279
d6ea11bed983 Commandline interface to ao_plugin updated according to mplayers complex parameter format and plugin pl_format finished (alpha code needs testing)
anders
parents: 3195
diff changeset
273 switch(pl_format.out&NBITS_MASK){
3309
28f2ebcb5c95 Format plugin now with working switch statements
anders
parents: 3279
diff changeset
274 case(B08):
3279
d6ea11bed983 Commandline interface to ao_plugin updated according to mplayers complex parameter format and plugin pl_format finished (alpha code needs testing)
anders
parents: 3195
diff changeset
275 for(i=0;i<len;i++)
d6ea11bed983 Commandline interface to ao_plugin updated according to mplayers complex parameter format and plugin pl_format finished (alpha code needs testing)
anders
parents: 3195
diff changeset
276 ((uint8_t*)out_data)[i]=(uint8_t)((((uint32_t*)in_data)[i])>>24);
d6ea11bed983 Commandline interface to ao_plugin updated according to mplayers complex parameter format and plugin pl_format finished (alpha code needs testing)
anders
parents: 3195
diff changeset
277 break;
3309
28f2ebcb5c95 Format plugin now with working switch statements
anders
parents: 3279
diff changeset
278 case(B16):
3279
d6ea11bed983 Commandline interface to ao_plugin updated according to mplayers complex parameter format and plugin pl_format finished (alpha code needs testing)
anders
parents: 3195
diff changeset
279 for(i=1;i<len;i++)
d6ea11bed983 Commandline interface to ao_plugin updated according to mplayers complex parameter format and plugin pl_format finished (alpha code needs testing)
anders
parents: 3195
diff changeset
280 ((uint16_t*)out_data)[i]=(uint16_t)((((uint32_t*)in_data)[i])>>16);
d6ea11bed983 Commandline interface to ao_plugin updated according to mplayers complex parameter format and plugin pl_format finished (alpha code needs testing)
anders
parents: 3195
diff changeset
281 break;
d6ea11bed983 Commandline interface to ao_plugin updated according to mplayers complex parameter format and plugin pl_format finished (alpha code needs testing)
anders
parents: 3195
diff changeset
282 }
3309
28f2ebcb5c95 Format plugin now with working switch statements
anders
parents: 3279
diff changeset
283 break;
3279
d6ea11bed983 Commandline interface to ao_plugin updated according to mplayers complex parameter format and plugin pl_format finished (alpha code needs testing)
anders
parents: 3195
diff changeset
284 }
d6ea11bed983 Commandline interface to ao_plugin updated according to mplayers complex parameter format and plugin pl_format finished (alpha code needs testing)
anders
parents: 3195
diff changeset
285 }
d6ea11bed983 Commandline interface to ao_plugin updated according to mplayers complex parameter format and plugin pl_format finished (alpha code needs testing)
anders
parents: 3195
diff changeset
286 // Switch to the correct endainess (agiain the problem with sun?)
d6ea11bed983 Commandline interface to ao_plugin updated according to mplayers complex parameter format and plugin pl_format finished (alpha code needs testing)
anders
parents: 3195
diff changeset
287 if((pl_format.out&END_MASK)!=LE){
d6ea11bed983 Commandline interface to ao_plugin updated according to mplayers complex parameter format and plugin pl_format finished (alpha code needs testing)
anders
parents: 3195
diff changeset
288 switch(pl_format.in&NBITS_MASK){
d6ea11bed983 Commandline interface to ao_plugin updated according to mplayers complex parameter format and plugin pl_format finished (alpha code needs testing)
anders
parents: 3195
diff changeset
289 case(B16):{
d6ea11bed983 Commandline interface to ao_plugin updated according to mplayers complex parameter format and plugin pl_format finished (alpha code needs testing)
anders
parents: 3195
diff changeset
290 register uint16_t s;
d6ea11bed983 Commandline interface to ao_plugin updated according to mplayers complex parameter format and plugin pl_format finished (alpha code needs testing)
anders
parents: 3195
diff changeset
291 for(i=1;i<len;i++){
d6ea11bed983 Commandline interface to ao_plugin updated according to mplayers complex parameter format and plugin pl_format finished (alpha code needs testing)
anders
parents: 3195
diff changeset
292 s=((uint16_t*)out_data)[i];
d6ea11bed983 Commandline interface to ao_plugin updated according to mplayers complex parameter format and plugin pl_format finished (alpha code needs testing)
anders
parents: 3195
diff changeset
293 ((uint16_t*)out_data)[i]=(uint16_t)(((s&0x00FF)<<8) | (s&0xFF00)>>8);
d6ea11bed983 Commandline interface to ao_plugin updated according to mplayers complex parameter format and plugin pl_format finished (alpha code needs testing)
anders
parents: 3195
diff changeset
294 }
d6ea11bed983 Commandline interface to ao_plugin updated according to mplayers complex parameter format and plugin pl_format finished (alpha code needs testing)
anders
parents: 3195
diff changeset
295 }
3309
28f2ebcb5c95 Format plugin now with working switch statements
anders
parents: 3279
diff changeset
296 break;
3279
d6ea11bed983 Commandline interface to ao_plugin updated according to mplayers complex parameter format and plugin pl_format finished (alpha code needs testing)
anders
parents: 3195
diff changeset
297 case(B32):{
d6ea11bed983 Commandline interface to ao_plugin updated according to mplayers complex parameter format and plugin pl_format finished (alpha code needs testing)
anders
parents: 3195
diff changeset
298 register uint32_t s;
d6ea11bed983 Commandline interface to ao_plugin updated according to mplayers complex parameter format and plugin pl_format finished (alpha code needs testing)
anders
parents: 3195
diff changeset
299 for(i=1;i<len;i++){
d6ea11bed983 Commandline interface to ao_plugin updated according to mplayers complex parameter format and plugin pl_format finished (alpha code needs testing)
anders
parents: 3195
diff changeset
300 s=((uint32_t*)out_data)[i];
d6ea11bed983 Commandline interface to ao_plugin updated according to mplayers complex parameter format and plugin pl_format finished (alpha code needs testing)
anders
parents: 3195
diff changeset
301 ((uint32_t*)out_data)[i]=(uint32_t)(((s&0x000000FF)<<24) | ((s&0x0000FF00)<<8) |
d6ea11bed983 Commandline interface to ao_plugin updated according to mplayers complex parameter format and plugin pl_format finished (alpha code needs testing)
anders
parents: 3195
diff changeset
302 ((s&0x00FF0000)>>8) | ((s&0xFF000000)>>24));
d6ea11bed983 Commandline interface to ao_plugin updated according to mplayers complex parameter format and plugin pl_format finished (alpha code needs testing)
anders
parents: 3195
diff changeset
303 }
d6ea11bed983 Commandline interface to ao_plugin updated according to mplayers complex parameter format and plugin pl_format finished (alpha code needs testing)
anders
parents: 3195
diff changeset
304 }
3309
28f2ebcb5c95 Format plugin now with working switch statements
anders
parents: 3279
diff changeset
305 break;
3279
d6ea11bed983 Commandline interface to ao_plugin updated according to mplayers complex parameter format and plugin pl_format finished (alpha code needs testing)
anders
parents: 3195
diff changeset
306 }
d6ea11bed983 Commandline interface to ao_plugin updated according to mplayers complex parameter format and plugin pl_format finished (alpha code needs testing)
anders
parents: 3195
diff changeset
307 }
d6ea11bed983 Commandline interface to ao_plugin updated according to mplayers complex parameter format and plugin pl_format finished (alpha code needs testing)
anders
parents: 3195
diff changeset
308 ao_plugin_data.data=out_data;
3194
1648d11fc36c commandline configuration of audio plugins now through struct, format conversion plugin added
anders
parents:
diff changeset
309 return 1;
1648d11fc36c commandline configuration of audio plugins now through struct, format conversion plugin added
anders
parents:
diff changeset
310 }
1648d11fc36c commandline configuration of audio plugins now through struct, format conversion plugin added
anders
parents:
diff changeset
311
1648d11fc36c commandline configuration of audio plugins now through struct, format conversion plugin added
anders
parents:
diff changeset
312
1648d11fc36c commandline configuration of audio plugins now through struct, format conversion plugin added
anders
parents:
diff changeset
313
3279
d6ea11bed983 Commandline interface to ao_plugin updated according to mplayers complex parameter format and plugin pl_format finished (alpha code needs testing)
anders
parents: 3195
diff changeset
314
d6ea11bed983 Commandline interface to ao_plugin updated according to mplayers complex parameter format and plugin pl_format finished (alpha code needs testing)
anders
parents: 3195
diff changeset
315