aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAurelien Jacobs <aurel@gnuage.org>2007-05-07 00:47:03 +0000
committerAurelien Jacobs <aurel@gnuage.org>2007-05-07 00:47:03 +0000
commitc53d2d90425e0abcca6ff96251bff84fc3993f80 (patch)
tree3679e62f3dbcf1b095d00e78cf08abf969931ab1
parent89ecc26188855c65245d4cc6c6b58e5d3c22edb6 (diff)
downloadffmpeg-c53d2d90425e0abcca6ff96251bff84fc3993f80.tar.gz
make some parser parameters const to avoid casting const to non-const
Originally committed as revision 8921 to svn://svn.ffmpeg.org/ffmpeg/trunk
-rw-r--r--libavcodec/avcodec.h2
-rw-r--r--libavcodec/cavs.c6
-rw-r--r--libavcodec/dca_parser.c6
-rw-r--r--libavcodec/dvbsub_parser.c2
-rw-r--r--libavcodec/dvdsub_parser.c2
-rw-r--r--libavcodec/h261_parser.c6
-rw-r--r--libavcodec/h263dec.c8
-rw-r--r--libavcodec/h264.c8
-rw-r--r--libavcodec/mjpeg.c6
-rw-r--r--libavcodec/mpeg12.c2
-rw-r--r--libavcodec/mpeg4video_parser.c6
-rw-r--r--libavcodec/mpegaudio_parser.c4
-rw-r--r--libavcodec/mpegvideo_parser.c6
-rw-r--r--libavcodec/parser.c6
-rw-r--r--libavcodec/parser.h2
-rw-r--r--libavcodec/pnm.c6
-rw-r--r--libavcodec/vc1_parser.c6
17 files changed, 42 insertions, 42 deletions
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index ae47abdd2e..dee12c245b 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -2981,7 +2981,7 @@ typedef struct AVCodecParser {
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);
diff --git a/libavcodec/cavs.c b/libavcodec/cavs.c
index 27d1b57ef3..eefacaf403 100644
--- a/libavcodec/cavs.c
+++ b/libavcodec/cavs.c
@@ -1506,7 +1506,7 @@ static int cavs_find_frame_end(ParseContext *pc, const uint8_t *buf,
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 @@ static int cavsvideo_parse(AVCodecParserContext *s,
}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;
}
diff --git a/libavcodec/dca_parser.c b/libavcodec/dca_parser.c
index 90eac203eb..6618b31565 100644
--- a/libavcodec/dca_parser.c
+++ b/libavcodec/dca_parser.c
@@ -94,7 +94,7 @@ static int dca_parse_init(AVCodecParserContext * s)
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 @@ static int dca_parse(AVCodecParserContext * s,
} 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;
}
diff --git a/libavcodec/dvbsub_parser.c b/libavcodec/dvbsub_parser.c
index a327a4ba1d..312c243bf5 100644
--- a/libavcodec/dvbsub_parser.c
+++ b/libavcodec/dvbsub_parser.c
@@ -48,7 +48,7 @@ static int dvbsub_parse_init(AVCodecParserContext *s)
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;
diff --git a/libavcodec/dvdsub_parser.c b/libavcodec/dvdsub_parser.c
index a823ab9f3b..5f1c1b6282 100644
--- a/libavcodec/dvdsub_parser.c
+++ b/libavcodec/dvdsub_parser.c
@@ -34,7 +34,7 @@ static int dvdsub_parse_init(AVCodecParserContext *s)
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;
diff --git a/libavcodec/h261_parser.c b/libavcodec/h261_parser.c
index 8c32b8bb0d..3671cdbf72 100644
--- a/libavcodec/h261_parser.c
+++ b/libavcodec/h261_parser.c
@@ -64,19 +64,19 @@ static int h261_find_frame_end(ParseContext *pc, AVCodecContext* avctx, const ui
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;
}
diff --git a/libavcodec/h263dec.c b/libavcodec/h263dec.c
index b385f84cda..8d7160ad4a 100644
--- a/libavcodec/h263dec.c
+++ b/libavcodec/h263dec.c
@@ -396,7 +396,7 @@ static int h263_find_frame_end(ParseContext *pc, const uint8_t *buf, int buf_siz
#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 @@ static int h263_parse(AVCodecParserContext *s,
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 @@ uint64_t time= rdtsc();
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;
}
diff --git a/libavcodec/h264.c b/libavcodec/h264.c
index 3c0df98abf..92e7d2f9dc 100644
--- a/libavcodec/h264.c
+++ b/libavcodec/h264.c
@@ -8039,7 +8039,7 @@ found:
#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 @@ static int h264_parse(AVCodecParserContext *s,
}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 @@ static int h264_parse(AVCodecParserContext *s,
}
}
- *poutbuf = (uint8_t *)buf;
+ *poutbuf = buf;
*poutbuf_size = buf_size;
return next;
}
@@ -8303,7 +8303,7 @@ static int decode_frame(AVCodecContext *avctx,
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);
}
diff --git a/libavcodec/mjpeg.c b/libavcodec/mjpeg.c
index 63df4a64b3..214fc08a9e 100644
--- a/libavcodec/mjpeg.c
+++ b/libavcodec/mjpeg.c
@@ -1005,7 +1005,7 @@ static int find_frame_end(ParseContext *pc, const uint8_t *buf, int buf_size){
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 @@ static int jpeg_parse(AVCodecParserContext *s,
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;
}
diff --git a/libavcodec/mpeg12.c b/libavcodec/mpeg12.c
index a894737be5..20ebcdbd3b 100644
--- a/libavcodec/mpeg12.c
+++ b/libavcodec/mpeg12.c
@@ -3096,7 +3096,7 @@ static int mpeg_decode_frame(AVCodecContext *avctx,
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;
}
diff --git a/libavcodec/mpeg4video_parser.c b/libavcodec/mpeg4video_parser.c
index 59d25eac0c..4771ca0b44 100644
--- a/libavcodec/mpeg4video_parser.c
+++ b/libavcodec/mpeg4video_parser.c
@@ -65,7 +65,7 @@ static int mpeg4video_parse_init(AVCodecParserContext *s)
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 @@ static int mpeg4video_parse(AVCodecParserContext *s,
}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 @@ static int mpeg4video_parse(AVCodecParserContext *s,
}
av_mpeg4_decode_header(s, avctx, buf, buf_size);
- *poutbuf = (uint8_t *)buf;
+ *poutbuf = buf;
*poutbuf_size = buf_size;
return next;
}
diff --git a/libavcodec/mpegaudio_parser.c b/libavcodec/mpegaudio_parser.c
index 96ef0f4636..8fb18ca5d4 100644
--- a/libavcodec/mpegaudio_parser.c
+++ b/libavcodec/mpegaudio_parser.c
@@ -50,7 +50,7 @@ static int mpegaudio_parse_init(AVCodecParserContext *s1)
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 @@ static int mpegaudio_parse(AVCodecParserContext *s1,
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;
diff --git a/libavcodec/mpegvideo_parser.c b/libavcodec/mpegvideo_parser.c
index afc509281d..8beaeb41ab 100644
--- a/libavcodec/mpegvideo_parser.c
+++ b/libavcodec/mpegvideo_parser.c
@@ -128,7 +128,7 @@ static void mpegvideo_extract_headers(AVCodecParserContext *s,
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 @@ static int mpegvideo_parse(AVCodecParserContext *s,
}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 @@ static int mpegvideo_parse(AVCodecParserContext *s,
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;
}
diff --git a/libavcodec/parser.c b/libavcodec/parser.c
index 170c55db80..9b1e792e26 100644
--- a/libavcodec/parser.c
+++ b/libavcodec/parser.c
@@ -130,7 +130,7 @@ int av_parser_parse(AVCodecParserContext *s,
}
/* 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 @@ void av_parser_close(AVCodecParserContext *s)
* 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 @@ static int aac_parse_init(AVCodecParserContext *s1)
/* 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;
diff --git a/libavcodec/parser.h b/libavcodec/parser.h
index 4be12e9913..baa2c6363f 100644
--- a/libavcodec/parser.h
+++ b/libavcodec/parser.h
@@ -54,7 +54,7 @@ typedef struct ParseContext1{
#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);
diff --git a/libavcodec/pnm.c b/libavcodec/pnm.c
index e2ee93251d..1056164af5 100644
--- a/libavcodec/pnm.c
+++ b/libavcodec/pnm.c
@@ -489,7 +489,7 @@ static int pam_probe(AVProbeData *pd)
#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 @@ retry:
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;
}
diff --git a/libavcodec/vc1_parser.c b/libavcodec/vc1_parser.c
index a4db401fc2..a76d147079 100644
--- a/libavcodec/vc1_parser.c
+++ b/libavcodec/vc1_parser.c
@@ -72,7 +72,7 @@ static int vc1_find_frame_end(ParseContext *pc, const uint8_t *buf,
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 @@ static int vc1_parse(AVCodecParserContext *s,
}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;
}