Mercurial > libavcodec.hg
comparison mpegvideo_parser.c @ 9036:8e5fe9e56b93 libavcodec
Correct time_base and repeat_pict for MPEG2 video.
Patch by Ivan Schreter, schreter gmx net
| author | cehoyos |
|---|---|
| date | Tue, 24 Feb 2009 20:23:19 +0000 |
| parents | 04423b2f6e0b |
| children | cecf81f93756 |
comparison
equal
deleted
inserted
replaced
| 9035:d22ed7aad1b0 | 9036:8e5fe9e56b93 |
|---|---|
| 79 | 79 |
| 80 pc->width |=(horiz_size_ext << 12); | 80 pc->width |=(horiz_size_ext << 12); |
| 81 pc->height |=( vert_size_ext << 12); | 81 pc->height |=( vert_size_ext << 12); |
| 82 avctx->bit_rate += (bit_rate_ext << 18) * 400; | 82 avctx->bit_rate += (bit_rate_ext << 18) * 400; |
| 83 avcodec_set_dimensions(avctx, pc->width, pc->height); | 83 avcodec_set_dimensions(avctx, pc->width, pc->height); |
| 84 avctx->time_base.den = pc->frame_rate.den * (frame_rate_ext_n + 1); | 84 avctx->time_base.den = pc->frame_rate.den * (frame_rate_ext_n + 1) * 2; |
| 85 avctx->time_base.num = pc->frame_rate.num * (frame_rate_ext_d + 1); | 85 avctx->time_base.num = pc->frame_rate.num * (frame_rate_ext_d + 1); |
| 86 avctx->codec_id = CODEC_ID_MPEG2VIDEO; | 86 avctx->codec_id = CODEC_ID_MPEG2VIDEO; |
| 87 avctx->sub_id = 2; /* forces MPEG2 */ | 87 avctx->sub_id = 2; /* forces MPEG2 */ |
| 88 } | 88 } |
| 89 break; | 89 break; |
| 93 top_field_first = buf[3] & (1 << 7); | 93 top_field_first = buf[3] & (1 << 7); |
| 94 repeat_first_field = buf[3] & (1 << 1); | 94 repeat_first_field = buf[3] & (1 << 1); |
| 95 progressive_frame = buf[4] & (1 << 7); | 95 progressive_frame = buf[4] & (1 << 7); |
| 96 | 96 |
| 97 /* check if we must repeat the frame */ | 97 /* check if we must repeat the frame */ |
| 98 s->repeat_pict = 1; | |
| 98 if (repeat_first_field) { | 99 if (repeat_first_field) { |
| 99 if (pc->progressive_sequence) { | 100 if (pc->progressive_sequence) { |
| 100 if (top_field_first) | 101 if (top_field_first) |
| 101 s->repeat_pict = 4; | 102 s->repeat_pict = 5; |
| 102 else | 103 else |
| 103 s->repeat_pict = 2; | 104 s->repeat_pict = 3; |
| 104 } else if (progressive_frame) { | 105 } else if (progressive_frame) { |
| 105 s->repeat_pict = 1; | 106 s->repeat_pict = 2; |
| 106 } | 107 } |
| 107 } | 108 } |
| 108 } | 109 } |
| 109 break; | 110 break; |
| 110 } | 111 } |
