Libav
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 Konstantin 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 "
libavcodec/bytestream.h
"
26
#include "
avformat.h
"
27
#include "
url.h
"
28
30
#define RTMP_CHANNELS 65599
31
36
enum
RTMPChannel
{
37
RTMP_NETWORK_CHANNEL
= 2,
38
RTMP_SYSTEM_CHANNEL
,
39
RTMP_AUDIO_CHANNEL
,
40
RTMP_VIDEO_CHANNEL
= 6,
41
RTMP_SOURCE_CHANNEL
= 8,
42
};
43
47
typedef
enum
RTMPPacketType
{
48
RTMP_PT_CHUNK_SIZE
= 1,
49
RTMP_PT_BYTES_READ
= 3,
50
RTMP_PT_PING
,
51
RTMP_PT_SERVER_BW
,
52
RTMP_PT_CLIENT_BW
,
53
RTMP_PT_AUDIO
= 8,
54
RTMP_PT_VIDEO
,
55
RTMP_PT_FLEX_STREAM
= 15,
56
RTMP_PT_FLEX_OBJECT
,
57
RTMP_PT_FLEX_MESSAGE
,
58
RTMP_PT_NOTIFY
,
59
RTMP_PT_SHARED_OBJ
,
60
RTMP_PT_INVOKE
,
61
RTMP_PT_METADATA
= 22,
62
}
RTMPPacketType
;
63
67
enum
RTMPPacketSize
{
68
RTMP_PS_TWELVEBYTES
= 0,
69
RTMP_PS_EIGHTBYTES
,
70
RTMP_PS_FOURBYTES
,
71
RTMP_PS_ONEBYTE
72
};
73
77
typedef
struct
RTMPPacket
{
78
int
channel_id
;
79
RTMPPacketType
type
;
80
uint32_t
timestamp
;
81
uint32_t
ts_delta
;
82
uint32_t
extra
;
83
uint8_t
*
data
;
84
int
size
;
85
int
offset
;
86
int
read
;
87
}
RTMPPacket
;
88
99
int
ff_rtmp_packet_create
(
RTMPPacket
*pkt,
int
channel_id,
RTMPPacketType
type,
100
int
timestamp,
int
size
);
101
107
void
ff_rtmp_packet_destroy
(
RTMPPacket
*pkt);
108
120
int
ff_rtmp_packet_read
(
URLContext
*h,
RTMPPacket
*p,
121
int
chunk_size,
RTMPPacket
**prev_pkt,
122
int
*nb_prev_pkt);
135
int
ff_rtmp_packet_read_internal
(
URLContext
*h,
RTMPPacket
*p,
int
chunk_size,
136
RTMPPacket
**prev_pkt,
int
*nb_prev_pkt,
137
uint8_t
c);
138
150
int
ff_rtmp_packet_write
(
URLContext
*h,
RTMPPacket
*p,
151
int
chunk_size,
RTMPPacket
**prev_pkt,
152
int
*nb_prev_pkt);
153
160
void
ff_rtmp_packet_dump
(
void
*ctx,
RTMPPacket
*p);
161
169
int
ff_rtmp_check_alloc_array
(
RTMPPacket
**prev_pkt,
int
*nb_prev_pkt,
170
int
channel);
171
185
int
ff_amf_tag_size
(
const
uint8_t
*
data
,
const
uint8_t
*data_end);
186
197
int
ff_amf_get_field_value
(
const
uint8_t
*
data
,
const
uint8_t
*data_end,
198
const
uint8_t
*
name
,
uint8_t
*dst,
int
dst_size);
199
206
void
ff_amf_write_bool
(
uint8_t
**dst,
int
val);
207
214
void
ff_amf_write_number
(
uint8_t
**dst,
double
num);
215
222
void
ff_amf_write_string
(
uint8_t
**dst,
const
char
*str);
223
231
void
ff_amf_write_string2
(
uint8_t
**dst,
const
char
*str1,
const
char
*str2);
232
238
void
ff_amf_write_null
(
uint8_t
**dst);
239
245
void
ff_amf_write_object_start
(
uint8_t
**dst);
246
253
void
ff_amf_write_field_name
(
uint8_t
**dst,
const
char
*str);
254
260
void
ff_amf_write_object_end
(
uint8_t
**dst);
261
269
int
ff_amf_read_bool
(
GetByteContext
*gbc,
int
*val);
270
278
int
ff_amf_read_number
(
GetByteContext
*gbc,
double
*val);
279
292
int
ff_amf_read_string
(
GetByteContext
*gbc,
uint8_t
*str,
293
int
strsize,
int
*length);
294
301
int
ff_amf_read_null
(
GetByteContext
*gbc);
302
309
int
ff_amf_match_string
(
const
uint8_t
*
data
,
int
size
,
const
char
*str);
310
// AMF funcs
312
313
#endif
/* AVFORMAT_RTMPPKT_H */
Generated on Thu Sep 30 2021 23:03:20 for Libav by
1.8.1.2