]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
FS-10456: [mod_av] add wav support to mod_av as well as specifying audio_codec #resolve
authorAnthony Minessale <anthm@freeswitch.org>
Fri, 30 Jun 2017 17:32:04 +0000 (12:32 -0500)
committerAnthony Minessale <anthm@freeswitch.org>
Fri, 30 Jun 2017 17:32:08 +0000 (12:32 -0500)
src/mod/applications/mod_av/avformat.c

index 4b84aea4504e82896f9c09568709727d25fc6d9e..663ae0b426600bc54ae94c0bf0fa5a46f527b480 100644 (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;