Mercurial > libavcodec.hg
comparison h264.c @ 7359:1980cae356ad libavcodec
Remove truncated support, use an AVParser if you used that, it is the same.
author | michael |
---|---|
date | Wed, 23 Jul 2008 14:44:07 +0000 |
parents | 2f9d5f6b8fff |
children | ce31f986474c |
comparison
equal
deleted
inserted
replaced
7358:2f9d5f6b8fff | 7359:1980cae356ad |
---|---|
7710 | 7710 |
7711 /** | 7711 /** |
7712 * returns the number of bytes consumed for building the current frame | 7712 * returns the number of bytes consumed for building the current frame |
7713 */ | 7713 */ |
7714 static int get_consumed_bytes(MpegEncContext *s, int pos, int buf_size){ | 7714 static int get_consumed_bytes(MpegEncContext *s, int pos, int buf_size){ |
7715 if(s->flags&CODEC_FLAG_TRUNCATED){ | |
7716 pos -= s->parse_context.last_index; | |
7717 if(pos<0) pos=0; // FIXME remove (unneeded?) | |
7718 | |
7719 return pos; | |
7720 }else{ | |
7721 if(pos==0) pos=1; //avoid infinite loops (i doubt that is needed but ...) | 7715 if(pos==0) pos=1; //avoid infinite loops (i doubt that is needed but ...) |
7722 if(pos+10>buf_size) pos=buf_size; // oops ;) | 7716 if(pos+10>buf_size) pos=buf_size; // oops ;) |
7723 | 7717 |
7724 return pos; | 7718 return pos; |
7725 } | |
7726 } | 7719 } |
7727 | 7720 |
7728 static int decode_frame(AVCodecContext *avctx, | 7721 static int decode_frame(AVCodecContext *avctx, |
7729 void *data, int *data_size, | 7722 void *data, int *data_size, |
7730 const uint8_t *buf, int buf_size) | 7723 const uint8_t *buf, int buf_size) |
7734 AVFrame *pict = data; | 7727 AVFrame *pict = data; |
7735 int buf_index; | 7728 int buf_index; |
7736 | 7729 |
7737 s->flags= avctx->flags; | 7730 s->flags= avctx->flags; |
7738 s->flags2= avctx->flags2; | 7731 s->flags2= avctx->flags2; |
7739 | |
7740 if(s->flags&CODEC_FLAG_TRUNCATED){ | |
7741 const int next= ff_h264_find_frame_end(h, buf, buf_size); | |
7742 assert((buf_size > 0) || (next == END_NOT_FOUND)); | |
7743 | |
7744 if( ff_combine_frame(&s->parse_context, next, &buf, &buf_size) < 0 ) | |
7745 return buf_size; | |
7746 //printf("next:%d buf_size:%d last_index:%d\n", next, buf_size, s->parse_context.last_index); | |
7747 } | |
7748 | 7732 |
7749 /* no supplementary picture */ | 7733 /* no supplementary picture */ |
7750 if (buf_size == 0) { | 7734 if (buf_size == 0) { |
7751 Picture *out; | 7735 Picture *out; |
7752 int i, out_idx; | 7736 int i, out_idx; |
8164 sizeof(H264Context), | 8148 sizeof(H264Context), |
8165 decode_init, | 8149 decode_init, |
8166 NULL, | 8150 NULL, |
8167 decode_end, | 8151 decode_end, |
8168 decode_frame, | 8152 decode_frame, |
8169 /*CODEC_CAP_DRAW_HORIZ_BAND |*/ CODEC_CAP_DR1 | CODEC_CAP_TRUNCATED | CODEC_CAP_DELAY, | 8153 /*CODEC_CAP_DRAW_HORIZ_BAND |*/ CODEC_CAP_DR1 | CODEC_CAP_DELAY, |
8170 .flush= flush_dpb, | 8154 .flush= flush_dpb, |
8171 .long_name = NULL_IF_CONFIG_SMALL("H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10"), | 8155 .long_name = NULL_IF_CONFIG_SMALL("H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10"), |
8172 }; | 8156 }; |
8173 | 8157 |
8174 #include "svq3.c" | 8158 #include "svq3.c" |