diff --git a/src/mod/applications/mod_httapi/mod_httapi.c b/src/mod/applications/mod_httapi/mod_httapi.c index 87f2203742..39f9051c1a 100644 --- a/src/mod/applications/mod_httapi/mod_httapi.c +++ b/src/mod/applications/mod_httapi/mod_httapi.c @@ -2967,12 +2967,18 @@ static switch_status_t file_open(switch_file_handle_t *handle, const char *path, context->cache_file, handle->channels, handle->samplerate, - SWITCH_FILE_FLAG_READ | SWITCH_FILE_DATA_SHORT, NULL)) != SWITCH_STATUS_SUCCESS) { + handle->flags, NULL)) != SWITCH_STATUS_SUCCESS) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid cache file %s opening url %s Discarding file.\n", context->cache_file, path); unlink(context->cache_file); unlink(context->meta_file); return status; } + + if (switch_test_flag(&context->fh, SWITCH_FILE_FLAG_VIDEO)) { + switch_set_flag(handle, SWITCH_FILE_FLAG_VIDEO); + } else { + switch_set_flag(handle, SWITCH_FILE_FLAG_VIDEO); + } } handle->private_info = context; @@ -3057,6 +3063,20 @@ static switch_status_t http_file_file_close(switch_file_handle_t *handle) } +static switch_status_t http_file_read_video(switch_file_handle_t *handle, switch_frame_t *frame, switch_video_read_flag_t flags) +{ + http_file_context_t *context = handle->private_info; + + return switch_core_file_read_video(&context->fh, frame, flags); +} + +static switch_status_t http_file_write_video(switch_file_handle_t *handle, switch_frame_t *frame) +{ + http_file_context_t *context = handle->private_info; + + return switch_core_file_write_video(&context->fh, frame); +} + static switch_status_t http_file_write(switch_file_handle_t *handle, void *data, size_t *len) { http_file_context_t *context = handle->private_info; @@ -3121,6 +3141,8 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_httapi_load) http_file_interface->file_read = http_file_file_read; http_file_interface->file_write = http_file_write; http_file_interface->file_seek = http_file_file_seek; + http_file_interface->file_read_video = http_file_read_video; + http_file_interface->file_write_video = http_file_write_video; https_file_supported_formats[0] = "https"; @@ -3132,6 +3154,8 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_httapi_load) https_file_interface->file_read = http_file_file_read; https_file_interface->file_write = http_file_write; https_file_interface->file_seek = http_file_file_seek; + https_file_interface->file_read_video = http_file_read_video; + https_file_interface->file_write_video = http_file_write_video; switch_snprintf(globals.cache_path, sizeof(globals.cache_path), "%s%shttp_file_cache", SWITCH_GLOBAL_dirs.storage_dir, SWITCH_PATH_SEPARATOR); switch_dir_make_recursive(globals.cache_path, SWITCH_DEFAULT_DIR_PERMS, pool);