summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorChristian Hoene <christian.hoene@symonics.com>2016-05-12 11:24:25 +0200
committerChristian Hoene <christian.hoene@symonics.com>2016-05-12 11:24:25 +0200
commita2713e0da4a884373b42b5d6672101c61bf443d2 (patch)
tree443e89efb0e597d5c4e220f8c183fca70af763a1 /modules
parent0b67d2c0c57a9a247e3e4fc3b39d8f23e21ee342 (diff)
debug output pretty print
Diffstat (limited to 'modules')
-rw-r--r--modules/mpa/decode.c40
-rw-r--r--modules/mpa/encode.c20
2 files changed, 30 insertions, 30 deletions
diff --git a/modules/mpa/decode.c b/modules/mpa/decode.c
index e862a1e..6ad1ffb 100644
--- a/modules/mpa/decode.c
+++ b/modules/mpa/decode.c
@@ -30,7 +30,7 @@ static void destructor(void *arg)
mpg123_close(ads->dec);
mpg123_delete(ads->dec);
#ifdef DEBUG
- debug("mpa: decoder destroyed\n");
+ debug("MPA dec destroyed\n");
#endif
}
@@ -47,7 +47,7 @@ int mpa_decode_update(struct audec_state **adsp, const struct aucodec *ac,
ads = *adsp;
#ifdef DEBUG
- debug("mpa: decoder created %s\n",fmtp);
+ debug("MPA dec created %s\n",fmtp);
#endif
if (ads)
@@ -73,8 +73,8 @@ int mpa_decode_update(struct audec_state **adsp, const struct aucodec *ac,
#else
result = mpg123_param(ads->dec, MPG123_VERBOSE, 0, 0.);
#endif
- if (result != MPG123_OK) {
- error("MPA libmpg123 param error %s\n",
+ if ( result != MPG123_OK) {
+ error("MPA dec param error %s\n",
mpg123_plain_strerror(result));
err = EINVAL;
goto out;
@@ -82,16 +82,16 @@ int mpa_decode_update(struct audec_state **adsp, const struct aucodec *ac,
result = mpg123_format_all(ads->dec);
- if (result != MPG123_OK) {
- error("MPA libmpg123 format error %s\n",
+ if ( result != MPG123_OK) {
+ error("MPA dec format error %s\n",
mpg123_plain_strerror(result));
err = EINVAL;
goto out;
}
result = mpg123_open_feed(ads->dec);
- if (result != MPG123_OK) {
- error("MPA libmpg123 open feed error %s\n",
+ if ( result != MPG123_OK) {
+ error("MPA dec open feed error %s\n",
mpg123_plain_strerror(result));
err = EINVAL;
goto out;
@@ -118,32 +118,32 @@ int mpa_decode_frm(struct audec_state *ads, int16_t *sampv, size_t *sampc,
spx_uint32_t out_len;
#ifdef DEBUG
- info("mpa decode start %d %ld\n",len, *sampc);
+ debug("MPA dec start %d %ld\n",len, *sampc);
#endif
if (!ads || !sampv || !sampc || !buf || len<=4)
return EINVAL;
if(*(uint32_t*)buf != 0) {
- error("MPA header is not zero %08X, not supported yet\n",
+ error("MPA dec header is not zero %08X, not supported yet\n",
*(uint32_t*)buf);
return EPROTO;
}
- n = 0;
- result = mpg123_decode(ads->dec, buf+4, len-4,
+ n = 0;
+ result = mpg123_decode(ads->dec, buf+4, len-4,
(unsigned char*)ads->intermediate_buffer,
sizeof(ads->intermediate_buffer), &n);
/* n counts bytes */
#ifdef DEBUG
- info("mpa decoded %d %d %d %d\n",result, len-4, n, ads->channels);
+ debug("MPA dec %d %d %d %d\n",result, len-4, n, ads->channels);
#endif
if (result == MPG123_NEW_FORMAT) {
mpg123_getformat(ads->dec, &samplerate, &channels, &encoding);
- info("MPA libmpg123 format change %d %d %04X\n",samplerate
+ info("MPA dec format change %d %d %04X\n",samplerate
,channels,encoding);
ads->channels = channels;
@@ -155,17 +155,17 @@ int mpa_decode_frm(struct audec_state *ads, int16_t *sampv, size_t *sampc,
samplerate, 48000, 3, &result);
if (result!=RESAMPLER_ERR_SUCCESS
|| ads->resampler==NULL) {
- error("mpa: upsampler failed %d\n",result);
+ error("MPA dec upsampler failed %d\n",result);
return EINVAL;
}
}
else
ads->resampler = NULL;
}
- else if (result == MPG123_NEED_MORE) ;
-// return 0;
+ else if (result == MPG123_NEED_MORE)
+ ; /* workaround: do nothing */
else if (result != MPG123_OK) {
- error("MPA libmpg123 feed error %d %s\n", result,
+ error("MPA dec feed error %d %s\n", result,
mpg123_plain_strerror(result));
return EPROTO;
}
@@ -179,7 +179,7 @@ int mpa_decode_frm(struct audec_state *ads, int16_t *sampv, size_t *sampc,
ads->resampler, ads->intermediate_buffer,
&intermediate_len, sampv, &out_len);
if (result!=RESAMPLER_ERR_SUCCESS) {
- error("mpa: upsample error: %s %d %d\n",
+ error("MPA dec upsample error: %s %d %d\n",
strerror(result), out_len, *sampc/2);
return EPROTO;
}
@@ -205,7 +205,7 @@ int mpa_decode_frm(struct audec_state *ads, int16_t *sampv, size_t *sampc,
}
#ifdef DEBUG
- info("mpa decode done %d\n",*sampc);
+ debug("MPA dec done %d\n",*sampc);
#endif
}
diff --git a/modules/mpa/encode.c b/modules/mpa/encode.c
index 8e903a0..396b893 100644
--- a/modules/mpa/encode.c
+++ b/modules/mpa/encode.c
@@ -31,7 +31,7 @@ static void destructor(void *arg)
if (aes->enc)
twolame_close(&aes->enc);
#ifdef DEBUG
- info("mpa encode destroyed\n");
+ debug("MPA enc destroyed\n");
#endif
}
@@ -55,13 +55,13 @@ int mpa_encode_update(struct auenc_state **aesp, const struct aucodec *ac,
aes = mem_zalloc(sizeof(*aes), destructor);
aes->enc = twolame_init();
if (!aes->enc) {
- error("mpa: encoder create failed\n");
+ error("MPA enc create failed\n");
mem_deref(aes);
return ENOMEM;
}
aes->channels = ac->ch;
#ifdef DEBUG
- info("mpa: encoder created %s\n",fmtp);
+ debug("MPA enc created %s\n",fmtp);
#endif
prm.samplerate = 32000;
@@ -89,14 +89,14 @@ int mpa_encode_update(struct auenc_state **aesp, const struct aucodec *ac,
result |= twolame_set_out_samplerate(aes->enc, prm.samplerate);
result |= twolame_set_num_channels(aes->enc, 2);
if (result!=0) {
- error("mpa: encoder set failed\n");
+ error("MPA enc set failed\n");
err=EINVAL;
goto out;
}
result = twolame_init_params(aes->enc);
if (result!=0) {
- error("mpa: encoder init params failed\n");
+ error("MPA enc init params failed\n");
err=EINVAL;
goto out;
}
@@ -107,7 +107,7 @@ int mpa_encode_update(struct auenc_state **aesp, const struct aucodec *ac,
aes->resampler = speex_resampler_init(2, 48000,
prm.samplerate, 3, &result);
if (result!=RESAMPLER_ERR_SUCCESS) {
- error("mpa: resampler init failed %d\n",result);
+ error("MPA enc resampler init failed %d\n",result);
err=EINVAL;
goto out;
}
@@ -143,7 +143,7 @@ int mpa_encode_frm(struct auenc_state *aes, uint8_t *buf, size_t *len,
sampv, &in_len, aes->intermediate_buffer,
&intermediate_len);
if (n!=RESAMPLER_ERR_SUCCESS || in_len != sampc/2) {
- warning("mpa: downsample error: %s %d %d\n",
+ error("MPA enc downsample error: %s %d %d\n",
strerror(n), in_len, sampc/2);
return EPROTO;
}
@@ -151,7 +151,7 @@ int mpa_encode_frm(struct auenc_state *aes, uint8_t *buf, size_t *len,
aes->intermediate_buffer, intermediate_len,
buf+4, (*len)-4);
#ifdef DEBUG
- info("mpa encode %d %d %d %d %d\n",intermediate_len,sampc,
+ debug("MPA enc %d %d %d %d %d\n",intermediate_len,sampc,
aes->channels,*len,n);
#endif
}
@@ -160,7 +160,7 @@ int mpa_encode_frm(struct auenc_state *aes, uint8_t *buf, size_t *len,
(int)(sampc/2), buf+4, (*len)-4);
if (n < 0) {
- error("mpa: encode error: %s\n", strerror((int)n));
+ error("MPA enc error %s\n", strerror((int)n));
return EPROTO;
}
@@ -172,7 +172,7 @@ int mpa_encode_frm(struct auenc_state *aes, uint8_t *buf, size_t *len,
*len = 0;
#ifdef DEBUG
- info("mpa encode %d %d %d %d\n",sampc,aes->channels,*len,n);
+ debug("MPA enc done %d %d %d %d\n",sampc,aes->channels,*len,n);
#endif
return 0;
}