Changeset 23f9442398a0a7a7b2f4a7b163fada125bfdc148
- Timestamp:
- 17/03/05 17:59:16
(4 years ago)
- Author:
- Christophe Massiot <massiot@videolan.org>
- git-committer:
- Christophe Massiot <massiot@videolan.org> 1111078756 +0000
- git-parent:
[05c786b6f3234f0b70952add5263f3446f5da217]
- git-author:
- Christophe Massiot <massiot@videolan.org> 1111078756 +0000
- Message:
* modules/stream_out/switcher.c: Fixed aspect ratio.
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| rdb70826 |
r23f9442 |
|
| 132 | 132 | int i_gop; |
|---|
| 133 | 133 | int i_qscale; |
|---|
| 134 | | AVRational sample_aspect_ratio; |
|---|
| | 134 | int i_aspect; |
|---|
| 135 | 135 | sout_stream_id_t *pp_audio_ids[MAX_AUDIO]; |
|---|
| 136 | 136 | |
|---|
| … | … | |
| 234 | 234 | { |
|---|
| 235 | 235 | *psz_parser++ = '\0'; |
|---|
| 236 | | p_sys->sample_aspect_ratio.num = atoi( val.psz_string ); |
|---|
| 237 | | p_sys->sample_aspect_ratio.den = atoi( psz_parser ); |
|---|
| | 236 | p_sys->i_aspect = atoi( val.psz_string ) * VOUT_ASPECT_FACTOR |
|---|
| | 237 | / atoi( psz_parser ); |
|---|
| 238 | 238 | } |
|---|
| 239 | 239 | else |
|---|
| 240 | 240 | { |
|---|
| 241 | 241 | msg_Warn( p_stream, "bad aspect ratio %s", val.psz_string ); |
|---|
| 242 | | p_sys->sample_aspect_ratio.num = 4; |
|---|
| 243 | | p_sys->sample_aspect_ratio.den = 3; |
|---|
| | 242 | p_sys->i_aspect = 4 * VOUT_ASPECT_FACTOR / 3; |
|---|
| 244 | 243 | } |
|---|
| 245 | 244 | |
|---|
| … | … | |
| 248 | 247 | else |
|---|
| 249 | 248 | { |
|---|
| 250 | | p_sys->sample_aspect_ratio.num = 4; |
|---|
| 251 | | p_sys->sample_aspect_ratio.den = 3; |
|---|
| | 249 | p_sys->i_aspect = 4 * VOUT_ASPECT_FACTOR / 3; |
|---|
| 252 | 250 | } |
|---|
| 253 | 251 | |
|---|
| … | … | |
| 696 | 694 | /* Create a new encoder. */ |
|---|
| 697 | 695 | int i_ff_codec = CODEC_ID_MPEG2VIDEO; |
|---|
| | 696 | int i_aspect_num, i_aspect_den; |
|---|
| | 697 | |
|---|
| 698 | 698 | if( i_ff_codec == 0 ) |
|---|
| 699 | 699 | { |
|---|
| … | … | |
| 733 | 733 | id->ff_enc_c->width = p_sys->p_pictures[p_sys->i_cmd-1].format.i_width; |
|---|
| 734 | 734 | id->ff_enc_c->height = p_sys->p_pictures[p_sys->i_cmd-1].format.i_height; |
|---|
| | 735 | av_reduce( &i_aspect_num, &i_aspect_den, |
|---|
| | 736 | p_sys->i_aspect, |
|---|
| | 737 | VOUT_ASPECT_FACTOR, 1 << 30 /* something big */ ); |
|---|
| | 738 | av_reduce( &id->ff_enc_c->sample_aspect_ratio.num, |
|---|
| | 739 | &id->ff_enc_c->sample_aspect_ratio.den, |
|---|
| | 740 | i_aspect_num * (int64_t)id->ff_enc_c->height, |
|---|
| | 741 | i_aspect_den * (int64_t)id->ff_enc_c->width, 1 << 30 ); |
|---|
| 735 | 742 | |
|---|
| 736 | 743 | id->ff_enc_c->frame_rate = 25; /* FIXME */ |
|---|
| 737 | 744 | id->ff_enc_c->frame_rate_base = 1; |
|---|
| 738 | | memcpy( &id->ff_enc_c->sample_aspect_ratio, &p_sys->sample_aspect_ratio, |
|---|
| 739 | | sizeof(AVRational) ); |
|---|
| 740 | 745 | |
|---|
| 741 | 746 | id->ff_enc_c->gop_size = 200; |
|---|