changeset 4931:0d1cc37d9430 libavcodec

make some parser parameters const to avoid casting const to non-const
author aurel
date Mon, 07 May 2007 00:47:03 +0000
parents 655d25351bfc
children 7c6a0470eb63
files avcodec.h cavs.c dca_parser.c dvbsub_parser.c dvdsub_parser.c h261_parser.c h263dec.c h264.c mjpeg.c mpeg12.c mpeg4video_parser.c mpegaudio_parser.c mpegvideo_parser.c parser.c parser.h pnm.c vc1_parser.c
diffstat 17 files changed, 42 insertions(+), 42 deletions(-) [+]
line wrap: on
line diff
--- a/avcodec.h	Sun May 06 15:25:04 2007 +0000
+++ b/avcodec.h	Mon May 07 00:47:03 2007 +0000
@@ -2981,7 +2981,7 @@
     int (*parser_init)(AVCodecParserContext *s);
     int (*parser_parse)(AVCodecParserContext *s,
                         AVCodecContext *avctx,
-                        uint8_t **poutbuf, int *poutbuf_size,
+                        const uint8_t **poutbuf, int *poutbuf_size,
                         const uint8_t *buf, int buf_size);
     void (*parser_close)(AVCodecParserContext *s);
     int (*split)(AVCodecContext *avctx, const uint8_t *buf, int buf_size);
--- a/cavs.c	Sun May 06 15:25:04 2007 +0000
+++ b/cavs.c	Mon May 07 00:47:03 2007 +0000
@@ -1506,7 +1506,7 @@
 
 static int cavsvideo_parse(AVCodecParserContext *s,
                            AVCodecContext *avctx,
-                           uint8_t **poutbuf, int *poutbuf_size,
+                           const uint8_t **poutbuf, int *poutbuf_size,
                            const uint8_t *buf, int buf_size)
 {
     ParseContext *pc = s->priv_data;
@@ -1517,13 +1517,13 @@
     }else{
         next= cavs_find_frame_end(pc, buf, buf_size);
 
-        if (ff_combine_frame(pc, next, (uint8_t **)&buf, &buf_size) < 0) {
+        if (ff_combine_frame(pc, next, &buf, &buf_size) < 0) {
             *poutbuf = NULL;
             *poutbuf_size = 0;
             return buf_size;
         }
     }
-    *poutbuf = (uint8_t *)buf;
+    *poutbuf = buf;
     *poutbuf_size = buf_size;
     return next;
 }
--- a/dca_parser.c	Sun May 06 15:25:04 2007 +0000
+++ b/dca_parser.c	Mon May 07 00:47:03 2007 +0000
@@ -94,7 +94,7 @@
 
 static int dca_parse(AVCodecParserContext * s,
                      AVCodecContext * avctx,
-                     uint8_t ** poutbuf, int *poutbuf_size,
+                     const uint8_t ** poutbuf, int *poutbuf_size,
                      const uint8_t * buf, int buf_size)
 {
     DCAParseContext *pc1 = s->priv_data;
@@ -106,13 +106,13 @@
     } else {
         next = dca_find_frame_end(pc1, buf, buf_size);
 
-        if (ff_combine_frame(pc, next, (uint8_t **) & buf, &buf_size) < 0) {
+        if (ff_combine_frame(pc, next, &buf, &buf_size) < 0) {
             *poutbuf = NULL;
             *poutbuf_size = 0;
             return buf_size;
         }
     }
-    *poutbuf = (uint8_t *) buf;
+    *poutbuf = buf;
     *poutbuf_size = buf_size;
     return next;
 }
