[FFmpeg-devel] [PATCH] at lots of const to lavf

Reimar Döffinger Reimar.Doeffinger
Sun Aug 24 19:43:46 CEST 2008


On Sun, Aug 24, 2008 at 04:31:49PM +0200, Michael Niedermayer wrote:
> On Sun, Aug 24, 2008 at 03:55:23PM +0200, Reimar D?ffinger wrote:
> > not sure if all of these make sense (those that are not enabled on my
> > system are not even tested).
> 
> ok

Most applied. Here are the parts I want the corresponding maintainers to
have a chance to look at it (because I find the change ugly or there
is an active maintainer and it is code I never touched).
I will apply in a few days if nobody responds.

Greetings,
Reimar D?ffinger
-------------- next part --------------
diff --git a/libavformat/isom.c b/libavformat/isom.c
index 3594020..fa45f9d 100644
--- a/libavformat/isom.c
+++ b/libavformat/isom.c
@@ -212,7 +212,7 @@ const AVCodecTag ff_codec_movsubtitle_tags[] = {
 /* cf. QTFileFormat.pdf p253, qtff.pdf p205 */
 /* http://developer.apple.com/documentation/mac/Text/Text-368.html */
 /* deprecated by putting the code as 3*5bit ascii */
-static const char *mov_mdhd_language_map[] = {
+static const char * const mov_mdhd_language_map[] = {
     /* 0-9 */
     "eng", "fra", "ger", "ita", "dut", "sve", "spa", "dan", "por", "nor",
     "heb", "jpn", "ara", "fin", "gre", "ice", "mlt", "tur", "hr "/*scr*/, "chi"/*ace?*/,
diff --git a/libavformat/rtp_h264.c b/libavformat/rtp_h264.c
index c83b3a7..dad0a19 100644
--- a/libavformat/rtp_h264.c
+++ b/libavformat/rtp_h264.c
@@ -68,6 +68,8 @@ typedef struct h264_rtp_extra_data {
 #define MAGIC_COOKIE (0xdeadbeef)       ///< Cookie for the extradata; to verify we are what we think we are, and that we haven't been freed.
 #define DEAD_COOKIE (0xdeaddead)        ///< Cookie for the extradata; once it is freed.
 
+static const uint8_t start_sequence[]= { 0, 0, 1 };
+
 /* ---------------- private code */
 static void sdp_parse_fmtp_config_h264(AVStream * stream,
                                        h264_rtp_extra_data * h264_data,
@@ -113,7 +115,6 @@ static void sdp_parse_fmtp_config_h264(AVStream * stream,
             h264_data->level_idc = level_idc;
         }
     } else  if (!strcmp(attr, "sprop-parameter-sets")) {
-        uint8_t start_sequence[]= { 0, 0, 1 };
         codec->extradata_size= 0;
         codec->extradata= NULL;
 
@@ -171,7 +172,6 @@ static int h264_handle_packet(RTPDemuxContext * s,
     uint8_t nal = buf[0];
     uint8_t type = (nal & 0x1f);
     int result= 0;
-    uint8_t start_sequence[]= {0, 0, 1};
 
 #ifdef DEBUG
     assert(data);
diff --git a/libavformat/rtp_internal.h b/libavformat/rtp_internal.h
index c34212d..b8328f6 100644
--- a/libavformat/rtp_internal.h
+++ b/libavformat/rtp_internal.h
@@ -117,7 +117,7 @@ struct RTPDemuxContext {
     int max_frames_per_packet;
 };
 
-extern RTPDynamicProtocolHandler *RTPFirstDynamicPayloadHandler;
+extern const RTPDynamicProtocolHandler *RTPFirstDynamicPayloadHandler;
 
 int rtsp_next_attr_and_value(const char **p, char *attr, int attr_size, char *value, int value_size); ///< from rtsp.c, but used by rtp dynamic protocol handlers.
 
diff --git a/libavformat/rtpdec.c b/libavformat/rtpdec.c
index 70b29e7..9a93f45 100644
--- a/libavformat/rtpdec.c
+++ b/libavformat/rtpdec.c
@@ -44,7 +44,7 @@
 */
 
 /* statistics functions */
-RTPDynamicProtocolHandler *RTPFirstDynamicPayloadHandler= NULL;
+const RTPDynamicProtocolHandler *RTPFirstDynamicPayloadHandler= NULL;
 
 static RTPDynamicProtocolHandler mp4v_es_handler= {"MP4V-ES", CODEC_TYPE_VIDEO, CODEC_ID_MPEG4};
 static RTPDynamicProtocolHandler mpeg4_generic_handler= {"mpeg4-generic", CODEC_TYPE_AUDIO, CODEC_ID_AAC};
diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c
index a3af365..9607182 100644
--- a/libavformat/rtsp.c
+++ b/libavformat/rtsp.c
@@ -275,7 +275,7 @@ typedef struct attrname_map
 /* All known fmtp parmeters and the corresping RTPAttrTypeEnum */
 #define ATTR_NAME_TYPE_INT 0
 #define ATTR_NAME_TYPE_STR 1
-static attrname_map_t attr_names[]=
+static const attrname_map_t attr_names[]=
 {
     {"SizeLength",       ATTR_NAME_TYPE_INT, offsetof(rtp_payload_data_t, sizelength)},
     {"IndexLength",      ATTR_NAME_TYPE_INT, offsetof(rtp_payload_data_t, indexlength)},



More information about the ffmpeg-devel mailing list