diff options
author | Tomas Kukosa <tomas.kukosa@siemens.com> | 2007-12-11 11:54:15 +0000 |
---|---|---|
committer | Tomas Kukosa <tomas.kukosa@siemens.com> | 2007-12-11 11:54:15 +0000 |
commit | 910c8f628197dbefadb5545ddf1a5943fa29567c (patch) | |
tree | d048dd37c707f4a892de4cf575acb1eb5dcc106f /plugins/easy_codec | |
parent | 2ce05b41ebe711d162540ba568243877552068d8 (diff) | |
download | wireshark-910c8f628197dbefadb5545ddf1a5943fa29567c.tar.gz |
From Ales Kocourek
example plugin updated
svn path=/trunk/; revision=23839
Diffstat (limited to 'plugins/easy_codec')
-rw-r--r-- | plugins/easy_codec/codec-g722.c | 6 | ||||
-rw-r--r-- | plugins/easy_codec/codec-g7231.c | 16 |
2 files changed, 11 insertions, 11 deletions
diff --git a/plugins/easy_codec/codec-g722.c b/plugins/easy_codec/codec-g722.c index 22a56f91ca..576d15a085 100644 --- a/plugins/easy_codec/codec-g722.c +++ b/plugins/easy_codec/codec-g722.c @@ -68,14 +68,14 @@ int codec_g722_decode(void *context, const void *input, int inputSizeBytes, void return 0; if (!output) - return (inputSizeBytes / L_G722_FRAME_COMPRESSED) * L_G722_FRAME * sizeof(short); + return (inputSizeBytes / L_G722_FRAME_COMPRESSED ) * L_G722_FRAME / 2 * sizeof(short) ; while ((inputSizeBytes >= L_G722_FRAME_COMPRESSED) && - ((*outputSizeBytes - decodedBytes) >= L_G722_FRAME * sizeof(short))) { + ((*outputSizeBytes - decodedBytes) >= L_G722_FRAME / 2 * sizeof(short))) { if (EasyG722_decoder(ctx->handle, (unsigned char*)bitstream, ctx->speach_buffer)) { int write_index = 0; - for(i = 0; i < L_G722_FRAME * sizeof(short); i+=2) { + for(i = 0; i < L_G722_FRAME; i+=2) { ctx->speach_buffer[write_index] = ctx->speach_buffer[i]; write_index++; } diff --git a/plugins/easy_codec/codec-g7231.c b/plugins/easy_codec/codec-g7231.c index b1b2b7e1ac..dcfa8923f1 100644 --- a/plugins/easy_codec/codec-g7231.c +++ b/plugins/easy_codec/codec-g7231.c @@ -37,6 +37,7 @@ struct g7231_context { CODER_HANDLE handle; short speach_buffer[L_G7231_FRAME]; + int l_g7231_frame_compressed; }; void *codec_g7231_init(void) { @@ -60,28 +61,27 @@ int codec_g7231_decode(void *context, const void *input, int inputSizeBytes, voi const unsigned char *bitstream = (const unsigned char*)input; short *speech = (short*)output; int decodedBytes = 0; - static int L_G7231_FRAME_COMPRESSED = 0; if (!ctx) return 0; if ( ctx->handle == -1) { if ( bitstream[0] & 0x03 ) { ctx->handle=EasyG7231_init_decoder(FALSE); - L_G7231_FRAME_COMPRESSED = L_G7231_FRAME_COMPRESSED_53; + ctx->l_g7231_frame_compressed = L_G7231_FRAME_COMPRESSED_53; } else { ctx->handle=EasyG7231_init_decoder(TRUE); - L_G7231_FRAME_COMPRESSED = L_G7231_FRAME_COMPRESSED_63; + ctx->l_g7231_frame_compressed = L_G7231_FRAME_COMPRESSED_63; } } - if ((inputSizeBytes % L_G7231_FRAME_COMPRESSED) != 0) + if ((inputSizeBytes % ctx->l_g7231_frame_compressed) != 0) return 0; if (!output) - return (inputSizeBytes / L_G7231_FRAME_COMPRESSED) * L_G7231_FRAME * sizeof(short); + return (inputSizeBytes / ctx->l_g7231_frame_compressed) * L_G7231_FRAME * sizeof(short); - while ((inputSizeBytes >= L_G7231_FRAME_COMPRESSED) && + while ((inputSizeBytes >= ctx->l_g7231_frame_compressed) && ((*outputSizeBytes - decodedBytes) >= L_G7231_FRAME * sizeof(short))) { if (EasyG7231_decoder(ctx->handle, (unsigned char*)bitstream, ctx->speach_buffer)) { @@ -90,8 +90,8 @@ int codec_g7231_decode(void *context, const void *input, int inputSizeBytes, voi decodedBytes += L_G7231_FRAME * sizeof(short); } - bitstream += L_G7231_FRAME_COMPRESSED; - inputSizeBytes -= L_G7231_FRAME_COMPRESSED; + bitstream += ctx->l_g7231_frame_compressed; + inputSizeBytes -= ctx->l_g7231_frame_compressed; } return decodedBytes; |