Merge branch 'multi-record'

This commit is contained in:
Roman Arutyunyan 2012-09-10 13:38:15 +04:00
commit ff247dafff
3 changed files with 556 additions and 199 deletions

View file

@ -326,6 +326,7 @@ typedef struct {
#define NGX_RTMP_MAIN_CONF 0x02000000
#define NGX_RTMP_SRV_CONF 0x04000000
#define NGX_RTMP_APP_CONF 0x08000000
#define NGX_RTMP_REC_CONF 0x10000000
#define NGX_RTMP_MAIN_CONF_OFFSET offsetof(ngx_rtmp_conf_ctx_t, main_conf)

File diff suppressed because it is too large Load diff

View file

@ -10,7 +10,15 @@
#include "ngx_rtmp.h"
#define NGX_RTMP_RECORD_OFF 0x01
#define NGX_RTMP_RECORD_AUDIO 0x02
#define NGX_RTMP_RECORD_VIDEO 0x04
#define NGX_RTMP_RECORD_KEYFRAMES 0x08
#define NGX_RTMP_RECORD_MANUAL 0x10
typedef struct {
ngx_str_t id;
ngx_uint_t flags;
ngx_str_t path;
size_t max_size;
@ -19,25 +27,40 @@ typedef struct {
ngx_str_t suffix;
ngx_flag_t unique;
ngx_url_t *url;
} ngx_rtmp_record_node_t;
typedef struct {
ngx_rtmp_record_node_t def;
ngx_array_t nodes; /* ngx_rtmp_record_node_t * */
} ngx_rtmp_record_app_conf_t;
typedef struct {
ngx_rtmp_record_node_t *conf;
ngx_file_t file;
ngx_uint_t nframes;
uint32_t epoch;
ngx_time_t last;
time_t timestamp;
} ngx_rtmp_record_node_ctx_t;
typedef struct {
ngx_array_t nodes; /* ngx_rtmp_record_node_ctx_t */
u_char name[NGX_RTMP_MAX_NAME];
u_char args[NGX_RTMP_MAX_ARGS];
} ngx_rtmp_record_ctx_t;
u_char * ngx_rtmp_record_make_path(ngx_rtmp_session_t *s);
ngx_int_t ngx_rtmp_record_open(ngx_rtmp_session_t *s);
/* Manual recording control,
* 'n' is record node index in config array.
* Note: these functions return path as pointer to a static buffer */
ngx_int_t ngx_rtmp_record_close(ngx_rtmp_session_t *s);
ngx_int_t ngx_rtmp_record_open(ngx_rtmp_session_t *s, ngx_uint_t n,
u_char **path);
ngx_int_t ngx_rtmp_record_close(ngx_rtmp_session_t *s, ngx_uint_t n,
u_char **path);
extern ngx_module_t ngx_rtmp_record_module;