forked from ML-Cai/IPcam
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathVOD_network_packet.h
97 lines (93 loc) · 2.02 KB
/
VOD_network_packet.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
#ifndef VOD_NETWORK_PACKET_H
#define VOD_NETWORK_PACKET_H
/* ---------------------------------------------------------------------------------------- */
/* Controller packet
*
*/
#define VOD_PACKET_TYPE_COMMAND 1
#define VOD_PACKET_TYPE_SERVICE 2
#define VOD_PACKET_TYPE_CODEC_CONTEXT 4
#define VOD_PACKET_TYPE_FRAME_HEADER 8
#define VOD_PACKET_TYPE_FRAME_DATA 16
/* Code Contex packet */
struct VOD_packet_CodecContext_slice
{
int bit_rate;
int width;
int height;
int time_base_den;
int time_base_num;
int gop_size;
int max_b_frames;
enum AVPixelFormat pix_fmt;
enum AVCodecID codec_id;
enum AVMediaType codec_type ;
int extradata_size ;
};
struct VOD_packet_CodecContext
{
struct VOD_packet_CodecContext_slice data;
char extradata[256];
};
/* -------------------------------------------------------- */
enum VOD_command {
COMMAND_STOP = 1,
COMMAND_PLAY = 2,
COMMAND_SEEK = 4,
COMMAND_FORWARD = 8,
COMMAND_BACKWARD = 16,
};
enum VOD_service{
REQ_LIST = 1,
REQ_CODEC = 2,
REQ_SEGMENT = 4,
REQ_LAST_FRAME_ID = 8,
};
/* VOD stream command */
struct VOD_packet_command
{
enum VOD_command controller ;
char Data[256] ;
} ;
/* VOD stream service request */
struct VOD_packet_service
{
enum VOD_service controller ;
char Data[256] ;
} ;
/* -------------------------------------------------------- */
/* VOD controller packet */
struct VOD_ControllerPacket_struct
{
int ControlType ;
union
{
struct VOD_packet_command command ;
struct VOD_packet_service service ;
struct VOD_packet_CodecContext codec_contex ;
};
};
/* ---------------------------------------------------------------------------------------- */
/* Data packet
*
*/
/* VOD AVPacket data slice , per slice 1024 bit ,and it's rebuild ID*/
struct VOD_packet_frame_data_slice
{
int ID ;
int size ;
char data[1024] ;
} ;
//#pragma pack(1)
struct VOD_DataPacket_struct
{
int DataType ;
union
{
struct AVPacket header ;
struct VOD_packet_frame_data_slice data ;
};
};
//#pragma pack()
/* -------------------------------------------------------- */
#endif