[-]
[+]
|
Changed |
nginx.spec
|
|
[-]
[+]
|
Changed |
nginx-1.4.3.tar.gz/CHANGES
^
|
@@ -1,4 +1,25 @@
+Changes with nginx 1.4.3 08 Oct 2013
+
+ *) Bugfix: a segmentation fault might occur in a worker process if the
+ ngx_http_spdy_module was used with the "client_body_in_file_only"
+ directive.
+
+ *) Bugfix: a segmentation fault might occur on start or during
+ reconfiguration if the "try_files" directive was used with an empty
+ parameter.
+
+ *) Bugfix: the $request_time variable did not work in nginx/Windows.
+
+ *) Bugfix: in the ngx_http_auth_basic_module when using "$apr1$"
+ password encryption method.
+ Thanks to Markus Linnala.
+
+ *) Bugfix: in the ngx_http_autoindex_module.
+
+ *) Bugfix: in the mail proxy server.
+
+
Changes with nginx 1.4.2 17 Jul 2013
*) Bugfix: the $r->header_in() embedded perl method did not return value
|
[-]
[+]
|
Changed |
nginx-1.4.3.tar.gz/CHANGES.ru
^
|
@@ -1,4 +1,25 @@
+Изменения в nginx 1.4.3 08.10.2013
+
+ *) Исправление: в рабочем процессе мог произойти segmentation fault,
+ если использовался модуль ngx_http_spdy_module и директива
+ client_body_in_file_only.
+
+ *) Исправление: на старте или во время переконфигурации мог произойти
+ segmentation fault, если использовалась директива try_files с пустым
+ параметром.
+
+ *) Исправление: переменная $request_time не работала в nginx/Windows.
+
+ *) Исправление: в модуле ngx_http_auth_basic_module при использовании
+ метода шифрования паролей "$apr1$".
+ Спасибо Markus Linnala.
+
+ *) Исправление: в модуле ngx_http_autoindex_module.
+
+ *) Исправление: в почтовом прокси-сервере.
+
+
Изменения в nginx 1.4.2 17.07.2013
*) Исправление: метод $r->header_in() встроенного перла не возвращал
|
[-]
[+]
|
Changed |
nginx-1.4.3.tar.gz/src/core/nginx.h
^
|
@@ -9,8 +9,8 @@
#define _NGINX_H_INCLUDED_
-#define nginx_version 1004002
-#define NGINX_VERSION "1.4.2"
+#define nginx_version 1004003
+#define NGINX_VERSION "1.4.3"
#define NGINX_VER "nginx/" NGINX_VERSION
#define NGINX_VAR "NGINX"
|
[-]
[+]
|
Changed |
nginx-1.4.3.tar.gz/src/core/ngx_crypt.c
^
|
@@ -137,7 +137,7 @@
/* output */
- *encrypted = ngx_pnalloc(pool, sizeof("$apr1$") - 1 + saltlen + 16 + 1);
+ *encrypted = ngx_pnalloc(pool, sizeof("$apr1$") - 1 + saltlen + 1 + 22 + 1);
if (*encrypted == NULL) {
return NGX_ERROR;
}
|
[-]
[+]
|
Changed |
nginx-1.4.3.tar.gz/src/http/modules/ngx_http_autoindex_module.c
^
|
@@ -304,7 +304,7 @@
if (ngx_de_info(filename, &dir) == NGX_FILE_ERROR) {
err = ngx_errno;
- if (err != NGX_ENOENT) {
+ if (err != NGX_ENOENT && err != NGX_ELOOP) {
ngx_log_error(NGX_LOG_CRIT, r->connection->log, err,
ngx_de_info_n " \"%s\" failed", filename);
@@ -388,7 +388,7 @@
b = ngx_create_temp_buf(r->pool, len);
if (b == NULL) {
- return NGX_HTTP_INTERNAL_SERVER_ERROR;
+ return NGX_ERROR;
}
if (entries.nelts > 1) {
@@ -649,7 +649,7 @@
ngx_close_dir_n " \"%V\" failed", name);
}
- return NGX_HTTP_INTERNAL_SERVER_ERROR;
+ return r->header_sent ? NGX_ERROR : NGX_HTTP_INTERNAL_SERVER_ERROR;
}
|
[-]
[+]
|
Changed |
nginx-1.4.3.tar.gz/src/http/modules/ngx_http_log_module.c
^
|
@@ -780,7 +780,7 @@
((tp->sec - r->start_sec) * 1000 + (tp->msec - r->start_msec));
ms = ngx_max(ms, 0);
- return ngx_sprintf(buf, "%T.%03M", ms / 1000, ms % 1000);
+ return ngx_sprintf(buf, "%T.%03M", (time_t) ms / 1000, ms % 1000);
}
|
[-]
[+]
|
Changed |
nginx-1.4.3.tar.gz/src/http/ngx_http_core_module.c
^
|
@@ -4758,7 +4758,9 @@
tf[i].name = value[i + 1];
- if (tf[i].name.data[tf[i].name.len - 1] == '/') {
+ if (tf[i].name.len > 0
+ && tf[i].name.data[tf[i].name.len - 1] == '/')
+ {
tf[i].test_dir = 1;
tf[i].name.len--;
tf[i].name.data[tf[i].name.len] = '\0';
|
[-]
[+]
|
Changed |
nginx-1.4.3.tar.gz/src/http/ngx_http_spdy.c
^
|
@@ -2529,13 +2529,6 @@
return NGX_ERROR;
}
- if (rb->rest == 0) {
- buf->in_file = 1;
- buf->file = &tf->file;
- } else {
- rb->buf = buf;
- }
-
} else {
if (rb->rest == 0) {
@@ -2546,10 +2539,10 @@
if (buf == NULL) {
return NGX_ERROR;
}
-
- rb->buf = buf;
}
+ rb->buf = buf;
+
rb->bufs = ngx_alloc_chain_link(r->pool);
if (rb->bufs == NULL) {
return NGX_ERROR;
|
[-]
[+]
|
Changed |
nginx-1.4.3.tar.gz/src/http/ngx_http_variables.c
^
|
@@ -1988,7 +1988,7 @@
((tp->sec - r->start_sec) * 1000 + (tp->msec - r->start_msec));
ms = ngx_max(ms, 0);
- v->len = ngx_sprintf(p, "%T.%03M", ms / 1000, ms % 1000) - p;
+ v->len = ngx_sprintf(p, "%T.%03M", (time_t) ms / 1000, ms % 1000) - p;
v->valid = 1;
v->no_cacheable = 0;
v->not_found = 0;
|
[-]
[+]
|
Changed |
nginx-1.4.3.tar.gz/src/mail/ngx_mail_smtp_module.c
^
|
@@ -277,7 +277,6 @@
p = ngx_cpymem(p, conf->capability.data, conf->capability.len);
p = ngx_cpymem(p, "250 STARTTLS" CRLF, sizeof("250 STARTTLS" CRLF) - 1);
- *p++ = CR; *p = LF;
p = conf->starttls_capability.data
+ (last - conf->capability.data) + 3;
|
[-]
[+]
|
Changed |
nginx-1.4.3.tar.gz/src/mail/ngx_mail_ssl_module.c
^
|
@@ -235,6 +235,11 @@
mode = "";
}
+ if (conf->file == NULL) {
+ conf->file = prev->file;
+ conf->line = prev->line;
+ }
+
if (*mode) {
if (conf->certificate.len == 0) {
|
[-]
[+]
|
Changed |
nginx-1.4.3.tar.gz/src/os/unix/ngx_errno.h
^
|
@@ -49,10 +49,10 @@
#define NGX_ECANCELED ECANCELED
#define NGX_EILSEQ EILSEQ
#define NGX_ENOMOREFILES 0
+#define NGX_ELOOP ELOOP
#if (NGX_HAVE_OPENAT)
#define NGX_EMLINK EMLINK
-#define NGX_ELOOP ELOOP
#endif
#if (__hpux__)
|
|
Deleted |
nginx-rtmp-module-1.0.2.tar.bz2
^
|
[-]
[+]
|
Changed |
nginx-rtmp-module-1.0.5.tar.bz2/README.md
^
|
@@ -4,7 +4,7 @@
### Project blog
- http://rarut.wordpress.com
+ http://nginx-rtmp.blogspot.com
### Wiki manual
@@ -16,10 +16,7 @@
https://groups.google.com/group/nginx-rtmp-ru (Russian)
-
-### Project page at github
-
- Project features, examples, donation information
+### Donation page (Paypal etc)
http://arut.github.com/nginx-rtmp-module/
@@ -60,8 +57,7 @@
* Statistics in XML/XSL in machine- & human-
readable form
-* Linux/FreeBSD/MacOS
-
+* Linux/FreeBSD/MacOS/Windows
### Build
@@ -71,11 +67,19 @@
make
make install
-Several versions of nginx (1.3.14 - 1.4.1) require http_ssl_module to be
+Several versions of nginx (1.3.14 - 1.5.0) require http_ssl_module to be
added as well:
./configure --add-module=<path-to-nginx-rtmp-module> --with-http_ssl_module
+### Windows limitations
+
+Windows support is limited. These features are not supported
+
+* execs
+* static pulls
+* auto_push
+
### RTMP URL format
rtmp://rtmp.example.com/app[/name]
@@ -239,7 +243,7 @@
# for the fragments. The directory contents is served via HTTP (see
# http{} section in config)
#
- # Incoming stream must be in H264/AAC/MP3. For iPhones use baseline H264
+ # Incoming stream must be in H264/AAC. For iPhones use baseline H264
# profile (see ffmpeg example).
# This example creates RTMP stream from movie ready for HLS:
#
|
[-]
[+]
|
Changed |
nginx-rtmp-module-1.0.5.tar.bz2/hls/ngx_rtmp_hls_module.c
^
|
@@ -17,6 +17,8 @@
static ngx_rtmp_stream_eof_pt next_stream_eof;
+static char * ngx_rtmp_hls_variant(ngx_conf_t *cf, ngx_command_t *cmd,
+ void *conf);
static ngx_int_t ngx_rtmp_hls_postconfiguration(ngx_conf_t *cf);
static void * ngx_rtmp_hls_create_app_conf(ngx_conf_t *cf);
static char * ngx_rtmp_hls_merge_app_conf(ngx_conf_t *cf,
@@ -37,12 +39,20 @@
typedef struct {
+ ngx_str_t suffix;
+ ngx_array_t args;
+} ngx_rtmp_hls_variant_t;
+
+
+typedef struct {
unsigned opened:1;
ngx_file_t file;
ngx_str_t playlist;
ngx_str_t playlist_bak;
+ ngx_str_t var_playlist;
+ ngx_str_t var_playlist_bak;
ngx_str_t stream;
ngx_str_t name;
@@ -59,6 +69,8 @@
ngx_buf_t *aframe;
uint64_t aframe_pts;
+
+ ngx_rtmp_hls_variant_t *var;
} ngx_rtmp_hls_ctx_t;
@@ -81,10 +93,13 @@
ngx_str_t path;
ngx_uint_t naming;
ngx_uint_t slicing;
+ ngx_uint_t type;
ngx_path_t *slot;
ngx_msec_t max_audio_delay;
size_t audio_buffer_size;
ngx_flag_t cleanup;
+ ngx_array_t *variant;
+ ngx_str_t base_url;
} ngx_rtmp_hls_app_conf_t;
@@ -97,6 +112,10 @@
#define NGX_RTMP_HLS_SLICING_ALIGNED 2
+#define NGX_RTMP_HLS_TYPE_LIVE 1
+#define NGX_RTMP_HLS_TYPE_EVENT 2
+
+
static ngx_conf_enum_t ngx_rtmp_hls_naming_slots[] = {
{ ngx_string("sequential"), NGX_RTMP_HLS_NAMING_SEQUENTIAL },
{ ngx_string("timestamp"), NGX_RTMP_HLS_NAMING_TIMESTAMP },
@@ -112,6 +131,13 @@
};
+static ngx_conf_enum_t ngx_rtmp_hls_type_slots[] = {
+ { ngx_string("live"), NGX_RTMP_HLS_TYPE_LIVE },
+ { ngx_string("event"), NGX_RTMP_HLS_TYPE_EVENT },
+ { ngx_null_string, 0 }
+};
+
+
static ngx_command_t ngx_rtmp_hls_commands[] = {
{ ngx_string("hls"),
@@ -191,6 +217,13 @@
offsetof(ngx_rtmp_hls_app_conf_t, slicing),
&ngx_rtmp_hls_slicing_slots },
+ { ngx_string("hls_type"),
+ NGX_RTMP_MAIN_CONF|NGX_RTMP_SRV_CONF|NGX_RTMP_APP_CONF|NGX_CONF_TAKE1,
+ ngx_conf_set_enum_slot,
+ NGX_RTMP_APP_CONF_OFFSET,
+ offsetof(ngx_rtmp_hls_app_conf_t, type),
+ &ngx_rtmp_hls_type_slots },
+
{ ngx_string("hls_max_audio_delay"),
NGX_RTMP_MAIN_CONF|NGX_RTMP_SRV_CONF|NGX_RTMP_APP_CONF|NGX_CONF_TAKE1,
ngx_conf_set_msec_slot,
@@ -212,6 +245,20 @@
offsetof(ngx_rtmp_hls_app_conf_t, cleanup),
NULL },
+ { ngx_string("hls_variant"),
+ NGX_RTMP_MAIN_CONF|NGX_RTMP_SRV_CONF|NGX_RTMP_APP_CONF|NGX_CONF_1MORE,
+ ngx_rtmp_hls_variant,
+ NGX_RTMP_APP_CONF_OFFSET,
+ 0,
+ NULL },
+
+ { ngx_string("hls_base_url"),
+ NGX_RTMP_MAIN_CONF|NGX_RTMP_SRV_CONF|NGX_RTMP_APP_CONF|NGX_CONF_TAKE1,
+ ngx_conf_set_str_slot,
+ NGX_RTMP_APP_CONF_OFFSET,
+ offsetof(ngx_rtmp_hls_app_conf_t, base_url),
+ NULL },
+
ngx_null_command
};
@@ -333,6 +380,112 @@
static ngx_int_t
+ngx_rtmp_hls_rename_file(u_char *src, u_char *dst)
+{
+ /* rename file with overwrite */
+
+#if (NGX_WIN32)
+ return MoveFileEx((LPCTSTR) src, (LPCTSTR) dst, MOVEFILE_REPLACE_EXISTING);
+#else
+ return ngx_rename_file(src, dst);
+#endif
+}
+
+
+static ngx_int_t
+ngx_rtmp_hls_write_variant_playlist(ngx_rtmp_session_t *s)
+{
+ static u_char buffer[1024];
+
+ u_char *p, *last;
+ ssize_t rc;
+ ngx_fd_t fd;
+ ngx_str_t *arg;
+ ngx_uint_t n, k;
+ ngx_rtmp_hls_ctx_t *ctx;
+ ngx_rtmp_hls_variant_t *var;
+ ngx_rtmp_hls_app_conf_t *hacf;
+
+ hacf = ngx_rtmp_get_module_app_conf(s, ngx_rtmp_hls_module);
+ ctx = ngx_rtmp_get_module_ctx(s, ngx_rtmp_hls_module);
+
+ fd = ngx_open_file(ctx->var_playlist_bak.data, NGX_FILE_WRONLY,
+ NGX_FILE_TRUNCATE, NGX_FILE_DEFAULT_ACCESS);
+
+ if (fd == NGX_INVALID_FILE) {
+ ngx_log_error(NGX_LOG_ERR, s->connection->log, ngx_errno,
+ "hls: " ngx_open_file_n " failed: '%V'",
+ &ctx->var_playlist_bak);
+
+ return NGX_ERROR;
+ }
+
+#define NGX_RTMP_HLS_VAR_HEADER "#EXTM3U\n#EXT-X-VERSION:3\n"
+
+ rc = ngx_write_fd(fd, NGX_RTMP_HLS_VAR_HEADER,
+ sizeof(NGX_RTMP_HLS_VAR_HEADER) - 1);
+ if (rc < 0) {
+ ngx_log_error(NGX_LOG_ERR, s->connection->log, ngx_errno,
+ "hls: " ngx_write_fd_n " failed: '%V'",
+ &ctx->var_playlist_bak);
+ ngx_close_file(fd);
+ return NGX_ERROR;
+ }
+
+ var = hacf->variant->elts;
+ for (n = 0; n < hacf->variant->nelts; n++, var++)
+ {
+ p = buffer;
+ last = buffer + sizeof(buffer);
+
+ p = ngx_slprintf(p, last, "#EXT-X-STREAM-INF:PROGRAM-ID=1");
+
+ arg = var->args.elts;
+ for (k = 0; k < var->args.nelts; k++, arg++) {
+ p = ngx_slprintf(p, last, ",%V", arg);
+ }
+
+ if (p < last) {
+ *p++ = '\n';
+ }
+
+ p = ngx_slprintf(p, last, "%V%*s%V",
+ &hacf->base_url,
+ ctx->name.len - ctx->var->suffix.len, ctx->name.data,
+ &var->suffix);
+ if (hacf->nested) {
+ p = ngx_slprintf(p, last, "%s", "/index");
+ }
+
+ p = ngx_slprintf(p, last, "%s", ".m3u8\n");
+
+ rc = ngx_write_fd(fd, buffer, p - buffer);
+ if (rc < 0) {
+ ngx_log_error(NGX_LOG_ERR, s->connection->log, ngx_errno,
+ "hls: " ngx_write_fd_n " failed '%V'",
+ &ctx->var_playlist_bak);
+ ngx_close_file(fd);
+ return NGX_ERROR;
+ }
+ }
+
+ ngx_close_file(fd);
+
+ rc = ngx_rtmp_hls_rename_file(ctx->var_playlist_bak.data,
+ ctx->var_playlist.data);
+
+ if (rc != NGX_OK) {
+ ngx_log_error(NGX_LOG_ERR, s->connection->log, ngx_errno,
+ "hls: rename failed: '%V'->'%V'",
+ &ctx->var_playlist_bak, &ctx->var_playlist);
+ return NGX_ERROR;
+ }
+
+ return NGX_OK;
+}
+
+
+static ngx_int_t
ngx_rtmp_hls_write_playlist(ngx_rtmp_session_t *s)
{
static u_char buffer[1024];
@@ -344,7 +497,8 @@
ngx_int_t nretry, rc;
ngx_rtmp_hls_frag_t *f;
ngx_uint_t i, max_frag;
- static ngx_str_t empty = ngx_null_string;
+ ngx_str_t name_part;
+ const char *sep;
hacf = ngx_rtmp_get_module_app_conf(s, ngx_rtmp_hls_module);
@@ -386,8 +540,11 @@
"#EXTM3U\n"
"#EXT-X-VERSION:3\n"
"#EXT-X-MEDIA-SEQUENCE:%uL\n"
- "#EXT-X-TARGETDURATION:%ui\n",
- ctx->frag, max_frag);
+ "#EXT-X-TARGETDURATION:%ui\n"
+ "%s",
+ ctx->frag, max_frag,
+ hacf->type == NGX_RTMP_HLS_TYPE_EVENT ?
+ "#EXT-X-PLAYLIST-TYPE: EVENT\n" : "");
n = ngx_write_fd(fd, buffer, p - buffer);
if (n < 0) {
@@ -398,17 +555,22 @@
return NGX_ERROR;
}
+ sep = hacf->nested ? (hacf->base_url.len ? "/" : "") : "-";
+
+ name_part.len = 0;
+ if (!hacf->nested || hacf->base_url.len) {
+ name_part = ctx->name;
+ }
+
for (i = 0; i < ctx->nfrags; i++) {
f = ngx_rtmp_hls_get_frag(s, i);
p = ngx_snprintf(buffer, sizeof(buffer),
"%s"
"#EXTINF:%.3f,\n"
- "%V%s%uL.ts\n",
+ "%V%V%s%uL.ts\n",
f->discont ? "#EXT-X-DISCONTINUITY\n" : "",
- f->duration,
- hacf->nested ? &empty : &ctx->name,
- hacf->nested ? "" : "-", f->id);
+ f->duration, &hacf->base_url, &name_part, sep, f->id);
ngx_log_debug5(NGX_LOG_DEBUG_RTMP, s->connection->log, 0,
"hls: fragment frag=%uL, n=%ui/%ui, duration=%.3f, "
@@ -427,13 +589,7 @@
ngx_close_file(fd);
-#if (NGX_WIN32)
- rc = MoveFileEx((LPCTSTR) ctx->playlist_bak.data,
- (LPCTSTR) ctx->playlist.data,
- MOVEFILE_REPLACE_EXISTING);
-#else
- rc = ngx_rename_file(ctx->playlist_bak.data, ctx->playlist.data);
-#endif
+ rc = ngx_rtmp_hls_rename_file(ctx->playlist_bak.data, ctx->playlist.data);
if (rc != NGX_OK) {
ngx_log_error(NGX_LOG_ERR, s->connection->log, ngx_errno,
@@ -442,6 +598,10 @@
return NGX_ERROR;
}
+ if (ctx->var) {
+ return ngx_rtmp_hls_write_variant_playlist(s);
+ }
+
return NGX_OK;
}
@@ -694,7 +854,7 @@
*ngx_sprintf(ctx->stream.data + ctx->stream.len, "%uL.ts", id) = 0;
ngx_log_debug5(NGX_LOG_DEBUG_RTMP, s->connection->log, 0,
- "hls: open fragment file='%s', frag=%uL, n=%uL, time=%uL, "
+ "hls: open fragment file='%s', frag=%uL, n=%ui, time=%uL, "
"discont=%i",
ctx->stream.data, ctx->frag, ctx->nfrags, ts, discont);
@@ -901,10 +1061,12 @@
{
ngx_rtmp_hls_app_conf_t *hacf;
ngx_rtmp_hls_ctx_t *ctx;
- u_char *p;
+ u_char *p, *pp;
ngx_rtmp_hls_frag_t *f;
ngx_buf_t *b;
size_t len;
+ ngx_rtmp_hls_variant_t *var;
+ ngx_uint_t n;
hacf = ngx_rtmp_get_module_app_conf(s, ngx_rtmp_hls_module);
if (hacf == NULL || !hacf->hls || hacf->path.len == 0) {
@@ -990,6 +1152,47 @@
ngx_memcpy(ctx->stream.data, ctx->playlist.data, ctx->stream.len - 1);
ctx->stream.data[ctx->stream.len - 1] = (hacf->nested ? '/' : '-');
+
+ /* varint playlist path */
+
+ if (hacf->variant) {
+ var = hacf->variant->elts;
+ for (n = 0; n < hacf->variant->nelts; n++, var++) {
+ if (ctx->name.len > var->suffix.len &&
+ ngx_memcmp(var->suffix.data,
+ ctx->name.data + ctx->name.len - var->suffix.len,
+ var->suffix.len)
+ == 0)
+ {
+ ctx->var = var;
+
+ len = (size_t) (p - ctx->playlist.data);
+
+ ctx->var_playlist.len = len - var->suffix.len + sizeof(".m3u8")
+ - 1;
+ ctx->var_playlist.data = ngx_palloc(s->connection->pool,
+ ctx->var_playlist.len + 1);
+
+ pp = ngx_cpymem(ctx->var_playlist.data, ctx->playlist.data,
+ len - var->suffix.len);
+ pp = ngx_cpymem(pp, ".m3u8", sizeof(".m3u8") - 1);
+ *pp = 0;
+
+ ctx->var_playlist_bak.len = ctx->var_playlist.len +
+ sizeof(".bak") - 1;
+ ctx->var_playlist_bak.data = ngx_palloc(s->connection->pool,
+ ctx->var_playlist_bak.len + 1);
+
+ pp = ngx_cpymem(ctx->var_playlist_bak.data,
+ ctx->var_playlist.data,
+ ctx->var_playlist.len);
+ pp = ngx_cpymem(pp, ".bak", sizeof(".bak") - 1);
+ *pp = 0;
+
+ break;
+ }
+ }
+ }
/* playlist path */
@@ -1815,6 +2018,58 @@
}
+static char *
+ngx_rtmp_hls_variant(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
+{
+ ngx_rtmp_hls_app_conf_t *hacf = conf;
+
+ ngx_str_t *value, *arg;
+ ngx_uint_t n;
+ ngx_rtmp_hls_variant_t *var;
+
+ value = cf->args->elts;
+
+ if (hacf->variant == NULL) {
+ hacf->variant = ngx_array_create(cf->pool, 1,
+ sizeof(ngx_rtmp_hls_variant_t));
+ if (hacf->variant == NULL) {
+ return NGX_CONF_ERROR;
+ }
+ }
+
+ var = ngx_array_push(hacf->variant);
+ if (var == NULL) {
+ return NGX_CONF_ERROR;
+ }
+
+ ngx_memzero(var, sizeof(ngx_rtmp_hls_variant_t));
+
+ var->suffix = value[1];
+
+ if (cf->args->nelts == 2) {
+ return NGX_CONF_OK;
+ }
+
+ if (ngx_array_init(&var->args, cf->pool, cf->args->nelts - 2,
+ sizeof(ngx_str_t))
+ != NGX_OK)
+ {
+ return NGX_CONF_ERROR;
+ }
+
+ arg = ngx_array_push_n(&var->args, cf->args->nelts - 2);
+ if (arg == NULL) {
+ return NGX_CONF_ERROR;
+ }
+
+ for (n = 2; n < cf->args->nelts; n++) {
+ *arg++ = value[n];
+ }
+
+ return NGX_CONF_OK;
+}
+
+
static void *
ngx_rtmp_hls_create_app_conf(ngx_conf_t *cf)
{
@@ -1835,6 +2090,7 @@
conf->nested = NGX_CONF_UNSET;
conf->naming = NGX_CONF_UNSET_UINT;
conf->slicing = NGX_CONF_UNSET_UINT;
+ conf->type = NGX_CONF_UNSET_UINT;
conf->max_audio_delay = NGX_CONF_UNSET_MSEC;
conf->audio_buffer_size = NGX_CONF_UNSET_SIZE;
conf->cleanup = NGX_CONF_UNSET;
@@ -1864,11 +2120,14 @@
NGX_RTMP_HLS_NAMING_SEQUENTIAL);
ngx_conf_merge_uint_value(conf->slicing, prev->slicing,
NGX_RTMP_HLS_SLICING_PLAIN);
+ ngx_conf_merge_uint_value(conf->type, prev->type,
+ NGX_RTMP_HLS_TYPE_LIVE);
ngx_conf_merge_msec_value(conf->max_audio_delay, prev->max_audio_delay,
300);
ngx_conf_merge_size_value(conf->audio_buffer_size, prev->audio_buffer_size,
NGX_RTMP_HLS_BUFSIZE);
ngx_conf_merge_value(conf->cleanup, prev->cleanup, 1);
+ ngx_conf_merge_str_value(conf->base_url, prev->base_url, "");
if (conf->fraglen) {
conf->winfrags = conf->playlen / conf->fraglen;
@@ -1876,7 +2135,9 @@
/* schedule cleanup */
- if (conf->path.len == 0 || !conf->cleanup) {
+ if (conf->path.len == 0 || !conf->cleanup ||
+ conf->type == NGX_RTMP_HLS_TYPE_EVENT)
+ {
return NGX_CONF_OK;
}
|
[-]
[+]
|
Changed |
nginx-rtmp-module-1.0.5.tar.bz2/ngx_rtmp.c
^
|
@@ -6,6 +6,7 @@
#include <ngx_config.h>
#include <ngx_core.h>
#include <ngx_event.h>
+#include <nginx.h>
#include "ngx_rtmp.h"
@@ -685,7 +686,11 @@
addrs[i].conf.ctx = addr[i].ctx;
- len = ngx_sock_ntop(addr[i].sockaddr, buf, NGX_SOCKADDR_STRLEN, 1);
+ len = ngx_sock_ntop(addr[i].sockaddr,
+#if (nginx_version >= 1005003)
+ addr[i].socklen,
+#endif
+ buf, NGX_SOCKADDR_STRLEN, 1);
p = ngx_pnalloc(cf->pool, len);
if (p == NULL) {
@@ -730,7 +735,11 @@
addrs6[i].conf.ctx = addr[i].ctx;
- len = ngx_sock_ntop(addr[i].sockaddr, buf, NGX_SOCKADDR_STRLEN, 1);
+ len = ngx_sock_ntop(addr[i].sockaddr,
+#if (nginx_version >= 1005003)
+ addr[i].socklen,
+#endif
+ buf, NGX_SOCKADDR_STRLEN, 1);
p = ngx_pnalloc(cf->pool, len);
if (p == NULL) {
|
[-]
[+]
|
Changed |
nginx-rtmp-module-1.0.5.tar.bz2/ngx_rtmp_cmd_module.c
^
|
@@ -171,7 +171,9 @@
}
len = ngx_strlen(v.app);
- if (len && v.app[len - 1] == '/') {
+ if (len > 10 && !ngx_memcmp(v.app + len - 10, "/_definst_", 10)) {
+ v.app[len - 10] = 0;
+ } else if (len && v.app[len - 1] == '/') {
v.app[len - 1] = 0;
}
|
[-]
[+]
|
Changed |
nginx-rtmp-module-1.0.5.tar.bz2/ngx_rtmp_codec_module.c
^
|
@@ -10,7 +10,46 @@
#include "ngx_rtmp_cmd_module.h"
+#define NGX_RTMP_CODEC_META_OFF 0
+#define NGX_RTMP_CODEC_META_ON 1
+#define NGX_RTMP_CODEC_META_COPY 2
+
+
+static void * ngx_rtmp_codec_create_app_conf(ngx_conf_t *cf);
+static char * ngx_rtmp_codec_merge_app_conf(ngx_conf_t *cf,
+ void *parent, void *child);
static ngx_int_t ngx_rtmp_codec_postconfiguration(ngx_conf_t *cf);
+static ngx_int_t ngx_rtmp_codec_reconstruct_meta(ngx_rtmp_session_t *s);
+static ngx_int_t ngx_rtmp_codec_copy_meta(ngx_rtmp_session_t *s,
+ ngx_rtmp_header_t *h, ngx_chain_t *in);
+static ngx_int_t ngx_rtmp_codec_prepare_meta(ngx_rtmp_session_t *s,
+ uint32_t timestamp);
+
+
+typedef struct {
+ ngx_uint_t meta;
+} ngx_rtmp_codec_app_conf_t;
+
+
+static ngx_conf_enum_t ngx_rtmp_codec_meta_slots[] = {
+ { ngx_string("off"), NGX_RTMP_CODEC_META_OFF },
+ { ngx_string("on"), NGX_RTMP_CODEC_META_ON },
+ { ngx_string("copy"), NGX_RTMP_CODEC_META_COPY },
+ { ngx_null_string, 0 }
+};
+
+
+static ngx_command_t ngx_rtmp_codec_commands[] = {
+
+ { ngx_string("meta"),
+ NGX_RTMP_MAIN_CONF|NGX_RTMP_SRV_CONF|NGX_RTMP_APP_CONF|NGX_CONF_TAKE1,
+ ngx_conf_set_enum_slot,
+ NGX_RTMP_APP_CONF_OFFSET,
+ offsetof(ngx_rtmp_codec_app_conf_t, meta),
+ &ngx_rtmp_codec_meta_slots },
+
+ ngx_null_command
+};
static ngx_rtmp_module_t ngx_rtmp_codec_module_ctx = {
@@ -20,15 +59,15 @@
NULL, /* init main configuration */
NULL, /* create server configuration */
NULL, /* merge server configuration */
- NULL, /* create app configuration */
- NULL /* merge app configuration */
+ ngx_rtmp_codec_create_app_conf, /* create app configuration */
+ ngx_rtmp_codec_merge_app_conf /* merge app configuration */
};
ngx_module_t ngx_rtmp_codec_module = {
NGX_MODULE_V1,
&ngx_rtmp_codec_module_ctx, /* module context */
- NULL, /* module directives */
+ ngx_rtmp_codec_commands, /* module directives */
NGX_RTMP_MODULE, /* module type */
NULL, /* init master */
NULL, /* init module */
@@ -276,12 +315,11 @@
static ngx_int_t
-ngx_rtmp_codec_update_meta(ngx_rtmp_session_t *s)
+ngx_rtmp_codec_reconstruct_meta(ngx_rtmp_session_t *s)
{
ngx_rtmp_codec_ctx_t *ctx;
ngx_rtmp_core_srv_conf_t *cscf;
ngx_int_t rc;
- ngx_rtmp_header_t h;
static struct {
double width;
@@ -395,10 +433,48 @@
return NGX_ERROR;
}
+ return ngx_rtmp_codec_prepare_meta(s, 0);
+}
+
+
+static ngx_int_t
+ngx_rtmp_codec_copy_meta(ngx_rtmp_session_t *s, ngx_rtmp_header_t *h,
+ ngx_chain_t *in)
+{
+ ngx_rtmp_codec_ctx_t *ctx;
+ ngx_rtmp_core_srv_conf_t *cscf;
+
+ ctx = ngx_rtmp_get_module_ctx(s, ngx_rtmp_codec_module);
+
+ cscf = ngx_rtmp_get_module_srv_conf(s, ngx_rtmp_core_module);
+
+ if (ctx->meta) {
+ ngx_rtmp_free_shared_chain(cscf, ctx->meta);
+ }
+
+ ctx->meta = ngx_rtmp_append_shared_bufs(cscf, NULL, in);
+
+ if (ctx->meta == NULL) {
+ return NGX_ERROR;
+ }
+
+ return ngx_rtmp_codec_prepare_meta(s, h->timestamp);
+}
+
+
+static ngx_int_t
+ngx_rtmp_codec_prepare_meta(ngx_rtmp_session_t *s, uint32_t timestamp)
+{
+ ngx_rtmp_header_t h;
+ ngx_rtmp_codec_ctx_t *ctx;
+
+ ctx = ngx_rtmp_get_module_ctx(s, ngx_rtmp_codec_module);
+
ngx_memzero(&h, sizeof(h));
h.csid = NGX_RTMP_CSID_AMF;
h.msid = NGX_RTMP_MSID;
h.type = NGX_RTMP_MSG_AMF_META;
+ h.timestamp = timestamp;
ngx_rtmp_prepare_message(s, &h, NULL, ctx->meta);
ctx->meta_version = ngx_rtmp_codec_get_next_version();
@@ -411,6 +487,7 @@
ngx_rtmp_codec_meta_data(ngx_rtmp_session_t *s, ngx_rtmp_header_t *h,
ngx_chain_t *in)
{
+ ngx_rtmp_codec_app_conf_t *cacf;
ngx_rtmp_codec_ctx_t *ctx;
ngx_uint_t skip;
@@ -509,6 +586,8 @@
in_inf, sizeof(in_inf) },
};
+ cacf = ngx_rtmp_get_module_app_conf(s, ngx_rtmp_codec_module);
+
ctx = ngx_rtmp_get_module_ctx(s, ngx_rtmp_codec_module);
if (ctx == NULL) {
ctx = ngx_pcalloc(s->connection->pool, sizeof(ngx_rtmp_codec_ctx_t));
@@ -555,12 +634,47 @@
ngx_rtmp_get_audio_codec_name(ctx->audio_codec_id),
ctx->audio_codec_id);
- ngx_rtmp_codec_update_meta(s);
+ switch (cacf->meta) {
+ case NGX_RTMP_CODEC_META_ON:
+ return ngx_rtmp_codec_reconstruct_meta(s);
+ case NGX_RTMP_CODEC_META_COPY:
+ return ngx_rtmp_codec_copy_meta(s, h, in);
+ }
+
+ /* NGX_RTMP_CODEC_META_OFF */
return NGX_OK;
}
+static void *
+ngx_rtmp_codec_create_app_conf(ngx_conf_t *cf)
+{
+ ngx_rtmp_codec_app_conf_t *cacf;
+
+ cacf = ngx_pcalloc(cf->pool, sizeof(ngx_rtmp_codec_app_conf_t));
+ if (cacf == NULL) {
+ return NULL;
+ }
+
+ cacf->meta = NGX_CONF_UNSET_UINT;
+
+ return cacf;
+}
+
+
+static char *
+ngx_rtmp_codec_merge_app_conf(ngx_conf_t *cf, void *parent, void *child)
+{
+ ngx_rtmp_codec_app_conf_t *prev = parent;
+ ngx_rtmp_codec_app_conf_t *conf = child;
+
+ ngx_conf_merge_uint_value(conf->meta, prev->meta, NGX_RTMP_CODEC_META_ON);
+
+ return NGX_CONF_OK;
+}
+
+
static ngx_int_t
ngx_rtmp_codec_postconfiguration(ngx_conf_t *cf)
{
|
[-]
[+]
|
Changed |
nginx-rtmp-module-1.0.5.tar.bz2/ngx_rtmp_core_module.c
^
|
@@ -7,6 +7,7 @@
#include <ngx_config.h>
#include <ngx_core.h>
#include <ngx_event.h>
+#include <nginx.h>
#include "ngx_rtmp.h"
@@ -599,7 +600,11 @@
ls->bind = 1;
} else {
- len = ngx_sock_ntop(sa, buf, NGX_SOCKADDR_STRLEN, 1);
+ len = ngx_sock_ntop(sa,
+#if (nginx_version >= 1005003)
+ ls->socklen,
+#endif
+ buf, NGX_SOCKADDR_STRLEN, 1);
ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
"ipv6only is not supported "
|
[-]
[+]
|
Changed |
nginx-rtmp-module-1.0.5.tar.bz2/ngx_rtmp_handler.c
^
|
@@ -276,7 +276,7 @@
s->in_last_ack = s->in_bytes;
ngx_log_debug1(NGX_LOG_DEBUG_RTMP, c->log, 0,
- "sending RTMP ACK(%D)", s->in_bytes);
+ "sending RTMP ACK(%uD)", s->in_bytes);
if (ngx_rtmp_send_ack(s, s->in_bytes)) {
ngx_rtmp_finalize_session(s);
|
[-]
[+]
|
Changed |
nginx-rtmp-module-1.0.5.tar.bz2/ngx_rtmp_live_module.c
^
|
@@ -37,13 +37,6 @@
offsetof(ngx_rtmp_live_app_conf_t, live),
NULL },
- { ngx_string("meta"),
- NGX_RTMP_MAIN_CONF|NGX_RTMP_SRV_CONF|NGX_RTMP_APP_CONF|NGX_CONF_TAKE1,
- ngx_conf_set_flag_slot,
- NGX_RTMP_APP_CONF_OFFSET,
- offsetof(ngx_rtmp_live_app_conf_t, meta),
- NULL },
-
{ ngx_string("stream_buckets"),
NGX_RTMP_MAIN_CONF|NGX_RTMP_SRV_CONF|NGX_RTMP_APP_CONF|NGX_CONF_TAKE1,
ngx_conf_set_str_slot,
@@ -150,7 +143,6 @@
}
lacf->live = NGX_CONF_UNSET;
- lacf->meta = NGX_CONF_UNSET;
lacf->nbuckets = NGX_CONF_UNSET;
lacf->buflen = NGX_CONF_UNSET_MSEC;
lacf->sync = NGX_CONF_UNSET_MSEC;
@@ -172,7 +164,6 @@
ngx_rtmp_live_app_conf_t *conf = child;
ngx_conf_merge_value(conf->live, prev->live, 0);
- ngx_conf_merge_value(conf->meta, prev->meta, 1);
ngx_conf_merge_value(conf->nbuckets, prev->nbuckets, 1024);
ngx_conf_merge_msec_value(conf->buflen, prev->buflen, 0);
ngx_conf_merge_msec_value(conf->sync, prev->sync, 300);
@@ -592,6 +583,11 @@
ngx_rtmp_live_stop(s);
}
+ if (ctx->publishing) {
+ ngx_rtmp_send_status(s, "NetStream.Unpublish.Success",
+ "status", "Stop publishing");
+ }
+
if (ctx->stream->ctx) {
ctx->stream = NULL;
goto next;
@@ -761,7 +757,7 @@
cs->timestamp = ch.timestamp;
delta = ch.timestamp - lh.timestamp;
-
+/*
if (delta >> 31) {
ngx_log_debug2(NGX_LOG_DEBUG_RTMP, s->connection->log, 0,
"live: clipping non-monotonical timestamp %uD->%uD",
@@ -771,7 +767,7 @@
ch.timestamp = lh.timestamp;
}
-
+*/
rpkt = ngx_rtmp_append_shared_bufs(cscf, NULL, in);
ngx_rtmp_prepare_message(s, &ch, &lh, rpkt);
@@ -809,7 +805,7 @@
}
}
- if (lacf->meta && codec_ctx->meta) {
+ if (codec_ctx->meta) {
meta = codec_ctx->meta;
meta_version = codec_ctx->meta_version;
}
|
[-]
[+]
|
Changed |
nginx-rtmp-module-1.0.5.tar.bz2/ngx_rtmp_record_module.c
^
|
@@ -397,7 +397,7 @@
}
if (ngx_strchr(rracf->suffix.data, '%')) {
- ngx_libc_localtime(ngx_cached_time->sec, &tm);
+ ngx_libc_localtime(rctx->timestamp, &tm);
p += strftime((char *) p, l - p, (char *) rracf->suffix.data, &tm);
} else {
p = ngx_cpymem(p, rracf->suffix.data,
|
[-]
[+]
|
Changed |
nginx-rtmp-module-1.0.5.tar.bz2/ngx_rtmp_stat_module.c
^
|
@@ -331,7 +331,7 @@
NGX_RTMP_STAT_L("</id>");
NGX_RTMP_STAT_L("<address>");
- NGX_RTMP_STAT_S(&s->connection->addr_text);
+ NGX_RTMP_STAT_ES(&s->connection->addr_text);
NGX_RTMP_STAT_L("</address>");
NGX_RTMP_STAT_L("<time>");
@@ -370,7 +370,7 @@
ngx_int_t n;
ngx_uint_t nclients, total_nclients;
u_char buf[NGX_INT_T_LEN];
- u_char bbuf[NGX_INT32_LEN * 2 + 1];
+ u_char bbuf[NGX_INT32_LEN];
ngx_rtmp_stat_loc_conf_t *slcf;
u_char *cname;
@@ -409,9 +409,8 @@
ngx_rtmp_stat_client(r, lll, s);
NGX_RTMP_STAT_L("<dropped>");
- NGX_RTMP_STAT(bbuf, ngx_snprintf(bbuf, sizeof(bbuf),
- "%uD/%uD", ctx->cs[1].dropped,
- ctx->cs[0].dropped) - bbuf);
+ NGX_RTMP_STAT(buf, ngx_snprintf(buf, sizeof(buf),
+ "%ui", ctx->ndropped) - buf);
NGX_RTMP_STAT_L("</dropped>");
NGX_RTMP_STAT_L("<avsync>");
|
[-]
[+]
|
Changed |
nginx-rtmp-module-1.0.5.tar.bz2/test/rtmp-publisher/RtmpPlayer.mxml
^
|
@@ -1,70 +1,69 @@
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
- xmlns:s="library://ns.adobe.com/flex/spark"
- xmlns:mx="library://ns.adobe.com/flex/mx"
- minWidth="500" minHeight="350" creationComplete="init()">
-
- <fx:Declarations>
- <!-- Place non-visual elements (e.g., services, value objects) here -->
- </fx:Declarations>
-
- <fx:Script>
- <![CDATA[
- import mx.controls.Alert;
- import mx.core.FlexGlobals;
- private var streamer:String;
- private var file:String;
-
- private function toggleFeedListener(event:MouseEvent):void {
- if(toggleFeed.label == 'Start Feed') {
- toggleFeed.label = 'Stop Feed';
- toggleAudio.enabled = true;
- videoDisplay.play();
- } else {
- toggleFeed.label = 'Start Feed';
- toggleAudio.enabled = false;
- videoDisplay.close();
- }
- }
-
- private function toggleAudioHandler(event:MouseEvent):void {
- if(toggleAudio.label == 'Unmute') {
- toggleAudio.label = 'Mute';
- videoDisplay.volume = 1;
- } else {
- toggleAudio.label = 'Unmute';
- videoDisplay.volume = 0;
- }
- }
-
- private function initListeners():void {
- toggleFeed.addEventListener(MouseEvent.CLICK, toggleFeedListener);
- toggleAudio.addEventListener(MouseEvent.CLICK, toggleAudioHandler);
- }
-
- private function init():void {
- streamer = FlexGlobals.topLevelApplication.parameters.streamer;
- file = FlexGlobals.topLevelApplication.parameters.file;
- if(file == null) {
- Alert.show('Missing flashvars: file');
- return;
- }
- if(streamer == null) {
- Alert.show('Missing flashvars: streamer');
- return;
- }
- videoDisplay.source = streamer + "/" + file;
- initListeners();
- }
- ]]>
- </fx:Script>
- <s:Panel x="0" y="0" width="100%" height="100%" title="RTMP Player">
- <mx:VideoDisplay width="100%" height="100%" id="videoDisplay" autoPlay="false">
- </mx:VideoDisplay>
- <s:controlBarContent>
- <s:Button label="Start Feed" id="toggleFeed"></s:Button>
- <s:Spacer width="100%" height="100%"/>
- <s:Button label="Mute" id="toggleAudio" enabled="false"></s:Button>
- </s:controlBarContent>
- </s:Panel>
+ xmlns:s="library://ns.adobe.com/flex/spark"
+ xmlns:mx="library://ns.adobe.com/flex/mx"
+ minWidth="500" minHeight="350" creationComplete="init()">
+
+ <fx:Script>
+ <![CDATA[
+ import mx.controls.Alert;
+ import mx.core.FlexGlobals;
+ import flash.display.StageDisplayState;
+ import mx.managers.SystemManager;
+
+ private var streamer:String;
+ private var file:String;
+
+ private function playButtonListener(event:MouseEvent):void {
+ if(playButton.label == 'Play') {
+ playButton.label = 'Stop';
+ videoDisplay.source = streamer + "/" + file;
+ videoDisplay.play();
+ } else {
+ playButton.label = 'Play';
+ videoDisplay.source = "";
+ //videoDisplay.close();
+ }
+ }
+
+ private function fullscreenButtonListener(event:MouseEvent):void {
+ try {
+ switch (systemManager.stage.displayState) {
+ case StageDisplayState.FULL_SCREEN:
+ stage.displayState = StageDisplayState.NORMAL;
+ break;
+ default:
+ stage.displayState = StageDisplayState.FULL_SCREEN;
+ break;
+ }
+ } catch (err:SecurityError) {
+ // ignore
+ }
+ }
+
+ private function init():void {
+ videoDisplay.mx_internal::videoPlayer.bufferTime = 1;
+
+ streamer = FlexGlobals.topLevelApplication.parameters.streamer;
+ if(streamer == null) {
+ Alert.show('Missing flashvars: streamer');
+ return;
+ }
+
+ file = FlexGlobals.topLevelApplication.parameters.file;
+ if(file == null) {
+ Alert.show('Missing flashvars: file');
+ return;
+ }
+
+ playButton.addEventListener(MouseEvent.CLICK, playButtonListener);
+ fullscreenButton.addEventListener(MouseEvent.CLICK, fullscreenButtonListener);
+ }
+ ]]>
+ </fx:Script>
+ <s:BorderContainer x="0" y="0" width="100%" height="100%">
+ <s:VideoDisplay width="100%" height="100%" id="videoDisplay"></s:VideoDisplay>
+ <s:Button label="Play" id="playButton" horizontalCenter="0" bottom="10"></s:Button>
+ <s:Button label="[ ]" id="fullscreenButton" right="10" bottom="10"></s:Button>
+ </s:BorderContainer>
</s:Application>
|
|
Changed |
nginx-rtmp-module-1.0.5.tar.bz2/test/rtmp-publisher/RtmpPlayer.swf
^
|
[-]
[+]
|
Changed |
nginx-rtmp-module-1.0.5.tar.bz2/test/rtmp-publisher/RtmpPublisher.mxml
^
|
@@ -4,14 +4,13 @@
xmlns:mx="library://ns.adobe.com/flex/mx"
minWidth="500" minHeight="350" creationComplete="init()">
- <fx:Declarations>
- <!-- Place non-visual elements (e.g., services, value objects) here -->
- </fx:Declarations>
-
<fx:Script>
<![CDATA[
import mx.controls.Alert;
import mx.core.FlexGlobals;
+ import mx.events.FlexEvent;
+ import spark.skins.spark.PanelSkin;
+
private var streamer:String;
private var file:String;
private var camera:Camera;
@@ -20,50 +19,21 @@
private var stream:NetStream;
private var h264Settings:H264VideoStreamSettings;
- private function toggleFeedListener(event:MouseEvent):void {
- if(toggleFeed.label == 'Start Feed') {
- toggleFeed.label = 'Stop Feed';
- stream.publish(file, 'live');
- videoDisplay.attachCamera(camera);
- toggleVideo.enabled = true;
- toggleAudio.enabled = true;
+ private function publishButtonListener(event:MouseEvent):void {
+ if(publishButton.label == 'Publish') {
+ publishButton.label = 'Stop';
+ connection = new NetConnection();
+ connection.connect(streamer);
+ connection.addEventListener(NetStatusEvent.NET_STATUS, netStatusHander);
} else {
- toggleFeed.label = 'Start Feed';
+ publishButton.label = 'Publish';
stream.close();
- videoDisplay.attachCamera(null);
- toggleVideo.enabled = false;
- toggleAudio.enabled = false;
- }
- }
-
- private function toggleVideoListener(event:MouseEvent):void {
- if(toggleVideo.label == 'Start Video') {
- toggleVideo.label = 'Stop Video';
- videoDisplay.attachCamera(camera);
- stream.attachCamera(camera);
- } else {
- toggleVideo.label = 'Start Video';
- videoDisplay.attachCamera(null);
- stream.attachCamera(null);
- }
- }
-
- private function toggleAudioListener(event:MouseEvent):void {
- if(toggleAudio.label == 'Start Audio') {
- toggleAudio.label = 'Stop Audio';
- stream.attachAudio(microphone);
- } else {
- toggleAudio.label = 'Start Audio';
- stream.attachAudio(null);
+ connection.close();
+ stream = null;
+ connection = null;
}
}
- private function initListeners():void {
- toggleFeed.addEventListener(MouseEvent.CLICK, toggleFeedListener);
- toggleVideo.addEventListener(MouseEvent.CLICK, toggleVideoListener);
- toggleAudio.addEventListener(MouseEvent.CLICK, toggleAudioListener);
- }
-
private function netStatusHander(event:NetStatusEvent):void {
switch(event.info.code) {
case 'NetConnection.Connect.Success':
@@ -71,47 +41,46 @@
stream.attachCamera(camera);
stream.attachAudio(microphone);
h264Settings = new H264VideoStreamSettings();
- h264Settings.setProfileLevel(H264Profile.BASELINE, H264Level.LEVEL_1_2);
+ h264Settings.setProfileLevel(H264Profile.BASELINE, H264Level.LEVEL_3_1);
stream.videoStreamSettings = h264Settings;
+ stream.publish(file, 'live');
break;
}
}
private function init():void {
streamer = FlexGlobals.topLevelApplication.parameters.streamer;
+ if(streamer == null) {
+ Alert.show('Missing flashvars: streamer');
+ return;
+ }
+
file = FlexGlobals.topLevelApplication.parameters.file;
if(file == null) {
Alert.show('Missing flashvars: file');
return;
}
- if(streamer == null) {
- Alert.show('Missing flashvars: streamer');
- return;
- }
- initListeners();
+
+ publishButton.addEventListener(MouseEvent.CLICK, publishButtonListener);
camera = Camera.getCamera();
+ camera.setMode(640, 480, 30);
+ camera.setQuality(131072, 70);
+
+ //videoDisplay.attachCamera(camera);
+ var localCam:Video = new Video(640,480);
+ localCam.attachCamera(camera);
+ videoDisplay.addChild(localCam);
+
microphone = Microphone.getMicrophone();
microphone.setSilenceLevel(0);
microphone.codec = "Speex";
microphone.encodeQuality = 6;
- camera.setMode(704, 576, 25);
- camera.setQuality(131072, 70);
- connection = new NetConnection();
- connection.connect(streamer);
- connection.addEventListener(NetStatusEvent.NET_STATUS, netStatusHander);
-
}
]]>
</fx:Script>
- <s:Panel x="0" y="0" width="100%" height="100%" title="RTMP Publisher">
- <mx:VideoDisplay width="100%" height="100%" id="videoDisplay">
- </mx:VideoDisplay>
- <s:controlBarContent>
- <s:Button label="Start Feed" id="toggleFeed"></s:Button>
- <s:Spacer width="100%" height="100%"/>
- <s:Button label="Stop Video" id="toggleVideo" enabled="false"></s:Button>
- <s:Button label="Stop Audio" id="toggleAudio" enabled="false"></s:Button>
- </s:controlBarContent>
- </s:Panel>
+ <s:BorderContainer x="0" y="0" width="100%" height="100%">
+ <s:VideoDisplay width="100%" height="100%" id="videoDisplay"></s:VideoDisplay>
+ <s:Button label="Publish" id="publishButton" horizontalCenter="0" bottom="10"></s:Button>
+ </s:BorderContainer>
</s:Application>
|
|
Changed |
nginx-rtmp-module-1.0.5.tar.bz2/test/rtmp-publisher/RtmpPublisher.swf
^
|
[-]
[+]
|
Changed |
nginx-rtmp-module-1.0.5.tar.bz2/test/rtmp-publisher/player.html
^
|
@@ -8,7 +8,10 @@
streamer: 'rtmp://localhost/myapp',
file:'mystream'
};
- swfobject.embedSWF("RtmpPlayer.swf", "rtmp-publisher", "500", "400", "9.0.0", null, flashVars);
+ var params = {};
+ params.allowfullscreen = "true";
+ var attributes = {};
+ swfobject.embedSWF("RtmpPlayer.swf", "rtmp-publisher", "640", "480", "9.0.0", null, flashVars, params, attributes);
</script>
</head>
<body>
|
[-]
[+]
|
Changed |
nginx-rtmp-module-1.0.5.tar.bz2/test/rtmp-publisher/publisher.html
^
|
@@ -8,7 +8,7 @@
streamer: 'rtmp://localhost/myapp',
file:'mystream'
};
- swfobject.embedSWF("RtmpPublisher.swf", "rtmp-publisher", "500", "400", "9.0.0", null, flashVars);
+ swfobject.embedSWF("RtmpPublisher.swf", "rtmp-publisher", "640", "480", "9.0.0", null, flashVars);
</script>
</head>
<body>
|