Mercurial > libavcodec.hg
comparison h264.c @ 6216:5a882b31308b libavcodec
consts
author | michael |
---|---|
date | Fri, 01 Feb 2008 02:35:11 +0000 |
parents | b26ccd688817 |
children | af4b8e1f9b6c |
comparison
equal
deleted
inserted
replaced
6215:1087db4b4d78 | 6216:5a882b31308b |
---|---|
1306 * @param consumed is the number of bytes used as input | 1306 * @param consumed is the number of bytes used as input |
1307 * @param length is the length of the array | 1307 * @param length is the length of the array |
1308 * @param dst_length is the number of decoded bytes FIXME here or a decode rbsp tailing? | 1308 * @param dst_length is the number of decoded bytes FIXME here or a decode rbsp tailing? |
1309 * @returns decoded bytes, might be src+1 if no escapes | 1309 * @returns decoded bytes, might be src+1 if no escapes |
1310 */ | 1310 */ |
1311 static uint8_t *decode_nal(H264Context *h, uint8_t *src, int *dst_length, int *consumed, int length){ | 1311 static const uint8_t *decode_nal(H264Context *h, const uint8_t *src, int *dst_length, int *consumed, int length){ |
1312 int i, si, di; | 1312 int i, si, di; |
1313 uint8_t *dst; | 1313 uint8_t *dst; |
1314 int bufidx; | 1314 int bufidx; |
1315 | 1315 |
1316 // src[0]&0x80; //forbidden bit | 1316 // src[0]&0x80; //forbidden bit |
1373 | 1373 |
1374 /** | 1374 /** |
1375 * identifies the exact end of the bitstream | 1375 * identifies the exact end of the bitstream |
1376 * @return the length of the trailing, or 0 if damaged | 1376 * @return the length of the trailing, or 0 if damaged |
1377 */ | 1377 */ |
1378 static int decode_rbsp_trailing(H264Context *h, uint8_t *src){ | 1378 static int decode_rbsp_trailing(H264Context *h, const uint8_t *src){ |
1379 int v= *src; | 1379 int v= *src; |
1380 int r; | 1380 int r; |
1381 | 1381 |
1382 tprintf(h->s.avctx, "rbsp trailing %X\n", v); | 1382 tprintf(h->s.avctx, "rbsp trailing %X\n", v); |
1383 | 1383 |
7359 h->s.error_count += h->thread_context[i]->s.error_count; | 7359 h->s.error_count += h->thread_context[i]->s.error_count; |
7360 } | 7360 } |
7361 } | 7361 } |
7362 | 7362 |
7363 | 7363 |
7364 static int decode_nal_units(H264Context *h, uint8_t *buf, int buf_size){ | 7364 static int decode_nal_units(H264Context *h, const uint8_t *buf, int buf_size){ |
7365 MpegEncContext * const s = &h->s; | 7365 MpegEncContext * const s = &h->s; |
7366 AVCodecContext * const avctx= s->avctx; | 7366 AVCodecContext * const avctx= s->avctx; |
7367 int buf_index=0; | 7367 int buf_index=0; |
7368 H264Context *hx; ///< thread context | 7368 H264Context *hx; ///< thread context |
7369 int context_count = 0; | 7369 int context_count = 0; |
7383 | 7383 |
7384 for(;;){ | 7384 for(;;){ |
7385 int consumed; | 7385 int consumed; |
7386 int dst_length; | 7386 int dst_length; |
7387 int bit_length; | 7387 int bit_length; |
7388 uint8_t *ptr; | 7388 const uint8_t *ptr; |
7389 int i, nalsize = 0; | 7389 int i, nalsize = 0; |
7390 int err; | 7390 int err; |
7391 | 7391 |
7392 if(h->is_avc) { | 7392 if(h->is_avc) { |
7393 if(buf_index >= buf_size) break; | 7393 if(buf_index >= buf_size) break; |
7561 } | 7561 } |
7562 } | 7562 } |
7563 | 7563 |
7564 static int decode_frame(AVCodecContext *avctx, | 7564 static int decode_frame(AVCodecContext *avctx, |
7565 void *data, int *data_size, | 7565 void *data, int *data_size, |
7566 uint8_t *buf, int buf_size) | 7566 const uint8_t *buf, int buf_size) |
7567 { | 7567 { |
7568 H264Context *h = avctx->priv_data; | 7568 H264Context *h = avctx->priv_data; |
7569 MpegEncContext *s = &h->s; | 7569 MpegEncContext *s = &h->s; |
7570 AVFrame *pict = data; | 7570 AVFrame *pict = data; |
7571 int buf_index; | 7571 int buf_index; |