mirror of
https://github.com/signalwire/freeswitch.git
synced 2026-07-24 13:12:03 +00:00
resample into core
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@254 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
@@ -28,9 +28,9 @@
|
||||
* switch.h -- Main Library Header
|
||||
*
|
||||
*/
|
||||
/*! \file switch.h
|
||||
\brief Main Library Header
|
||||
*/
|
||||
/*! \file switch.h
|
||||
\brief Main Library Header
|
||||
*/
|
||||
|
||||
#ifndef SWITCH_H
|
||||
#define SWITCH_H
|
||||
@@ -61,7 +61,7 @@ extern "C" {
|
||||
#include <switch_channel.h>
|
||||
#include <switch_buffer.h>
|
||||
#include <switch_event.h>
|
||||
|
||||
#include <switch_resample.h>
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -29,8 +29,8 @@
|
||||
* switch_core.h -- Core Library
|
||||
*
|
||||
*/
|
||||
/*! \file switch_core.h
|
||||
\brief Core Library
|
||||
/*! \file switch_core.h
|
||||
\brief Core Library
|
||||
*/
|
||||
|
||||
#ifndef SWITCH_CORE_H
|
||||
|
||||
@@ -29,8 +29,8 @@
|
||||
* switch_frame.h -- Media Frame Structure
|
||||
*
|
||||
*/
|
||||
/*! \file switch_frame.h
|
||||
\brief Media Frame Structure
|
||||
/*! \file switch_frame.h
|
||||
\brief Media Frame Structure
|
||||
*/
|
||||
|
||||
#ifndef SWITCH_FRAME_H
|
||||
|
||||
@@ -29,8 +29,8 @@
|
||||
* switch_module_interfaces.h -- Module Interface Definitions
|
||||
*
|
||||
*/
|
||||
/*! \file switch_module_interfaces.h
|
||||
\brief Module Interface Definitions
|
||||
/*! \file switch_module_interfaces.h
|
||||
\brief Module Interface Definitions
|
||||
*/
|
||||
#ifndef SWITCH_MODULE_INTERFACES_H
|
||||
#define SWITCH_MODULE_INTERFACES_H
|
||||
|
||||
@@ -0,0 +1,80 @@
|
||||
/*
|
||||
* FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
|
||||
* Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com>
|
||||
*
|
||||
* Version: MPL 1.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Anthony Minessale II <anthmct@yahoo.com>
|
||||
* Portions created by the Initial Developer are Copyright (C)
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Anthony Minessale II <anthmct@yahoo.com>
|
||||
*
|
||||
*
|
||||
* switch_caller.h -- Caller Identification
|
||||
*
|
||||
*/
|
||||
/*! \file switch_resample.h
|
||||
\brief Audio Resample Code
|
||||
*/
|
||||
|
||||
#ifndef SWITCH_RESAMPLE_H
|
||||
#define SWITCH_RESAMPLE_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct switch_audio_resampler {
|
||||
void *resampler;
|
||||
int from_rate;
|
||||
int to_rate;
|
||||
double factor;
|
||||
float *from;
|
||||
int from_len;
|
||||
size_t from_size;
|
||||
float *to;
|
||||
int to_len;
|
||||
size_t to_size;
|
||||
};
|
||||
|
||||
#include <switch.h>
|
||||
SWITCH_DECLARE(switch_status) switch_resample_create(switch_audio_resampler **new_resampler,
|
||||
int from_rate,
|
||||
size_t from_size,
|
||||
int to_rate,
|
||||
size_t to_size,
|
||||
switch_memory_pool *pool);
|
||||
|
||||
SWITCH_DECLARE(int) switch_resample_process(switch_audio_resampler *resampler, float *src, int srclen, float *dst, int dstlen, int last);
|
||||
|
||||
SWITCH_DECLARE(size_t) switch_float_to_short(float *f, short *s, size_t len);
|
||||
SWITCH_DECLARE(int) switch_char_to_float(char *c, float *f, int len);
|
||||
SWITCH_DECLARE(int) switch_float_to_char(float *f, char *c, int len);
|
||||
SWITCH_DECLARE(int) switch_short_to_float(short *s, float *f, int len);
|
||||
SWITCH_DECLARE(void) switch_swap_linear(int16_t *buf, int len);
|
||||
SWITCH_DECLARE(void) switch_resample_destroy(switch_audio_resampler *resampler);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -153,7 +153,7 @@ typedef enum {
|
||||
} switch_event_t;
|
||||
|
||||
|
||||
|
||||
typedef struct switch_audio_resampler switch_audio_resampler;
|
||||
typedef struct switch_event_header switch_event_header;
|
||||
typedef struct switch_event switch_event;
|
||||
typedef struct switch_event_subclass switch_event_subclass;
|
||||
|
||||
@@ -71,12 +71,8 @@ typedef typeof(tv.tv_usec) switch_suseconds_t;
|
||||
SWITCH_DECLARE(unsigned int) switch_separate_string(char *buf, char delim, char **array, int arraylen);
|
||||
SWITCH_DECLARE(switch_status) switch_socket_create_pollfd(switch_pollfd_t *poll, switch_socket_t *sock, unsigned int flags, switch_memory_pool *pool);
|
||||
SWITCH_DECLARE(int) switch_socket_waitfor(switch_pollfd_t *poll, int ms);
|
||||
SWITCH_DECLARE(void) switch_swap_linear(int16_t *buf, int len);
|
||||
SWITCH_DECLARE(char *) switch_cut_path(char *in);
|
||||
SWITCH_DECLARE(size_t) switch_float_to_short(float *f, short *s, size_t len);
|
||||
SWITCH_DECLARE(int) switch_char_to_float(char *c, float *f, int len);
|
||||
SWITCH_DECLARE(int) switch_float_to_char(float *f, char *c, int len);
|
||||
SWITCH_DECLARE(int) switch_short_to_float(short *s, float *f, int len);
|
||||
|
||||
|
||||
#if !defined(switch_strdupa) && defined(__GNUC__)
|
||||
# define switch_strdupa(s) \
|
||||
|
||||
Reference in New Issue
Block a user