FFmpeg
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Functions | Variables
rtpproto.c File Reference

RTP protocol. More...

#include "libavutil/parseutils.h"
#include "libavutil/avstring.h"
#include "avformat.h"
#include "avio_internal.h"
#include "rtp.h"
#include "rtpproto.h"
#include "url.h"
#include <stdarg.h>
#include "internal.h"
#include "network.h"
#include "os_support.h"
#include <fcntl.h>

Go to the source code of this file.

Data Structures

struct  RTPContext
 

Functions

int ff_rtp_set_remote_url (URLContext *h, const char *uri)
 If no filename is given to av_open_input_file because you want to get the local port first, then you must call this function to set the remote server address.
 
static struct addrinfortp_resolve_host (const char *hostname, int port, int type, int family, int flags)
 
static int compare_addr (const struct sockaddr_storage *a, const struct sockaddr_storage *b)
 
static int get_port (const struct sockaddr_storage *ss)
 
static void set_port (struct sockaddr_storage *ss, int port)
 
static int rtp_check_source_lists (RTPContext *s, struct sockaddr_storage *source_addr_ptr)
 
static av_printf_format (3, 4)
 add option to url of the form: "http://host:port/path?option1=val1&option2=val2...
 
static void build_udp_url (char *buf, int buf_size, const char *hostname, int port, int local_port, int ttl, int max_packet_size, int connect, int dscp, const char *include_sources, const char *exclude_sources)
 
static void rtp_parse_addr_list (URLContext *h, char *buf, struct sockaddr_storage ***address_list_ptr, int *address_list_size_ptr)
 
static int rtp_open (URLContext *h, const char *uri, int flags)
 url syntax: rtp://host:port[?option=val...] option: 'ttl=n' : set the ttl value (for multicast only) 'rtcpport=n' : set the remote rtcp port to n 'localrtpport=n' : set the local rtp port to n 'localrtcpport=n' : set the local rtcp port to n 'pkt_size=n' : set max packet size 'connect=0/1' : do a connect() on the UDP socket 'sources=ip[,ip]' : list allowed source IP addresses 'block=ip[,ip]' : list disallowed source IP addresses 'write_to_source=0/1' : send packets to the source address of the latest received packet 'dscp=n' : set DSCP value to n (QoS) deprecated option: 'localport=n' : set the local port to n
 
static int rtp_read (URLContext *h, uint8_t *buf, int size)
 
static int rtp_write (URLContext *h, const uint8_t *buf, int size)
 
static int rtp_close (URLContext *h)
 
int ff_rtp_get_local_rtp_port (URLContext *h)
 Return the local rtp port used by the RTP connection.
 
int ff_rtp_get_local_rtcp_port (URLContext *h)
 Return the local rtcp port used by the RTP connection.
 
static int rtp_get_file_handle (URLContext *h)
 
static int rtp_get_multi_file_handle (URLContext *h, int **handles, int *numhandles)
 

Variables

URLProtocol ff_rtp_protocol
 

Detailed Description

RTP protocol.

Definition in file rtpproto.c.

Function Documentation

int ff_rtp_set_remote_url ( URLContext h,
const char *  uri 
)

If no filename is given to av_open_input_file because you want to get the local port first, then you must call this function to set the remote server address.

Parameters
hmedia file context
uriof the remote server
Returns
zero if no error.

Definition at line 63 of file rtpproto.c.

static struct addrinfo* rtp_resolve_host ( const char *  hostname,
int  port,
int  type,
int  family,
int  flags 
)
staticread

Definition at line 92 of file rtpproto.c.

Referenced by rtp_parse_addr_list().

static int compare_addr ( const struct sockaddr_storage a,
const struct sockaddr_storage b 
)
static

Definition at line 111 of file rtpproto.c.

Referenced by rtp_check_source_lists().

static int get_port ( const struct sockaddr_storage ss)
static

Definition at line 131 of file rtpproto.c.

Referenced by rtp_write().

static void set_port ( struct sockaddr_storage ss,
int  port 
)
static

Definition at line 142 of file rtpproto.c.

Referenced by rtp_write().

static int rtp_check_source_lists ( RTPContext s,
struct sockaddr_storage source_addr_ptr 
)
static

Definition at line 152 of file rtpproto.c.

Referenced by rtp_read().

static av_printf_format ( ,
 
)
static

add option to url of the form: "http://host:port/path?option1=val1&option2=val2...

Definition at line 176 of file rtpproto.c.

static void build_udp_url ( char *  buf,
int  buf_size,
const char *  hostname,
int  port,
int  local_port,
int  ttl,
int  max_packet_size,
int  connect,
int  dscp,
const char *  include_sources,
const char *  exclude_sources 
)
static

Definition at line 191 of file rtpproto.c.

Referenced by rtp_open().

static void rtp_parse_addr_list ( URLContext h,
char *  buf,
struct sockaddr_storage ***  address_list_ptr,
int *  address_list_size_ptr 
)
static

Definition at line 217 of file rtpproto.c.

Referenced by rtp_open().

static int rtp_open ( URLContext h,
const char *  uri,
int  flags 
)
static

url syntax: rtp://host:port[?option=val...] option: 'ttl=n' : set the ttl value (for multicast only) 'rtcpport=n' : set the remote rtcp port to n 'localrtpport=n' : set the local rtp port to n 'localrtcpport=n' : set the local rtcp port to n 'pkt_size=n' : set max packet size 'connect=0/1' : do a connect() on the UDP socket 'sources=ip[,ip]' : list allowed source IP addresses 'block=ip[,ip]' : list disallowed source IP addresses 'write_to_source=0/1' : send packets to the source address of the latest received packet 'dscp=n' : set DSCP value to n (QoS) deprecated option: 'localport=n' : set the local port to n

if rtcpport isn't set the rtcp port will be the rtp port + 1 if local rtp port isn't set any available port will be used for the local rtp and rtcp ports if the local rtcp port is not set it will be the local rtp port + 1

Definition at line 280 of file rtpproto.c.

static int rtp_read ( URLContext h,
uint8_t buf,
int  size 
)
static

Definition at line 389 of file rtpproto.c.

static int rtp_write ( URLContext h,
const uint8_t buf,
int  size 
)
static

Definition at line 431 of file rtpproto.c.

static int rtp_close ( URLContext h)
static

Definition at line 503 of file rtpproto.c.

int ff_rtp_get_local_rtp_port ( URLContext h)

Return the local rtp port used by the RTP connection.

Parameters
hmedia file context
Returns
the local port number

Definition at line 526 of file rtpproto.c.

Referenced by rtsp_cmd_setup(), and rtsp_read_setup().

int ff_rtp_get_local_rtcp_port ( URLContext h)

Return the local rtcp port used by the RTP connection.

Parameters
hmedia file context
Returns
the local port number

Definition at line 538 of file rtpproto.c.

Referenced by rtsp_cmd_setup().

static int rtp_get_file_handle ( URLContext h)
static

Definition at line 544 of file rtpproto.c.

static int rtp_get_multi_file_handle ( URLContext h,
int **  handles,
int *  numhandles 
)
static

Definition at line 550 of file rtpproto.c.

Variable Documentation

URLProtocol ff_rtp_protocol
Initial value:
= {
.name = "rtp",
.url_open = rtp_open,
.url_read = rtp_read,
.url_write = rtp_write,
.url_close = rtp_close,
.url_get_file_handle = rtp_get_file_handle,
.url_get_multi_file_handle = rtp_get_multi_file_handle,
.priv_data_size = sizeof(RTPContext),
}

Definition at line 563 of file rtpproto.c.