FS-10456: [mod_av] add wav support to mod_av as well as specifying audio_codec #resolve

This commit is contained in:
Anthony Minessale 2017-06-30 12:32:04 -05:00
parent fc1dd2a4ef
commit 4aa4baa69f
1 changed files with 14 additions and 0 deletions

View File

@ -1900,6 +1900,19 @@ static switch_status_t av_file_open(switch_file_handle_t *handle, const char *pa
fmt = context->fc->oformat;
if ((tmp = switch_event_get_header(handle->params, "av_audio_codec"))) {
if ((context->audio_codec = avcodec_find_encoder_by_name(tmp))) {
fmt->audio_codec = context->audio_codec->id;
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "specified audio codec %s %s [%s]\n",
tmp, context->audio_codec->name, context->audio_codec->long_name);
}
}
if (!strcasecmp(ext, "wav")) {
context->has_video = 0;
switch_clear_flag(handle, SWITCH_FILE_FLAG_VIDEO);
}
/* open the output file, if needed */
if (!(fmt->flags & AVFMT_NOFILE)) {
ret = avio_open(&context->fc->pb, file, AVIO_FLAG_WRITE);
@ -2743,6 +2756,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_avformat_load)
supported_formats[i++] = "mov";
supported_formats[i++] = "mkv";
supported_formats[i++] = "webm";
//supported_formats[i++] = "wav";
file_interface = (switch_file_interface_t *)switch_loadable_module_create_interface(*module_interface, SWITCH_FILE_INTERFACE);
file_interface->interface_name = modname;