vpc->v.s.avctx = avctx;
vpc->v.parse_only = 1;
next = buf;
+ s->repeat_pict = 0;
for(start = buf, end = buf + buf_size; next < end; start = next){
int buf2_size, size;
if(size <= 0) continue;
switch(AV_RB32(start)){
case VC1_CODE_SEQHDR:
- vc1_decode_sequence_header(avctx, &vpc->v, &gb);
+ ff_vc1_decode_sequence_header(avctx, &vpc->v, &gb);
break;
case VC1_CODE_ENTRYPOINT:
- vc1_decode_entry_point(avctx, &vpc->v, &gb);
+ ff_vc1_decode_entry_point(avctx, &vpc->v, &gb);
break;
case VC1_CODE_FRAME:
if(vpc->v.profile < PROFILE_ADVANCED)
- vc1_parse_frame_header (&vpc->v, &gb);
+ ff_vc1_parse_frame_header (&vpc->v, &gb);
else
- vc1_parse_frame_header_adv(&vpc->v, &gb);
+ ff_vc1_parse_frame_header_adv(&vpc->v, &gb);
/* keep AV_PICTURE_TYPE_BI internal to VC1 */
if (vpc->v.s.pict_type == AV_PICTURE_TYPE_BI)
else
s->pict_type = vpc->v.s.pict_type;
+ if (avctx->ticks_per_frame > 1){
+ // process pulldown flags
+ s->repeat_pict = 1;
+ // Pulldown flags are only valid when 'broadcast' has been set.
+ // So ticks_per_frame will be 2
+ if (vpc->v.rff){
+ // repeat field
+ s->repeat_pict = 2;
+ }else if (vpc->v.rptfrm){
+ // repeat frames
+ s->repeat_pict = vpc->v.rptfrm * 2 + 1;
+ }
+ }
+
break;
}
}
}
/**
- * finds the end of the current frame in the bitstream.
+ * Find the end of the current frame in the bitstream.
* @return the position of the first byte of the next frame, or -1
*/
static int vc1_find_frame_end(ParseContext *pc, const uint8_t *buf,
return 0;
}
+static int vc1_parse_init(AVCodecParserContext *s)
+{
+ VC1ParseContext *vpc = s->priv_data;
+ vpc->v.s.slice_context_count = 1;
+ return ff_vc1_init_common(&vpc->v);
+}
+
AVCodecParser ff_vc1_parser = {
- { CODEC_ID_VC1 },
- sizeof(VC1ParseContext),
- NULL,
- vc1_parse,
- ff_parse1_close,
- vc1_split,
+ .codec_ids = { AV_CODEC_ID_VC1 },
+ .priv_data_size = sizeof(VC1ParseContext),
+ .parser_init = vc1_parse_init,
+ .parser_parse = vc1_parse,
+ .parser_close = ff_parse_close,
+ .split = vc1_split,
};