diff mbox series

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

Message ID 20201230233157.1055287-14-andreas.rheinhardt@gmail.com
State Accepted
Commit a6d741920f0ed1a73e664bd8705164526d814922
Headers show
Series [FFmpeg-devel,01/30] avcodec/opustab: Make array static
Related show

Checks

Context Check Description
andriy/x86_make success Make finished
andriy/x86_make_fate success Make fate finished
andriy/PPC64_make success Make finished
andriy/PPC64_make_fate success Make fate finished

Commit Message

Andreas Rheinhardt Dec. 30, 2020, 11:31 p.m. UTC
Also constify the list of pointers to said RTPDynamicProtocolHandlers.

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

Comments

Andreas Rheinhardt Dec. 30, 2020, 11:39 p.m. UTC | #1
Andreas Rheinhardt:
> Also constify the list of pointers to said RTPDynamicProtocolHandlers.
> 
> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@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, \
> 
It is of course avformat/rtpdec. I have amended the commit locally.

- Andreas
diff mbox series

Patch

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, \