-
Notifications
You must be signed in to change notification settings - Fork 73
/
ngx_rtmp_gop_cache_module.h
78 lines (56 loc) · 2.73 KB
/
ngx_rtmp_gop_cache_module.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
/*
* Copyright (C) 2017 Gnolizuh
*/
#ifndef _NGX_RTMP_GOP_CACHE_H_INCLUDED_
#define _NGX_RTMP_GOP_CACHE_H_INCLUDED_
#include "ngx_rtmp.h"
#define NGX_RTMP_LIVE_PURE_AUDIO_GUESS_CNT 115 /* pure audio */
typedef struct ngx_rtmp_gop_frame_s ngx_rtmp_gop_frame_t;
typedef struct ngx_rtmp_gop_cache_s ngx_rtmp_gop_cache_t;
typedef struct {
ngx_chain_t *(*append_meta)(ngx_rtmp_session_t *s, ngx_rtmp_header_t *h, ngx_chain_t *in);
void (*send_header)(ngx_rtmp_session_t *s, ngx_rtmp_session_t *ps);
ngx_int_t (*send_message)(ngx_rtmp_session_t *s, ngx_chain_t *in, ngx_uint_t priority);
ngx_chain_t *(*append_shared_bufs)(ngx_rtmp_session_t *s, ngx_rtmp_header_t *h, ngx_rtmp_header_t *lh, ngx_chain_t *in);
void (*free_shared_chain)(ngx_rtmp_session_t *s, ngx_chain_t *in);
} ngx_rtmp_send_handler_t;
struct ngx_rtmp_gop_frame_s {
ngx_rtmp_header_t h;
ngx_uint_t prio;
ngx_chain_t *frame;
ngx_rtmp_gop_frame_t *next;
};
struct ngx_rtmp_gop_cache_s {
ngx_rtmp_gop_frame_t *head;
ngx_rtmp_gop_frame_t *tail;
ngx_rtmp_gop_cache_t *next;
ngx_chain_t *video_seq_header_data;
ngx_chain_t *audio_seq_header_data;
ngx_chain_t *meta;
ngx_chain_t *meta_flv;
ngx_uint_t meta_version;
ngx_rtmp_header_t meta_header;
ngx_int_t video_frame_cnt;
ngx_int_t audio_frame_cnt;
};
typedef struct {
ngx_pool_t *pool;
ngx_rtmp_gop_cache_t *head;
ngx_rtmp_gop_cache_t *tail;
ngx_rtmp_gop_cache_t *free_cache;
ngx_rtmp_gop_frame_t *free_frame;
ngx_uint_t cache_count;
ngx_uint_t video_frame_cnt;
ngx_uint_t audio_frame_cnt;
ngx_uint_t audio_after_last_video_cnt;
} ngx_rtmp_gop_cache_ctx_t;
typedef struct {
ngx_flag_t gop_cache;
ngx_int_t gop_cache_count;
ngx_int_t gop_max_count;
ngx_int_t gop_max_acount;
ngx_int_t gop_max_vcount;
} ngx_rtmp_gop_cache_app_conf_t;
extern ngx_module_t ngx_rtmp_gop_cache_module;
extern ngx_rtmp_send_handler_t *ngx_rtmp_send_handlers[2];
#endif /* _NGX_RTMP_LIVE_H_INCLUDED_ */