#include <stdint.h>
#include "avformat.h"
#include "rtspcodes.h"
#include "rtpdec.h"
#include "network.h"
#include "httpauth.h"
#include "libavutil/log.h"
Go to the source code of this file.
Data Structures | |
struct | RTSPTransportField |
This describes a single item in the "Transport:" line of one stream as negotiated by the SETUP RTSP command. More... | |
struct | RTSPMessageHeader |
This describes the server response to each RTSP command. More... | |
struct | RTSPState |
Private data for the RTSP demuxer. More... | |
struct | RTSPStream |
Describes a single stream, as identified by a single m= line block in the SDP content. More... | |
Defines | |
#define | RTSP_DEFAULT_PORT 554 |
#define | RTSP_MAX_TRANSPORTS 8 |
#define | RTSP_TCP_MAX_PACKET_SIZE 1472 |
#define | RTSP_DEFAULT_NB_AUDIO_CHANNELS 1 |
#define | RTSP_DEFAULT_AUDIO_SAMPLERATE 44100 |
#define | RTSP_RTP_PORT_MIN 5000 |
#define | RTSP_RTP_PORT_MAX 10000 |
Typedefs | |
typedef struct RTSPTransportField | RTSPTransportField |
This describes a single item in the "Transport:" line of one stream as negotiated by the SETUP RTSP command. | |
typedef struct RTSPMessageHeader | RTSPMessageHeader |
This describes the server response to each RTSP command. | |
typedef struct RTSPState | RTSPState |
Private data for the RTSP demuxer. | |
typedef struct RTSPStream | RTSPStream |
Describes a single stream, as identified by a single m= line block in the SDP content. | |
Enumerations | |
enum | RTSPLowerTransport { RTSP_LOWER_TRANSPORT_UDP = 0, RTSP_LOWER_TRANSPORT_TCP = 1, RTSP_LOWER_TRANSPORT_UDP_MULTICAST = 2, RTSP_LOWER_TRANSPORT_NB } |
Network layer over which RTP/etc packet data will be transported. More... | |
enum | RTSPTransport { RTSP_TRANSPORT_RTP, RTSP_TRANSPORT_RDT, RTSP_TRANSPORT_NB } |
Packet profile of the data that we will be receiving. More... | |
enum | RTSPControlTransport { RTSP_MODE_PLAIN, RTSP_MODE_TUNNEL } |
Transport mode for the RTSP data. More... | |
enum | RTSPClientState { RTSP_STATE_IDLE, RTSP_STATE_STREAMING, RTSP_STATE_PAUSED, RTSP_STATE_SEEKING } |
Client state, i.e. More... | |
enum | RTSPServerType { RTSP_SERVER_RTP, RTSP_SERVER_REAL, RTSP_SERVER_WMS, RTSP_SERVER_NB } |
Identifies particular servers that require special handling, such as standards-incompliant "Transport:" lines in the SETUP request. More... | |
Functions | |
void | ff_rtsp_parse_line (RTSPMessageHeader *reply, const char *buf, RTSPState *rt, const char *method) |
int | ff_rtsp_send_cmd_async (AVFormatContext *s, const char *method, const char *url, const char *headers) |
Send a command to the RTSP server without waiting for the reply. | |
int | ff_rtsp_send_cmd_with_content (AVFormatContext *s, const char *method, const char *url, const char *headers, RTSPMessageHeader *reply, unsigned char **content_ptr, const unsigned char *send_content, int send_content_length) |
Send a command to the RTSP server and wait for the reply. | |
int | ff_rtsp_send_cmd (AVFormatContext *s, const char *method, const char *url, const char *headers, RTSPMessageHeader *reply, unsigned char **content_ptr) |
Send a command to the RTSP server and wait for the reply. | |
int | ff_rtsp_read_reply (AVFormatContext *s, RTSPMessageHeader *reply, unsigned char **content_ptr, int return_on_interleaved_data, const char *method) |
Read a RTSP message from the server, or prepare to read data packets if we're reading data interleaved over the TCP/RTSP connection as well. | |
void | ff_rtsp_skip_packet (AVFormatContext *s) |
Skip a RTP/TCP interleaved packet. | |
int | ff_rtsp_connect (AVFormatContext *s) |
Connect to the RTSP server and set up the individual media streams. | |
void | ff_rtsp_close_streams (AVFormatContext *s) |
Close and free all streams within the RTSP (de)muxer. | |
void | ff_rtsp_close_connections (AVFormatContext *rt) |
Close all connection handles within the RTSP (de)muxer. | |
int | ff_rtsp_setup_input_streams (AVFormatContext *s, RTSPMessageHeader *reply) |
Get the description of the stream and set up the RTSPStream child objects. | |
int | ff_rtsp_setup_output_streams (AVFormatContext *s, const char *addr) |
Announce the stream to the server and set up the RTSPStream child objects for each media stream. | |
int | ff_sdp_parse (AVFormatContext *s, const char *content) |
Parse an SDP description of streams by populating an RTSPState struct within the AVFormatContext; also allocate the RTP streams and the pollfd array used for UDP streams. | |
int | ff_rtsp_tcp_read_packet (AVFormatContext *s, RTSPStream **prtsp_st, uint8_t *buf, int buf_size) |
Receive one RTP packet from an TCP interleaved RTSP stream. | |
int | ff_rtsp_fetch_packet (AVFormatContext *s, AVPacket *pkt) |
Receive one packet from the RTSPStreams set up in the AVFormatContext (which should contain a RTSPState struct as priv_data). | |
int | ff_rtsp_make_setup_request (AVFormatContext *s, const char *host, int port, int lower_transport, const char *real_challenge) |
Do the SETUP requests for each stream for the chosen lower transport mode. | |
void | ff_rtsp_undo_setup (AVFormatContext *s) |
Undo the effect of ff_rtsp_make_setup_request, close the transport_priv and rtp_handle fields. | |
Variables | |
int | rtsp_rtp_port_min |
int | rtsp_rtp_port_max |
#define RTSP_RTP_PORT_MAX 10000 |
Definition at line 69 of file rtsp.h.
Referenced by ff_rtsp_make_setup_request().
#define RTSP_RTP_PORT_MIN 5000 |
Definition at line 68 of file rtsp.h.
Referenced by ff_rtsp_make_setup_request().
#define RTSP_TCP_MAX_PACKET_SIZE 1472 |
Definition at line 65 of file rtsp.h.
Referenced by rtsp_open_transport_ctx(), and tcp_write_packet().
typedef struct RTSPMessageHeader RTSPMessageHeader |
This describes the server response to each RTSP command.
Private data for the RTSP demuxer.
typedef struct RTSPStream RTSPStream |
Describes a single stream, as identified by a single m= line block in the SDP content.
In the case of RDT, one RTSPStream can represent multiple AVStreams. In this case, each AVStream in this set has similar content (but different codec/bitrate).
typedef struct RTSPTransportField RTSPTransportField |
This describes a single item in the "Transport:" line of one stream as negotiated by the SETUP RTSP command.
Multiple transports are comma- separated ("Transport: x-read-rdt/tcp;interleaved=0-1,rtp/avp/udp; client_port=1000-1001;server_port=1800-1801") and described in separate RTSPTransportFields.
enum RTSPClientState |
Client state, i.e.
whether we are currently receiving data (PLAYING) or setup-but-not-receiving (PAUSED). State can be changed in applications by calling av_read_play/pause().
enum RTSPControlTransport |
enum RTSPLowerTransport |
enum RTSPServerType |
enum RTSPTransport |
void ff_rtsp_close_connections | ( | AVFormatContext * | rt | ) |
Close all connection handles within the RTSP (de)muxer.
rt | RTSP (de)muxer context |
Definition at line 1291 of file rtsp.c.
Referenced by ff_rtsp_connect(), rtsp_read_close(), rtsp_read_header(), rtsp_write_close(), and rtsp_write_header().
void ff_rtsp_close_streams | ( | AVFormatContext * | s | ) |
Close and free all streams within the RTSP (de)muxer.
s | RTSP (de)muxer context |
Definition at line 513 of file rtsp.c.
Referenced by ff_rtsp_connect(), rtsp_read_close(), rtsp_read_header(), rtsp_write_close(), rtsp_write_header(), sdp_read_close(), and sdp_read_header().
int ff_rtsp_connect | ( | AVFormatContext * | s | ) |
Connect to the RTSP server and set up the individual media streams.
This can be used for both muxers and demuxers.
s | RTSP (de)muxer context |
Definition at line 1299 of file rtsp.c.
Referenced by rtsp_read_header(), and rtsp_write_header().
int ff_rtsp_fetch_packet | ( | AVFormatContext * | s, | |
AVPacket * | pkt | |||
) |
Receive one packet from the RTSPStreams set up in the AVFormatContext (which should contain a RTSPState struct as priv_data).
Definition at line 1619 of file rtsp.c.
Referenced by rtsp_read_packet().
int ff_rtsp_make_setup_request | ( | AVFormatContext * | s, | |
const char * | host, | |||
int | port, | |||
int | lower_transport, | |||
const char * | real_challenge | |||
) |
Do the SETUP requests for each stream for the chosen lower transport mode.
Definition at line 1048 of file rtsp.c.
Referenced by ff_rtsp_connect(), and resetup_tcp().
void ff_rtsp_parse_line | ( | RTSPMessageHeader * | reply, | |
const char * | buf, | |||
RTSPState * | rt, | |||
const char * | method | |||
) |
Definition at line 758 of file rtsp.c.
Referenced by ff_rtsp_read_reply(), and rtsp_parse_request().
int ff_rtsp_read_reply | ( | AVFormatContext * | s, | |
RTSPMessageHeader * | reply, | |||
unsigned char ** | content_ptr, | |||
int | return_on_interleaved_data, | |||
const char * | method | |||
) |
Read a RTSP message from the server, or prepare to read data packets if we're reading data interleaved over the TCP/RTSP connection as well.
s | RTSP (de)muxer context | |
reply | pointer where the RTSP message header will be stored | |
content_ptr | pointer where the RTSP message body, if any, will be stored (length is in reply) | |
return_on_interleaved_data | whether the function may return if we encounter a data marker ('$'), which precedes data packets over interleaved TCP/RTSP connections. If this is set, this function will return 1 after encountering a '$'. If it is not set, the function will skip any data packets (if they are encountered), until a reply has been fully parsed. If no more data is available without parsing a reply, it will return an error. | |
method | the RTSP method this is a reply to. This affects how some response headers are acted upon. May be NULL. |
Definition at line 839 of file rtsp.c.
Referenced by ff_rtsp_send_cmd_with_content(), ff_rtsp_tcp_read_packet(), rtsp_write_packet(), and udp_read_packet().
int ff_rtsp_send_cmd | ( | AVFormatContext * | s, | |
const char * | method, | |||
const char * | url, | |||
const char * | headers, | |||
RTSPMessageHeader * | reply, | |||
unsigned char ** | content_ptr | |||
) |
Send a command to the RTSP server and wait for the reply.
Definition at line 1003 of file rtsp.c.
Referenced by ff_rtsp_connect(), ff_rtsp_make_setup_request(), ff_rtsp_setup_input_streams(), rtsp_read_packet(), rtsp_read_pause(), rtsp_read_play(), and rtsp_write_record().
int ff_rtsp_send_cmd_async | ( | AVFormatContext * | s, | |
const char * | method, | |||
const char * | url, | |||
const char * | headers | |||
) |
Send a command to the RTSP server without waiting for the reply.
Definition at line 997 of file rtsp.c.
Referenced by rtsp_read_close(), rtsp_read_packet(), and rtsp_write_close().
int ff_rtsp_send_cmd_with_content | ( | AVFormatContext * | s, | |
const char * | method, | |||
const char * | url, | |||
const char * | headers, | |||
RTSPMessageHeader * | reply, | |||
unsigned char ** | content_ptr, | |||
const unsigned char * | send_content, | |||
int | send_content_length | |||
) |
Send a command to the RTSP server and wait for the reply.
s | RTSP (de)muxer context | |
method | the method for the request | |
url | the target url for the request | |
headers | extra header lines to include in the request | |
reply | pointer where the RTSP message header will be stored | |
content_ptr | pointer where the RTSP message body, if any, will be stored (length is in reply) | |
send_content | if non-null, the data to send as request body content | |
send_content_length | the length of the send_content data, or 0 if send_content is null |
Definition at line 1011 of file rtsp.c.
Referenced by ff_rtsp_send_cmd(), and ff_rtsp_setup_output_streams().
int ff_rtsp_setup_input_streams | ( | AVFormatContext * | s, | |
RTSPMessageHeader * | reply | |||
) |
Get the description of the stream and set up the RTSPStream child objects.
The Require: attribute is needed for proper streaming from Realmedia servers.
Definition at line 107 of file rtspdec.c.
Referenced by ff_rtsp_connect().
int ff_rtsp_setup_output_streams | ( | AVFormatContext * | s, | |
const char * | addr | |||
) |
Announce the stream to the server and set up the RTSPStream child objects for each media stream.
Definition at line 53 of file rtspenc.c.
Referenced by ff_rtsp_connect().
void ff_rtsp_skip_packet | ( | AVFormatContext * | s | ) |
Skip a RTP/TCP interleaved packet.
Definition at line 814 of file rtsp.c.
Referenced by ff_rtsp_read_reply(), and rtsp_write_packet().
int ff_rtsp_tcp_read_packet | ( | AVFormatContext * | s, | |
RTSPStream ** | prtsp_st, | |||
uint8_t * | buf, | |||
int | buf_size | |||
) |
Receive one RTP packet from an TCP interleaved RTSP stream.
Definition at line 184 of file rtspdec.c.
Referenced by ff_rtsp_fetch_packet().
void ff_rtsp_undo_setup | ( | AVFormatContext * | s | ) |
Undo the effect of ff_rtsp_make_setup_request, close the transport_priv and rtp_handle fields.
Definition at line 479 of file rtsp.c.
Referenced by ff_rtsp_close_streams(), ff_rtsp_make_setup_request(), and resetup_tcp().
int ff_sdp_parse | ( | AVFormatContext * | s, | |
const char * | content | |||
) |
Parse an SDP description of streams by populating an RTSPState struct within the AVFormatContext; also allocate the RTP streams and the pollfd array used for UDP streams.
Definition at line 431 of file rtsp.c.
Referenced by ff_rtsp_setup_input_streams(), and sdp_read_header().