+ /* Sequence header code */
+ static const int code_to_frame_rate[16][2] =
+ {
+ { 1, 1 }, /* invalid */
+ { 24000, 1001 }, { 24, 1 }, { 25, 1 }, { 30000, 1001 },
+ { 30, 1 }, { 50, 1 }, { 60000, 1001 }, { 60, 1 },
+ /* Unofficial 15fps from Xing*/
+ { 15, 1001 },
+ /* Unofficial economy rates from libmpeg3 */
+ { 5000, 1001 }, { 1000, 1001 }, { 12000, 1001 }, { 15000, 1001 },
+ { 1, 1 }, { 1, 1 } /* invalid */
+ };
+
+ if( p_sys->p_seq ) block_Release( p_sys->p_seq );
+ if( p_sys->p_ext ) block_Release( p_sys->p_ext );
+
+ p_sys->p_seq = block_Duplicate( p_frag );
+ p_sys->i_seq_old = 0;
+ p_sys->p_ext = NULL;
+
+ p_dec->fmt_out.video.i_width =
+ ( p_frag->p_buffer[4] << 4)|(p_frag->p_buffer[5] >> 4 );
+ p_dec->fmt_out.video.i_height =
+ ( (p_frag->p_buffer[5]&0x0f) << 8 )|p_frag->p_buffer[6];
+ p_sys->i_aspect_ratio_info = p_frag->p_buffer[7] >> 4;
+
+ /* TODO: MPEG1 aspect ratio */
+
+ p_sys->i_frame_rate = code_to_frame_rate[p_frag->p_buffer[7]&0x0f][0];
+ p_sys->i_frame_rate_base =
+ code_to_frame_rate[p_frag->p_buffer[7]&0x0f][1];
+
+ p_dec->fmt_out.video.i_frame_rate = p_sys->i_frame_rate;
+ p_dec->fmt_out.video.i_frame_rate_base = p_sys->i_frame_rate_base;
+
+ p_sys->b_seq_progressive = true;
+ p_sys->b_low_delay = true;
+
+ if ( !p_sys->b_inited )
+ {
+ msg_Dbg( p_dec, "size %dx%d fps=%.3f",
+ p_dec->fmt_out.video.i_width, p_dec->fmt_out.video.i_height,
+ p_sys->i_frame_rate / (float)p_sys->i_frame_rate_base );
+ p_sys->b_inited = 1;
+ }