Mercurial > mplayer.hg
comparison libaf/af_format.c @ 14399:1a882e2a419b
af_fmt2str fixes (remove trailing space, call with size of buffer, not size-1)
author | reimar |
---|---|
date | Thu, 06 Jan 2005 14:32:08 +0000 |
parents | 8380694ba14f |
children | 95bb94a930a3 |
comparison
equal
deleted
inserted
replaced
14398:889b6b99b1b8 | 14399:1a882e2a419b |
---|---|
162 i+=snprintf(&str[i],size-i,"signed "); | 162 i+=snprintf(&str[i],size-i,"signed "); |
163 | 163 |
164 i+=snprintf(&str[i],size-i,"int "); | 164 i+=snprintf(&str[i],size-i,"int "); |
165 } | 165 } |
166 } | 166 } |
167 // remove trailing space | |
168 if (i > 0 && str[i - 1] == ' ') | |
169 i--; | |
167 str[i] = 0; // make sure it is 0 terminated. | 170 str[i] = 0; // make sure it is 0 terminated. |
168 return str; | 171 return str; |
169 } | 172 } |
170 | 173 |
171 char *af_fmt2str_short(int format) | 174 char *af_fmt2str_short(int format) |
266 switch(format & AF_FORMAT_SPECIAL_MASK){ | 269 switch(format & AF_FORMAT_SPECIAL_MASK){ |
267 case(AF_FORMAT_IMA_ADPCM): | 270 case(AF_FORMAT_IMA_ADPCM): |
268 case(AF_FORMAT_MPEG2): | 271 case(AF_FORMAT_MPEG2): |
269 case(AF_FORMAT_AC3): | 272 case(AF_FORMAT_AC3): |
270 af_msg(AF_MSG_ERROR,"[format] Sample format %s not yet supported \n", | 273 af_msg(AF_MSG_ERROR,"[format] Sample format %s not yet supported \n", |
271 af_fmt2str(format,buf,255)); | 274 af_fmt2str(format,buf,256)); |
272 return AF_ERROR; | 275 return AF_ERROR; |
273 } | 276 } |
274 return AF_OK; | 277 return AF_OK; |
275 } | 278 } |
276 | 279 |
293 (AF_OK != check_format(((af_data_t*)arg)->format)) || | 296 (AF_OK != check_format(((af_data_t*)arg)->format)) || |
294 (AF_OK != check_bps(af->data->bps)) || | 297 (AF_OK != check_bps(af->data->bps)) || |
295 (AF_OK != check_format(af->data->format))) | 298 (AF_OK != check_format(af->data->format))) |
296 return AF_ERROR; | 299 return AF_ERROR; |
297 | 300 |
298 af_msg(AF_MSG_VERBOSE,"[format] Changing sample format from %sto %s \n", | 301 af_msg(AF_MSG_VERBOSE,"[format] Changing sample format from %s to %s\n", |
299 af_fmt2str(((af_data_t*)arg)->format,buf1,255), | 302 af_fmt2str(((af_data_t*)arg)->format,buf1,256), |
300 af_fmt2str(af->data->format,buf2,255)); | 303 af_fmt2str(af->data->format,buf2,256)); |
301 | 304 |
302 af->data->rate = ((af_data_t*)arg)->rate; | 305 af->data->rate = ((af_data_t*)arg)->rate; |
303 af->data->nch = ((af_data_t*)arg)->nch; | 306 af->data->nch = ((af_data_t*)arg)->nch; |
304 af->mul.n = af->data->bps; | 307 af->mul.n = af->data->bps; |
305 af->mul.d = ((af_data_t*)arg)->bps; | 308 af->mul.d = ((af_data_t*)arg)->bps; |
314 af->play = play_swapendian; | 317 af->play = play_swapendian; |
315 } | 318 } |
316 if ((data->format == AF_FORMAT_FLOAT_NE) && | 319 if ((data->format == AF_FORMAT_FLOAT_NE) && |
317 (af->data->format == AF_FORMAT_S16_NE)) | 320 (af->data->format == AF_FORMAT_S16_NE)) |
318 { | 321 { |
319 af_msg(AF_MSG_VERBOSE,"[format] Accelerated %sto %sconversion\n", | 322 af_msg(AF_MSG_VERBOSE,"[format] Accelerated %s to %s conversion\n", |
320 af_fmt2str(((af_data_t*)arg)->format,buf1,255), | 323 af_fmt2str(((af_data_t*)arg)->format,buf1,256), |
321 af_fmt2str(af->data->format,buf2,255)); | 324 af_fmt2str(af->data->format,buf2,256)); |
322 af->play = play_float_s16; | 325 af->play = play_float_s16; |
323 } | 326 } |
324 if ((data->format == AF_FORMAT_S16_NE) && | 327 if ((data->format == AF_FORMAT_S16_NE) && |
325 (af->data->format == AF_FORMAT_FLOAT_NE)) | 328 (af->data->format == AF_FORMAT_FLOAT_NE)) |
326 { | 329 { |
327 af_msg(AF_MSG_VERBOSE,"[format] Accelerated %sto %sconversion\n", | 330 af_msg(AF_MSG_VERBOSE,"[format] Accelerated %s to %s conversion\n", |
328 af_fmt2str(((af_data_t*)arg)->format,buf1,255), | 331 af_fmt2str(((af_data_t*)arg)->format,buf1,256), |
329 af_fmt2str(af->data->format,buf2,255)); | 332 af_fmt2str(af->data->format,buf2,256)); |
330 af->play = play_s16_float; | 333 af->play = play_s16_float; |
331 } | 334 } |
332 return AF_OK; | 335 return AF_OK; |
333 } | 336 } |
334 case AF_CONTROL_COMMAND_LINE:{ | 337 case AF_CONTROL_COMMAND_LINE:{ |