FFmpeg
|
#include "libavcodec/bytestream.h"
#include "libavutil/avstring.h"
#include "libavutil/intfloat.h"
#include "avformat.h"
#include "rtmppkt.h"
#include "flv.h"
#include "url.h"
Go to the source code of this file.
Functions | |
void | ff_amf_write_bool (uint8_t **dst, int val) |
Write boolean value in AMF format to buffer. | |
void | ff_amf_write_number (uint8_t **dst, double val) |
Write number in AMF format to buffer. | |
void | ff_amf_write_string (uint8_t **dst, const char *str) |
Write string in AMF format to buffer. | |
void | ff_amf_write_string2 (uint8_t **dst, const char *str1, const char *str2) |
Write a string consisting of two parts in AMF format to a buffer. | |
void | ff_amf_write_null (uint8_t **dst) |
Write AMF NULL value to buffer. | |
void | ff_amf_write_object_start (uint8_t **dst) |
Write marker for AMF object to buffer. | |
void | ff_amf_write_field_name (uint8_t **dst, const char *str) |
Write string used as field name in AMF object to buffer. | |
void | ff_amf_write_object_end (uint8_t **dst) |
Write marker for end of AMF object to buffer. | |
int | ff_amf_read_bool (GetByteContext *bc, int *val) |
Read AMF boolean value. | |
int | ff_amf_read_number (GetByteContext *bc, double *val) |
Read AMF number value. | |
int | ff_amf_read_string (GetByteContext *bc, uint8_t *str, int strsize, int *length) |
Read AMF string value. | |
int | ff_amf_read_null (GetByteContext *bc) |
Read AMF NULL value. | |
int | ff_rtmp_packet_read (URLContext *h, RTMPPacket *p, int chunk_size, RTMPPacket *prev_pkt) |
Read RTMP packet sent by the server. | |
int | ff_rtmp_packet_read_internal (URLContext *h, RTMPPacket *p, int chunk_size, RTMPPacket *prev_pkt, uint8_t hdr) |
Read internal RTMP packet sent by the server. | |
int | ff_rtmp_packet_write (URLContext *h, RTMPPacket *pkt, int chunk_size, RTMPPacket *prev_pkt) |
Send RTMP packet to the server. | |
int | ff_rtmp_packet_create (RTMPPacket *pkt, int channel_id, RTMPPacketType type, int timestamp, int size) |
Create new RTMP packet with given attributes. | |
void | ff_rtmp_packet_destroy (RTMPPacket *pkt) |
Free RTMP packet. | |
int | ff_amf_tag_size (const uint8_t *data, const uint8_t *data_end) |
Calculate number of bytes taken by first AMF entry in data. | |
int | ff_amf_get_field_value (const uint8_t *data, const uint8_t *data_end, const uint8_t *name, uint8_t *dst, int dst_size) |
Retrieve value of given AMF object field in string form. | |
static const char * | rtmp_packet_type (int type) |
static void | ff_amf_tag_contents (void *ctx, const uint8_t *data, const uint8_t *data_end) |
void | ff_rtmp_packet_dump (void *ctx, RTMPPacket *p) |
Print information and contents of RTMP packet. | |
Write boolean value in AMF format to buffer.
dst | pointer to the input buffer (will be modified) |
val | value to write |
Definition at line 31 of file rtmppkt.c.
Referenced by gen_connect(), and rtmp_write_amf_data().
Write number in AMF format to buffer.
dst | pointer to the input buffer (will be modified) |
num | value to write |
Definition at line 37 of file rtmppkt.c.
Referenced by gen_check_bw(), gen_connect(), gen_create_stream(), gen_delete_stream(), gen_fcpublish_stream(), gen_fcsubscribe_stream(), gen_fcunpublish_stream(), gen_play(), gen_publish(), gen_release_stream(), read_connect(), rtmp_write_amf_data(), and send_invoke_response().
Write string in AMF format to buffer.
dst | pointer to the input buffer (will be modified) |
str | string to write |
Definition at line 43 of file rtmppkt.c.
Referenced by gen_check_bw(), gen_connect(), gen_create_stream(), gen_delete_stream(), gen_fcpublish_stream(), gen_fcsubscribe_stream(), gen_fcunpublish_stream(), gen_play(), gen_publish(), gen_release_stream(), read_connect(), rtmp_write(), rtmp_write_amf_data(), and send_invoke_response().
Write a string consisting of two parts in AMF format to a buffer.
dst | pointer to the input buffer (will be modified) |
str1 | first string to write, may be null |
str2 | second string to write, may be null |
Definition at line 50 of file rtmppkt.c.
Referenced by gen_connect().
Write AMF NULL value to buffer.
dst | pointer to the input buffer (will be modified) |
Definition at line 63 of file rtmppkt.c.
Referenced by gen_check_bw(), gen_create_stream(), gen_delete_stream(), gen_fcpublish_stream(), gen_fcsubscribe_stream(), gen_fcunpublish_stream(), gen_play(), gen_publish(), gen_release_stream(), read_connect(), rtmp_write_amf_data(), and send_invoke_response().
Write marker for AMF object to buffer.
dst | pointer to the input buffer (will be modified) |
Definition at line 68 of file rtmppkt.c.
Referenced by gen_connect(), read_connect(), rtmp_write_amf_data(), and send_invoke_response().
Write string used as field name in AMF object to buffer.
dst | pointer to the input buffer (will be modified) |
str | string to write |
Definition at line 73 of file rtmppkt.c.
Referenced by gen_connect(), read_connect(), rtmp_write_amf_data(), and send_invoke_response().
Write marker for end of AMF object to buffer.
dst | pointer to the input buffer (will be modified) |
Definition at line 79 of file rtmppkt.c.
Referenced by gen_connect(), read_connect(), rtmp_write_amf_data(), and send_invoke_response().
int ff_amf_read_bool | ( | GetByteContext * | gbc, |
int * | val | ||
) |
Read AMF boolean value.
[in,out] | gbc | GetByteContext initialized with AMF-formatted data |
[out] | val | 0 or 1 |
int ff_amf_read_number | ( | GetByteContext * | gbc, |
double * | val | ||
) |
Read AMF number value.
[in,out] | gbc | GetByteContext initialized with AMF-formatted data |
[out] | val | read value |
Definition at line 95 of file rtmppkt.c.
Referenced by find_tracked_method(), read_connect(), rtmp_send_packet(), and send_invoke_response().
int ff_amf_read_string | ( | GetByteContext * | gbc, |
uint8_t * | str, | ||
int | strsize, | ||
int * | length | ||
) |
Read AMF string value.
Appends a trailing null byte to output string in order to ease later parsing.
[in,out] | gbc | GetByteContext initialized with AMF-formatted data |
[out] | str | read string |
[in] | strsize | buffer size available to store the read string |
[out] | length | read string length |
Definition at line 105 of file rtmppkt.c.
Referenced by handle_notify(), read_connect(), rtmp_send_packet(), and send_invoke_response().
int ff_amf_read_null | ( | GetByteContext * | gbc | ) |
Read AMF NULL value.
[in,out] | gbc | GetByteContext initialized with AMF-formatted data |
Definition at line 125 of file rtmppkt.c.
Referenced by send_invoke_response().
int ff_rtmp_packet_read | ( | URLContext * | h, |
RTMPPacket * | p, | ||
int | chunk_size, | ||
RTMPPacket * | prev_pkt | ||
) |
Read RTMP packet sent by the server.
h | reader context |
p | packet |
chunk_size | current chunk size |
prev_pkt | previously read packet headers for all channels (may be needed for restoring incomplete packet header) |
Definition at line 132 of file rtmppkt.c.
Referenced by get_packet(), and read_connect().
int ff_rtmp_packet_read_internal | ( | URLContext * | h, |
RTMPPacket * | p, | ||
int | chunk_size, | ||
RTMPPacket * | prev_pkt, | ||
uint8_t | c | ||
) |
Read internal RTMP packet sent by the server.
h | reader context |
p | packet |
chunk_size | current chunk size |
prev_pkt | previously read packet headers for all channels (may be needed for restoring incomplete packet header) |
c | the first byte already read |
Definition at line 143 of file rtmppkt.c.
Referenced by ff_rtmp_packet_read(), and rtmp_write().
int ff_rtmp_packet_write | ( | URLContext * | h, |
RTMPPacket * | p, | ||
int | chunk_size, | ||
RTMPPacket * | prev_pkt | ||
) |
Send RTMP packet to the server.
h | reader context |
p | packet to send |
chunk_size | current chunk size |
prev_pkt | previously sent packet headers for all channels (may be used for packet header compressing) |
Definition at line 234 of file rtmppkt.c.
Referenced by handle_chunk_size(), read_connect(), rtmp_send_packet(), and send_invoke_response().
int ff_rtmp_packet_create | ( | RTMPPacket * | pkt, |
int | channel_id, | ||
RTMPPacketType | type, | ||
int | timestamp, | ||
int | size | ||
) |
Create new RTMP packet with given attributes.
pkt | packet |
channel_id | packet channel ID |
type | packet type |
timestamp | packet timestamp |
size | packet size |
Definition at line 311 of file rtmppkt.c.
Referenced by ff_rtmp_packet_read_internal(), gen_buffer_time(), gen_bytes_read(), gen_check_bw(), gen_connect(), gen_create_stream(), gen_delete_stream(), gen_fcpublish_stream(), gen_fcsubscribe_stream(), gen_fcunpublish_stream(), gen_play(), gen_pong(), gen_publish(), gen_release_stream(), gen_server_bw(), gen_swf_verification(), read_connect(), rtmp_write(), and send_invoke_response().
void ff_rtmp_packet_destroy | ( | RTMPPacket * | pkt | ) |
Free RTMP packet.
pkt | packet |
Definition at line 329 of file rtmppkt.c.
Referenced by ff_rtmp_packet_read_internal(), gen_connect(), get_packet(), read_connect(), rtmp_close(), rtmp_send_packet(), rtmp_write(), and send_invoke_response().
Calculate number of bytes taken by first AMF entry in data.
data | input data |
data_end | input buffer end |
Definition at line 337 of file rtmppkt.c.
Referenced by ff_amf_get_field_value(), ff_amf_tag_contents(), ff_amf_tag_size(), ff_rtmp_packet_dump(), and handle_invoke_status().
int ff_amf_get_field_value | ( | const uint8_t * | data, |
const uint8_t * | data_end, | ||
const uint8_t * | name, | ||
uint8_t * | dst, | ||
int | dst_size | ||
) |
Retrieve value of given AMF object field in string form.
data | AMF object data |
data_end | input buffer end |
name | name of field to retrieve |
dst | buffer for storing result |
dst_size | output buffer size |
Definition at line 373 of file rtmppkt.c.
Referenced by handle_invoke_error(), handle_invoke_status(), and read_connect().
|
static |
Definition at line 420 of file rtmppkt.c.
Referenced by ff_rtmp_packet_dump().
|
static |
Definition at line 441 of file rtmppkt.c.
Referenced by ff_rtmp_packet_dump().
void ff_rtmp_packet_dump | ( | void * | ctx, |
RTMPPacket * | p | ||
) |
Print information and contents of RTMP packet.
ctx | output context |
p | packet to dump |
Definition at line 502 of file rtmppkt.c.
Referenced by rtmp_parse_result().