| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
| 5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
| 6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 return 0; | 38 return 0; |
| 39 } | 39 } |
| 40 } | 40 } |
| 41 | 41 |
| 42 int WebRtcG722_FreeEncoder(G722EncInst *G722enc_inst) | 42 int WebRtcG722_FreeEncoder(G722EncInst *G722enc_inst) |
| 43 { | 43 { |
| 44 // Free encoder memory | 44 // Free encoder memory |
| 45 return WebRtc_g722_encode_release((G722EncoderState*) G722enc_inst); | 45 return WebRtc_g722_encode_release((G722EncoderState*) G722enc_inst); |
| 46 } | 46 } |
| 47 | 47 |
| 48 int16_t WebRtcG722_Encode(G722EncInst *G722enc_inst, | 48 size_t WebRtcG722_Encode(G722EncInst *G722enc_inst, |
| 49 const int16_t* speechIn, | 49 const int16_t* speechIn, |
| 50 int16_t len, | 50 size_t len, |
| 51 uint8_t* encoded) | 51 uint8_t* encoded) |
| 52 { | 52 { |
| 53 unsigned char *codechar = (unsigned char*) encoded; | 53 unsigned char *codechar = (unsigned char*) encoded; |
| 54 // Encode the input speech vector | 54 // Encode the input speech vector |
| 55 return WebRtc_g722_encode((G722EncoderState*) G722enc_inst, codechar, | 55 return WebRtc_g722_encode((G722EncoderState*) G722enc_inst, codechar, |
| 56 speechIn, len); | 56 speechIn, len); |
| 57 } | 57 } |
| 58 | 58 |
| 59 int16_t WebRtcG722_CreateDecoder(G722DecInst **G722dec_inst) | 59 int16_t WebRtcG722_CreateDecoder(G722DecInst **G722dec_inst) |
| 60 { | 60 { |
| 61 *G722dec_inst=(G722DecInst*)malloc(sizeof(G722DecoderState)); | 61 *G722dec_inst=(G722DecInst*)malloc(sizeof(G722DecoderState)); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 78 return 0; | 78 return 0; |
| 79 } | 79 } |
| 80 } | 80 } |
| 81 | 81 |
| 82 int WebRtcG722_FreeDecoder(G722DecInst *G722dec_inst) | 82 int WebRtcG722_FreeDecoder(G722DecInst *G722dec_inst) |
| 83 { | 83 { |
| 84 // Free encoder memory | 84 // Free encoder memory |
| 85 return WebRtc_g722_decode_release((G722DecoderState*) G722dec_inst); | 85 return WebRtc_g722_decode_release((G722DecoderState*) G722dec_inst); |
| 86 } | 86 } |
| 87 | 87 |
| 88 int16_t WebRtcG722_Decode(G722DecInst *G722dec_inst, | 88 size_t WebRtcG722_Decode(G722DecInst *G722dec_inst, |
| 89 const uint8_t *encoded, | 89 const uint8_t *encoded, |
| 90 int16_t len, | 90 size_t len, |
| 91 int16_t *decoded, | 91 int16_t *decoded, |
| 92 int16_t *speechType) | 92 int16_t *speechType) |
| 93 { | 93 { |
| 94 // Decode the G.722 encoder stream | 94 // Decode the G.722 encoder stream |
| 95 *speechType=G722_WEBRTC_SPEECH; | 95 *speechType=G722_WEBRTC_SPEECH; |
| 96 return WebRtc_g722_decode((G722DecoderState*) G722dec_inst, decoded, | 96 return WebRtc_g722_decode((G722DecoderState*) G722dec_inst, decoded, |
| 97 encoded, len); | 97 encoded, len); |
| 98 } | 98 } |
| 99 | 99 |
| 100 int16_t WebRtcG722_Version(char *versionStr, short len) | 100 int16_t WebRtcG722_Version(char *versionStr, short len) |
| 101 { | 101 { |
| 102 // Get version string | 102 // Get version string |
| 103 char version[30] = "2.0.0\n"; | 103 char version[30] = "2.0.0\n"; |
| 104 if (strlen(version) < (unsigned int)len) | 104 if (strlen(version) < (unsigned int)len) |
| 105 { | 105 { |
| 106 strcpy(versionStr, version); | 106 strcpy(versionStr, version); |
| 107 return 0; | 107 return 0; |
| 108 } | 108 } |
| 109 else | 109 else |
| 110 { | 110 { |
| 111 return -1; | 111 return -1; |
| 112 } | 112 } |
| 113 } | 113 } |
| 114 | 114 |
| OLD | NEW |