mirror of
https://github.com/signalwire/freeswitch.git
synced 2026-07-24 05:02:10 +00:00
let codecs and timers use existing pool and add new file i/o backend
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@212 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
@@ -124,6 +124,11 @@ SWITCH_DECLARE(void) pbx_core_session_signal_state_change(switch_core_session *s
|
||||
SWITCH_DECLARE(char *) switch_core_strdup(switch_memory_pool *pool, char *todup);
|
||||
SWITCH_DECLARE(switch_core_db *) switch_core_db_open_file(char *filename);
|
||||
SWITCH_DECLARE(char *) switch_core_session_get_uuid(switch_core_session *session);
|
||||
SWITCH_DECLARE(switch_status) switch_core_file_open(switch_file_handle *fh, char *file_path, unsigned int flags, switch_memory_pool *pool);
|
||||
SWITCH_DECLARE(switch_status) switch_core_file_read(switch_file_handle *fh, void *data, size_t *len);
|
||||
SWITCH_DECLARE(switch_status) switch_core_file_write(switch_file_handle *fh, void *data, size_t *len);
|
||||
SWITCH_DECLARE(switch_status) switch_core_file_seek(switch_file_handle *fh, unsigned int *cur_pos, unsigned int samples, int whence);
|
||||
SWITCH_DECLARE(switch_status) switch_core_file_close(switch_file_handle *fh);
|
||||
|
||||
#define SWITCH_CORE_DB "core"
|
||||
#define switch_core_db_handle() switch_core_db_open_file(SWITCH_CORE_DB)
|
||||
|
||||
@@ -60,7 +60,7 @@ SWITCH_DECLARE(switch_api_interface *) loadable_module_get_api_interface(char *n
|
||||
SWITCH_DECLARE(int) loadable_module_get_codecs(switch_memory_pool *pool, switch_codec_interface **array, int arraylen);
|
||||
SWITCH_DECLARE(int) loadable_module_get_codecs_sorted(switch_memory_pool *pool, switch_codec_interface **array, int arraylen, char **prefs, int preflen);
|
||||
SWITCH_DECLARE(switch_status) switch_api_execute(char *cmd, char *arg, char *retbuf, size_t len);
|
||||
SWITCH_DECLARE(switch_api_interface *) loadable_module_get_file_interface(char *name);
|
||||
SWITCH_DECLARE(switch_file_interface *) loadable_module_get_file_interface(char *name);
|
||||
SWITCH_DECLARE(void) loadable_module_shutdown(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
@@ -159,19 +159,25 @@ struct switch_dialplan_interface {
|
||||
|
||||
struct switch_file_interface {
|
||||
const char *interface_name;
|
||||
switch_status (*file_open)(switch_file_handle *);
|
||||
switch_status (*file_open)(switch_file_handle *, char *file_path);
|
||||
switch_status (*file_close)(switch_file_handle *);
|
||||
switch_status (*file_read)(switch_file_handle *, void *data, size_t len);
|
||||
switch_status (*file_write)(switch_file_handle *, void *data, size_t len);
|
||||
switch_status (*file_seek)(switch_file_handle *, unsigned int samples, int whence);
|
||||
switch_status (*file_read)(switch_file_handle *, void *data, size_t *len);
|
||||
switch_status (*file_write)(switch_file_handle *, void *data, size_t *len);
|
||||
switch_status (*file_seek)(switch_file_handle *, unsigned int *cur_pos, unsigned int samples, int whence);
|
||||
char **extens;
|
||||
const struct switch_file_interface *next;
|
||||
const char *extens[];
|
||||
};
|
||||
|
||||
struct switch_file_handle {
|
||||
const struct switch_file_interface *file_interface;
|
||||
unsigned int flags;
|
||||
switch_file_t *fd;
|
||||
unsigned int samples;
|
||||
unsigned int samplerate;
|
||||
unsigned int channels;
|
||||
unsigned int format;
|
||||
unsigned int sections;
|
||||
int seekable;
|
||||
unsigned int sample_count;
|
||||
switch_memory_pool *memory_pool;
|
||||
void *private;
|
||||
|
||||
@@ -117,6 +117,17 @@ typedef enum {
|
||||
SWITCH_TIMER_FLAG_FREE_POOL = (1 << 0),
|
||||
} switch_timer_flag;
|
||||
|
||||
typedef enum {
|
||||
SWITCH_FILE_FLAG_READ = (1 << 0),
|
||||
SWITCH_FILE_FLAG_WRITE = (1 << 1),
|
||||
SWITCH_FILE_FLAG_FREE_POOL = (1 << 2),
|
||||
SWITCH_FILE_DATA_SHORT = (1 << 3),
|
||||
SWITCH_FILE_DATA_INT = (1 << 4),
|
||||
SWITCH_FILE_DATA_FLOAT = (1 << 5),
|
||||
SWITCH_FILE_DATA_DOUBLE = (1 << 6),
|
||||
SWITCH_FILE_DATA_RAW = (1 << 7),
|
||||
} switch_file_flag;
|
||||
|
||||
typedef enum {
|
||||
SWITCH_CODEC_TYPE_AUDIO,
|
||||
SWITCH_CODEC_TYPE_VIDEO,
|
||||
|
||||
Reference in New Issue
Block a user