lavf/sdp: add const qualifiers where appropriate

Declares that these structs are read-only for this code.
This commit is contained in:
Anton Khirnov 2021-12-04 17:47:41 +01:00
parent 3c9778d342
commit 230646751d
4 changed files with 17 additions and 16 deletions

View File

@ -557,7 +557,7 @@ uint64_t ff_parse_ntp_time(uint64_t ntp_ts);
* @param fmt the AVFormatContext, which might contain options modifying * @param fmt the AVFormatContext, which might contain options modifying
* the generated SDP * the generated SDP
*/ */
void ff_sdp_write_media(char *buff, int size, AVStream *st, int idx, void ff_sdp_write_media(char *buff, int size, const AVStream *st, int idx,
const char *dest_addr, const char *dest_type, const char *dest_addr, const char *dest_type,
int port, int ttl, AVFormatContext *fmt); int port, int ttl, AVFormatContext *fmt);

View File

@ -87,8 +87,8 @@ int ff_rtp_get_codec_info(AVCodecParameters *par, int payload_type)
return -1; return -1;
} }
int ff_rtp_get_payload_type(AVFormatContext *fmt, int ff_rtp_get_payload_type(const AVFormatContext *fmt,
AVCodecParameters *par, int idx) const AVCodecParameters *par, int idx)
{ {
int i; int i;
const AVOutputFormat *ofmt = fmt ? fmt->oformat : NULL; const AVOutputFormat *ofmt = fmt ? fmt->oformat : NULL;

View File

@ -38,8 +38,8 @@
* @param idx The stream index * @param idx The stream index
* @return The payload type (the 'PT' field in the RTP header). * @return The payload type (the 'PT' field in the RTP header).
*/ */
int ff_rtp_get_payload_type(AVFormatContext *fmt, AVCodecParameters *par, int ff_rtp_get_payload_type(const AVFormatContext *fmt,
int idx); const AVCodecParameters *par, int idx);
/** /**
* Initialize a codec context based on the payload type. * Initialize a codec context based on the payload type.

View File

@ -151,7 +151,7 @@ static int sdp_get_address(char *dest_addr, int size, int *ttl, const char *url)
} }
#define MAX_PSET_SIZE 1024 #define MAX_PSET_SIZE 1024
static char *extradata2psets(AVFormatContext *s, AVCodecParameters *par) static char *extradata2psets(AVFormatContext *s, const AVCodecParameters *par)
{ {
char *psets, *p; char *psets, *p;
const uint8_t *r; const uint8_t *r;
@ -222,7 +222,7 @@ static char *extradata2psets(AVFormatContext *s, AVCodecParameters *par)
return psets; return psets;
} }
static char *extradata2psets_hevc(AVCodecParameters *par) static char *extradata2psets_hevc(const AVCodecParameters *par)
{ {
char *psets; char *psets;
uint8_t *extradata = par->extradata; uint8_t *extradata = par->extradata;
@ -323,7 +323,7 @@ err:
return NULL; return NULL;
} }
static char *extradata2config(AVFormatContext *s, AVCodecParameters *par) static char *extradata2config(AVFormatContext *s, const AVCodecParameters *par)
{ {
char *config; char *config;
@ -343,7 +343,7 @@ static char *extradata2config(AVFormatContext *s, AVCodecParameters *par)
return config; return config;
} }
static char *xiph_extradata2config(AVFormatContext *s, AVCodecParameters *par) static char *xiph_extradata2config(AVFormatContext *s, const AVCodecParameters *par)
{ {
uint8_t *config; uint8_t *config;
char *encoded_config; char *encoded_config;
@ -413,7 +413,7 @@ xiph_fail:
return NULL; return NULL;
} }
static int latm_context2profilelevel(AVCodecParameters *par) static int latm_context2profilelevel(const AVCodecParameters *par)
{ {
/* MP4A-LATM /* MP4A-LATM
* The RTP payload format specification is described in RFC 3016 * The RTP payload format specification is described in RFC 3016
@ -442,7 +442,7 @@ static int latm_context2profilelevel(AVCodecParameters *par)
return profile_level; return profile_level;
} }
static char *latm_context2config(AVFormatContext *s, AVCodecParameters *par) static char *latm_context2config(AVFormatContext *s, const AVCodecParameters *par)
{ {
/* MP4A-LATM /* MP4A-LATM
* The RTP payload format specification is described in RFC 3016 * The RTP payload format specification is described in RFC 3016
@ -477,10 +477,11 @@ static char *latm_context2config(AVFormatContext *s, AVCodecParameters *par)
return config; return config;
} }
static char *sdp_write_media_attributes(char *buff, int size, AVStream *st, int payload_type, AVFormatContext *fmt) static char *sdp_write_media_attributes(char *buff, int size, const AVStream *st,
int payload_type, AVFormatContext *fmt)
{ {
char *config = NULL; char *config = NULL;
AVCodecParameters *p = st->codecpar; const AVCodecParameters *p = st->codecpar;
switch (p->codec_id) { switch (p->codec_id) {
case AV_CODEC_ID_DIRAC: case AV_CODEC_ID_DIRAC:
@ -762,11 +763,11 @@ static char *sdp_write_media_attributes(char *buff, int size, AVStream *st, int
return buff; return buff;
} }
void ff_sdp_write_media(char *buff, int size, AVStream *st, int idx, void ff_sdp_write_media(char *buff, int size, const AVStream *st, int idx,
const char *dest_addr, const char *dest_type, const char *dest_addr, const char *dest_type,
int port, int ttl, AVFormatContext *fmt) int port, int ttl, AVFormatContext *fmt)
{ {
AVCodecParameters *p = st->codecpar; const AVCodecParameters *p = st->codecpar;
const char *type; const char *type;
int payload_type; int payload_type;
@ -863,7 +864,7 @@ int av_sdp_create(AVFormatContext *ac[], int n_files, char *buf, int size)
return AVERROR(ENOSYS); return AVERROR(ENOSYS);
} }
void ff_sdp_write_media(char *buff, int size, AVStream *st, int idx, void ff_sdp_write_media(char *buff, int size, const AVStream *st, int idx,
const char *dest_addr, const char *dest_type, const char *dest_addr, const char *dest_type,
int port, int ttl, AVFormatContext *fmt) int port, int ttl, AVFormatContext *fmt)
{ {