--- a/dvbsub_parser.c	Sun May 06 15:25:04 2007 +0000
+++ b/dvbsub_parser.c	Mon May 07 00:47:03 2007 +0000
@@ -48,7 +48,7 @@
 
 static int dvbsub_parse(AVCodecParserContext *s,
                         AVCodecContext *avctx,
-                        uint8_t **poutbuf, int *poutbuf_size,
+                        const uint8_t **poutbuf, int *poutbuf_size,
                         const uint8_t *buf, int buf_size)
 {
     DVBSubParseContext *pc = s->priv_data;
--- a/dvdsub_parser.c	Sun May 06 15:25:04 2007 +0000
+++ b/dvdsub_parser.c	Mon May 07 00:47:03 2007 +0000
@@ -34,7 +34,7 @@
 
 static int dvdsub_parse(AVCodecParserContext *s,
                         AVCodecContext *avctx,
-                        uint8_t **poutbuf, int *poutbuf_size,
+                        const uint8_t **poutbuf, int *poutbuf_size,
                         const uint8_t *buf, int buf_size)
 {
     DVDSubParseContext *pc = s->priv_data;
--- a/h261_parser.c	Sun May 06 15:25:04 2007 +0000
+++ b/h261_parser.c	Mon May 07 00:47:03 2007 +0000
@@ -64,19 +64,19 @@
 
 static int h261_parse(AVCodecParserContext *s,
                       AVCodecContext *avctx,
-                      uint8_t **poutbuf, int *poutbuf_size,
+                      const uint8_t **poutbuf, int *poutbuf_size,
                       const uint8_t *buf, int buf_size)
 {
     ParseContext *pc = s->priv_data;
     int next;
 
     next= h261_find_frame_end(pc,avctx, buf, buf_size);
-    if (ff_combine_frame(pc, next, (uint8_t **)&buf, &buf_size) < 0) {
+    if (ff_combine_frame(pc, next, &buf, &buf_size) < 0) {
         *poutbuf = NULL;
         *poutbuf_size = 0;
         return buf_size;
     }
-    *poutbuf = (uint8_t *)buf;
+    *poutbuf = buf;
     *poutbuf_size = buf_size;
     return next;
 }
--- a/h263dec.c	Sun May 06 15:25:04 2007 +0000
+++ b/h263dec.c	Mon May 07 00:47:03 2007 +0000
@@ -396,7 +396,7 @@
 #ifdef CONFIG_H263_PARSER
 static int h263_parse(AVCodecParserContext *s,
                            AVCodecContext *avctx,
-                           uint8_t **poutbuf, int *poutbuf_size,
+                           const uint8_t **poutbuf, int *poutbuf_size,
                            const uint8_t *buf, int buf_size)
 {
     ParseContext *pc = s->priv_data;
@@ -404,13 +404,13 @@
 
     next= h263_find_frame_end(pc, buf, buf_size);
 
-    if (ff_combine_frame(pc, next, (uint8_t **)&buf, &buf_size) < 0) {
+    if (ff_combine_frame(pc, next, &buf, &buf_size) < 0) {
         *poutbuf = NULL;
         *poutbuf_size = 0;
         return buf_size;
     }
 
-    *poutbuf = (uint8_t *)buf;
+    *poutbuf = buf;
     *poutbuf_size = buf_size;
     return next;
 }
@@ -460,7 +460,7 @@
             return -1;
         }
 
-        if( ff_combine_frame(&s->parse_context, next, &buf, &buf_size) < 0 )
+        if( ff_combine_frame(&s->parse_context, next, (const uint8_t **)&buf, &buf_size) < 0 )
             return buf_size;
     }
 
--- a/h264.c	Sun May 06 15:25:04 2007 +0000
+++ b/h264.c	Mon May 07 00:47:03 2007 +0000
@@ -8039,7 +8039,7 @@
 #ifdef CONFIG_H264_PARSER
 static int h264_parse(AVCodecParserContext *s,
                       AVCodecContext *avctx,
-                      uint8_t **poutbuf, int *poutbuf_size,
+                      const uint8_t **poutbuf, int *poutbuf_size,
                       const uint8_t *buf, int buf_size)
 {
     H264Context *h = s->priv_data;
@@ -8051,7 +8051,7 @@
     }else{
         next= find_frame_end(h, buf, buf_size);
 
-        if (ff_combine_frame(pc, next, (uint8_t **)&buf, &buf_size) < 0) {
+        if (ff_combine_frame(pc, next, &buf, &buf_size) < 0) {
             *poutbuf = NULL;
             *poutbuf_size = 0;
             return buf_size;
@@ -8063,7 +8063,7 @@
         }
     }
 
-    *poutbuf = (uint8_t *)buf;
+    *poutbuf = buf;
     *poutbuf_size = buf_size;
     return next;
 }
@@ -8303,7 +8303,7 @@
     if(s->flags&CODEC_FLAG_TRUNCATED){
         int next= find_frame_end(h, buf, buf_size);
 
-        if( ff_combine_frame(&s->parse_context, next, &buf, &buf_size) < 0 )
+        if( ff_combine_frame(&s->parse_context, next, (const uint8_t **)&buf, &buf_size) < 0 )
             return buf_size;
 //printf("next:%d buf_size:%d last_index:%d\n", next, buf_size, s->parse_context.last_index);
     }
--- a/mjpeg.c	Sun May 06 15:25:04 2007 +0000
+++ b/mjpeg.c	Mon May 07 00:47:03 2007 +0000
@@ -1005,7 +1005,7 @@
 
 static int jpeg_parse(AVCodecParserContext *s,
                            AVCodecContext *avctx,
-                           uint8_t **poutbuf, int *poutbuf_size,
+                           const uint8_t **poutbuf, int *poutbuf_size,
                            const uint8_t *buf, int buf_size)
 {
     ParseContext *pc = s->priv_data;
@@ -1013,13 +1013,13 @@
 
     next= find_frame_end(pc, buf, buf_size);
 
-    if (ff_combine_frame(pc, next, (uint8_t **)&buf, &buf_size) < 0) {
+    if (ff_combine_frame(pc, next, &buf, &buf_size) < 0) {
         *poutbuf = NULL;
         *poutbuf_size = 0;
         return buf_size;
     }
 
-    *poutbuf = (uint8_t *)buf;
+    *poutbuf = buf;
     *poutbuf_size = buf_size;
     return next;
 }
--- a/mpeg12.c	Sun May 06 15:25:04 2007 +0000
+++ b/mpeg12.c	Mon May 07 00:47:03 2007 +0000
@@ -3096,7 +3096,7 @@
     if(s2->flags&CODEC_FLAG_TRUNCATED){
         int next= ff_mpeg1_find_frame_end(&s2->parse_context, buf, buf_size);
 
-        if( ff_combine_frame(&s2->parse_context, next, &buf, &buf_size) < 0 )
+        if( ff_combine_frame(&s2->parse_context, next, (const uint8_t **)&buf, &buf_size) < 0 )
             return buf_size;
     }
 
--- a/mpeg4video_parser.c	Sun May 06 15:25:04 2007 +0000
+++ b/mpeg4video_parser.c	Mon May 07 00:47:03 2007 +0000
@@ -65,7 +65,7 @@
 
 static int mpeg4video_parse(AVCodecParserContext *s,
                            AVCodecContext *avctx,
-                           uint8_t **poutbuf, int *poutbuf_size,
+                           const uint8_t **poutbuf, int *poutbuf_size,
                            const uint8_t *buf, int buf_size)
 {
     ParseContext *pc = s->priv_data;
@@ -76,7 +76,7 @@
     }else{
         next= ff_mpeg4_find_frame_end(pc, buf, buf_size);
 
-        if (ff_combine_frame(pc, next, (uint8_t **)&buf, &buf_size) < 0) {
+        if (ff_combine_frame(pc, next, &buf, &buf_size) < 0) {
             *poutbuf = NULL;
             *poutbuf_size = 0;
             return buf_size;
@@ -84,7 +84,7 @@
     }
     av_mpeg4_decode_header(s, avctx, buf, buf_size);
 
-    *poutbuf = (uint8_t *)buf;
+    *poutbuf = buf;
     *poutbuf_size = buf_size;
     return next;
 }
--- a/mpegaudio_parser.c	Sun May 06 15:25:04 2007 +0000
+++ b/mpegaudio_parser.c	Mon May 07 00:47:03 2007 +0000
@@ -50,7 +50,7 @@
 
 static int mpegaudio_parse(AVCodecParserContext *s1,
                            AVCodecContext *avctx,
-                           uint8_t **poutbuf, int *poutbuf_size,
+                           const uint8_t **poutbuf, int *poutbuf_size,
                            const uint8_t *buf, int buf_size)
 {
     MpegAudioParseContext *s = s1->priv_data;
@@ -186,7 +186,7 @@
         if(s->frame_size > 0 && buf_ptr - buf == s->inbuf_ptr - s->inbuf
            && buf_size + buf_ptr - buf >= s->frame_size){
             if(s->header_count > 0){
-                *poutbuf = (uint8_t *)buf;
+                *poutbuf = buf;
                 *poutbuf_size = s->frame_size;
             }
             buf_ptr = buf + s->frame_size;
--- a/mpegvideo_parser.c	Sun May 06 15:25:04 2007 +0000
+++ b/mpegvideo_parser.c	Mon May 07 00:47:03 2007 +0000
@@ -128,7 +128,7 @@
 
 static int mpegvideo_parse(AVCodecParserContext *s,
                            AVCodecContext *avctx,
-                           uint8_t **poutbuf, int *poutbuf_size,
+                           const uint8_t **poutbuf, int *poutbuf_size,
                            const uint8_t *buf, int buf_size)
 {
     ParseContext1 *pc1 = s->priv_data;
@@ -140,7 +140,7 @@
     }else{
         next= ff_mpeg1_find_frame_end(pc, buf, buf_size);
 
-        if (ff_combine_frame(pc, next, (uint8_t **)&buf, &buf_size) < 0) {
+        if (ff_combine_frame(pc, next, &buf, &buf_size) < 0) {
             *poutbuf = NULL;
             *poutbuf_size = 0;
             return buf_size;
@@ -156,7 +156,7 @@
            s->pict_type, (double)avctx->time_base.den / avctx->time_base.num, s->repeat_pict);
 #endif
 
-    *poutbuf = (uint8_t *)buf;
+    *poutbuf = buf;
     *poutbuf_size = buf_size;
     return next;
 }
--- a/parser.c	Sun May 06 15:25:04 2007 +0000
+++ b/parser.c	Mon May 07 00:47:03 2007 +0000
@@ -130,7 +130,7 @@
     }
 
     /* WARNING: the returned index can be negative */
-    index = s->parser->parser_parse(s, avctx, poutbuf, poutbuf_size, buf, buf_size);
+    index = s->parser->parser_parse(s, avctx, (const uint8_t **)poutbuf, poutbuf_size, buf, buf_size);
 //av_log(NULL, AV_LOG_DEBUG, "parser: in:%"PRId64", %"PRId64", out:%"PRId64", %"PRId64", in:%d out:%d id:%d\n", pts, dts, s->last_pts, s->last_dts, buf_size, *poutbuf_size, avctx->codec_id);
     /* update the file pointer */
     if (*poutbuf_size) {
@@ -223,7 +223,7 @@
  * combines the (truncated) bitstream to a complete frame
  * @returns -1 if no complete frame could be created
  */
-int ff_combine_frame(ParseContext *pc, int next, uint8_t **buf, int *buf_size)
+int ff_combine_frame(ParseContext *pc, int next, const uint8_t **buf, int *buf_size)
 {
 #if 0
     if(pc->overread){
@@ -525,7 +525,7 @@
 /* also used for ADTS AAC */
 static int ac3_parse(AVCodecParserContext *s1,
                      AVCodecContext *avctx,
-                     uint8_t **poutbuf, int *poutbuf_size,
+                     const uint8_t **poutbuf, int *poutbuf_size,
                      const uint8_t *buf, int buf_size)
 {
     AC3ParseContext *s = s1->priv_data;
--- a/parser.h	Sun May 06 15:25:04 2007 +0000
+++ b/parser.h	Mon May 07 00:47:03 2007 +0000
@@ -54,7 +54,7 @@
 
 #define END_NOT_FOUND (-100)
 
-int ff_combine_frame(ParseContext *pc, int next, uint8_t **buf, int *buf_size);
+int ff_combine_frame(ParseContext *pc, int next, const uint8_t **buf, int *buf_size);
 int ff_mpeg4video_split(AVCodecContext *avctx, const uint8_t *buf,
                         int buf_size);
 void ff_parse_close(AVCodecParserContext *s);
--- a/pnm.c	Sun May 06 15:25:04 2007 +0000
+++ b/pnm.c	Mon May 07 00:47:03 2007 +0000
@@ -489,7 +489,7 @@
 #ifdef CONFIG_PNM_PARSER
 static int pnm_parse(AVCodecParserContext *s,
                            AVCodecContext *avctx,
-                           uint8_t **poutbuf, int *poutbuf_size,
+                           const uint8_t **poutbuf, int *poutbuf_size,
                            const uint8_t *buf, int buf_size)
 {
     ParseContext *pc = s->priv_data;
@@ -538,12 +538,12 @@
             next= END_NOT_FOUND;
     }
 
-    if(ff_combine_frame(pc, next, (uint8_t **)&buf, &buf_size)<0){
+    if(ff_combine_frame(pc, next, &buf, &buf_size)<0){
         *poutbuf = NULL;
         *poutbuf_size = 0;
         return buf_size;
     }
-    *poutbuf = (uint8_t *)buf;
+    *poutbuf = buf;
     *poutbuf_size = buf_size;
     return next;
 }
--- a/vc1_parser.c	Sun May 06 15:25:04 2007 +0000
+++ b/vc1_parser.c	Mon May 07 00:47:03 2007 +0000
@@ -72,7 +72,7 @@
 
 static int vc1_parse(AVCodecParserContext *s,
                            AVCodecContext *avctx,
-                           uint8_t **poutbuf, int *poutbuf_size,
+                           const uint8_t **poutbuf, int *poutbuf_size,
                            const uint8_t *buf, int buf_size)
 {
     ParseContext *pc = s->priv_data;
@@ -83,13 +83,13 @@
     }else{
         next= vc1_find_frame_end(pc, buf, buf_size);
 
-        if (ff_combine_frame(pc, next, (uint8_t **)&buf, &buf_size) < 0) {
+        if (ff_combine_frame(pc, next, &buf, &buf_size) < 0) {
             *poutbuf = NULL;
             *poutbuf_size = 0;
             return buf_size;
         }
     }
-    *poutbuf = (uint8_t *)buf;
+    *poutbuf = buf;
     *poutbuf_size = buf_size;
     return next;
 }