[FFmpeg-devel] [PATCH 14/30] avcodec/rtpdec: Constify RTPDynamicProtocolHandlers

Andreas Rheinhardt andreas.rheinhardt at gmail.com
Thu Dec 31 01:31:41 EET 2020


Also constify the list of pointers to said RTPDynamicProtocolHandlers.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
---
 libavformat/rdt.c       |  2 +-
 libavformat/rtpdec.c    | 22 +++++++++++-----------
 libavformat/rtpdec_qt.c |  2 +-
 3 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/libavformat/rdt.c b/libavformat/rdt.c
index 60c36f09e6..e5824f6a48 100644
--- a/libavformat/rdt.c
+++ b/libavformat/rdt.c
@@ -554,7 +554,7 @@ rdt_close_context (PayloadContext *rdt)
 }
 
 #define RDT_HANDLER(n, s, t) \
-RTPDynamicProtocolHandler ff_rdt_ ## n ## _handler = { \
+const RTPDynamicProtocolHandler ff_rdt_ ## n ## _handler = { \
     .enc_name         = s, \
     .codec_type       = t, \
     .codec_id         = AV_CODEC_ID_NONE, \
diff --git a/libavformat/rtpdec.c b/libavformat/rtpdec.c
index 3d5b200099..dfecb722d5 100644
--- a/libavformat/rtpdec.c
+++ b/libavformat/rtpdec.c
@@ -33,48 +33,48 @@
 
 #define MIN_FEEDBACK_INTERVAL 200000 /* 200 ms in us */
 
-static RTPDynamicProtocolHandler l24_dynamic_handler = {
+static const RTPDynamicProtocolHandler l24_dynamic_handler = {
     .enc_name   = "L24",
     .codec_type = AVMEDIA_TYPE_AUDIO,
     .codec_id   = AV_CODEC_ID_PCM_S24BE,
 };
 
-static RTPDynamicProtocolHandler gsm_dynamic_handler = {
+static const RTPDynamicProtocolHandler gsm_dynamic_handler = {
     .enc_name   = "GSM",
     .codec_type = AVMEDIA_TYPE_AUDIO,
     .codec_id   = AV_CODEC_ID_GSM,
 };
 
-static RTPDynamicProtocolHandler realmedia_mp3_dynamic_handler = {
+static const RTPDynamicProtocolHandler realmedia_mp3_dynamic_handler = {
     .enc_name   = "X-MP3-draft-00",
     .codec_type = AVMEDIA_TYPE_AUDIO,
     .codec_id   = AV_CODEC_ID_MP3ADU,
 };
 
-static RTPDynamicProtocolHandler speex_dynamic_handler = {
+static const RTPDynamicProtocolHandler speex_dynamic_handler = {
     .enc_name   = "speex",
     .codec_type = AVMEDIA_TYPE_AUDIO,
     .codec_id   = AV_CODEC_ID_SPEEX,
 };
 
-static RTPDynamicProtocolHandler opus_dynamic_handler = {
+static const RTPDynamicProtocolHandler opus_dynamic_handler = {
     .enc_name   = "opus",
     .codec_type = AVMEDIA_TYPE_AUDIO,
     .codec_id   = AV_CODEC_ID_OPUS,
 };
 
-static RTPDynamicProtocolHandler t140_dynamic_handler = { /* RFC 4103 */
+static const RTPDynamicProtocolHandler t140_dynamic_handler = { /* RFC 4103 */
     .enc_name   = "t140",
     .codec_type = AVMEDIA_TYPE_SUBTITLE,
     .codec_id   = AV_CODEC_ID_TEXT,
 };
 
-extern RTPDynamicProtocolHandler ff_rdt_video_handler;
-extern RTPDynamicProtocolHandler ff_rdt_audio_handler;
-extern RTPDynamicProtocolHandler ff_rdt_live_video_handler;
-extern RTPDynamicProtocolHandler ff_rdt_live_audio_handler;
+extern const RTPDynamicProtocolHandler ff_rdt_video_handler;
+extern const RTPDynamicProtocolHandler ff_rdt_audio_handler;
+extern const RTPDynamicProtocolHandler ff_rdt_live_video_handler;
+extern const RTPDynamicProtocolHandler ff_rdt_live_audio_handler;
 
-static const RTPDynamicProtocolHandler *rtp_dynamic_protocol_handler_list[] = {
+static const RTPDynamicProtocolHandler *const rtp_dynamic_protocol_handler_list[] = {
     /* rtp */
     &ff_ac3_dynamic_handler,
     &ff_amr_nb_dynamic_handler,
diff --git a/libavformat/rtpdec_qt.c b/libavformat/rtpdec_qt.c
index 740c382d07..93bf31746b 100644
--- a/libavformat/rtpdec_qt.c
+++ b/libavformat/rtpdec_qt.c
@@ -241,7 +241,7 @@ static void qt_rtp_close(PayloadContext *qt)
 }
 
 #define RTP_QT_HANDLER(m, n, s, t) \
-RTPDynamicProtocolHandler ff_ ## m ## _rtp_ ## n ## _handler = { \
+const RTPDynamicProtocolHandler ff_ ## m ## _rtp_ ## n ## _handler = { \
     .enc_name         = s, \
     .codec_type       = t, \
     .codec_id         = AV_CODEC_ID_NONE, \
-- 
2.25.1



More information about the ffmpeg-devel mailing list