Main Page
Related Pages
Modules
Data Structures
Files
Examples
File List
Globals
libavformat
rtmppkt.h
Go to the documentation of this file.
1
/*
2
* RTMP packet utilities
3
* Copyright (c) 2009 Kostya Shishkov
4
*
5
* This file is part of Libav.
6
*
7
* Libav is free software; you can redistribute it and/or
8
* modify it under the terms of the GNU Lesser General Public
9
* License as published by the Free Software Foundation; either
10
* version 2.1 of the License, or (at your option) any later version.
11
*
12
* Libav is distributed in the hope that it will be useful,
13
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15
* Lesser General Public License for more details.
16
*
17
* You should have received a copy of the GNU Lesser General Public
18
* License along with Libav; if not, write to the Free Software
19
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20
*/
21
22
#ifndef AVFORMAT_RTMPPKT_H
23
#define AVFORMAT_RTMPPKT_H
24
25
#include "
avformat.h
"
26
#include "
url.h
"
27
29
#define RTMP_CHANNELS 65599
30
35
enum
RTMPChannel
{
36
RTMP_NETWORK_CHANNEL
= 2,
37
RTMP_SYSTEM_CHANNEL
,
38
RTMP_SOURCE_CHANNEL
,
39
RTMP_VIDEO_CHANNEL
= 8,
40
RTMP_AUDIO_CHANNEL
,
41
};
42
46
typedef
enum
RTMPPacketType
{
47
RTMP_PT_CHUNK_SIZE
= 1,
48
RTMP_PT_BYTES_READ
= 3,
49
RTMP_PT_PING
,
50
RTMP_PT_SERVER_BW
,
51
RTMP_PT_CLIENT_BW
,
52
RTMP_PT_AUDIO
= 8,
53
RTMP_PT_VIDEO
,
54
RTMP_PT_FLEX_STREAM
= 15,
55
RTMP_PT_FLEX_OBJECT
,
56
RTMP_PT_FLEX_MESSAGE
,
57
RTMP_PT_NOTIFY
,
58
RTMP_PT_SHARED_OBJ
,
59
RTMP_PT_INVOKE
,
60
RTMP_PT_METADATA
= 22,
61
}
RTMPPacketType
;
62
66
enum
RTMPPacketSize
{
67
RTMP_PS_TWELVEBYTES
= 0,
68
RTMP_PS_EIGHTBYTES
,
69
RTMP_PS_FOURBYTES
,
70
RTMP_PS_ONEBYTE
71
};
72
76
typedef
struct
RTMPPacket
{
77
int
channel_id
;
78
RTMPPacketType
type
;
79
uint32_t
timestamp
;
80
uint32_t
ts_delta
;
81
uint32_t
extra
;
82
uint8_t *
data
;
83
int
size
;
84
}
RTMPPacket
;
85
96
int
ff_rtmp_packet_create
(
RTMPPacket
*pkt,
int
channel_id,
RTMPPacketType
type,
97
int
timestamp,
int
size
);
98
104
void
ff_rtmp_packet_destroy
(
RTMPPacket
*pkt);
105
116
int
ff_rtmp_packet_read
(
URLContext
*h,
RTMPPacket
*p,
117
int
chunk_size,
RTMPPacket
*prev_pkt);
118
129
int
ff_rtmp_packet_write
(
URLContext
*h,
RTMPPacket
*p,
130
int
chunk_size,
RTMPPacket
*prev_pkt);
131
138
void
ff_rtmp_packet_dump
(
void
*ctx,
RTMPPacket
*p);
139
153
int
ff_amf_tag_size
(
const
uint8_t *
data
,
const
uint8_t *data_end);
154
165
int
ff_amf_get_field_value
(
const
uint8_t *
data
,
const
uint8_t *data_end,
166
const
uint8_t *
name
, uint8_t *dst,
int
dst_size);
167
174
void
ff_amf_write_bool
(uint8_t **dst,
int
val);
175
182
void
ff_amf_write_number
(uint8_t **dst,
double
num);
183
190
void
ff_amf_write_string
(uint8_t **dst,
const
char
*str);
191
197
void
ff_amf_write_null
(uint8_t **dst);
198
204
void
ff_amf_write_object_start
(uint8_t **dst);
205
212
void
ff_amf_write_field_name
(uint8_t **dst,
const
char
*str);
213
219
void
ff_amf_write_object_end
(uint8_t **dst);
220
226
int
ff_amf_match_string
(
const
uint8_t *
data
,
int
size
,
const
char
*str);
227
// AMF funcs
229
230
#endif
/* AVFORMAT_RTMPPKT_H */