FFmpeg
Macros | Enumerations | Functions
rtp.h File Reference
#include <stdint.h>
#include "libavutil/avutil.h"
#include "libavcodec/codec_id.h"
#include "libavcodec/codec_par.h"
#include "libavformat/avformat.h"

Go to the source code of this file.

Macros

#define RTP_PT_PRIVATE   96
 
#define RTP_VERSION   2
 
#define RTP_MAX_SDES   256
 maximum text length for SDES More...
 
#define RTCP_TX_RATIO_NUM   5
 
#define RTCP_TX_RATIO_DEN   1000
 
#define RTP_XIPH_IDENT   0xfecdba
 
#define RTP_PT_IS_RTCP(x)
 
#define NTP_TO_RTP_FORMAT(x)   av_rescale((x), INT64_C(1) << 32, 1000000)
 

Enumerations

enum  RTCPType {
  RTCP_FIR = 192, RTCP_NACK, RTCP_SMPTETC, RTCP_IJ,
  RTCP_SR = 200, RTCP_RR, RTCP_SDES, RTCP_BYE,
  RTCP_APP, RTCP_RTPFB, RTCP_PSFB, RTCP_XR,
  RTCP_AVB, RTCP_RSI, RTCP_TOKEN
}
 

Functions

int ff_rtp_get_payload_type (const AVFormatContext *fmt, const AVCodecParameters *par, int idx)
 Return the payload type for a given stream used in the given format context. More...
 
int ff_rtp_get_codec_info (AVCodecParameters *par, int payload_type)
 Initialize a codec context based on the payload type. More...
 
const char * ff_rtp_enc_name (int payload_type)
 Return the encoding name (as defined in http://www.iana.org/assignments/rtp-parameters) for a given payload type. More...
 
enum AVCodecID ff_rtp_codec_id (const char *buf, enum AVMediaType codec_type)
 Return the codec id for the given encoding name and codec type. More...
 

Macro Definition Documentation

◆ RTP_PT_PRIVATE

#define RTP_PT_PRIVATE   96

Definition at line 79 of file rtp.h.

◆ RTP_VERSION

#define RTP_VERSION   2

Definition at line 80 of file rtp.h.

◆ RTP_MAX_SDES

#define RTP_MAX_SDES   256

maximum text length for SDES

Definition at line 81 of file rtp.h.

◆ RTCP_TX_RATIO_NUM

#define RTCP_TX_RATIO_NUM   5

Definition at line 84 of file rtp.h.

◆ RTCP_TX_RATIO_DEN

#define RTCP_TX_RATIO_DEN   1000

Definition at line 85 of file rtp.h.

◆ RTP_XIPH_IDENT

#define RTP_XIPH_IDENT   0xfecdba

Definition at line 91 of file rtp.h.

◆ RTP_PT_IS_RTCP

#define RTP_PT_IS_RTCP (   x)
Value:
(((x) >= RTCP_FIR && (x) <= RTCP_IJ) || \
((x) >= RTCP_SR && (x) <= RTCP_TOKEN))

Definition at line 112 of file rtp.h.

◆ NTP_TO_RTP_FORMAT

#define NTP_TO_RTP_FORMAT (   x)    av_rescale((x), INT64_C(1) << 32, 1000000)

Definition at line 115 of file rtp.h.

Enumeration Type Documentation

◆ RTCPType

enum RTCPType
Enumerator
RTCP_FIR 
RTCP_NACK 
RTCP_SMPTETC 
RTCP_IJ 
RTCP_SR 
RTCP_RR 
RTCP_SDES 
RTCP_BYE 
RTCP_APP 
RTCP_RTPFB 
RTCP_PSFB 
RTCP_XR 
RTCP_AVB 
RTCP_RSI 
RTCP_TOKEN 

Definition at line 94 of file rtp.h.

Function Documentation

◆ ff_rtp_get_payload_type()

int ff_rtp_get_payload_type ( const AVFormatContext fmt,
const AVCodecParameters par,
int  idx 
)

Return the payload type for a given stream used in the given format context.

Static payload types are derived from the codec. Dynamic payload type are derived from the id field in AVStream. The format context private option payload_type overrides both.

Parameters
fmtThe context of the format
parThe codec parameters
idxThe stream index
Returns
The payload type (the 'PT' field in the RTP header).

Definition at line 90 of file rtp.c.

Referenced by ff_rtp_chain_mux_open(), and rtp_write_header().

◆ ff_rtp_get_codec_info()

int ff_rtp_get_codec_info ( AVCodecParameters par,
int  payload_type 
)

Initialize a codec context based on the payload type.

Fill the codec_type and codec_id fields of a codec context with information depending on the payload type; for audio codecs, the channels and sample_rate fields are also filled.

Parameters
parThe codec parameters
payload_typeThe payload type (the 'PT' field in the RTP header)
Returns
In case of unknown payload type or dynamic payload type, a negative value is returned; otherwise, 0 is returned

Definition at line 71 of file rtp.c.

◆ ff_rtp_enc_name()

const char* ff_rtp_enc_name ( int  payload_type)

Return the encoding name (as defined in http://www.iana.org/assignments/rtp-parameters) for a given payload type.

Parameters
payload_typeThe payload type (the 'PT' field in the RTP header)
Returns
In case of unknown payload type or dynamic payload type, a pointer to an empty string is returned; otherwise, a pointer to a string containing the encoding name is returned

Definition at line 132 of file rtp.c.

◆ ff_rtp_codec_id()

enum AVCodecID ff_rtp_codec_id ( const char *  buf,
enum AVMediaType  codec_type 
)

Return the codec id for the given encoding name and codec type.

Parameters
bufA pointer to the string containing the encoding name
codec_typeThe codec type
Returns
In case of unknown encoding name, AV_CODEC_ID_NONE is returned; otherwise, the codec id is returned

Definition at line 143 of file rtp.c.

RTCP_IJ
@ RTCP_IJ
Definition: rtp.h:98
RTCP_TOKEN
@ RTCP_TOKEN
Definition: rtp.h:109
RTCP_FIR
@ RTCP_FIR
Definition: rtp.h:95
RTCP_SR
@ RTCP_SR
Definition: rtp.h:99