提交 d0071f56 authored 作者: Anthony Minessale's avatar Anthony Minessale

FS-10209: [freeswitch-core,mod_av] Add auth params to file handles

上级 be0e1e14
...@@ -391,17 +391,6 @@ static switch_status_t add_stream(MediaStream *mst, AVFormatContext *fc, AVCodec ...@@ -391,17 +391,6 @@ static switch_status_t add_stream(MediaStream *mst, AVFormatContext *fc, AVCodec
c->codec_id = codec_id; c->codec_id = codec_id;
if (mm->auth_username) {
char tmp[256] = "";
switch_snprintf(tmp, sizeof(tmp), "pubUser=%s", mm->auth_username);
av_set_options_string(c, tmp, "=", ":");
if (mm->auth_password) {
switch_snprintf(tmp, sizeof(tmp), "pubPasswd=%s", mm->auth_password);
av_set_options_string(c, tmp, "=", ":");
}
}
/* Resolution must be a multiple of two. */ /* Resolution must be a multiple of two. */
c->width = mst->width; c->width = mst->width;
c->height = mst->height; c->height = mst->height;
...@@ -958,7 +947,7 @@ SWITCH_STANDARD_APP(record_av_function) ...@@ -958,7 +947,7 @@ SWITCH_STANDARD_APP(record_av_function)
char codec_str[256]; char codec_str[256];
const AVCodecDescriptor *desc; const AVCodecDescriptor *desc;
if (!strncmp(data, "rtmp://", 7)) { if (!strncmp(data, "rtmp://", 7) || !strncmp(data, "rtsp://", 7)) {
fmt->video_codec = AV_CODEC_ID_H264; fmt->video_codec = AV_CODEC_ID_H264;
fmt->audio_codec = AV_CODEC_ID_AAC; fmt->audio_codec = AV_CODEC_ID_AAC;
} }
...@@ -1786,9 +1775,20 @@ static switch_status_t av_file_open(switch_file_handle_t *handle, const char *pa ...@@ -1786,9 +1775,20 @@ static switch_status_t av_file_open(switch_file_handle_t *handle, const char *pa
return SWITCH_STATUS_GENERR; return SWITCH_STATUS_GENERR;
} else if (handle->stream_name && (!strcasecmp(handle->stream_name, "rtmp") || !strcasecmp(handle->stream_name, "youtube"))) { } else if (handle->stream_name && (!strcasecmp(handle->stream_name, "rtmp") || !strcasecmp(handle->stream_name, "youtube"))) {
format = "flv"; format = "flv";
switch_snprintf(file, sizeof(file), "rtmp://%s", path);
// meh really silly format for the user / pass libav.....
if (handle->mm.auth_username && handle->mm.auth_password) {
switch_snprintf(file, sizeof(file), "rtmp://%s pubUser=%s pubPasswd=%s flashver=FMLE/3.0", path, handle->mm.auth_username, handle->mm.auth_password);
} else {
switch_snprintf(file, sizeof(file), "rtmp://%s", path);
}
} else if (handle->stream_name && !strcasecmp(handle->stream_name, "rtsp")) {
format = "rtsp";
switch_snprintf(file, sizeof(file), "rtsp://%s", path);
} }
ext++; ext++;
if ((context = (av_file_context_t *)switch_core_alloc(handle->memory_pool, sizeof(av_file_context_t))) == 0) { if ((context = (av_file_context_t *)switch_core_alloc(handle->memory_pool, sizeof(av_file_context_t))) == 0) {
...@@ -1879,7 +1879,7 @@ static switch_status_t av_file_open(switch_file_handle_t *handle, const char *pa ...@@ -1879,7 +1879,7 @@ static switch_status_t av_file_open(switch_file_handle_t *handle, const char *pa
if (fmt->video_codec != AV_CODEC_ID_NONE) { if (fmt->video_codec != AV_CODEC_ID_NONE) {
const AVCodecDescriptor *desc; const AVCodecDescriptor *desc;
if ((handle->stream_name && (!strcasecmp(handle->stream_name, "rtmp") || !strcasecmp(handle->stream_name, "youtube")))) { if ((handle->stream_name && (!strcasecmp(handle->stream_name, "rtmp") || !strcasecmp(handle->stream_name, "rtsp") || !strcasecmp(handle->stream_name, "youtube")))) {
if (fmt->video_codec != AV_CODEC_ID_H264 ) { if (fmt->video_codec != AV_CODEC_ID_H264 ) {
fmt->video_codec = AV_CODEC_ID_H264; // force H264 fmt->video_codec = AV_CODEC_ID_H264; // force H264
...@@ -2631,6 +2631,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_avformat_load) ...@@ -2631,6 +2631,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_avformat_load)
supported_formats[i++] = "av"; supported_formats[i++] = "av";
supported_formats[i++] = "rtmp"; supported_formats[i++] = "rtmp";
supported_formats[i++] = "rtsp";
supported_formats[i++] = "mp4"; supported_formats[i++] = "mp4";
supported_formats[i++] = "m4a"; supported_formats[i++] = "m4a";
supported_formats[i++] = "mov"; supported_formats[i++] = "mov";
......
...@@ -93,7 +93,7 @@ int mod_av_lockmgr_cb(void **m, enum AVLockOp op) ...@@ -93,7 +93,7 @@ int mod_av_lockmgr_cb(void **m, enum AVLockOp op)
static void log_callback(void *ptr, int level, const char *fmt, va_list vl) static void log_callback(void *ptr, int level, const char *fmt, va_list vl)
{ {
switch_log_level_t switch_level = SWITCH_LOG_DEBUG; switch_log_level_t switch_level = SWITCH_LOG_DEBUG;
return;
/* naggy messages */ /* naggy messages */
if (level == AV_LOG_DEBUG || level == AV_LOG_WARNING) return; if (level == AV_LOG_DEBUG || level == AV_LOG_WARNING) return;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论