|
|
|
@@ -73,6 +73,7 @@ static void mpegvideo_extract_headers(AVCodecParserContext *s, |
|
|
|
pc->frame_rate = avctx->framerate = ff_mpeg12_frame_rate_tab[frame_rate_index]; |
|
|
|
bit_rate = (buf[4]<<10) | (buf[5]<<2) | (buf[6]>>6); |
|
|
|
avctx->codec_id = AV_CODEC_ID_MPEG1VIDEO; |
|
|
|
avctx->ticks_per_frame = 1; |
|
|
|
} |
|
|
|
break; |
|
|
|
case EXT_START_CODE: |
|
|
|
@@ -94,9 +95,10 @@ static void mpegvideo_extract_headers(AVCodecParserContext *s, |
|
|
|
bit_rate = (bit_rate&0x3FFFF) | (bit_rate_ext << 18); |
|
|
|
if(did_set_size) |
|
|
|
ff_set_dimensions(avctx, pc->width, pc->height); |
|
|
|
avctx->framerate.num = pc->frame_rate.num * (frame_rate_ext_n + 1) * 2; |
|
|
|
avctx->framerate.num = pc->frame_rate.num * (frame_rate_ext_n + 1); |
|
|
|
avctx->framerate.den = pc->frame_rate.den * (frame_rate_ext_d + 1); |
|
|
|
avctx->codec_id = AV_CODEC_ID_MPEG2VIDEO; |
|
|
|
avctx->ticks_per_frame = 2; |
|
|
|
} |
|
|
|
break; |
|
|
|
case 0x8: /* picture coding extension */ |
|
|
|
@@ -151,7 +153,7 @@ static void mpegvideo_extract_headers(AVCodecParserContext *s, |
|
|
|
} |
|
|
|
#if FF_API_AVCTX_TIMEBASE |
|
|
|
if (avctx->framerate.num) |
|
|
|
avctx->time_base = av_inv_q(avctx->framerate); |
|
|
|
avctx->time_base = av_inv_q(av_mul_q(avctx->framerate, (AVRational){avctx->ticks_per_frame, 1})); |
|
|
|
#endif |
|
|
|
} |
|
|
|
|
|
|
|
@@ -181,7 +183,7 @@ static int mpegvideo_parse(AVCodecParserContext *s, |
|
|
|
function should be negligible for uncorrupted streams */ |
|
|
|
mpegvideo_extract_headers(s, avctx, buf, buf_size); |
|
|
|
av_dlog(NULL, "pict_type=%d frame_rate=%0.3f repeat_pict=%d\n", |
|
|
|
s->pict_type, (double)avctx->time_base.den / avctx->time_base.num, s->repeat_pict); |
|
|
|
s->pict_type, av_q2d(avctx->framerate), s->repeat_pict); |
|
|
|
|
|
|
|
*poutbuf = buf; |
|
|
|
*poutbuf_size = buf_size; |
|
|
|
|