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

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

上级 9c61f364
...@@ -340,6 +340,8 @@ typedef struct switch_mm_s { ...@@ -340,6 +340,8 @@ typedef struct switch_mm_s {
int scale_w; int scale_w;
int scale_h; int scale_h;
switch_img_fmt_t fmt; switch_img_fmt_t fmt;
char *auth_username;
char *auth_password;
} switch_mm_t; } switch_mm_t;
/*! an abstract representation of a file handle (some parameters based on compat with libsndfile) */ /*! an abstract representation of a file handle (some parameters based on compat with libsndfile) */
......
...@@ -391,6 +391,17 @@ static switch_status_t add_stream(MediaStream *mst, AVFormatContext *fc, AVCodec ...@@ -391,6 +391,17 @@ 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;
......
...@@ -177,6 +177,14 @@ SWITCH_DECLARE(switch_status_t) switch_core_perform_file_open(const char *file, ...@@ -177,6 +177,14 @@ SWITCH_DECLARE(switch_status_t) switch_core_perform_file_open(const char *file,
fh->mm.try_hardware_encoder = switch_true(val); fh->mm.try_hardware_encoder = switch_true(val);
} }
if ((val = switch_event_get_header(fh->params, "auth_username"))) {
fh->mm.auth_username = switch_core_strdup(fh->memory_pool, val);
}
if ((val = switch_event_get_header(fh->params, "auth_password"))) {
fh->mm.auth_password = switch_core_strdup(fh->memory_pool, val);
}
if ((val = switch_event_get_header(fh->params, "fps"))) { if ((val = switch_event_get_header(fh->params, "fps"))) {
float ftmp = atof(val); float ftmp = atof(val);
if (ftmp > 0.0f) { if (ftmp > 0.0f) {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论