[vlc-commits] [Git][videolan/vlc][master] packetizer: mpeg4video: read aspect ratio

Steve Lhomme (@robUx4) gitlab at videolan.org
Thu Jul 11 05:07:39 UTC 2024



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
b902a4c2 by François Cartegnie at 2024-07-11T04:50:43+00:00
packetizer: mpeg4video: read aspect ratio

- - - - -


1 changed file:

- modules/packetizer/mpeg4video.c


Changes:

=====================================
modules/packetizer/mpeg4video.c
=====================================
@@ -355,15 +355,13 @@ static block_t *ParseMPEGBlock( decoder_t *p_dec, block_t *p_frag )
     return p_pic;
 }
 
-/* ParseVOL:
- *  TODO:
- *      - support aspect ratio
- */
+/* ParseVOL: */
 static int ParseVOL( decoder_t *p_dec, es_format_t *fmt,
                      uint8_t *p_vol, int i_vol )
 {
     decoder_sys_t *p_sys = p_dec->p_sys;
-    int i_vo_ver_id, i_ar, i_shape;
+    int i_vo_ver_id, i_shape;
+    h26x_aspect_ratio_t ar;
     bs_t s;
 
     for( ;; )
@@ -392,12 +390,21 @@ static int ParseVOL( decoder_t *p_dec, es_format_t *fmt,
     {
         i_vo_ver_id = 1;
     }
-    i_ar = bs_read( &s, 4 );
-    if( i_ar == 0xf )
+    ar.aspect_ratio_idc = bs_read( &s, 4 );
+    if( ar.aspect_ratio_idc == 0xf )
     {
-        bs_skip( &s, 8 );  /* ar_width */
-        bs_skip( &s, 8 );  /* ar_height */
+        ar.aspect_ratio_idc = 0xff; // was only coded on 4 bits in MPEG4
+        ar.sar_width = bs_read( &s, 8 );
+        ar.sar_height = bs_read( &s, 8 );
     }
+    if(!p_dec->fmt_in->video.i_sar_num ||
+       !p_dec->fmt_in->video.i_sar_den)
+    {
+        h26x_get_aspect_ratio(&ar,
+                              &fmt->video.i_sar_num,
+                              &fmt->video.i_sar_den);
+    }
+
     if( bs_read1( &s ) )
     {
         /* vol control parameter */



View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/b902a4c2eb2807cdb554e90e6c6595ab7681d978

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/b902a4c2eb2807cdb554e90e6c6595ab7681d978
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance


More information about the vlc-commits mailing list