comparison h264.c @ 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 777f250df232
children 9a6a0818e93f
comparison
equal deleted inserted replaced
4930:655d25351bfc 4931:0d1cc37d9430
8037 } 8037 }
8038 8038
8039 #ifdef CONFIG_H264_PARSER 8039 #ifdef CONFIG_H264_PARSER
8040 static int h264_parse(AVCodecParserContext *s, 8040 static int h264_parse(AVCodecParserContext *s,
8041 AVCodecContext *avctx, 8041 AVCodecContext *avctx,
8042 uint8_t **poutbuf, int *poutbuf_size, 8042 const uint8_t **poutbuf, int *poutbuf_size,
8043 const uint8_t *buf, int buf_size) 8043 const uint8_t *buf, int buf_size)
8044 { 8044 {
8045 H264Context *h = s->priv_data; 8045 H264Context *h = s->priv_data;
8046 ParseContext *pc = &h->s.parse_context; 8046 ParseContext *pc = &h->s.parse_context;
8047 int next; 8047 int next;
8049 if(s->flags & PARSER_FLAG_COMPLETE_FRAMES){ 8049 if(s->flags & PARSER_FLAG_COMPLETE_FRAMES){
8050 next= buf_size; 8050 next= buf_size;
8051 }else{ 8051 }else{
8052 next= find_frame_end(h, buf, buf_size); 8052 next= find_frame_end(h, buf, buf_size);
8053 8053
8054 if (ff_combine_frame(pc, next, (uint8_t **)&buf, &buf_size) < 0) { 8054 if (ff_combine_frame(pc, next, &buf, &buf_size) < 0) {
8055 *poutbuf = NULL; 8055 *poutbuf = NULL;
8056 *poutbuf_size = 0; 8056 *poutbuf_size = 0;
8057 return buf_size; 8057 return buf_size;
8058 } 8058 }
8059 8059
8061 assert(pc->last_index + next >= 0 ); 8061 assert(pc->last_index + next >= 0 );
8062 find_frame_end(h, &pc->buffer[pc->last_index + next], -next); //update state 8062 find_frame_end(h, &pc->buffer[pc->last_index + next], -next); //update state
8063 } 8063 }
8064 } 8064 }
8065 8065
8066 *poutbuf = (uint8_t *)buf; 8066 *poutbuf = buf;
8067 *poutbuf_size = buf_size; 8067 *poutbuf_size = buf_size;
8068 return next; 8068 return next;
8069 } 8069 }
8070 8070
8071 static int h264_split(AVCodecContext *avctx, 8071 static int h264_split(AVCodecContext *avctx,
8301 } 8301 }
8302 8302
8303 if(s->flags&CODEC_FLAG_TRUNCATED){ 8303 if(s->flags&CODEC_FLAG_TRUNCATED){
8304 int next= find_frame_end(h, buf, buf_size); 8304 int next= find_frame_end(h, buf, buf_size);
8305 8305
8306 if( ff_combine_frame(&s->parse_context, next, &buf, &buf_size) < 0 ) 8306 if( ff_combine_frame(&s->parse_context, next, (const uint8_t **)&buf, &buf_size) < 0 )
8307 return buf_size; 8307 return buf_size;
8308 //printf("next:%d buf_size:%d last_index:%d\n", next, buf_size, s->parse_context.last_index); 8308 //printf("next:%d buf_size:%d last_index:%d\n", next, buf_size, s->parse_context.last_index);
8309 } 8309 }
8310 8310
8311 if(h->is_avc && !h->got_avcC) { 8311 if(h->is_avc && !h->got_avcC) {