1 /*****************************************************************************
2 * libmpeg2.c: mpeg2 video decoder module making use of libmpeg2.
3 *****************************************************************************
4 * Copyright (C) 1999-2001 the VideoLAN team
7 * Authors: Gildas Bazin <gbazin@videolan.org>
8 * Christophe Massiot <massiot@via.ecp.fr>
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
23 *****************************************************************************/
25 /*****************************************************************************
27 *****************************************************************************/
32 #include <vlc_common.h>
33 #include <vlc_plugin.h>
35 #include <vlc_codec.h>
36 #include <vlc_block_helper.h>
37 #include "../codec/cc.h"
41 #include <vlc_codec_synchro.h>
43 /*****************************************************************************
44 * decoder_sys_t : libmpeg2 decoder descriptor
45 *****************************************************************************/
51 mpeg2dec_t *p_mpeg2dec;
52 const mpeg2_info_t *p_info;
58 mtime_t i_previous_pts;
59 mtime_t i_current_pts;
60 mtime_t i_previous_dts;
61 mtime_t i_current_dts;
62 picture_t * p_picture_to_destroy;
64 bool b_after_sequence_header; /* is it the next frame after
65 * the sequence header ? */
66 bool b_slice_i; /* intra-slice refresh stream */
74 decoder_synchro_t *p_synchro;
78 mtime_t i_last_frame_pts;
80 /* Closed captioning support */
87 /*****************************************************************************
89 *****************************************************************************/
90 static int OpenDecoder( vlc_object_t * );
91 static void CloseDecoder( vlc_object_t * );
93 static picture_t *DecodeBlock( decoder_t *, block_t ** );
94 static block_t *GetCc( decoder_t *p_dec, bool pb_present[4] );
96 static picture_t *GetNewPicture( decoder_t *, uint8_t ** );
97 static void GetAR( decoder_t *p_dec );
99 /*****************************************************************************
101 *****************************************************************************/
103 set_description( N_("MPEG I/II video decoder (using libmpeg2)") );
104 set_capability( "decoder", 150 );
105 set_category( CAT_INPUT );
106 set_subcategory( SUBCAT_INPUT_VCODEC );
107 set_callbacks( OpenDecoder, CloseDecoder );
108 add_shortcut( "libmpeg2" );
111 /*****************************************************************************
112 * OpenDecoder: probe the decoder and return score
113 *****************************************************************************/
114 static int OpenDecoder( vlc_object_t *p_this )
116 decoder_t *p_dec = (decoder_t*)p_this;
117 decoder_sys_t *p_sys;
118 uint32_t i_accel = 0;
120 if( p_dec->fmt_in.i_codec != VLC_FOURCC('m','p','g','v') &&
121 p_dec->fmt_in.i_codec != VLC_FOURCC('m','p','g','1') &&
122 /* Pinnacle hardware-mpeg1 */
123 p_dec->fmt_in.i_codec != VLC_FOURCC('P','I','M','1') &&
124 p_dec->fmt_in.i_codec != VLC_FOURCC('m','p','2','v') &&
125 p_dec->fmt_in.i_codec != VLC_FOURCC('m','p','g','2') &&
126 p_dec->fmt_in.i_codec != VLC_FOURCC('h','d','v','2') )
131 /* Allocate the memory needed to store the decoder's structure */
132 if( ( p_dec->p_sys = p_sys =
133 (decoder_sys_t *)malloc(sizeof(decoder_sys_t)) ) == NULL )
136 /* Initialize the thread properties */
137 memset( p_sys, 0, sizeof(decoder_sys_t) );
138 p_sys->p_mpeg2dec = NULL;
139 p_sys->p_synchro = NULL;
140 p_sys->p_info = NULL;
141 p_sys->i_current_pts = 0;
142 p_sys->i_previous_pts = 0;
143 p_sys->i_current_dts = 0;
144 p_sys->i_previous_dts = 0;
145 p_sys->p_picture_to_destroy = NULL;
146 p_sys->b_garbage_pic = 0;
147 p_sys->b_slice_i = 0;
148 p_sys->b_second_field = 0;
150 p_sys->b_preroll = false;
154 p_sys->i_cc_flags = 0;
155 #if MPEG2_RELEASE >= MPEG2_VERSION (0, 5, 0)
156 p_dec->pf_get_cc = GetCc;
157 cc_Init( &p_sys->cc );
160 #if defined( __i386__ ) || defined( __x86_64__ )
161 if( vlc_CPU() & CPU_CAPABILITY_MMX )
163 i_accel |= MPEG2_ACCEL_X86_MMX;
166 if( vlc_CPU() & CPU_CAPABILITY_3DNOW )
168 i_accel |= MPEG2_ACCEL_X86_3DNOW;
171 if( vlc_CPU() & CPU_CAPABILITY_MMXEXT )
173 i_accel |= MPEG2_ACCEL_X86_MMXEXT;
176 #elif defined( __powerpc__ ) || defined( __ppc__ ) || defined( __ppc64__ )
177 if( vlc_CPU() & CPU_CAPABILITY_ALTIVEC )
179 i_accel |= MPEG2_ACCEL_PPC_ALTIVEC;
183 /* If we do not know this CPU, trust libmpeg2's feature detection */
184 i_accel = MPEG2_ACCEL_DETECT;
188 /* Set CPU acceleration features */
189 mpeg2_accel( i_accel );
191 /* Initialize decoder */
192 p_sys->p_mpeg2dec = mpeg2_init();
193 if( p_sys->p_mpeg2dec == NULL)
195 msg_Err( p_dec, "mpeg2_init() failed" );
200 p_sys->p_info = mpeg2_info( p_sys->p_mpeg2dec );
202 p_dec->pf_decode_video = DecodeBlock;
207 /*****************************************************************************
208 * RunDecoder: the libmpeg2 decoder
209 *****************************************************************************/
210 static picture_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
212 decoder_sys_t *p_sys = p_dec->p_sys;
218 if( !pp_block || !*pp_block ) return NULL;
224 state = mpeg2_parse( p_sys->p_mpeg2dec );
229 if( !p_block->i_buffer )
231 block_Release( p_block );
234 if( p_block->i_flags & (BLOCK_FLAG_DISCONTINUITY
235 | BLOCK_FLAG_CORRUPTED))
236 cc_Flush( &p_sys->cc );
238 if( (p_block->i_flags & (BLOCK_FLAG_DISCONTINUITY
239 | BLOCK_FLAG_CORRUPTED)) &&
241 p_sys->p_info->sequence &&
242 p_sys->p_info->sequence->width != (unsigned)-1 )
244 decoder_SynchroReset( p_sys->p_synchro );
245 if( p_sys->p_info->current_fbuf != NULL
246 && p_sys->p_info->current_fbuf->id != NULL )
248 p_sys->b_garbage_pic = 1;
249 p_pic = p_sys->p_info->current_fbuf->id;
254 buf[0] = buf[1] = buf[2] = NULL;
255 if( (p_pic = GetNewPicture( p_dec, buf )) == NULL )
257 p_block->i_buffer = 0;
260 mpeg2_set_buf( p_sys->p_mpeg2dec, buf, p_pic );
261 mpeg2_stride( p_sys->p_mpeg2dec, p_pic->p[Y_PLANE].i_pitch );
263 p_sys->p_picture_to_destroy = p_pic;
265 if ( p_sys->b_slice_i )
267 decoder_SynchroNewPicture( p_sys->p_synchro,
268 I_CODING_TYPE, 2, 0, 0,
269 p_sys->p_info->sequence->flags & SEQ_FLAG_LOW_DELAY );
270 decoder_SynchroDecode( p_sys->p_synchro );
271 decoder_SynchroEnd( p_sys->p_synchro, I_CODING_TYPE, 0 );
275 if( p_block->i_flags & BLOCK_FLAG_PREROLL )
277 p_sys->b_preroll = true;
279 else if( p_sys->b_preroll )
281 p_sys->b_preroll = false;
283 decoder_SynchroReset( p_sys->p_synchro );
289 mpeg2_pts( p_sys->p_mpeg2dec, (uint32_t)p_block->i_pts );
291 #else /* New interface */
292 if( p_block->i_pts || p_block->i_dts )
294 mpeg2_tag_picture( p_sys->p_mpeg2dec,
295 (uint32_t)p_block->i_pts,
296 (uint32_t)p_block->i_dts );
298 p_sys->i_previous_pts = p_sys->i_current_pts;
299 p_sys->i_current_pts = p_block->i_pts;
300 p_sys->i_previous_dts = p_sys->i_current_dts;
301 p_sys->i_current_dts = p_block->i_dts;
304 mpeg2_buffer( p_sys->p_mpeg2dec, p_block->p_buffer,
305 p_block->p_buffer + p_block->i_buffer );
307 p_block->i_buffer = 0;
310 #if MPEG2_RELEASE >= MPEG2_VERSION (0, 5, 0)
312 case STATE_SEQUENCE_MODIFIED:
319 /* Initialize video output */
321 buf[0] = buf[1] = buf[2] = NULL;
325 mpeg2_custom_fbuf( p_sys->p_mpeg2dec, 1 );
327 /* Set the first 2 reference frames */
328 mpeg2_set_buf( p_sys->p_mpeg2dec, buf, NULL );
330 if( (p_pic = GetNewPicture( p_dec, buf )) == NULL )
332 block_Release( p_block );
336 mpeg2_set_buf( p_sys->p_mpeg2dec, buf, p_pic );
337 mpeg2_stride( p_sys->p_mpeg2dec, p_pic->p[Y_PLANE].i_pitch );
339 /* This picture will never go through display_picture. */
342 /* For some reason, libmpeg2 will put this pic twice in
343 * discard_picture. This can be considered a bug in libmpeg2. */
344 p_dec->pf_picture_link( p_dec, p_pic );
346 if( p_sys->p_synchro )
348 decoder_SynchroRelease( p_sys->p_synchro );
350 p_sys->p_synchro = decoder_SynchroInit( p_dec,
351 (uint32_t)((uint64_t)1001000000 * 27 /
352 p_sys->p_info->sequence->frame_period) );
353 p_sys->b_after_sequence_header = 1;
357 case STATE_PICTURE_2ND:
358 p_sys->b_second_field = 1;
364 mtime_t i_pts, i_dts;
365 buf[0] = buf[1] = buf[2] = NULL;
367 if ( p_sys->b_after_sequence_header &&
368 ((p_sys->p_info->current_picture->flags &
369 PIC_MASK_CODING_TYPE) == PIC_FLAG_CODING_TYPE_P) )
371 /* Intra-slice refresh. Simulate a blank I picture. */
372 msg_Dbg( p_dec, "intra-slice refresh stream" );
373 decoder_SynchroNewPicture( p_sys->p_synchro,
374 I_CODING_TYPE, 2, 0, 0,
375 p_sys->p_info->sequence->flags & SEQ_FLAG_LOW_DELAY );
376 decoder_SynchroDecode( p_sys->p_synchro );
377 decoder_SynchroEnd( p_sys->p_synchro, I_CODING_TYPE, 0 );
378 p_sys->b_slice_i = 1;
380 p_sys->b_after_sequence_header = 0;
383 i_pts = p_sys->p_info->current_picture->flags & PIC_FLAG_PTS ?
384 ( ( p_sys->p_info->current_picture->pts ==
385 (uint32_t)p_sys->i_current_pts ) ?
386 p_sys->i_current_pts : p_sys->i_previous_pts ) : 0;
389 /* Hack to handle demuxers which only have DTS timestamps */
390 if( !i_pts && !p_block->i_pts && p_block->i_dts > 0 )
392 if( p_sys->p_info->sequence->flags & SEQ_FLAG_LOW_DELAY ||
393 (p_sys->p_info->current_picture->flags &
394 PIC_MASK_CODING_TYPE) == PIC_FLAG_CODING_TYPE_B )
396 i_pts = p_block->i_dts;
399 p_block->i_pts = p_block->i_dts = 0;
402 #else /* New interface */
404 i_pts = p_sys->p_info->current_picture->flags & PIC_FLAG_TAGS ?
405 ( ( p_sys->p_info->current_picture->tag ==
406 (uint32_t)p_sys->i_current_pts ) ?
407 p_sys->i_current_pts : p_sys->i_previous_pts ) : 0;
408 i_dts = p_sys->p_info->current_picture->flags & PIC_FLAG_TAGS ?
409 ( ( p_sys->p_info->current_picture->tag2 ==
410 (uint32_t)p_sys->i_current_dts ) ?
411 p_sys->i_current_dts : p_sys->i_previous_dts ) : 0;
414 /* If nb_fields == 1, it is a field picture, and it will be
415 * followed by another field picture for which we won't call
416 * decoder_SynchroNewPicture() because this would have other
417 * problems, so we take it into account here.
418 * This kind of sucks, but I didn't think better. --Meuuh
420 decoder_SynchroNewPicture( p_sys->p_synchro,
421 p_sys->p_info->current_picture->flags & PIC_MASK_CODING_TYPE,
422 p_sys->p_info->current_picture->nb_fields == 1 ? 2 :
423 p_sys->p_info->current_picture->nb_fields, i_pts, i_dts,
424 p_sys->p_info->sequence->flags & SEQ_FLAG_LOW_DELAY );
426 if( !p_dec->b_pace_control && !p_sys->b_preroll &&
428 && ((p_sys->p_info->current_picture->flags
429 & PIC_MASK_CODING_TYPE) == PIC_FLAG_CODING_TYPE_P))
430 && !decoder_SynchroChoose( p_sys->p_synchro,
431 p_sys->p_info->current_picture->flags
432 & PIC_MASK_CODING_TYPE,
433 /*p_sys->p_vout->render_time*/ 0 /*FIXME*/,
434 p_sys->p_info->sequence->flags & SEQ_FLAG_LOW_DELAY ) )
436 mpeg2_skip( p_sys->p_mpeg2dec, 1 );
438 decoder_SynchroTrash( p_sys->p_synchro );
439 mpeg2_set_buf( p_sys->p_mpeg2dec, buf, NULL );
443 mpeg2_skip( p_sys->p_mpeg2dec, 0 );
445 decoder_SynchroDecode( p_sys->p_synchro );
447 if( (p_pic = GetNewPicture( p_dec, buf )) == NULL )
449 block_Release( p_block );
453 mpeg2_set_buf( p_sys->p_mpeg2dec, buf, p_pic );
454 mpeg2_stride( p_sys->p_mpeg2dec, p_pic->p[Y_PLANE].i_pitch );
456 if( p_sys->p_info->user_data_len > 2 )
458 p_sys->i_cc_pts = i_pts;
459 p_sys->i_cc_dts = i_dts;
460 if( (p_sys->p_info->current_picture->flags
461 & PIC_MASK_CODING_TYPE) == PIC_FLAG_CODING_TYPE_P )
462 p_sys->i_cc_flags = BLOCK_FLAG_TYPE_P;
463 else if( (p_sys->p_info->current_picture->flags
464 & PIC_MASK_CODING_TYPE) == PIC_FLAG_CODING_TYPE_B )
465 p_sys->i_cc_flags = BLOCK_FLAG_TYPE_B;
466 else p_sys->i_cc_flags = BLOCK_FLAG_TYPE_I;
468 cc_Extract( &p_sys->cc, &p_sys->p_info->user_data[0], p_sys->p_info->user_data_len );
476 if( p_sys->p_info->display_fbuf
477 && p_sys->p_info->display_fbuf->id )
479 p_pic = (picture_t *)p_sys->p_info->display_fbuf->id;
481 decoder_SynchroEnd( p_sys->p_synchro,
482 p_sys->p_info->display_picture->flags
483 & PIC_MASK_CODING_TYPE,
484 p_sys->b_garbage_pic );
485 p_sys->b_garbage_pic = 0;
487 if( p_sys->p_picture_to_destroy != p_pic )
489 p_pic->date = decoder_SynchroDate( p_sys->p_synchro );
493 p_sys->p_picture_to_destroy = NULL;
498 if( p_sys->p_info->discard_fbuf &&
499 p_sys->p_info->discard_fbuf->id )
501 p_dec->pf_picture_unlink( p_dec,
502 p_sys->p_info->discard_fbuf->id );
505 /* For still frames */
506 if( state == STATE_END && p_pic ) p_pic->b_force = true;
510 /* Avoid frames with identical timestamps.
511 * Especially needed for still frames in DVD menus. */
512 if( p_sys->i_last_frame_pts == p_pic->date ) p_pic->date++;
513 p_sys->i_last_frame_pts = p_pic->date;
522 buf[0] = buf[1] = buf[2] = NULL;
524 msg_Warn( p_dec, "invalid picture encountered" );
525 if ( ( p_sys->p_info->current_picture == NULL ) ||
526 ( ( p_sys->p_info->current_picture->flags &
527 PIC_MASK_CODING_TYPE) != PIC_FLAG_CODING_TYPE_B ) )
529 if( p_sys->p_synchro ) decoder_SynchroReset( p_sys->p_synchro );
531 mpeg2_skip( p_sys->p_mpeg2dec, 1 );
533 cc_Flush( &p_sys->cc );
535 if( p_sys->p_info->current_fbuf &&
536 p_sys->p_info->current_fbuf->id )
538 p_sys->b_garbage_pic = 1;
539 p_pic = p_sys->p_info->current_fbuf->id;
541 else if( !p_sys->p_info->sequence )
547 if( (p_pic = GetNewPicture( p_dec, buf )) == NULL )
549 mpeg2_set_buf( p_sys->p_mpeg2dec, buf, p_pic );
550 mpeg2_stride( p_sys->p_mpeg2dec, p_pic->p[Y_PLANE].i_pitch );
552 p_sys->p_picture_to_destroy = p_pic;
554 memset( p_pic->p[0].p_pixels, 0,
555 p_sys->p_info->sequence->width
556 * p_sys->p_info->sequence->height );
557 memset( p_pic->p[1].p_pixels, 0x80,
558 p_sys->p_info->sequence->width
559 * p_sys->p_info->sequence->height / 4 );
560 memset( p_pic->p[2].p_pixels, 0x80,
561 p_sys->p_info->sequence->width
562 * p_sys->p_info->sequence->height / 4 );
564 if( p_sys->b_slice_i )
566 decoder_SynchroNewPicture( p_sys->p_synchro,
567 I_CODING_TYPE, 2, 0, 0,
568 p_sys->p_info->sequence->flags & SEQ_FLAG_LOW_DELAY );
569 decoder_SynchroDecode( p_sys->p_synchro );
570 decoder_SynchroEnd( p_sys->p_synchro, I_CODING_TYPE, 0 );
584 /*****************************************************************************
585 * CloseDecoder: libmpeg2 decoder destruction
586 *****************************************************************************/
587 static void CloseDecoder( vlc_object_t *p_this )
589 decoder_t *p_dec = (decoder_t *)p_this;
590 decoder_sys_t *p_sys = p_dec->p_sys;
592 if( p_sys->p_synchro ) decoder_SynchroRelease( p_sys->p_synchro );
594 if( p_sys->p_mpeg2dec ) mpeg2_close( p_sys->p_mpeg2dec );
599 /*****************************************************************************
600 * GetNewPicture: Get a new picture from the vout and set the buf struct
601 *****************************************************************************/
602 static picture_t *GetNewPicture( decoder_t *p_dec, uint8_t **pp_buf )
604 decoder_sys_t *p_sys = p_dec->p_sys;
607 p_dec->fmt_out.video.i_width = p_sys->p_info->sequence->width;
608 p_dec->fmt_out.video.i_visible_width =
609 p_sys->p_info->sequence->picture_width;
610 p_dec->fmt_out.video.i_height = p_sys->p_info->sequence->height;
611 p_dec->fmt_out.video.i_visible_height =
612 p_sys->p_info->sequence->picture_height;
613 p_dec->fmt_out.video.i_aspect = p_sys->i_aspect;
614 p_dec->fmt_out.video.i_sar_num = p_sys->i_sar_num;
615 p_dec->fmt_out.video.i_sar_den = p_sys->i_sar_den;
617 if( p_sys->p_info->sequence->frame_period > 0 )
619 p_dec->fmt_out.video.i_frame_rate =
620 (uint32_t)( (uint64_t)1001000000 * 27 /
621 p_sys->p_info->sequence->frame_period );
622 p_dec->fmt_out.video.i_frame_rate_base = 1001;
625 p_dec->fmt_out.i_codec =
626 ( p_sys->p_info->sequence->chroma_height <
627 p_sys->p_info->sequence->height ) ?
628 VLC_FOURCC('I','4','2','0') : VLC_FOURCC('I','4','2','2');
630 /* Get a new picture */
631 p_pic = p_dec->pf_vout_buffer_new( p_dec );
633 if( p_pic == NULL ) return NULL;
635 p_pic->b_progressive = p_sys->p_info->current_picture != NULL ?
636 p_sys->p_info->current_picture->flags & PIC_FLAG_PROGRESSIVE_FRAME : 1;
637 p_pic->b_top_field_first = p_sys->p_info->current_picture != NULL ?
638 p_sys->p_info->current_picture->flags & PIC_FLAG_TOP_FIELD_FIRST : 1;
639 p_pic->i_nb_fields = p_sys->p_info->current_picture != NULL ?
640 p_sys->p_info->current_picture->nb_fields : 2;
642 p_dec->pf_picture_link( p_dec, p_pic );
644 pp_buf[0] = p_pic->p[0].p_pixels;
645 pp_buf[1] = p_pic->p[1].p_pixels;
646 pp_buf[2] = p_pic->p[2].p_pixels;
651 /*****************************************************************************
652 * GetCc: Retrieves the Closed Captions for the CC decoder.
653 *****************************************************************************/
654 static block_t *GetCc( decoder_t *p_dec, bool pb_present[4] )
656 decoder_sys_t *p_sys = p_dec->p_sys;
657 block_t *p_cc = NULL;
660 for( i = 0; i < 4; i++ )
661 pb_present[i] = p_sys->cc.pb_present[i];
663 if( p_sys->cc.i_data <= 0 )
666 p_cc = block_New( p_dec, p_sys->cc.i_data);
669 memcpy( p_cc->p_buffer, p_sys->cc.p_data, p_sys->cc.i_data );
671 p_cc->i_pts = p_sys->cc.b_reorder ? p_sys->i_cc_pts : p_sys->i_cc_dts;
672 p_cc->i_flags = ( p_sys->cc.b_reorder ? p_sys->i_cc_flags : BLOCK_FLAG_TYPE_P ) & ( BLOCK_FLAG_TYPE_I|BLOCK_FLAG_TYPE_P|BLOCK_FLAG_TYPE_B);
674 cc_Flush( &p_sys->cc );
678 /*****************************************************************************
679 * GetAR: Get aspect ratio
680 *****************************************************************************/
681 static void GetAR( decoder_t *p_dec )
683 decoder_sys_t *p_sys = p_dec->p_sys;
685 /* Check whether the input gave a particular aspect ratio */
686 if( p_dec->fmt_in.video.i_aspect )
688 p_sys->i_aspect = p_dec->fmt_in.video.i_aspect;
692 /* Use the value provided in the MPEG sequence header */
693 if( p_sys->p_info->sequence->pixel_height > 0 )
696 ((uint64_t)p_sys->p_info->sequence->picture_width) *
697 p_sys->p_info->sequence->pixel_width *
699 p_sys->p_info->sequence->picture_height /
700 p_sys->p_info->sequence->pixel_height;
701 p_sys->i_sar_num = p_sys->p_info->sequence->pixel_width;
702 p_sys->i_sar_den = p_sys->p_info->sequence->pixel_height;
706 /* Invalid aspect, assume 4:3.
707 * This shouldn't happen and if it does it is a bug
708 * in libmpeg2 (likely triggered by an invalid stream) */
709 p_sys->i_aspect = VOUT_ASPECT_FACTOR * 4 / 3;
710 p_sys->i_sar_num = p_sys->p_info->sequence->picture_height * 4;
711 p_sys->i_sar_den = p_sys->p_info->sequence->picture_width * 3;
715 msg_Dbg( p_dec, "%dx%d (display %d,%d), aspect %d, sar %i:%i, %u.%03u fps",
716 p_sys->p_info->sequence->picture_width,
717 p_sys->p_info->sequence->picture_height,
718 p_sys->p_info->sequence->display_width,
719 p_sys->p_info->sequence->display_height,
720 p_sys->i_aspect, p_sys->i_sar_num, p_sys->i_sar_den,
721 (uint32_t)((uint64_t)1001000000 * 27 /
722 p_sys->p_info->sequence->frame_period / 1001),
723 (uint32_t)((uint64_t)1001000000 * 27 /
724 p_sys->p_info->sequence->frame_period % 1001) );