FFmpeg
Loading...
Searching...
No Matches
rtspdec.c File Reference
#include "config_components.h"
#include "libavutil/avstring.h"
#include "libavutil/avassert.h"
#include "libavutil/intreadwrite.h"
#include "libavutil/mathematics.h"
#include "libavutil/mem.h"
#include "libavutil/random_seed.h"
#include "libavutil/time.h"
#include "avformat.h"
#include "demux.h"
#include "internal.h"
#include "network.h"
#include "os_support.h"
#include "rtpproto.h"
#include "rtsp.h"
#include "rdt.h"
#include "tls.h"
#include "url.h"
#include "version.h"

Go to the source code of this file.

Data Structures

struct  RTSPStatusMessage
 

Functions

static int rtsp_read_close (AVFormatContext *s)
 
static int read_line (AVFormatContext *s, char *rbuf, const int rbufsize, int *rbuflen)
 
static int rtsp_send_reply (AVFormatContext *s, enum RTSPStatusCode code, const char *extracontent, uint16_t seq)
 
static int check_sessionid (AVFormatContext *s, RTSPMessageHeader *request)
 
static int rtsp_read_request (AVFormatContext *s, RTSPMessageHeader *request, const char *method)
 
static int rtsp_read_announce (AVFormatContext *s)
 
static int rtsp_read_options (AVFormatContext *s)
 
static int rtsp_read_setup (AVFormatContext *s, char *host, char *controlurl)
 
static int rtsp_read_record (AVFormatContext *s)
 
static int parse_command_line (AVFormatContext *s, const char *line, int linelen, char *uri, int urisize, char *method, int methodsize, enum RTSPMethod *methodcode)
 
int ff_rtsp_parse_streaming_commands (AVFormatContext *s)
 Parse RTSP commands (OPTIONS, PAUSE and TEARDOWN) during streaming in listen mode.
 
static int rtsp_read_play (AVFormatContext *s)
 
static int rtsp_read_pause (AVFormatContext *s)
 
static int rtsp_read_set_state (AVFormatContext *s, enum FFInputFormatStreamState state)
 
static char * dict_to_headers (AVDictionary *headers)
 
static int rtsp_submit_command (struct AVFormatContext *s, enum AVFormatCommandID id, void *data)
 
static int rtsp_read_command_reply (AVFormatContext *s, enum AVFormatCommandID id, void **data_out)
 
static int rtsp_handle_command (struct AVFormatContext *s, enum FFInputFormatCommandOption opt, enum AVFormatCommandID id, void *data)
 
int ff_rtsp_setup_input_streams (AVFormatContext *s, RTSPMessageHeader *reply)
 Get the description of the stream and set up the RTSPStream child objects.
 
static int rtsp_listen (AVFormatContext *s)
 
static int rtsp_probe (const AVProbeData *p)
 
static int rtsp_read_header (AVFormatContext *s)
 
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.
 
static int resetup_tcp (AVFormatContext *s)
 
static int rtsp_read_packet (AVFormatContext *s, AVPacket *pkt)
 
static int rtsp_read_seek (AVFormatContext *s, int stream_index, int64_t timestamp, int flags)
 

Variables

static const struct RTSPStatusMessage status_messages []
 
static const AVClass rtsp_demuxer_class
 
const FFInputFormat ff_rtsp_demuxer
 

Function Documentation

◆ rtsp_read_close()

static int rtsp_read_close ( AVFormatContext * s)
static

Definition at line 62 of file rtspdec.c.

Referenced by rtsp_read_header().

◆ read_line()

static int read_line ( AVFormatContext * s,
char * rbuf,
const int rbufsize,
int * rbuflen )
inlinestatic

Definition at line 77 of file rtspdec.c.

Referenced by ff_rtsp_parse_streaming_commands(), rtsp_listen(), and rtsp_read_request().

◆ rtsp_send_reply()

static int rtsp_send_reply ( AVFormatContext * s,
enum RTSPStatusCode code,
const char * extracontent,
uint16_t seq )
static

◆ check_sessionid()

static int check_sessionid ( AVFormatContext * s,
RTSPMessageHeader * request )
inlinestatic

Definition at line 129 of file rtspdec.c.

Referenced by rtsp_read_record(), and rtsp_read_request().

◆ rtsp_read_request()

static int rtsp_read_request ( AVFormatContext * s,
RTSPMessageHeader * request,
const char * method )
inlinestatic

