/*!
\brief Open a media file using file format modules
\param fh a file handle to use
+ \param codec_imp the codec implementation being used
\param file_path the path to the file
\param flags read/write flags
\param pool the pool to use (NULL for new pool)
\return SWITCH_STATUS_SUCCESS if the file is opened
\note the loadable module used is chosen based on the file extension
*/
-SWITCH_DECLARE(switch_status_t) switch_core_file_open(switch_file_handle_t *fh, char *file_path, unsigned int flags, switch_memory_pool_t *pool);
-
+SWITCH_DECLARE(switch_status_t) switch_core_file_open(switch_file_handle_t *fh,
+ const switch_codec_implementation_t *codec_imp,
+ char *file_path,
+ unsigned int flags,
+ switch_memory_pool_t *pool);
/*!
\brief Read media from a file handle
\param fh the file handle to read from (must be initilized by you memset all 0 for read, fill in channels and rate for write)
switch_memory_pool_t *memory_pool;
/*! private data for the format module to store handle specific info */
void *private_info;
+ char *handler;
+ const switch_codec_implementation_t *codec_imp;
int64_t pos;
switch_buffer_t *audio_buffer;
uint32_t thresh;
}
if (switch_core_file_open(&fh,
+ NULL,
rec->path,
SWITCH_FILE_FLAG_WRITE | SWITCH_FILE_DATA_SHORT,
rec->pool) != SWITCH_STATUS_SUCCESS) {
/* Open the file */
if (switch_core_file_open(&fnode->fh,
+ NULL,
file,
SWITCH_FILE_FLAG_READ | SWITCH_FILE_DATA_SHORT,
pool) != SWITCH_STATUS_SUCCESS) {
/* Open the file */
if (switch_core_file_open(&fnode->fh,
+ switch_core_session_get_read_codec(member->session)->implementation,
file,
SWITCH_FILE_FLAG_READ | SWITCH_FILE_DATA_SHORT,
pool) != SWITCH_STATUS_SUCCESS) {
switch_set_flag_locked((&globals), GFLAG_RING);
if (ring_file) {
if (switch_core_file_open(&fh,
+ globals.read_codec.implementation,
ring_file,
SWITCH_FILE_FLAG_READ | SWITCH_FILE_DATA_SHORT,
NULL) == SWITCH_STATUS_SUCCESS) {
}
if (switch_core_file_open(&tech_pvt->fh,
+ globals.read_codec.implementation,
tech_pvt->hold_file,
SWITCH_FILE_FLAG_READ | SWITCH_FILE_DATA_SHORT,
switch_core_session_get_pool(tech_pvt->session)) != SWITCH_STATUS_SUCCESS) {
return SWITCH_STATUS_SUCCESS;
}
-SWITCH_DECLARE(switch_status_t) switch_core_file_open(switch_file_handle_t *fh, char *file_path, unsigned int flags,
- switch_memory_pool_t *pool)
+SWITCH_DECLARE(switch_status_t) switch_core_file_open(switch_file_handle_t *fh,
+ const switch_codec_implementation_t *codec_imp,
+ char *file_path,
+ unsigned int flags,
+ switch_memory_pool_t *pool)
{
char *ext;
switch_status_t status;
switch_set_flag(fh, SWITCH_FILE_FLAG_FREE_POOL);
}
+ if (rhs) {
+ fh->handler = switch_core_strdup(fh->memory_pool, rhs);
+ }
+
+ fh->codec_imp = codec_imp;
+
return fh->file_interface->file_open(fh, file_path);
}
if (switch_core_file_open(fh,
+ read_codec->implementation,
file,
SWITCH_FILE_FLAG_WRITE | SWITCH_FILE_DATA_SHORT,
switch_core_session_get_pool(session)) != SWITCH_STATUS_SUCCESS) {
if (switch_core_file_open(fh,
+ read_codec->implementation,
file,
SWITCH_FILE_FLAG_WRITE | SWITCH_FILE_DATA_SHORT,
switch_core_session_get_pool(session)) != SWITCH_STATUS_SUCCESS) {
}
if (switch_core_file_open(fh,
+ read_codec->implementation,
file,
SWITCH_FILE_FLAG_READ | SWITCH_FILE_DATA_SHORT,
switch_core_session_get_pool(session)) != SWITCH_STATUS_SUCCESS) {
ringback.fhb.channels = read_codec->implementation->number_of_channels;
ringback.fhb.samplerate = read_codec->implementation->samples_per_second;
if (switch_core_file_open(&ringback.fhb,
+ read_codec->implementation,
ringback_data,
SWITCH_FILE_FLAG_READ | SWITCH_FILE_DATA_SHORT,
switch_core_session_get_pool(session)) != SWITCH_STATUS_SUCCESS) {