Commit dced1f6c authored by Carl Eugen Hoyos's avatar Carl Eugen Hoyos

lavf/rtpdec: Constify several pointers.

Fixes two warnings:
libavformat/rtpdec.c:155:20: warning: return discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
libavformat/rtpdec.c:168:20: warning: return discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
parent f2318aee
...@@ -53,7 +53,7 @@ struct RDTDemuxContext { ...@@ -53,7 +53,7 @@ struct RDTDemuxContext {
RDTDemuxContext * RDTDemuxContext *
ff_rdt_parse_open(AVFormatContext *ic, int first_stream_of_set_idx, ff_rdt_parse_open(AVFormatContext *ic, int first_stream_of_set_idx,
void *priv_data, RTPDynamicProtocolHandler *handler) void *priv_data, const RTPDynamicProtocolHandler *handler)
{ {
RDTDemuxContext *s = av_mallocz(sizeof(RDTDemuxContext)); RDTDemuxContext *s = av_mallocz(sizeof(RDTDemuxContext));
if (!s) if (!s)
......
...@@ -41,7 +41,7 @@ typedef struct RDTDemuxContext RDTDemuxContext; ...@@ -41,7 +41,7 @@ typedef struct RDTDemuxContext RDTDemuxContext;
RDTDemuxContext *ff_rdt_parse_open(AVFormatContext *ic, RDTDemuxContext *ff_rdt_parse_open(AVFormatContext *ic,
int first_stream_of_set_idx, int first_stream_of_set_idx,
void *priv_data, void *priv_data,
RTPDynamicProtocolHandler *handler); const RTPDynamicProtocolHandler *handler);
void ff_rdt_parse_close(RDTDemuxContext *s); void ff_rdt_parse_close(RDTDemuxContext *s);
/** /**
......
...@@ -143,7 +143,7 @@ const RTPDynamicProtocolHandler *ff_rtp_handler_iterate(void **opaque) ...@@ -143,7 +143,7 @@ const RTPDynamicProtocolHandler *ff_rtp_handler_iterate(void **opaque)
return r; return r;
} }
RTPDynamicProtocolHandler *ff_rtp_handler_find_by_name(const char *name, const RTPDynamicProtocolHandler *ff_rtp_handler_find_by_name(const char *name,
enum AVMediaType codec_type) enum AVMediaType codec_type)
{ {
void *i = 0; void *i = 0;
...@@ -157,7 +157,7 @@ RTPDynamicProtocolHandler *ff_rtp_handler_find_by_name(const char *name, ...@@ -157,7 +157,7 @@ RTPDynamicProtocolHandler *ff_rtp_handler_find_by_name(const char *name,
return NULL; return NULL;
} }
RTPDynamicProtocolHandler *ff_rtp_handler_find_by_id(int id, const RTPDynamicProtocolHandler *ff_rtp_handler_find_by_id(int id,
enum AVMediaType codec_type) enum AVMediaType codec_type)
{ {
void *i = 0; void *i = 0;
...@@ -572,7 +572,7 @@ RTPDemuxContext *ff_rtp_parse_open(AVFormatContext *s1, AVStream *st, ...@@ -572,7 +572,7 @@ RTPDemuxContext *ff_rtp_parse_open(AVFormatContext *s1, AVStream *st,
} }
void ff_rtp_parse_set_dynamic_protocol(RTPDemuxContext *s, PayloadContext *ctx, void ff_rtp_parse_set_dynamic_protocol(RTPDemuxContext *s, PayloadContext *ctx,
RTPDynamicProtocolHandler *handler) const RTPDynamicProtocolHandler *handler)
{ {
s->dynamic_protocol_context = ctx; s->dynamic_protocol_context = ctx;
s->handler = handler; s->handler = handler;
......
...@@ -43,7 +43,7 @@ typedef struct RTPDemuxContext RTPDemuxContext; ...@@ -43,7 +43,7 @@ typedef struct RTPDemuxContext RTPDemuxContext;
RTPDemuxContext *ff_rtp_parse_open(AVFormatContext *s1, AVStream *st, RTPDemuxContext *ff_rtp_parse_open(AVFormatContext *s1, AVStream *st,
int payload_type, int queue_size); int payload_type, int queue_size);
void ff_rtp_parse_set_dynamic_protocol(RTPDemuxContext *s, PayloadContext *ctx, void ff_rtp_parse_set_dynamic_protocol(RTPDemuxContext *s, PayloadContext *ctx,
RTPDynamicProtocolHandler *handler); const RTPDynamicProtocolHandler *handler);
void ff_rtp_parse_set_crypto(RTPDemuxContext *s, const char *suite, void ff_rtp_parse_set_crypto(RTPDemuxContext *s, const char *suite,
const char *params); const char *params);
int ff_rtp_parse_packet(RTPDemuxContext *s, AVPacket *pkt, int ff_rtp_parse_packet(RTPDemuxContext *s, AVPacket *pkt,
...@@ -208,7 +208,7 @@ const RTPDynamicProtocolHandler *ff_rtp_handler_iterate(void **opaque); ...@@ -208,7 +208,7 @@ const RTPDynamicProtocolHandler *ff_rtp_handler_iterate(void **opaque);
* @param name name of the requested rtp dynamic protocol handler * @param name name of the requested rtp dynamic protocol handler
* @return A rtp dynamic protocol handler if one was found, NULL otherwise. * @return A rtp dynamic protocol handler if one was found, NULL otherwise.
*/ */
RTPDynamicProtocolHandler *ff_rtp_handler_find_by_name(const char *name, const RTPDynamicProtocolHandler *ff_rtp_handler_find_by_name(const char *name,
enum AVMediaType codec_type); enum AVMediaType codec_type);
/** /**
* Find a registered rtp dynamic protocol handler with a matching codec ID. * Find a registered rtp dynamic protocol handler with a matching codec ID.
...@@ -216,7 +216,7 @@ RTPDynamicProtocolHandler *ff_rtp_handler_find_by_name(const char *name, ...@@ -216,7 +216,7 @@ RTPDynamicProtocolHandler *ff_rtp_handler_find_by_name(const char *name,
* @param id AVCodecID of the requested rtp dynamic protocol handler. * @param id AVCodecID of the requested rtp dynamic protocol handler.
* @return A rtp dynamic protocol handler if one was found, NULL otherwise. * @return A rtp dynamic protocol handler if one was found, NULL otherwise.
*/ */
RTPDynamicProtocolHandler *ff_rtp_handler_find_by_id(int id, const RTPDynamicProtocolHandler *ff_rtp_handler_find_by_id(int id,
enum AVMediaType codec_type); enum AVMediaType codec_type);
/* from rtsp.c, but used by rtp dynamic protocol handlers. */ /* from rtsp.c, but used by rtp dynamic protocol handlers. */
......
...@@ -211,7 +211,7 @@ static int get_sockaddr(AVFormatContext *s, ...@@ -211,7 +211,7 @@ static int get_sockaddr(AVFormatContext *s,
} }
#if CONFIG_RTPDEC #if CONFIG_RTPDEC
static void init_rtp_handler(RTPDynamicProtocolHandler *handler, static void init_rtp_handler(const RTPDynamicProtocolHandler *handler,
RTSPStream *rtsp_st, AVStream *st) RTSPStream *rtsp_st, AVStream *st)
{ {
AVCodecParameters *par = st ? st->codecpar : NULL; AVCodecParameters *par = st ? st->codecpar : NULL;
...@@ -271,7 +271,7 @@ static int sdp_parse_rtpmap(AVFormatContext *s, ...@@ -271,7 +271,7 @@ static int sdp_parse_rtpmap(AVFormatContext *s,
} }
if (par->codec_id == AV_CODEC_ID_NONE) { if (par->codec_id == AV_CODEC_ID_NONE) {
RTPDynamicProtocolHandler *handler = const RTPDynamicProtocolHandler *handler =
ff_rtp_handler_find_by_name(buf, par->codec_type); ff_rtp_handler_find_by_name(buf, par->codec_type);
init_rtp_handler(handler, rtsp_st, st); init_rtp_handler(handler, rtsp_st, st);
/* If no dynamic handler was found, check with the list of standard /* If no dynamic handler was found, check with the list of standard
...@@ -495,7 +495,7 @@ static void sdp_parse_line(AVFormatContext *s, SDPParseState *s1, ...@@ -495,7 +495,7 @@ static void sdp_parse_line(AVFormatContext *s, SDPParseState *s1,
if (CONFIG_RTPDEC && !rt->ts) if (CONFIG_RTPDEC && !rt->ts)
rt->ts = avpriv_mpegts_parse_open(s); rt->ts = avpriv_mpegts_parse_open(s);
} else { } else {
RTPDynamicProtocolHandler *handler; const RTPDynamicProtocolHandler *handler;
handler = ff_rtp_handler_find_by_id( handler = ff_rtp_handler_find_by_id(
rtsp_st->sdp_payload_type, AVMEDIA_TYPE_DATA); rtsp_st->sdp_payload_type, AVMEDIA_TYPE_DATA);
init_rtp_handler(handler, rtsp_st, NULL); init_rtp_handler(handler, rtsp_st, NULL);
...@@ -513,7 +513,7 @@ static void sdp_parse_line(AVFormatContext *s, SDPParseState *s1, ...@@ -513,7 +513,7 @@ static void sdp_parse_line(AVFormatContext *s, SDPParseState *s1,
rtsp_st->stream_index = st->index; rtsp_st->stream_index = st->index;
st->codecpar->codec_type = codec_type; st->codecpar->codec_type = codec_type;
if (rtsp_st->sdp_payload_type < RTP_PT_PRIVATE) { if (rtsp_st->sdp_payload_type < RTP_PT_PRIVATE) {
RTPDynamicProtocolHandler *handler; const RTPDynamicProtocolHandler *handler;
/* if standard payload type, we can find the codec right now */ /* if standard payload type, we can find the codec right now */
ff_rtp_get_codec_info(st->codecpar, rtsp_st->sdp_payload_type); ff_rtp_get_codec_info(st->codecpar, rtsp_st->sdp_payload_type);
if (st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO && if (st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO &&
......
...@@ -458,7 +458,7 @@ typedef struct RTSPStream { ...@@ -458,7 +458,7 @@ typedef struct RTSPStream {
/** The following are used for dynamic protocols (rtpdec_*.c/rdt.c) */ /** The following are used for dynamic protocols (rtpdec_*.c/rdt.c) */
//@{ //@{
/** handler structure */ /** handler structure */
RTPDynamicProtocolHandler *dynamic_handler; const RTPDynamicProtocolHandler *dynamic_handler;
/** private data associated with the dynamic protocol */ /** private data associated with the dynamic protocol */
PayloadContext *dynamic_protocol_context; PayloadContext *dynamic_protocol_context;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment