changeset 34159:bf6f772e609d

Mark pointer arguments as const where possible.
author reimar
date Mon, 24 Oct 2011 16:20:00 +0000
parents 562cd6805eac
children a252f21a07e3
files libmpdemux/mpeg_hdr.c libmpdemux/mpeg_hdr.h
diffstat 2 files changed, 12 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/libmpdemux/mpeg_hdr.c	Mon Oct 24 16:15:02 2011 +0000
+++ b/libmpdemux/mpeg_hdr.c	Mon Oct 24 16:20:00 2011 +0000
@@ -70,7 +70,7 @@
 }
 
 static int header_process_sequence_extension (mp_mpeg_header_t * picture,
-					      unsigned char * buffer)
+					      const unsigned char * buffer)
 {
     /* check chroma format, size extensions, marker bit */
 
@@ -87,7 +87,7 @@
     return 0;
 }
 
-static int header_process_picture_coding_extension (mp_mpeg_header_t * picture, unsigned char * buffer)
+static int header_process_picture_coding_extension (mp_mpeg_header_t * picture, const unsigned char * buffer)
 {
     picture->picture_structure = buffer[2] & 3;
     picture->top_field_first = buffer[3] >> 7;
@@ -113,7 +113,7 @@
     return 0;
 }
 
-int mp_header_process_extension (mp_mpeg_header_t * picture, unsigned char * buffer)
+int mp_header_process_extension (mp_mpeg_header_t * picture, const unsigned char * buffer)
 {
     switch (buffer[0] & 0xf0) {
     case 0x10:	/* sequence extension */
@@ -157,7 +157,7 @@
 }
 
 //MPEG4 HEADERS
-unsigned char mp_getbits(unsigned char *buffer, unsigned int from, unsigned char len)
+unsigned char mp_getbits(const unsigned char *buffer, unsigned int from, unsigned char len)
 {
     unsigned int n;
     unsigned char m, u, l, y;
@@ -178,7 +178,7 @@
     return  y;
 }
 
-static inline unsigned int mp_getbits16(unsigned char *buffer, unsigned int from, unsigned char len)
+static inline unsigned int mp_getbits16(const unsigned char *buffer, unsigned int from, unsigned char len)
 {
     if(len > 8)
         return (mp_getbits(buffer, from, len - 8) << 8) | mp_getbits(buffer, from + len - 8, 8);
@@ -189,7 +189,7 @@
 #define getbits mp_getbits
 #define getbits16 mp_getbits16
 
-static int read_timeinc(mp_mpeg_header_t * picture, unsigned char * buffer, int n)
+static int read_timeinc(mp_mpeg_header_t * picture, const unsigned char * buffer, int n)
 {
     if(picture->timeinc_bits > 8) {
       picture->timeinc_unit = getbits(buffer, n, picture->timeinc_bits - 8) << 8;
@@ -204,7 +204,7 @@
     return n;
 }
 
-int mp4_header_process_vol(mp_mpeg_header_t * picture, unsigned char * buffer)
+int mp4_header_process_vol(mp_mpeg_header_t * picture, const unsigned char * buffer)
 {
     unsigned int n, aspect=0, aspectw=0, aspecth=0,  x=1, v;
 
@@ -268,7 +268,7 @@
     return 0;
 }
 
-void mp4_header_process_vop(mp_mpeg_header_t * picture, unsigned char * buffer)
+void mp4_header_process_vop(mp_mpeg_header_t * picture, const unsigned char * buffer)
 {
   int n;
   n = 0;
--- a/libmpdemux/mpeg_hdr.h	Mon Oct 24 16:15:02 2011 +0000
+++ b/libmpdemux/mpeg_hdr.h	Mon Oct 24 16:20:00 2011 +0000
@@ -43,13 +43,13 @@
 } mp_mpeg_header_t;
 
 int mp_header_process_sequence_header (mp_mpeg_header_t * picture, const unsigned char * buffer);
-int mp_header_process_extension (mp_mpeg_header_t * picture, unsigned char * buffer);
+int mp_header_process_extension (mp_mpeg_header_t * picture, const unsigned char * buffer);
 float mpeg12_aspect_info(mp_mpeg_header_t *picture);
-int mp4_header_process_vol(mp_mpeg_header_t * picture, unsigned char * buffer);
-void mp4_header_process_vop(mp_mpeg_header_t * picture, unsigned char * buffer);
+int mp4_header_process_vol(mp_mpeg_header_t * picture, const unsigned char * buffer);
+void mp4_header_process_vop(mp_mpeg_header_t * picture, const unsigned char * buffer);
 int h264_parse_sps(mp_mpeg_header_t * picture, const unsigned char * buf, int len);
 int mp_vc1_decode_sequence_header(mp_mpeg_header_t * picture, const unsigned char * buf, int len);
 
-unsigned char mp_getbits(unsigned char *buffer, unsigned int from, unsigned char len);
+unsigned char mp_getbits(const unsigned char *buffer, unsigned int from, unsigned char len);
 
 #endif /* MPLAYER_MPEG_HDR_H */