◆ rtsp_read_announce()

static int rtsp_read_announce ( AVFormatContext * s)
static

Definition at line 177 of file rtspdec.c.

Referenced by rtsp_listen().

◆ rtsp_read_options()

static int rtsp_read_options ( AVFormatContext * s)
static

Definition at line 224 of file rtspdec.c.

Referenced by rtsp_listen().

◆ rtsp_read_setup()

static int rtsp_read_setup ( AVFormatContext * s,
char * host,
char * controlurl )
static

Definition at line 242 of file rtspdec.c.

Referenced by rtsp_listen().

◆ rtsp_read_record()

static int rtsp_read_record ( AVFormatContext * s)
static

Definition at line 361 of file rtspdec.c.

Referenced by rtsp_listen().

◆ parse_command_line()

static int parse_command_line ( AVFormatContext * s,
const char * line,
int linelen,
char * uri,
int urisize,
char * method,
int methodsize,
enum RTSPMethod * methodcode )
inlinestatic

Definition at line 383 of file rtspdec.c.

Referenced by ff_rtsp_parse_streaming_commands(), and rtsp_listen().

◆ ff_rtsp_parse_streaming_commands()

int ff_rtsp_parse_streaming_commands ( AVFormatContext * s)

Parse RTSP commands (OPTIONS, PAUSE and TEARDOWN) during streaming in listen mode.

Definition at line 486 of file rtspdec.c.

◆ rtsp_read_play()

static int rtsp_read_play ( AVFormatContext * s)
static

Definition at line 527 of file rtspdec.c.

Referenced by rtsp_read_header(), rtsp_read_packet(), rtsp_read_seek(), and rtsp_read_set_state().

◆ rtsp_read_pause()

static int rtsp_read_pause ( AVFormatContext * s)
static

Definition at line 598 of file rtspdec.c.

Referenced by rtsp_read_packet(), rtsp_read_seek(), and rtsp_read_set_state().

◆ rtsp_read_set_state()

static int rtsp_read_set_state ( AVFormatContext * s,
enum FFInputFormatStreamState state )
static

Definition at line 615 of file rtspdec.c.

◆ dict_to_headers()

static char * dict_to_headers ( AVDictionary * headers)
static

Definition at line 628 of file rtspdec.c.

Referenced by rtsp_submit_command().

◆ rtsp_submit_command()

static int rtsp_submit_command ( struct AVFormatContext * s,
enum AVFormatCommandID id,
void * data )
static

Definition at line 643 of file rtspdec.c.

Referenced by rtsp_handle_command().

◆ rtsp_read_command_reply()

static int rtsp_read_command_reply ( AVFormatContext * s,
enum AVFormatCommandID id,
void ** data_out )
static

Definition at line 670 of file rtspdec.c.

Referenced by rtsp_handle_command().

◆ rtsp_handle_command()

static int rtsp_handle_command ( struct AVFormatContext * s,
enum FFInputFormatCommandOption opt,
enum AVFormatCommandID id,
void * data )
static

Definition at line 707 of file rtspdec.c.

◆ ff_rtsp_setup_input_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 721 of file rtspdec.c.

◆ rtsp_listen()

static int rtsp_listen ( AVFormatContext * s)
static

Definition at line 758 of file rtspdec.c.

Referenced by rtsp_read_header().

◆ rtsp_probe()

static int rtsp_probe ( const AVProbeData * p)
static

Definition at line 839 of file rtspdec.c.

◆ rtsp_read_header()

static int rtsp_read_header ( AVFormatContext * s)
static

Definition at line 851 of file rtspdec.c.

◆ ff_rtsp_tcp_read_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 892 of file rtspdec.c.

◆ resetup_tcp()

static int resetup_tcp ( AVFormatContext * s)
static

Definition at line 943 of file rtspdec.c.

Referenced by rtsp_read_packet().

◆ rtsp_read_packet()

static int rtsp_read_packet ( AVFormatContext * s,
AVPacket * pkt )
static

Definition at line 956 of file rtspdec.c.

◆ rtsp_read_seek()

static int rtsp_read_seek ( AVFormatContext * s,
int stream_index,
int64_t timestamp,
int flags )
static

Definition at line 1071 of file rtspdec.c.

Variable Documentation

◆ status_messages

