Collaboration diagram for File Functions:
Defines | |
| #define | switch_core_file_open(_fh, _file_path, _channels, _rate, _flags, _pool) switch_core_perform_file_open(__FILE__, __SWITCH_FUNC__, __LINE__, _fh, _file_path, _channels, _rate, _flags, _pool) |
| Open a media file using file format modules. | |
Functions | |
| switch_status_t | switch_core_perform_file_open (const char *file, const char *func, int line, _In_ switch_file_handle_t *fh, _In_opt_z_ const char *file_path, _In_ uint8_t channels, _In_ uint32_t rate, _In_ unsigned int flags, _In_opt_ switch_memory_pool_t *pool) |
| switch_status_t | switch_core_file_read (_In_ switch_file_handle_t *fh, void *data, switch_size_t *len) |
| Read media from a file handle. | |
| switch_status_t | switch_core_file_write (_In_ switch_file_handle_t *fh, void *data, switch_size_t *len) |
| Write media to a file handle. | |
| switch_status_t | switch_core_file_seek (_In_ switch_file_handle_t *fh, unsigned int *cur_pos, int64_t samples, int whence) |
| Seek a position in a file. | |
| switch_status_t | switch_core_file_set_string (_In_ switch_file_handle_t *fh, switch_audio_col_t col, const char *string) |
| Set metadata to the desired string. | |
| switch_status_t | switch_core_file_get_string (_In_ switch_file_handle_t *fh, switch_audio_col_t col, const char **string) |
| get metadata of the desired string | |
| switch_status_t | switch_core_file_close (_In_ switch_file_handle_t *fh) |
| Close an open file handle. | |
| switch_status_t | switch_core_file_truncate (switch_file_handle_t *fh, int64_t offset) |
| #define switch_core_file_open | ( | _fh, | |||
| _file_path, | |||||
| _channels, | |||||
| _rate, | |||||
| _flags, | |||||
| _pool | ) | switch_core_perform_file_open(__FILE__, __SWITCH_FUNC__, __LINE__, _fh, _file_path, _channels, _rate, _flags, _pool) |
Open a media file using file format modules.
| _fh | a file handle to use | |
| _file_path | the path to the file | |
| _channels | the number of channels | |
| _rate | the sample rate | |
| _flags | read/write flags | |
| _pool | the pool to use (NULL for new pool) |
Definition at line 1629 of file switch_core.h.
Referenced by main(), setup_ringback(), switch_ivr_displace_session(), switch_ivr_insert_file(), switch_ivr_play_file(), switch_ivr_record_file(), switch_ivr_record_session(), switch_ivr_wait_for_answer(), and switch_ivr_wait_for_silence().
| switch_status_t switch_core_file_close | ( | _In_ switch_file_handle_t * | fh | ) |
Close an open file handle.
| fh | the file handle to close |
Referenced by main(), read_displace_callback(), record_callback(), switch_ivr_displace_session(), switch_ivr_insert_file(), switch_ivr_play_file(), switch_ivr_record_file(), switch_ivr_record_session(), switch_ivr_wait_for_answer(), switch_ivr_wait_for_silence(), and write_displace_callback().
| switch_status_t switch_core_file_get_string | ( | _In_ switch_file_handle_t * | fh, | |
| switch_audio_col_t | col, | |||
| const char ** | string | |||
| ) |
get metadata of the desired string
| fh | the file handle to get data from | |
| col | the enum of the col name | |
| string | pointer to the string to fetch |
Referenced by switch_ivr_play_file().
| switch_status_t switch_core_file_read | ( | _In_ switch_file_handle_t * | fh, | |
| void * | data, | |||
| switch_size_t * | len | |||
| ) |
Read media from a file handle.
| fh | the file handle to read from (must be initilized by you memset all 0 for read, fill in channels and rate for write) | |
| data | the buffer to read the data to | |
| len | the max size of the buffer |
Referenced by read_displace_callback(), switch_ivr_insert_file(), switch_ivr_play_file(), switch_ivr_wait_for_answer(), switch_ivr_wait_for_silence(), and write_displace_callback().
| switch_status_t switch_core_file_seek | ( | _In_ switch_file_handle_t * | fh, | |
| unsigned int * | cur_pos, | |||
| int64_t | samples, | |||
| int | whence | |||
| ) |
Seek a position in a file.
| fh | the file handle to seek | |
| cur_pos | the current position in the file | |
| samples | the amount of samples to seek from the beginning of the file | |
| whence | the indicator (see traditional seek) |
Referenced by read_displace_callback(), switch_ivr_insert_file(), switch_ivr_play_file(), switch_ivr_process_fh(), switch_ivr_record_file(), switch_ivr_wait_for_answer(), and write_displace_callback().
| switch_status_t switch_core_file_set_string | ( | _In_ switch_file_handle_t * | fh, | |
| switch_audio_col_t | col, | |||
| const char * | string | |||
| ) |
Set metadata to the desired string.
| fh | the file handle to set data to | |
| col | the enum of the col name | |
| string | the string to add |
Referenced by switch_ivr_record_file(), and switch_ivr_record_session().
| switch_status_t switch_core_file_truncate | ( | switch_file_handle_t * | fh, | |
| int64_t | offset | |||
| ) |
Definition at line 492 of file switch_core_file.c.
References switch_assert, switch_buffer_zero(), SWITCH_FILE_FLAG_WRITE, SWITCH_FILE_OPEN, SWITCH_STATUS_FALSE, SWITCH_STATUS_SUCCESS, and switch_test_flag.
Referenced by switch_ivr_process_fh().
00493 { 00494 switch_status_t status; 00495 00496 switch_assert(fh != NULL); 00497 switch_assert(fh->file_interface != NULL); 00498 00499 if (!(switch_test_flag(fh, SWITCH_FILE_OPEN) && switch_test_flag(fh, SWITCH_FILE_FLAG_WRITE))) { 00500 return SWITCH_STATUS_FALSE; 00501 } 00502 00503 if (!fh->file_interface->file_truncate) { 00504 return SWITCH_STATUS_FALSE; 00505 } 00506 00507 if ((status = fh->file_interface->file_truncate(fh, offset)) == SWITCH_STATUS_SUCCESS) { 00508 if (fh->buffer) { 00509 switch_buffer_zero(fh->buffer); 00510 } 00511 if (fh->pre_buffer) { 00512 switch_buffer_zero(fh->pre_buffer); 00513 } 00514 fh->samples_out = 0; 00515 fh->pos = 0; 00516 } 00517 00518 return status; 00519 00520 }
| switch_status_t switch_core_file_write | ( | _In_ switch_file_handle_t * | fh, | |
| void * | data, | |||
| switch_size_t * | len | |||
| ) |
Write media to a file handle.
| fh | the file handle to write to | |
| data | the buffer to write | |
| len | the amount of data to write from the buffer |
Referenced by record_callback(), switch_ivr_insert_file(), switch_ivr_record_file(), and teletone_handler().
| switch_status_t switch_core_perform_file_open | ( | const char * | file, | |
| const char * | func, | |||
| int | line, | |||
| _In_ switch_file_handle_t * | fh, | |||
| _In_opt_z_ const char * | file_path, | |||
| _In_ uint8_t | channels, | |||
| _In_ uint32_t | rate, | |||
| _In_ unsigned int | flags, | |||
| _In_opt_ switch_memory_pool_t * | pool | |||
| ) |
1.4.7