libavformat/rtsp.c File Reference

#include "libavutil/avassert.h"
#include "libavutil/base64.h"
#include "libavutil/avstring.h"
#include "libavutil/intreadwrite.h"
#include "libavutil/mathematics.h"
#include "libavutil/parseutils.h"
#include "libavutil/random_seed.h"
#include "libavutil/dict.h"
#include "libavutil/opt.h"
#include "libavutil/time.h"
#include "avformat.h"
#include "avio_internal.h"
#include "internal.h"
#include "network.h"
#include "os_support.h"
#include "http.h"
#include "rtsp.h"
#include "rtpdec.h"
#include "rdt.h"
#include "rtpdec_formats.h"
#include "rtpenc_chain.h"
#include "url.h"
#include "rtpenc.h"
#include "mpegts.h"

Go to the source code of this file.

Defines

#define POLL_TIMEOUT_MS   100
#define READ_PACKET_TIMEOUT_S   10
#define MAX_TIMEOUTS   READ_PACKET_TIMEOUT_S * 1000 / POLL_TIMEOUT_MS
#define SDP_MAX_SIZE   16384
#define RECVBUF_SIZE   10 * RTP_MAX_PACKET_LENGTH
#define DEFAULT_REORDERING_DELAY   100000
#define OFFSET(x)   offsetof(RTSPState, x)
#define DEC   AV_OPT_FLAG_DECODING_PARAM
#define ENC   AV_OPT_FLAG_ENCODING_PARAM
#define RTSP_FLAG_OPTS(name, longname)
#define RTSP_MEDIATYPE_OPTS(name, longname)

Functions

static void get_word_until_chars (char *buf, int buf_size, const char *sep, const char **pp)
static void get_word_sep (char *buf, int buf_size, const char *sep, const char **pp)
static void get_word (char *buf, int buf_size, const char **pp)
static void rtsp_parse_range_npt (const char *p, int64_t *start, int64_t *end)
 Parse a string p in the form of Range:npt=xx-xx, and determine the start and end time.
static int get_sockaddr (const char *buf, struct sockaddr_storage *sock)
void ff_rtsp_undo_setup (AVFormatContext *s)
 Undo the effect of ff_rtsp_make_setup_request, close the transport_priv and rtp_handle fields.
void ff_rtsp_close_streams (AVFormatContext *s)
 Close and free all streams within the RTSP (de)muxer.
int ff_rtsp_open_transport_ctx (AVFormatContext *s, RTSPStream *rtsp_st)
 Open RTSP transport context.

Variables

const AVOption ff_rtsp_options []
static const AVOption sdp_options []
static const AVOption rtp_options []


Define Documentation

#define DEC   AV_OPT_FLAG_DECODING_PARAM

Definition at line 64 of file rtsp.c.

#define DEFAULT_REORDERING_DELAY   100000

Definition at line 61 of file rtsp.c.

#define ENC   AV_OPT_FLAG_ENCODING_PARAM

Definition at line 65 of file rtsp.c.

#define MAX_TIMEOUTS   READ_PACKET_TIMEOUT_S * 1000 / POLL_TIMEOUT_MS

Definition at line 58 of file rtsp.c.

#define OFFSET (  )     offsetof(RTSPState, x)

Definition at line 63 of file rtsp.c.

#define POLL_TIMEOUT_MS   100

Definition at line 56 of file rtsp.c.

#define READ_PACKET_TIMEOUT_S   10

Definition at line 57 of file rtsp.c.

#define RECVBUF_SIZE   10 * RTP_MAX_PACKET_LENGTH

Definition at line 60 of file rtsp.c.

#define RTSP_FLAG_OPTS ( name,
longname   ) 

Value:

{ name, longname, OFFSET(rtsp_flags), AV_OPT_TYPE_FLAGS, {.i64 = 0}, INT_MIN, INT_MAX, DEC, "rtsp_flags" }, \
    { "filter_src", "Only receive packets from the negotiated peer IP", 0, AV_OPT_TYPE_CONST, {.i64 = RTSP_FLAG_FILTER_SRC}, 0, 0, DEC, "rtsp_flags" }, \
    { "listen", "Wait for incoming connections", 0, AV_OPT_TYPE_CONST, {.i64 = RTSP_FLAG_LISTEN}, 0, 0, DEC, "rtsp_flags" }

Definition at line 67 of file rtsp.c.

#define RTSP_MEDIATYPE_OPTS ( name,
longname   ) 

Value:

{ name, longname, OFFSET(media_type_mask), AV_OPT_TYPE_FLAGS, { .i64 = (1 << (AVMEDIA_TYPE_DATA+1)) - 1 }, INT_MIN, INT_MAX, DEC, "allowed_media_types" }, \
    { "video", "Video", 0, AV_OPT_TYPE_CONST, {.i64 = 1 << AVMEDIA_TYPE_VIDEO}, 0, 0, DEC, "allowed_media_types" }, \
    { "audio", "Audio", 0, AV_OPT_TYPE_CONST, {.i64 = 1 << AVMEDIA_TYPE_AUDIO}, 0, 0, DEC, "allowed_media_types" }, \
    { "data", "Data", 0, AV_OPT_TYPE_CONST, {.i64 = 1 << AVMEDIA_TYPE_DATA}, 0, 0, DEC, "allowed_media_types" }

