Changeset bb1a6786a9824360280e7802e11cb067f8e3e100
- Timestamp:
- 26/03/03 00:06:49
(6 years ago)
- Author:
- Gildas Bazin <gbazin@videolan.org>
- git-committer:
- Gildas Bazin <gbazin@videolan.org> 1048633609 +0000
- git-parent:
[9bfeef47ae46c792a46531d1181ecb4124465a7f]
- git-author:
- Gildas Bazin <gbazin@videolan.org> 1048633609 +0000
- Message:
* modules/codec/libmpeg2.c: fixed aspect ratio when reading DVDs.
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| r73fcd93 |
rbb1a678 |
|
| 3 | 3 | ***************************************************************************** |
|---|
| 4 | 4 | * Copyright (C) 1999-2001 VideoLAN |
|---|
| 5 | | * $Id: libmpeg2.c,v 1.3 2003/03/20 21:45:01 gbazin Exp $ |
|---|
| | 5 | * $Id: libmpeg2.c,v 1.4 2003/03/25 23:06:49 gbazin Exp $ |
|---|
| 6 | 6 | * |
|---|
| 7 | 7 | * Authors: Gildas Bazin <gbazin@netcourrier.com> |
|---|
| … | … | |
| 35 | 35 | #include <mpeg2dec/mpeg2.h> |
|---|
| 36 | 36 | |
|---|
| | 37 | /* Aspect ratio (ISO/IEC 13818-2 section 6.3.3, table 6-3) */ |
|---|
| | 38 | #define AR_SQUARE_PICTURE 1 /* square pixels */ |
|---|
| | 39 | #define AR_3_4_PICTURE 2 /* 3:4 picture (TV) */ |
|---|
| | 40 | #define AR_16_9_PICTURE 3 /* 16:9 picture (wide screen) */ |
|---|
| | 41 | #define AR_221_1_PICTURE 4 /* 2.21:1 picture (movie) */ |
|---|
| | 42 | |
|---|
| 37 | 43 | /***************************************************************************** |
|---|
| 38 | 44 | * dec_thread_t : libmpeg2 decoder thread descriptor |
|---|
| … | … | |
| 54 | 60 | mtime_t i_previous_pts; |
|---|
| 55 | 61 | mtime_t i_current_pts; |
|---|
| | 62 | mtime_t i_period_remainder; |
|---|
| 56 | 63 | |
|---|
| 57 | 64 | /* |
|---|
| … | … | |
| 123 | 130 | p_dec->i_current_pts = 0; |
|---|
| 124 | 131 | p_dec->i_previous_pts = 0; |
|---|
| | 132 | p_dec->i_period_remainder = 0; |
|---|
| 125 | 133 | |
|---|
| 126 | 134 | /* Initialize decoder */ |
|---|
| … | … | |
| 176 | 184 | case STATE_SEQUENCE: |
|---|
| 177 | 185 | /* Initialize video output */ |
|---|
| 178 | | i_aspect = ((uint64_t)p_dec->p_info->sequence->width) * |
|---|
| 179 | | p_dec->p_info->sequence->pixel_width * VOUT_ASPECT_FACTOR / |
|---|
| 180 | | p_dec->p_info->sequence->height / |
|---|
| 181 | | p_dec->p_info->sequence->pixel_height; |
|---|
| | 186 | |
|---|
| | 187 | /* Check whether the input gives a particular aspect ratio */ |
|---|
| | 188 | if( p_dec->p_fifo->p_demux_data |
|---|
| | 189 | && ( *(int*)(p_dec->p_fifo->p_demux_data) & 0x7 ) ) |
|---|
| | 190 | { |
|---|
| | 191 | i_aspect = *(int*)(p_dec->p_fifo->p_demux_data); |
|---|
| | 192 | switch( i_aspect ) |
|---|
| | 193 | { |
|---|
| | 194 | case AR_3_4_PICTURE: |
|---|
| | 195 | i_aspect = VOUT_ASPECT_FACTOR * 4 / 3; |
|---|
| | 196 | break; |
|---|
| | 197 | case AR_16_9_PICTURE: |
|---|
| | 198 | i_aspect = VOUT_ASPECT_FACTOR * 16 / 9; |
|---|
| | 199 | break; |
|---|
| | 200 | case AR_221_1_PICTURE: |
|---|
| | 201 | i_aspect = VOUT_ASPECT_FACTOR * 221 / 100; |
|---|
| | 202 | break; |
|---|
| | 203 | case AR_SQUARE_PICTURE: |
|---|
| | 204 | default: |
|---|
| | 205 | i_aspect = VOUT_ASPECT_FACTOR * |
|---|
| | 206 | p_dec->p_info->sequence->width / |
|---|
| | 207 | p_dec->p_info->sequence->height; |
|---|
| | 208 | break; |
|---|
| | 209 | } |
|---|
| | 210 | } |
|---|
| | 211 | else |
|---|
| | 212 | { |
|---|
| | 213 | /* Use the value provided in the MPEG sequence header */ |
|---|
| | 214 | i_aspect = ((uint64_t)p_dec->p_info->sequence->width) * |
|---|
| | 215 | p_dec->p_info->sequence->pixel_width * VOUT_ASPECT_FACTOR / |
|---|
| | 216 | p_dec->p_info->sequence->height / |
|---|
| | 217 | p_dec->p_info->sequence->pixel_height; |
|---|
| | 218 | } |
|---|
| 182 | 219 | |
|---|
| 183 | 220 | i_chroma = VLC_FOURCC('Y','V','1','2'); |
|---|
| … | … | |
| 233 | 270 | else |
|---|
| 234 | 271 | { |
|---|
| 235 | | p_dec->i_pts += (p_dec->p_info->sequence->frame_period/27); |
|---|
| | 272 | p_dec->i_pts += ( (p_dec->p_info->sequence->frame_period + |
|---|
| | 273 | p_dec->i_period_remainder) / 27 ); |
|---|
| | 274 | p_dec->i_period_remainder = |
|---|
| | 275 | p_dec->p_info->sequence->frame_period + |
|---|
| | 276 | p_dec->i_period_remainder - |
|---|
| | 277 | ( p_dec->p_info->sequence->frame_period + |
|---|
| | 278 | p_dec->i_period_remainder ) / 27 * 27; |
|---|
| 236 | 279 | } |
|---|
| 237 | 280 | vout_DatePicture( p_dec->p_vout, p_pic, p_dec->i_pts ); |
|---|