Author: achaloyan <achaloyan@f001bc3a-424a-0410-80a0-a715b8f413a8>
Date: Fri Jun 19 18:11:47 2009 +0000 Fixed L16 encode/decode svn-id: https://unimrcp.googlecode.com/svn/trunk@995 Author: achaloyan <achaloyan@f001bc3a-424a-0410-80a0-a715b8f413a8> Date: Fri Jun 19 18:10:49 2009 +0000 Make decision whether to set decoder before and encoder after the bridge based on codec vtable (even linear codec such as L16 has encoder and decoder) svn-id: https://unimrcp.googlecode.com/svn/trunk@994 Author: achaloyan <achaloyan@f001bc3a-424a-0410-80a0-a715b8f413a8> Date: Fri Jun 19 17:24:00 2009 +0000 Added missing #include for BYTEFUNC (fixed compilation undr gcc) svn-id: https://unimrcp.googlecode.com/svn/trunk@993 git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@13880 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
b610bf2f9f
commit
c57128abce
|
@ -14,6 +14,8 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#define APR_WANT_BYTEFUNC
|
||||
#include <apr_want.h>
|
||||
#include "mpf_codec.h"
|
||||
|
||||
/* linear 16-bit PCM (host horder) */
|
||||
|
@ -40,12 +42,12 @@ static apt_bool_t l16_encode(mpf_codec_t *codec, const mpf_codec_frame_t *frame_
|
|||
apr_uint32_t i;
|
||||
const short *buf_in = frame_in->buffer;
|
||||
short *buf_out = frame_out->buffer;
|
||||
apr_size_t samples = frame_in->size / sizeof(short);
|
||||
|
||||
frame_out->size = frame_in->size;
|
||||
|
||||
for(i=0; i<frame_in->size; ) {
|
||||
for(i=0; i<samples; i++) {
|
||||
buf_out[i] = htons(buf_in[i]);
|
||||
i += sizeof(short);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
|
@ -56,12 +58,12 @@ static apt_bool_t l16_decode(mpf_codec_t *codec, const mpf_codec_frame_t *frame_
|
|||
apr_uint32_t i;
|
||||
const short *buf_in = frame_in->buffer;
|
||||
short *buf_out = frame_out->buffer;
|
||||
apr_size_t samples = frame_in->size / sizeof(short);
|
||||
|
||||
frame_out->size = frame_in->size;
|
||||
|
||||
for(i=0; i<frame_in->size; ) {
|
||||
for(i=0; i<samples; i++) {
|
||||
buf_out[i] = ntohs(buf_in[i]);
|
||||
i += sizeof(short);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
|
|
|
@ -208,12 +208,12 @@ static mpf_object_t* mpf_context_connection_create(mpf_context_t *context, mpf_t
|
|||
object = mpf_null_bridge_create(source,sink,context->pool);
|
||||
}
|
||||
else {
|
||||
if(rx_codec->attribs->bits_per_samples != BITS_PER_SAMPLE) {
|
||||
if(rx_codec->vtable && rx_codec->vtable->decode) {
|
||||
/* set decoder before bridge */
|
||||
mpf_audio_stream_t *decoder = mpf_decoder_create(source,context->pool);
|
||||
source = decoder;
|
||||
}
|
||||
if(tx_codec->attribs->bits_per_samples != BITS_PER_SAMPLE) {
|
||||
if(tx_codec->vtable && tx_codec->vtable->encode) {
|
||||
/* set encoder after bridge */
|
||||
mpf_audio_stream_t *encoder = mpf_encoder_create(sink,context->pool);
|
||||
sink = encoder;
|
||||
|
|
Loading…
Reference in New Issue