Definition at line 72 of file rtsp.c.

#define SDP_MAX_SIZE   16384

Definition at line 59 of file rtsp.c.

Referenced by ff_rtsp_setup_output_streams().


Function Documentation

void ff_rtsp_close_streams ( AVFormatContext s  ) 

Close and free all streams within the RTSP (de)muxer.

Parameters:
s RTSP (de)muxer context

Definition at line 583 of file rtsp.c.

Referenced by rtsp_read_close(), rtsp_read_header(), rtsp_write_close(), and rtsp_write_header().

int ff_rtsp_open_transport_ctx ( AVFormatContext s,
RTSPStream rtsp_st 
)

Open RTSP transport context.

Definition at line 609 of file rtsp.c.

Referenced by rtsp_read_setup().

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 549 of file rtsp.c.

Referenced by ff_rtsp_close_streams(), and resetup_tcp().

static int get_sockaddr ( const char *  buf,
struct sockaddr_storage sock 
) [static]

Definition at line 162 of file rtsp.c.

static void get_word ( char *  buf,
int  buf_size,
const char **  pp 
) [static]

Definition at line 131 of file rtsp.c.

static void get_word_sep ( char *  buf,
int  buf_size,
const char *  sep,
const char **  pp 
) [static]

Definition at line 124 of file rtsp.c.

Referenced by rtsp_parse_range_npt().

static void get_word_until_chars ( char *  buf,
int  buf_size,
const char *  sep,
const char **  pp 
) [static]

Definition at line 105 of file rtsp.c.

Referenced by get_word(), and get_word_sep().

static void rtsp_parse_range_npt ( const char *  p,
int64_t *  start,
int64_t *  end 
) [static]

Parse a string p in the form of Range:npt=xx-xx, and determine the start and end time.

Used for seeking in the rtp stream.

Definition at line 140 of file rtsp.c.


Variable Documentation

Initial value:

 {
    { "initial_pause",  "Don't start playing the stream immediately", OFFSET(initial_pause), AV_OPT_TYPE_INT, {.i64 = 0}, 0, 1, DEC },
    FF_RTP_FLAG_OPTS(RTSPState, rtp_muxer_flags),
    { "rtsp_transport", "RTSP transport protocols", OFFSET(lower_transport_mask), AV_OPT_TYPE_FLAGS, {.i64 = 0}, INT_MIN, INT_MAX, DEC|ENC, "rtsp_transport" }, 
    { "udp", "UDP", 0, AV_OPT_TYPE_CONST, {.i64 = 1 << RTSP_LOWER_TRANSPORT_UDP}, 0, 0, DEC|ENC, "rtsp_transport" }, 
    { "tcp", "TCP", 0, AV_OPT_TYPE_CONST, {.i64 = 1 << RTSP_LOWER_TRANSPORT_TCP}, 0, 0, DEC|ENC, "rtsp_transport" }, 
    { "udp_multicast", "UDP multicast", 0, AV_OPT_TYPE_CONST, {.i64 = 1 << RTSP_LOWER_TRANSPORT_UDP_MULTICAST}, 0, 0, DEC, "rtsp_transport" },
    { "http", "HTTP tunneling", 0, AV_OPT_TYPE_CONST, {.i64 = (1 << RTSP_LOWER_TRANSPORT_HTTP)}, 0, 0, DEC, "rtsp_transport" },
    RTSP_FLAG_OPTS("rtsp_flags", "RTSP flags"),
    RTSP_MEDIATYPE_OPTS("allowed_media_types", "Media types to accept from the server"),
    { "min_port", "Minimum local UDP port", OFFSET(rtp_port_min), AV_OPT_TYPE_INT, {.i64 = RTSP_RTP_PORT_MIN}, 0, 65535, DEC|ENC },
    { "max_port", "Maximum local UDP port", OFFSET(rtp_port_max), AV_OPT_TYPE_INT, {.i64 = RTSP_RTP_PORT_MAX}, 0, 65535, DEC|ENC },
    { "timeout", "Maximum timeout (in seconds) to wait for incoming connections. -1 is infinite. Implies flag listen", OFFSET(initial_timeout), AV_OPT_TYPE_INT, {.i64 = -1}, INT_MIN, INT_MAX, DEC },
    { NULL },
}

Definition at line 78 of file rtsp.c.

const AVOption rtp_options[] [static]

Initial value:

 {
    RTSP_FLAG_OPTS("rtp_flags", "RTP flags"),
    { NULL },
}

Definition at line 100 of file rtsp.c.

const AVOption sdp_options[] [static]

Initial value:

 {
    RTSP_FLAG_OPTS("sdp_flags", "SDP flags"),
    RTSP_MEDIATYPE_OPTS("allowed_media_types", "Media types to accept from the server"),
    { NULL },
}

Definition at line 94 of file rtsp.c.


Generated on Fri Oct 26 02:50:11 2012 for FFmpeg by  doxygen 1.5.8