yading@11: /* yading@11: * RTSP definitions yading@11: * Copyright (c) 2002 Fabrice Bellard yading@11: * yading@11: * This file is part of FFmpeg. yading@11: * yading@11: * FFmpeg is free software; you can redistribute it and/or yading@11: * modify it under the terms of the GNU Lesser General Public yading@11: * License as published by the Free Software Foundation; either yading@11: * version 2.1 of the License, or (at your option) any later version. yading@11: * yading@11: * FFmpeg is distributed in the hope that it will be useful, yading@11: * but WITHOUT ANY WARRANTY; without even the implied warranty of yading@11: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU yading@11: * Lesser General Public License for more details. yading@11: * yading@11: * You should have received a copy of the GNU Lesser General Public yading@11: * License along with FFmpeg; if not, write to the Free Software yading@11: * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA yading@11: */ yading@11: #ifndef AVFORMAT_RTSP_H yading@11: #define AVFORMAT_RTSP_H yading@11: yading@11: #include yading@11: #include "avformat.h" yading@11: #include "rtspcodes.h" yading@11: #include "rtpdec.h" yading@11: #include "network.h" yading@11: #include "httpauth.h" yading@11: yading@11: #include "libavutil/log.h" yading@11: #include "libavutil/opt.h" yading@11: yading@11: /** yading@11: * Network layer over which RTP/etc packet data will be transported. yading@11: */ yading@11: enum RTSPLowerTransport { yading@11: RTSP_LOWER_TRANSPORT_UDP = 0, /**< UDP/unicast */ yading@11: RTSP_LOWER_TRANSPORT_TCP = 1, /**< TCP; interleaved in RTSP */ yading@11: RTSP_LOWER_TRANSPORT_UDP_MULTICAST = 2, /**< UDP/multicast */ yading@11: RTSP_LOWER_TRANSPORT_NB, yading@11: RTSP_LOWER_TRANSPORT_HTTP = 8, /**< HTTP tunneled - not a proper yading@11: transport mode as such, yading@11: only for use via AVOptions */ yading@11: RTSP_LOWER_TRANSPORT_CUSTOM = 16, /**< Custom IO - not a public yading@11: option for lower_transport_mask, yading@11: but set in the SDP demuxer based yading@11: on a flag. */ yading@11: }; yading@11: yading@11: /** yading@11: * Packet profile of the data that we will be receiving. Real servers yading@11: * commonly send RDT (although they can sometimes send RTP as well), yading@11: * whereas most others will send RTP. yading@11: */ yading@11: enum RTSPTransport { yading@11: RTSP_TRANSPORT_RTP, /**< Standards-compliant RTP */ yading@11: RTSP_TRANSPORT_RDT, /**< Realmedia Data Transport */ yading@11: RTSP_TRANSPORT_RAW, /**< Raw data (over UDP) */ yading@11: RTSP_TRANSPORT_NB yading@11: }; yading@11: yading@11: /** yading@11: * Transport mode for the RTSP data. This may be plain, or yading@11: * tunneled, which is done over HTTP. yading@11: */ yading@11: enum RTSPControlTransport { yading@11: RTSP_MODE_PLAIN, /**< Normal RTSP */ yading@11: RTSP_MODE_TUNNEL /**< RTSP over HTTP (tunneling) */ yading@11: }; yading@11: yading@11: #define RTSP_DEFAULT_PORT 554 yading@11: #define RTSP_MAX_TRANSPORTS 8 yading@11: #define RTSP_TCP_MAX_PACKET_SIZE 1472 yading@11: #define RTSP_DEFAULT_NB_AUDIO_CHANNELS 1 yading@11: #define RTSP_DEFAULT_AUDIO_SAMPLERATE 44100 yading@11: #define RTSP_RTP_PORT_MIN 5000 yading@11: #define RTSP_RTP_PORT_MAX 65000 yading@11: yading@11: /** yading@11: * This describes a single item in the "Transport:" line of one stream as yading@11: * negotiated by the SETUP RTSP command. Multiple transports are comma- yading@11: * separated ("Transport: x-read-rdt/tcp;interleaved=0-1,rtp/avp/udp; yading@11: * client_port=1000-1001;server_port=1800-1801") and described in separate yading@11: * RTSPTransportFields. yading@11: */ yading@11: typedef struct RTSPTransportField { yading@11: /** interleave ids, if TCP transport; each TCP/RTSP data packet starts yading@11: * with a '$', stream length and stream ID. If the stream ID is within yading@11: * the range of this interleaved_min-max, then the packet belongs to yading@11: * this stream. */ yading@11: int interleaved_min, interleaved_max; yading@11: yading@11: /** UDP multicast port range; the ports to which we should connect to yading@11: * receive multicast UDP data. */ yading@11: int port_min, port_max; yading@11: yading@11: /** UDP client ports; these should be the local ports of the UDP RTP yading@11: * (and RTCP) sockets over which we receive RTP/RTCP data. */ yading@11: int client_port_min, client_port_max; yading@11: yading@11: /** UDP unicast server port range; the ports to which we should connect yading@11: * to receive unicast UDP RTP/RTCP data. */ yading@11: int server_port_min, server_port_max; yading@11: yading@11: /** time-to-live value (required for multicast); the amount of HOPs that yading@11: * packets will be allowed to make before being discarded. */ yading@11: int ttl; yading@11: yading@11: /** transport set to record data */ yading@11: int mode_record; yading@11: yading@11: struct sockaddr_storage destination; /**< destination IP address */ yading@11: char source[INET6_ADDRSTRLEN + 1]; /**< source IP address */ yading@11: yading@11: /** data/packet transport protocol; e.g. RTP or RDT */ yading@11: enum RTSPTransport transport; yading@11: yading@11: /** network layer transport protocol; e.g. TCP or UDP uni-/multicast */ yading@11: enum RTSPLowerTransport lower_transport; yading@11: } RTSPTransportField; yading@11: yading@11: /** yading@11: * This describes the server response to each RTSP command. yading@11: */ yading@11: typedef struct RTSPMessageHeader { yading@11: /** length of the data following this header */ yading@11: int content_length; yading@11: yading@11: enum RTSPStatusCode status_code; /**< response code from server */ yading@11: yading@11: /** number of items in the 'transports' variable below */ yading@11: int nb_transports; yading@11: yading@11: /** Time range of the streams that the server will stream. In yading@11: * AV_TIME_BASE unit, AV_NOPTS_VALUE if not used */ yading@11: int64_t range_start, range_end; yading@11: yading@11: /** describes the complete "Transport:" line of the server in response yading@11: * to a SETUP RTSP command by the client */ yading@11: RTSPTransportField transports[RTSP_MAX_TRANSPORTS]; yading@11: yading@11: int seq; /**< sequence number */ yading@11: yading@11: /** the "Session:" field. This value is initially set by the server and yading@11: * should be re-transmitted by the client in every RTSP command. */ yading@11: char session_id[512]; yading@11: yading@11: /** the "Location:" field. This value is used to handle redirection. yading@11: */ yading@11: char location[4096]; yading@11: yading@11: /** the "RealChallenge1:" field from the server */ yading@11: char real_challenge[64]; yading@11: yading@11: /** the "Server: field, which can be used to identify some special-case yading@11: * servers that are not 100% standards-compliant. We use this to identify yading@11: * Windows Media Server, which has a value "WMServer/v.e.r.sion", where yading@11: * version is a sequence of digits (e.g. 9.0.0.3372). Helix/Real servers yading@11: * use something like "Helix [..] Server Version v.e.r.sion (platform) yading@11: * (RealServer compatible)" or "RealServer Version v.e.r.sion (platform)", yading@11: * where platform is the output of $uname -msr | sed 's/ /-/g'. */ yading@11: char server[64]; yading@11: yading@11: /** The "timeout" comes as part of the server response to the "SETUP" yading@11: * command, in the "Session: [;timeout=]" line. It is the yading@11: * time, in seconds, that the server will go without traffic over the yading@11: * RTSP/TCP connection before it closes the connection. To prevent yading@11: * this, sent dummy requests (e.g. OPTIONS) with intervals smaller yading@11: * than this value. */ yading@11: int timeout; yading@11: yading@11: /** The "Notice" or "X-Notice" field value. See yading@11: * http://tools.ietf.org/html/draft-stiemerling-rtsp-announce-00 yading@11: * for a complete list of supported values. */ yading@11: int notice; yading@11: yading@11: /** The "reason" is meant to specify better the meaning of the error code yading@11: * returned yading@11: */ yading@11: char reason[256]; yading@11: yading@11: /** yading@11: * Content type header yading@11: */ yading@11: char content_type[64]; yading@11: } RTSPMessageHeader; yading@11: yading@11: /** yading@11: * Client state, i.e. whether we are currently receiving data (PLAYING) or yading@11: * setup-but-not-receiving (PAUSED). State can be changed in applications yading@11: * by calling av_read_play/pause(). yading@11: */ yading@11: enum RTSPClientState { yading@11: RTSP_STATE_IDLE, /**< not initialized */ yading@11: RTSP_STATE_STREAMING, /**< initialized and sending/receiving data */ yading@11: RTSP_STATE_PAUSED, /**< initialized, but not receiving data */ yading@11: RTSP_STATE_SEEKING, /**< initialized, requesting a seek */ yading@11: }; yading@11: yading@11: /** yading@11: * Identify particular servers that require special handling, such as yading@11: * standards-incompliant "Transport:" lines in the SETUP request. yading@11: */ yading@11: enum RTSPServerType { yading@11: RTSP_SERVER_RTP, /**< Standards-compliant RTP-server */ yading@11: RTSP_SERVER_REAL, /**< Realmedia-style server */ yading@11: RTSP_SERVER_WMS, /**< Windows Media server */ yading@11: RTSP_SERVER_NB yading@11: }; yading@11: yading@11: /** yading@11: * Private data for the RTSP demuxer. yading@11: * yading@11: * @todo Use AVIOContext instead of URLContext yading@11: */ yading@11: typedef struct RTSPState { yading@11: const AVClass *class; /**< Class for private options. */ yading@11: URLContext *rtsp_hd; /* RTSP TCP connection handle */ yading@11: yading@11: /** number of items in the 'rtsp_streams' variable */ yading@11: int nb_rtsp_streams; yading@11: yading@11: struct RTSPStream **rtsp_streams; /**< streams in this session */ yading@11: yading@11: /** indicator of whether we are currently receiving data from the yading@11: * server. Basically this isn't more than a simple cache of the yading@11: * last PLAY/PAUSE command sent to the server, to make sure we don't yading@11: * send 2x the same unexpectedly or commands in the wrong state. */ yading@11: enum RTSPClientState state; yading@11: yading@11: /** the seek value requested when calling av_seek_frame(). This value yading@11: * is subsequently used as part of the "Range" parameter when emitting yading@11: * the RTSP PLAY command. If we are currently playing, this command is yading@11: * called instantly. If we are currently paused, this command is called yading@11: * whenever we resume playback. Either way, the value is only used once, yading@11: * see rtsp_read_play() and rtsp_read_seek(). */ yading@11: int64_t seek_timestamp; yading@11: yading@11: int seq; /**< RTSP command sequence number */ yading@11: yading@11: /** copy of RTSPMessageHeader->session_id, i.e. the server-provided session yading@11: * identifier that the client should re-transmit in each RTSP command */ yading@11: char session_id[512]; yading@11: yading@11: /** copy of RTSPMessageHeader->timeout, i.e. the time (in seconds) that yading@11: * the server will go without traffic on the RTSP/TCP line before it yading@11: * closes the connection. */ yading@11: int timeout; yading@11: yading@11: /** timestamp of the last RTSP command that we sent to the RTSP server. yading@11: * This is used to calculate when to send dummy commands to keep the yading@11: * connection alive, in conjunction with timeout. */ yading@11: int64_t last_cmd_time; yading@11: yading@11: /** the negotiated data/packet transport protocol; e.g. RTP or RDT */ yading@11: enum RTSPTransport transport; yading@11: yading@11: /** the negotiated network layer transport protocol; e.g. TCP or UDP yading@11: * uni-/multicast */ yading@11: enum RTSPLowerTransport lower_transport; yading@11: yading@11: /** brand of server that we're talking to; e.g. WMS, REAL or other. yading@11: * Detected based on the value of RTSPMessageHeader->server or the presence yading@11: * of RTSPMessageHeader->real_challenge */ yading@11: enum RTSPServerType server_type; yading@11: yading@11: /** the "RealChallenge1:" field from the server */ yading@11: char real_challenge[64]; yading@11: yading@11: /** plaintext authorization line (username:password) */ yading@11: char auth[128]; yading@11: yading@11: /** authentication state */ yading@11: HTTPAuthState auth_state; yading@11: yading@11: /** The last reply of the server to a RTSP command */ yading@11: char last_reply[2048]; /* XXX: allocate ? */ yading@11: yading@11: /** RTSPStream->transport_priv of the last stream that we read a yading@11: * packet from */ yading@11: void *cur_transport_priv; yading@11: yading@11: /** The following are used for Real stream selection */ yading@11: //@{ yading@11: /** whether we need to send a "SET_PARAMETER Subscribe:" command */ yading@11: int need_subscription; yading@11: yading@11: /** stream setup during the last frame read. This is used to detect if yading@11: * we need to subscribe or unsubscribe to any new streams. */ yading@11: enum AVDiscard *real_setup_cache; yading@11: yading@11: /** current stream setup. This is a temporary buffer used to compare yading@11: * current setup to previous frame setup. */ yading@11: enum AVDiscard *real_setup; yading@11: yading@11: /** the last value of the "SET_PARAMETER Subscribe:" RTSP command. yading@11: * this is used to send the same "Unsubscribe:" if stream setup changed, yading@11: * before sending a new "Subscribe:" command. */ yading@11: char last_subscription[1024]; yading@11: //@} yading@11: yading@11: /** The following are used for RTP/ASF streams */ yading@11: //@{ yading@11: /** ASF demuxer context for the embedded ASF stream from WMS servers */ yading@11: AVFormatContext *asf_ctx; yading@11: yading@11: /** cache for position of the asf demuxer, since we load a new yading@11: * data packet in the bytecontext for each incoming RTSP packet. */ yading@11: uint64_t asf_pb_pos; yading@11: //@} yading@11: yading@11: /** some MS RTSP streams contain a URL in the SDP that we need to use yading@11: * for all subsequent RTSP requests, rather than the input URI; in yading@11: * other cases, this is a copy of AVFormatContext->filename. */ yading@11: char control_uri[1024]; yading@11: yading@11: /** The following are used for parsing raw mpegts in udp */ yading@11: //@{ yading@11: struct MpegTSContext *ts; yading@11: int recvbuf_pos; yading@11: int recvbuf_len; yading@11: //@} yading@11: yading@11: /** Additional output handle, used when input and output are done yading@11: * separately, eg for HTTP tunneling. */ yading@11: URLContext *rtsp_hd_out; yading@11: yading@11: /** RTSP transport mode, such as plain or tunneled. */ yading@11: enum RTSPControlTransport control_transport; yading@11: yading@11: /* Number of RTCP BYE packets the RTSP session has received. yading@11: * An EOF is propagated back if nb_byes == nb_streams. yading@11: * This is reset after a seek. */ yading@11: int nb_byes; yading@11: yading@11: /** Reusable buffer for receiving packets */ yading@11: uint8_t* recvbuf; yading@11: yading@11: /** yading@11: * A mask with all requested transport methods yading@11: */ yading@11: int lower_transport_mask; yading@11: yading@11: /** yading@11: * The number of returned packets yading@11: */ yading@11: uint64_t packets; yading@11: yading@11: /** yading@11: * Polling array for udp yading@11: */ yading@11: struct pollfd *p; yading@11: yading@11: /** yading@11: * Whether the server supports the GET_PARAMETER method. yading@11: */ yading@11: int get_parameter_supported; yading@11: yading@11: /** yading@11: * Do not begin to play the stream immediately. yading@11: */ yading@11: int initial_pause; yading@11: yading@11: /** yading@11: * Option flags for the chained RTP muxer. yading@11: */ yading@11: int rtp_muxer_flags; yading@11: yading@11: /** Whether the server accepts the x-Dynamic-Rate header */ yading@11: int accept_dynamic_rate; yading@11: yading@11: /** yading@11: * Various option flags for the RTSP muxer/demuxer. yading@11: */ yading@11: int rtsp_flags; yading@11: yading@11: /** yading@11: * Mask of all requested media types yading@11: */ yading@11: int media_type_mask; yading@11: yading@11: /** yading@11: * Minimum and maximum local UDP ports. yading@11: */ yading@11: int rtp_port_min, rtp_port_max; yading@11: yading@11: /** yading@11: * Timeout to wait for incoming connections. yading@11: */ yading@11: int initial_timeout; yading@11: yading@11: /** yading@11: * timeout of socket i/o operations. yading@11: */ yading@11: int stimeout; yading@11: yading@11: /** yading@11: * Size of RTP packet reordering queue. yading@11: */ yading@11: int reordering_queue_size; yading@11: } RTSPState; yading@11: yading@11: #define RTSP_FLAG_FILTER_SRC 0x1 /**< Filter incoming UDP packets - yading@11: receive packets only from the right yading@11: source address and port. */ yading@11: #define RTSP_FLAG_LISTEN 0x2 /**< Wait for incoming connections. */ yading@11: #define RTSP_FLAG_CUSTOM_IO 0x4 /**< Do all IO via the AVIOContext. */ yading@11: yading@11: /** yading@11: * Describe a single stream, as identified by a single m= line block in the yading@11: * SDP content. In the case of RDT, one RTSPStream can represent multiple yading@11: * AVStreams. In this case, each AVStream in this set has similar content yading@11: * (but different codec/bitrate). yading@11: */ yading@11: typedef struct RTSPStream { yading@11: URLContext *rtp_handle; /**< RTP stream handle (if UDP) */ yading@11: void *transport_priv; /**< RTP/RDT parse context if input, RTP AVFormatContext if output */ yading@11: yading@11: /** corresponding stream index, if any. -1 if none (MPEG2TS case) */ yading@11: int stream_index; yading@11: yading@11: /** interleave IDs; copies of RTSPTransportField->interleaved_min/max yading@11: * for the selected transport. Only used for TCP. */ yading@11: int interleaved_min, interleaved_max; yading@11: yading@11: char control_url[1024]; /**< url for this stream (from SDP) */ yading@11: yading@11: /** The following are used only in SDP, not RTSP */ yading@11: //@{ yading@11: int sdp_port; /**< port (from SDP content) */ yading@11: struct sockaddr_storage sdp_ip; /**< IP address (from SDP content) */ yading@11: int sdp_ttl; /**< IP Time-To-Live (from SDP content) */ yading@11: int sdp_payload_type; /**< payload type */ yading@11: //@} yading@11: yading@11: /** The following are used for dynamic protocols (rtpdec_*.c/rdt.c) */ yading@11: //@{ yading@11: /** handler structure */ yading@11: RTPDynamicProtocolHandler *dynamic_handler; yading@11: yading@11: /** private data associated with the dynamic protocol */ yading@11: PayloadContext *dynamic_protocol_context; yading@11: //@} yading@11: yading@11: /** Enable sending RTCP feedback messages according to RFC 4585 */ yading@11: int feedback; yading@11: yading@11: char crypto_suite[40]; yading@11: char crypto_params[100]; yading@11: } RTSPStream; yading@11: yading@11: void ff_rtsp_parse_line(RTSPMessageHeader *reply, const char *buf, yading@11: RTSPState *rt, const char *method); yading@11: yading@11: /** yading@11: * Send a command to the RTSP server without waiting for the reply. yading@11: * yading@11: * @see rtsp_send_cmd_with_content_async yading@11: */ yading@11: int ff_rtsp_send_cmd_async(AVFormatContext *s, const char *method, yading@11: const char *url, const char *headers); yading@11: yading@11: /** yading@11: * Send a command to the RTSP server and wait for the reply. yading@11: * yading@11: * @param s RTSP (de)muxer context yading@11: * @param method the method for the request yading@11: * @param url the target url for the request yading@11: * @param headers extra header lines to include in the request yading@11: * @param reply pointer where the RTSP message header will be stored yading@11: * @param content_ptr pointer where the RTSP message body, if any, will yading@11: * be stored (length is in reply) yading@11: * @param send_content if non-null, the data to send as request body content yading@11: * @param send_content_length the length of the send_content data, or 0 if yading@11: * send_content is null yading@11: * yading@11: * @return zero if success, nonzero otherwise yading@11: */ yading@11: int ff_rtsp_send_cmd_with_content(AVFormatContext *s, yading@11: const char *method, const char *url, yading@11: const char *headers, yading@11: RTSPMessageHeader *reply, yading@11: unsigned char **content_ptr, yading@11: const unsigned char *send_content, yading@11: int send_content_length); yading@11: yading@11: /** yading@11: * Send a command to the RTSP server and wait for the reply. yading@11: * yading@11: * @see rtsp_send_cmd_with_content yading@11: */ yading@11: int ff_rtsp_send_cmd(AVFormatContext *s, const char *method, yading@11: const char *url, const char *headers, yading@11: RTSPMessageHeader *reply, unsigned char **content_ptr); yading@11: yading@11: /** yading@11: * Read a RTSP message from the server, or prepare to read data yading@11: * packets if we're reading data interleaved over the TCP/RTSP yading@11: * connection as well. yading@11: * yading@11: * @param s RTSP (de)muxer context yading@11: * @param reply pointer where the RTSP message header will be stored yading@11: * @param content_ptr pointer where the RTSP message body, if any, will yading@11: * be stored (length is in reply) yading@11: * @param return_on_interleaved_data whether the function may return if we yading@11: * encounter a data marker ('$'), which precedes data yading@11: * packets over interleaved TCP/RTSP connections. If this yading@11: * is set, this function will return 1 after encountering yading@11: * a '$'. If it is not set, the function will skip any yading@11: * data packets (if they are encountered), until a reply yading@11: * has been fully parsed. If no more data is available yading@11: * without parsing a reply, it will return an error. yading@11: * @param method the RTSP method this is a reply to. This affects how yading@11: * some response headers are acted upon. May be NULL. yading@11: * yading@11: * @return 1 if a data packets is ready to be received, -1 on error, yading@11: * and 0 on success. yading@11: */ yading@11: int ff_rtsp_read_reply(AVFormatContext *s, RTSPMessageHeader *reply, yading@11: unsigned char **content_ptr, yading@11: int return_on_interleaved_data, const char *method); yading@11: yading@11: /** yading@11: * Skip a RTP/TCP interleaved packet. yading@11: */ yading@11: void ff_rtsp_skip_packet(AVFormatContext *s); yading@11: yading@11: /** yading@11: * Connect to the RTSP server and set up the individual media streams. yading@11: * This can be used for both muxers and demuxers. yading@11: * yading@11: * @param s RTSP (de)muxer context yading@11: * yading@11: * @return 0 on success, < 0 on error. Cleans up all allocations done yading@11: * within the function on error. yading@11: */ yading@11: int ff_rtsp_connect(AVFormatContext *s); yading@11: yading@11: /** yading@11: * Close and free all streams within the RTSP (de)muxer yading@11: * yading@11: * @param s RTSP (de)muxer context yading@11: */ yading@11: void ff_rtsp_close_streams(AVFormatContext *s); yading@11: yading@11: /** yading@11: * Close all connection handles within the RTSP (de)muxer yading@11: * yading@11: * @param s RTSP (de)muxer context yading@11: */ yading@11: void ff_rtsp_close_connections(AVFormatContext *s); yading@11: yading@11: /** yading@11: * Get the description of the stream and set up the RTSPStream child yading@11: * objects. yading@11: */ yading@11: int ff_rtsp_setup_input_streams(AVFormatContext *s, RTSPMessageHeader *reply); yading@11: yading@11: /** yading@11: * Announce the stream to the server and set up the RTSPStream child yading@11: * objects for each media stream. yading@11: */ yading@11: int ff_rtsp_setup_output_streams(AVFormatContext *s, const char *addr); yading@11: yading@11: /** yading@11: * Parse RTSP commands (OPTIONS, PAUSE and TEARDOWN) during streaming in yading@11: * listen mode. yading@11: */ yading@11: int ff_rtsp_parse_streaming_commands(AVFormatContext *s); yading@11: yading@11: /** yading@11: * Parse an SDP description of streams by populating an RTSPState struct yading@11: * within the AVFormatContext; also allocate the RTP streams and the yading@11: * pollfd array used for UDP streams. yading@11: */ yading@11: int ff_sdp_parse(AVFormatContext *s, const char *content); yading@11: yading@11: /** yading@11: * Receive one RTP packet from an TCP interleaved RTSP stream. yading@11: */ yading@11: int ff_rtsp_tcp_read_packet(AVFormatContext *s, RTSPStream **prtsp_st, yading@11: uint8_t *buf, int buf_size); yading@11: yading@11: /** yading@11: * Receive one packet from the RTSPStreams set up in the AVFormatContext yading@11: * (which should contain a RTSPState struct as priv_data). yading@11: */ yading@11: int ff_rtsp_fetch_packet(AVFormatContext *s, AVPacket *pkt); yading@11: yading@11: /** yading@11: * Do the SETUP requests for each stream for the chosen yading@11: * lower transport mode. yading@11: * @return 0 on success, <0 on error, 1 if protocol is unavailable yading@11: */ yading@11: int ff_rtsp_make_setup_request(AVFormatContext *s, const char *host, int port, yading@11: int lower_transport, const char *real_challenge); yading@11: yading@11: /** yading@11: * Undo the effect of ff_rtsp_make_setup_request, close the yading@11: * transport_priv and rtp_handle fields. yading@11: */ yading@11: void ff_rtsp_undo_setup(AVFormatContext *s); yading@11: yading@11: /** yading@11: * Open RTSP transport context. yading@11: */ yading@11: int ff_rtsp_open_transport_ctx(AVFormatContext *s, RTSPStream *rtsp_st); yading@11: yading@11: extern const AVOption ff_rtsp_options[]; yading@11: yading@11: #endif /* AVFORMAT_RTSP_H */