提交 29bddbd3 authored 作者: Seven Du's avatar Seven Du 提交者: Michael Jerris

WIP add experimental vorbis codec

made it like a codec mod so we can share the same code in case opus is fully supported in webm
add -lvorbis -lvorbisenc to Makefile
the audio is still completely silence, hope we can find out why
上级 ca291c3f
差异被折叠。
......@@ -37,6 +37,7 @@
// using mkvmuxer::int64;
// using mkvmuxer::uint64;
#include "mod_webm.h"
#ifdef _MSC_VER
// Disable MSVC warnings that suggest making code non-portable.
......@@ -49,8 +50,8 @@ SWITCH_MODULE_DEFINITION(mod_webm, mod_webm_load, NULL, NULL);
#define IS_VP8_KEY_FRAME(byte) ((((byte) & 0x01) ^ 0x01) ? true : false)
#define IS_VP9_KEY_FRAME(byte) (((byte) & 0x01) ? true : false)
#define AUDIO_CODEC "OPUS"
// #define AUDIO_CODEC "VORBIS"
// #define AUDIO_CODEC "OPUS"
#define AUDIO_CODEC "VORBIS"
struct webm_file_context {
switch_memory_pool_t *pool;
......@@ -190,6 +191,14 @@ static switch_status_t webm_file_open(switch_file_handle_t *handle, const char *
}
}
if (!strcmp(AUDIO_CODEC, "VORBIS")) {
uint16_t size = 0;
uint8_t *codec_private_data = NULL;
switch_core_codec_control(&context->audio_codec, SCC_GET_CODEC_PRIVATE, SCCT_INT, (void *)&size, NULL, (void **)&codec_private_data);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "======codec_private_data size: %d data: %p\n", size, codec_private_data);
context->audio->SetCodecPrivate(codec_private_data, size);
}
if (1) { // for better quality?
int bw = 4096;
switch_core_codec_control(&context->video_codec, SCC_VIDEO_BANDWIDTH, SCCT_INT, (void *)&bw, NULL, NULL);
......@@ -474,6 +483,8 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_webm_load)
file_interface->file_set_string = webm_file_set_string;
file_interface->file_get_string = webm_file_get_string;
mod_vorbis_load(module_interface, pool);
/* indicate that the module should continue to be loaded */
return SWITCH_STATUS_SUCCESS;
}
......
/*
* FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
* Copyright (C) 2005-2015, Anthony Minessale II <anthm@freeswitch.org>
*
* Version: MPL 1.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
*
* The Initial Developer of the Original Code is
* Seven Du <dujinfang@gmail.com>
* Portions created by the Initial Developer are Copyright (C)
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Seven Du <dujinfang@gmail.com>
*
*
* mod_webm.h -- Webm headers
*
*/
#include <switch.h>
#define SCC_GET_CODEC_PRIVATE SCC_VIDEO_BANDWIDTH
typedef struct vorbis_context_s vorbis_context_t;
#ifdef __cplusplus
extern "C" {
#endif
SWITCH_MODULE_LOAD_FUNCTION(mod_vorbis_load);
#ifdef __cplusplus
}
#endif
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论