Skip to content

Commit 94fdac5

Browse files
committed
Merge branch 'shared_record'
2 parents 6b5f766 + 5d7a5ea commit 94fdac5

File tree

2 files changed

+50
-29
lines changed

2 files changed

+50
-29
lines changed

ngx_rtmp_record_module.c

Lines changed: 4 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,12 @@
99
#include "ngx_rtmp_cmd_module.h"
1010
#include "ngx_rtmp_netcall_module.h"
1111
#include "ngx_rtmp_codec_module.h"
12+
#include "ngx_rtmp_record_module.h"
1213

1314

1415
static ngx_rtmp_publish_pt next_publish;
1516
static ngx_rtmp_delete_stream_pt next_delete_stream;
1617

17-
static ngx_int_t ngx_rtmp_record_open(ngx_rtmp_session_t *s);
18-
static ngx_int_t ngx_rtmp_record_close(ngx_rtmp_session_t *s);
19-
2018

2119
static char * ngx_rtmp_notify_on_record_done(ngx_conf_t *cf,
2220
ngx_command_t *cmd, void *conf);
@@ -28,29 +26,6 @@ static ngx_int_t ngx_rtmp_record_write_frame(ngx_rtmp_session_t *s,
2826
ngx_rtmp_header_t *h, ngx_chain_t *in);
2927

3028

31-
typedef struct {
32-
ngx_uint_t flags;
33-
ngx_str_t path;
34-
size_t max_size;
35-
size_t max_frames;
36-
ngx_msec_t interval;
37-
ngx_str_t suffix;
38-
ngx_flag_t unique;
39-
ngx_url_t *url;
40-
} ngx_rtmp_record_app_conf_t;
41-
42-
43-
typedef struct {
44-
ngx_file_t file;
45-
ngx_uint_t nframes;
46-
uint32_t epoch;
47-
ngx_time_t last;
48-
time_t timestamp;
49-
u_char name[NGX_RTMP_MAX_NAME];
50-
u_char args[NGX_RTMP_MAX_ARGS];
51-
} ngx_rtmp_record_ctx_t;
52-
53-
5429
#define NGX_RTMP_RECORD_OFF 0x01
5530
#define NGX_RTMP_RECORD_AUDIO 0x02
5631
#define NGX_RTMP_RECORD_VIDEO 0x04
@@ -223,7 +198,7 @@ ngx_rtmp_record_write_header(ngx_file_t *file)
223198

224199

225200
/* This funcion returns pointer to a static buffer */
226-
static u_char *
201+
u_char *
227202
ngx_rtmp_record_make_path(ngx_rtmp_session_t *s)
228203
{
229204
ngx_rtmp_record_ctx_t *ctx;
@@ -256,7 +231,7 @@ ngx_rtmp_record_make_path(ngx_rtmp_session_t *s)
256231
}
257232

258233

259-
static ngx_int_t
234+
ngx_int_t
260235
ngx_rtmp_record_open(ngx_rtmp_session_t *s)
261236
{
262237
ngx_rtmp_record_ctx_t *ctx;
@@ -455,7 +430,7 @@ ngx_rtmp_record_notify(ngx_rtmp_session_t *s)
455430
}
456431

457432

458-
static ngx_int_t
433+
ngx_int_t
459434
ngx_rtmp_record_close(ngx_rtmp_session_t *s)
460435
{
461436
ngx_rtmp_record_ctx_t *ctx;

ngx_rtmp_record_module.h

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
/*
2+
* Copyright (c) 2012 Roman Arutyunyan
3+
*/
4+
5+
6+
#ifndef _NGX_RTMP_RECORD_H_INCLUDED_
7+
#define _NGX_RTMP_RECORD_H_INCLUDED_
8+
9+
10+
#include "ngx_rtmp.h"
11+
12+
13+
typedef struct {
14+
ngx_uint_t flags;
15+
ngx_str_t path;
16+
size_t max_size;
17+
size_t max_frames;
18+
ngx_msec_t interval;
19+
ngx_str_t suffix;
20+
ngx_flag_t unique;
21+
ngx_url_t *url;
22+
} ngx_rtmp_record_app_conf_t;
23+
24+
25+
typedef struct {
26+
ngx_file_t file;
27+
ngx_uint_t nframes;
28+
uint32_t epoch;
29+
ngx_time_t last;
30+
time_t timestamp;
31+
u_char name[NGX_RTMP_MAX_NAME];
32+
u_char args[NGX_RTMP_MAX_ARGS];
33+
} ngx_rtmp_record_ctx_t;
34+
35+
36+
u_char * ngx_rtmp_record_make_path(ngx_rtmp_session_t *s);
37+
38+
ngx_int_t ngx_rtmp_record_open(ngx_rtmp_session_t *s);
39+
40+
ngx_int_t ngx_rtmp_record_close(ngx_rtmp_session_t *s);
41+
42+
43+
extern ngx_module_t ngx_rtmp_record_module;
44+
45+
46+
#endif /* _NGX_RTMP_RECORD_H_INCLUDED_ */

0 commit comments

Comments
 (0)