[vlc-commits] demux: mp4: fix fallback on PAR (fix #11075)

Francois Cartegnie git at videolan.org
Wed Mar 26 17:44:53 CET 2014


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Wed Mar 26 17:26:12 2014 +0100| [bcf7989613b3bb888e5a9941ffe3310539347586] | committer: Francois Cartegnie

demux: mp4: fix fallback on PAR (fix #11075)

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=bcf7989613b3bb888e5a9941ffe3310539347586
---

 modules/demux/mp4/mp4.c |   11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/modules/demux/mp4/mp4.c b/modules/demux/mp4/mp4.c
index c3038f4..9e2abd7 100644
--- a/modules/demux/mp4/mp4.c
+++ b/modules/demux/mp4/mp4.c
@@ -1773,8 +1773,15 @@ static int TrackCreateES( demux_t *p_demux, mp4_track_t *p_track,
         if( p_pasp && p_pasp->data.p_pasp->i_horizontal_spacing > 0 &&
                       p_pasp->data.p_pasp->i_vertical_spacing > 0 )
         {
-            p_track->fmt.video.i_sar_num = p_pasp->data.p_pasp->i_horizontal_spacing;
-            p_track->fmt.video.i_sar_den = p_pasp->data.p_pasp->i_vertical_spacing;
+            /* Convert pixel ratio to picture/display aspect ratio */
+            /* SAR * PAR -> DAR */
+            vlc_ureduce( &p_track->fmt.video.i_sar_num, &p_track->fmt.video.i_sar_den,
+                         (uint64_t) p_pasp->data.p_pasp->i_horizontal_spacing
+                                    * p_track->fmt.video.i_width,
+                         (uint64_t) p_pasp->data.p_pasp->i_vertical_spacing
+                                    * p_track->fmt.video.i_height,
+                         UINT32_MAX
+                         );
         }
 
         /* Support for cropping (eg. in H263 files) */



More information about the vlc-commits mailing list