const struct RTSPStatusMessage status_messages[]
static
Initial value:
= {
{ RTSP_STATUS_OK, "OK" },
{ RTSP_STATUS_METHOD, "Method Not Allowed" },
{ RTSP_STATUS_BANDWIDTH, "Not Enough Bandwidth" },
{ RTSP_STATUS_SESSION, "Session Not Found" },
{ RTSP_STATUS_STATE, "Method Not Valid in This State" },
{ RTSP_STATUS_AGGREGATE, "Aggregate operation not allowed" },
{ RTSP_STATUS_ONLY_AGGREGATE, "Only aggregate operation allowed" },
{ RTSP_STATUS_TRANSPORT, "Unsupported transport" },
{ RTSP_STATUS_INTERNAL, "Internal Server Error" },
{ RTSP_STATUS_SERVICE, "Service Unavailable" },
{ RTSP_STATUS_VERSION, "RTSP Version not supported" },
{ 0, "NULL" }
}
@ RTSP_STATUS_METHOD
Definition rtspcodes.h:47
@ RTSP_STATUS_SESSION
Definition rtspcodes.h:60
@ RTSP_STATUS_OK
Definition rtspcodes.h:33
@ RTSP_STATUS_VERSION
Definition rtspcodes.h:74
@ RTSP_STATUS_BANDWIDTH
Definition rtspcodes.h:59
@ RTSP_STATUS_STATE
Definition rtspcodes.h:61
@ RTSP_STATUS_SERVICE
Definition rtspcodes.h:72
@ RTSP_STATUS_TRANSPORT
Definition rtspcodes.h:67
@ RTSP_STATUS_AGGREGATE
Definition rtspcodes.h:65
@ RTSP_STATUS_ONLY_AGGREGATE
Definition rtspcodes.h:66
@ RTSP_STATUS_INTERNAL
Definition rtspcodes.h:69

Referenced by rtsp_send_reply().

◆ rtsp_demuxer_class

const AVClass rtsp_demuxer_class
static
Initial value:
= {
.class_name = "RTSP demuxer",
.item_name = av_default_item_name,
.option = ff_rtsp_options,
}
const char * av_default_item_name(void *ptr)
Return the context name.
Definition log.c:241
#define LIBAVUTIL_VERSION_INT
Definition version.h:85
const AVOption ff_rtsp_options[]
Definition rtsp.c:87

Definition at line 1098 of file rtspdec.c.

◆ ff_rtsp_demuxer

const FFInputFormat ff_rtsp_demuxer
Initial value:
= {
.p.name = "rtsp",
.p.long_name = NULL_IF_CONFIG_SMALL("RTSP input"),
.p.flags = AVFMT_NOFILE,
.p.priv_class = &rtsp_demuxer_class,
.priv_data_size = sizeof(RTSPState),
.read_set_state = rtsp_read_set_state,
.handle_command = rtsp_handle_command,
}
#define AVFMT_NOFILE
Demuxer will use avio_open, no opened file should be provided by the caller.
Definition avformat.h:488
static int read_packet(void *opaque, uint8_t *buf, int buf_size)
static int read_probe(const AVProbeData *p)
Definition cdg.c:30
static int read_header(FFV1Context *f, RangeCoder *c)
Definition ffv1dec.c:578
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
Definition internal.h:88
static av_cold int read_close(AVFormatContext *ctx)
Definition libcdio.c:143
static int read_seek(AVFormatContext *ctx, int stream_index, int64_t timestamp, int flags)
Definition libcdio.c:151
static int rtsp_probe(const AVProbeData *p)
Definition rtspdec.c:839
static int rtsp_read_close(AVFormatContext *s)
Definition rtspdec.c:62
static int rtsp_read_set_state(AVFormatContext *s, enum FFInputFormatStreamState state)
Definition rtspdec.c:615
static int rtsp_read_header(AVFormatContext *s)
Definition rtspdec.c:851
static const AVClass rtsp_demuxer_class
Definition rtspdec.c:1098
static int rtsp_handle_command(struct AVFormatContext *s, enum FFInputFormatCommandOption opt, enum AVFormatCommandID id, void *data)
Definition rtspdec.c:707
static int rtsp_read_packet(AVFormatContext *s, AVPacket *pkt)
Definition rtspdec.c:956
static int rtsp_read_seek(AVFormatContext *s, int stream_index, int64_t timestamp, int flags)
Definition rtspdec.c:1071
Private data for the RTSP demuxer.
Definition rtsp.h:226

Definition at line 1105 of file rtspdec.c.