-
-
Notifications
You must be signed in to change notification settings - Fork 576
/
ngx_rtmp_codec_module.h
119 lines (95 loc) · 3.48 KB
/
ngx_rtmp_codec_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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
/*
* Copyright (C) Roman Arutyunyan
* Copyright (C) Winshining
*/
#ifndef _NGX_RTMP_CODEC_H_INCLUDED_
#define _NGX_RTMP_CODEC_H_INCLUDED_
#include <ngx_config.h>
#include <ngx_core.h>
#include "ngx_rtmp.h"
/* AVC NAL unit types */
enum {
NGX_RTMP_NALU_SLICE = 1,
NGX_RTMP_NALU_DPA = 2,
NGX_RTMP_NALU_DPB = 3,
NGX_RTMP_NALU_DPC = 4,
NGX_RTMP_NALU_IDR = 5,
NGX_RTMP_NALU_SEI = 6,
NGX_RTMP_NALU_SPS = 7,
NGX_RTMP_NALU_PPS = 8,
NGX_RTMP_NALU_AUD = 9,
NGX_RTMP_NALU_EOSEQ = 10,
NGX_RTMP_NALU_EOSTREAM = 11,
NGX_RTMP_NALU_FILL = 12,
NGX_RTMP_NALU_SPS_EXT = 13,
NGX_RTMP_NALU_AUXILIARY_SLICE = 19
};
/* AVC frame types */
enum {
NGX_RTMP_FRAME_IDR = 1,
NGX_RTMP_FRAME_INTER = 2,
NGX_RTMP_FRAME_DISPOSABLE = 3,
NGX_RTMP_FRAME_GENERATED = 4,
NGX_RTMP_FRAME_VIDEOINFOCMD = 5
};
/* Audio codecs */
enum {
/* Uncompressed codec id is actually 0,
* but we use another value for consistency */
NGX_RTMP_AUDIO_UNCOMPRESSED = 16,
NGX_RTMP_AUDIO_ADPCM = 1,
NGX_RTMP_AUDIO_MP3 = 2,
NGX_RTMP_AUDIO_LINEAR_LE = 3,
NGX_RTMP_AUDIO_NELLY16 = 4,
NGX_RTMP_AUDIO_NELLY8 = 5,
NGX_RTMP_AUDIO_NELLY = 6,
NGX_RTMP_AUDIO_G711A = 7,
NGX_RTMP_AUDIO_G711U = 8,
NGX_RTMP_AUDIO_AAC = 10,
NGX_RTMP_AUDIO_SPEEX = 11,
NGX_RTMP_AUDIO_MP3_8 = 14,
NGX_RTMP_AUDIO_DEVSPEC = 15
};
/* Video codecs */
enum {
NGX_RTMP_VIDEO_JPEG = 1,
NGX_RTMP_VIDEO_SORENSON_H263 = 2,
NGX_RTMP_VIDEO_SCREEN = 3,
NGX_RTMP_VIDEO_ON2_VP6 = 4,
NGX_RTMP_VIDEO_ON2_VP6_ALPHA = 5,
NGX_RTMP_VIDEO_SCREEN2 = 6,
NGX_RTMP_VIDEO_H264 = 7
};
u_char * ngx_rtmp_get_audio_codec_name(ngx_uint_t id);
u_char * ngx_rtmp_get_video_codec_name(ngx_uint_t id);
#define NGX_RTMP_SPS_MAX_LENGTH 256
typedef struct {
ngx_uint_t width;
ngx_uint_t height;
double duration;
double frame_rate;
double video_data_rate;
ngx_uint_t video_codec_id;
double audio_data_rate;
ngx_uint_t audio_codec_id;
ngx_uint_t aac_profile;
ngx_uint_t aac_chan_conf;
ngx_uint_t aac_sbr;
ngx_uint_t aac_ps;
ngx_uint_t avc_profile;
ngx_uint_t avc_compat;
ngx_uint_t avc_level;
ngx_uint_t avc_nal_bytes;
ngx_uint_t avc_ref_frames;
ngx_uint_t sample_rate; /* 5512, 11025, 22050, 44100 */
ngx_uint_t sample_size; /* 1=8bit, 2=16bit */
ngx_uint_t audio_channels; /* 1, 2 */
u_char profile[32];
u_char level[32];
ngx_chain_t *avc_header;
ngx_chain_t *aac_header;
ngx_chain_t *meta;
ngx_uint_t meta_version;
} ngx_rtmp_codec_ctx_t;
extern ngx_module_t ngx_rtmp_codec_module;
#endif /* _NGX_RTMP_LIVE_H_INCLUDED_ */