--- libavcodec/cavs_parser.c | 53 ++++++++++++++++++++++++------------------------ 1 file changed, 27 insertions(+), 26 deletions(-)
diff --git a/libavcodec/cavs_parser.c b/libavcodec/cavs_parser.c index 84f647c..8bfd8ff 100644 --- a/libavcodec/cavs_parser.c +++ b/libavcodec/cavs_parser.c @@ -25,8 +25,8 @@ * @author Stefan Gehrer <[email protected]> */ -#include "parser.h" #include "cavs.h" +#include "parser.h" /** @@ -34,42 +34,43 @@ * @return the position of the first byte of the next frame, or -1 */ static int cavs_find_frame_end(ParseContext *pc, const uint8_t *buf, - int buf_size) { + int buf_size) +{ int pic_found, i; uint32_t state; - pic_found= pc->frame_start_found; - state= pc->state; + pic_found = pc->frame_start_found; + state = pc->state; - i=0; - if(!pic_found){ - for(i=0; i<buf_size; i++){ - state= (state<<8) | buf[i]; - if(state == PIC_I_START_CODE || state == PIC_PB_START_CODE){ + i = 0; + if (!pic_found) { + for (i = 0; i < buf_size; i++) { + state = (state << 8) | buf[i]; + if (state == PIC_I_START_CODE || state == PIC_PB_START_CODE) { i++; - pic_found=1; + pic_found = 1; break; } } } - if(pic_found){ + if (pic_found) { /* EOF considered as end of frame */ if (buf_size == 0) return 0; - for(; i<buf_size; i++){ - state= (state<<8) | buf[i]; - if((state&0xFFFFFF00) == 0x100){ - if(state > SLICE_MAX_START_CODE){ - pc->frame_start_found=0; - pc->state=-1; - return i-3; + for (; i < buf_size; i++) { + state = (state << 8) | buf[i]; + if ((state & 0xFFFFFF00) == 0x100) { + if (state > SLICE_MAX_START_CODE) { + pc->frame_start_found = 0; + pc->state = -1; + return i - 3; } } } } - pc->frame_start_found= pic_found; - pc->state= state; + pc->frame_start_found = pic_found; + pc->state = state; return END_NOT_FOUND; } @@ -81,18 +82,18 @@ static int cavsvideo_parse(AVCodecParserContext *s, ParseContext *pc = s->priv_data; int next; - if(s->flags & PARSER_FLAG_COMPLETE_FRAMES){ - next= buf_size; - }else{ - next= cavs_find_frame_end(pc, buf, buf_size); + if (s->flags & PARSER_FLAG_COMPLETE_FRAMES) { + next = buf_size; + } else { + next = cavs_find_frame_end(pc, buf, buf_size); if (ff_combine_frame(pc, next, &buf, &buf_size) < 0) { - *poutbuf = NULL; + *poutbuf = NULL; *poutbuf_size = 0; return buf_size; } } - *poutbuf = buf; + *poutbuf = buf; *poutbuf_size = buf_size; return next; } -- 1.8.3.2 _______________________________________________ libav-devel mailing list [email protected] https://lists.libav.org/mailman/listinfo/libav-devel
