comparison libaf/af_channels.c @ 29049:8c706ce21c6f

Remove af_msg special-casing API in libaf. Replace it by standard mp_msg message system.
author bircoph
date Sat, 28 Mar 2009 19:57:56 +0000
parents 72d0b1444141
children 0f1b5b68af32
comparison
equal deleted inserted replaced
29048:584ff003cce9 29049:8c706ce21c6f
106 tout+=outs; 106 tout+=outs;
107 } 107 }
108 break; 108 break;
109 } 109 }
110 default: 110 default:
111 af_msg(AF_MSG_ERROR,"[channels] Unsupported number of bytes/sample: %i" 111 mp_msg(MSGT_AFILTER, MSGL_ERR, "[channels] Unsupported number of bytes/sample: %i"
112 " please report this error on the MPlayer mailing list. \n",bps); 112 " please report this error on the MPlayer mailing list. \n",bps);
113 } 113 }
114 } 114 }
115 115
116 // Make sure the routes are sane 116 // Make sure the routes are sane
117 static int check_routes(af_channels_t* s, int nin, int nout) 117 static int check_routes(af_channels_t* s, int nin, int nout)
118 { 118 {
119 int i; 119 int i;
120 if((s->nr < 1) || (s->nr > AF_NCH)){ 120 if((s->nr < 1) || (s->nr > AF_NCH)){
121 af_msg(AF_MSG_ERROR,"[channels] The number of routing pairs must be" 121 mp_msg(MSGT_AFILTER, MSGL_ERR, "[channels] The number of routing pairs must be"
122 " between 1 and %i. Current value is %i\n",AF_NCH,s->nr); 122 " between 1 and %i. Current value is %i\n",AF_NCH,s->nr);
123 return AF_ERROR; 123 return AF_ERROR;
124 } 124 }
125 125
126 for(i=0;i<s->nr;i++){ 126 for(i=0;i<s->nr;i++){
127 if((s->route[i][FR] >= nin) || (s->route[i][TO] >= nout)){ 127 if((s->route[i][FR] >= nin) || (s->route[i][TO] >= nout)){
128 af_msg(AF_MSG_ERROR,"[channels] Invalid routing in pair nr. %i.\n", i); 128 mp_msg(MSGT_AFILTER, MSGL_ERR, "[channels] Invalid routing in pair nr. %i.\n", i);
129 return AF_ERROR; 129 return AF_ERROR;
130 } 130 }
131 } 131 }
132 return AF_OK; 132 return AF_OK;
133 } 133 }
178 if(s->nr){ 178 if(s->nr){
179 char* cp = &((char*)arg)[n]; 179 char* cp = &((char*)arg)[n];
180 int ch = 0; 180 int ch = 0;
181 // Sanity check 181 // Sanity check
182 if((s->nr < 1) || (s->nr > AF_NCH)){ 182 if((s->nr < 1) || (s->nr > AF_NCH)){
183 af_msg(AF_MSG_ERROR,"[channels] The number of routing pairs must be" 183 mp_msg(MSGT_AFILTER, MSGL_ERR, "[channels] The number of routing pairs must be"
184 " between 1 and %i. Current value is %i\n",AF_NCH,s->nr); 184 " between 1 and %i. Current value is %i\n",AF_NCH,s->nr);
185 } 185 }
186 s->router = 1; 186 s->router = 1;
187 // Scan for pairs on commandline 187 // Scan for pairs on commandline
188 while((*cp == ':') && (ch < s->nr)){ 188 while((*cp == ':') && (ch < s->nr)){
189 sscanf(cp, ":%i:%i%n" ,&s->route[ch][FR], &s->route[ch][TO], &n); 189 sscanf(cp, ":%i:%i%n" ,&s->route[ch][FR], &s->route[ch][TO], &n);
190 af_msg(AF_MSG_VERBOSE,"[channels] Routing from channel %i to" 190 mp_msg(MSGT_AFILTER, MSGL_V, "[channels] Routing from channel %i to"
191 " channel %i\n",s->route[ch][FR],s->route[ch][TO]); 191 " channel %i\n",s->route[ch][FR],s->route[ch][TO]);
192 cp = &cp[n]; 192 cp = &cp[n];
193 ch++; 193 ch++;
194 } 194 }
195 } 195 }
201 case AF_CONTROL_CHANNELS | AF_CONTROL_SET: 201 case AF_CONTROL_CHANNELS | AF_CONTROL_SET:
202 // Reinit must be called after this function has been called 202 // Reinit must be called after this function has been called
203 203
204 // Sanity check 204 // Sanity check
205 if(((int*)arg)[0] <= 0 || ((int*)arg)[0] > AF_NCH){ 205 if(((int*)arg)[0] <= 0 || ((int*)arg)[0] > AF_NCH){
206 af_msg(AF_MSG_ERROR,"[channels] The number of output channels must be" 206 mp_msg(MSGT_AFILTER, MSGL_ERR, "[channels] The number of output channels must be"
207 " between 1 and %i. Current value is %i\n",AF_NCH,((int*)arg)[0]); 207 " between 1 and %i. Current value is %i\n",AF_NCH,((int*)arg)[0]);
208 return AF_ERROR; 208 return AF_ERROR;
209 } 209 }
210 210
211 af->data->nch=((int*)arg)[0]; 211 af->data->nch=((int*)arg)[0];
212 if(!s->router) 212 if(!s->router)
213 af_msg(AF_MSG_VERBOSE,"[channels] Changing number of channels" 213 mp_msg(MSGT_AFILTER, MSGL_V, "[channels] Changing number of channels"
214 " to %i\n",af->data->nch); 214 " to %i\n",af->data->nch);
215 return AF_OK; 215 return AF_OK;
216 case AF_CONTROL_CHANNELS | AF_CONTROL_GET: 216 case AF_CONTROL_CHANNELS | AF_CONTROL_GET:
217 *(int*)arg = af->data->nch; 217 *(int*)arg = af->data->nch;
218 return AF_OK; 218 return AF_OK;