comparison h264.c @ 2174:6d614374d907 libavcodec

Get H.264 frame rate from SPS/VUI patch by (Mns Rullgrd <mru at kth dot se>)
author michael
date Mon, 16 Aug 2004 22:48:05 +0000
parents b25df257eab0
children 24ed7893bf82
comparison
equal deleted inserted replaced
2173:380c40efd6bb 2174:6d614374d907
80 int crop_right; ///< frame_cropping_rect_right_offset 80 int crop_right; ///< frame_cropping_rect_right_offset
81 int crop_top; ///< frame_cropping_rect_top_offset 81 int crop_top; ///< frame_cropping_rect_top_offset
82 int crop_bottom; ///< frame_cropping_rect_bottom_offset 82 int crop_bottom; ///< frame_cropping_rect_bottom_offset
83 int vui_parameters_present_flag; 83 int vui_parameters_present_flag;
84 AVRational sar; 84 AVRational sar;
85 int timing_info_present_flag;
86 uint32_t num_units_in_tick;
87 uint32_t time_scale;
88 int fixed_frame_rate_flag;
85 short offset_for_ref_frame[256]; //FIXME dyn aloc? 89 short offset_for_ref_frame[256]; //FIXME dyn aloc?
86 }SPS; 90 }SPS;
87 91
88 /** 92 /**
89 * Picture parameter set 93 * Picture parameter set
3040 alloc_tables(h); 3044 alloc_tables(h);
3041 3045
3042 s->avctx->width = s->width; 3046 s->avctx->width = s->width;
3043 s->avctx->height = s->height; 3047 s->avctx->height = s->height;
3044 s->avctx->sample_aspect_ratio= h->sps.sar; 3048 s->avctx->sample_aspect_ratio= h->sps.sar;
3049
3050 if(h->sps.timing_info_present_flag && h->sps.fixed_frame_rate_flag){
3051 s->avctx->frame_rate = h->sps.time_scale;
3052 s->avctx->frame_rate_base = h->sps.num_units_in_tick;
3053 }
3045 } 3054 }
3046 3055
3047 if(first_mb_in_slice == 0){ 3056 if(first_mb_in_slice == 0){
3048 frame_start(h); 3057 frame_start(h);
3049 } 3058 }
5300 }else{ 5309 }else{
5301 sps->sar.num= 5310 sps->sar.num=
5302 sps->sar.den= 0; 5311 sps->sar.den= 0;
5303 } 5312 }
5304 // s->avctx->aspect_ratio= sar_width*s->width / (float)(s->height*sar_height); 5313 // s->avctx->aspect_ratio= sar_width*s->width / (float)(s->height*sar_height);
5314
5315 if(get_bits1(&s->gb)){ /* overscan_info_present_flag */
5316 get_bits1(&s->gb); /* overscan_appropriate_flag */
5317 }
5318
5319 if(get_bits1(&s->gb)){ /* video_signal_type_present_flag */
5320 get_bits(&s->gb, 3); /* video_format */
5321 get_bits1(&s->gb); /* video_full_range_flag */
5322 if(get_bits1(&s->gb)){ /* colour_description_present_flag */
5323 get_bits(&s->gb, 8); /* colour_primaries */
5324 get_bits(&s->gb, 8); /* transfer_characteristics */
5325 get_bits(&s->gb, 8); /* matrix_coefficients */
5326 }
5327 }
5328
5329 if(get_bits1(&s->gb)){ /* chroma_location_info_present_flag */
5330 get_ue_golomb(&s->gb); /* chroma_sample_location_type_top_field */
5331 get_ue_golomb(&s->gb); /* chroma_sample_location_type_bottom_field */
5332 }
5333
5334 sps->timing_info_present_flag = get_bits1(&s->gb);
5335 if(sps->timing_info_present_flag){
5336 sps->num_units_in_tick = get_bits_long(&s->gb, 32);
5337 sps->time_scale = get_bits_long(&s->gb, 32);
5338 sps->fixed_frame_rate_flag = get_bits1(&s->gb);
5339 }
5340
5305 #if 0 5341 #if 0
5306 | overscan_info_present_flag |0 |u(1) | 5342 | overscan_info_present_flag |0 |u(1) |
5307 | if( overscan_info_present_flag ) | | | 5343 | if( overscan_info_present_flag ) | | |
5308 | overscan_appropriate_flag |0 |u(1) | 5344 | overscan_appropriate_flag |0 |u(1) |
5309 | video_signal_type_present_flag |0 |u(1) | 5345 | video_signal_type_present_flag |0 |u(1) |