]> git.sesse.net Git - vlc/blobdiff - modules/codec/libmpeg2.c
* modules/video_filter/*: implemented a forwarding vout_vaControl().
[vlc] / modules / codec / libmpeg2.c
index 6ad9697904bd576cb8edaf50cce39ab5aeec8e0e..88c2a642c2f50baebb240d05a738a58438abe6a1 100755 (executable)
@@ -2,7 +2,7 @@
  * libmpeg2.c: mpeg2 video decoder module making use of libmpeg2.
  *****************************************************************************
  * Copyright (C) 1999-2001 VideoLAN
- * $Id: libmpeg2.c,v 1.44 2004/02/25 18:22:54 fenrir Exp $
+ * $Id$
  *
  * Authors: Gildas Bazin <gbazin@netcourrier.com>
  *          Christophe Massiot <massiot@via.ecp.fr>
@@ -294,11 +294,22 @@ static picture_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
             else
             {
                 /* Use the value provided in the MPEG sequence header */
-                p_sys->i_aspect =
-                    ((uint64_t)p_sys->p_info->sequence->display_width) *
-                    p_sys->p_info->sequence->pixel_width * VOUT_ASPECT_FACTOR /
-                    p_sys->p_info->sequence->display_height /
-                    p_sys->p_info->sequence->pixel_height;
+                if( p_sys->p_info->sequence->pixel_height > 0 )
+                {
+                    p_sys->i_aspect =
+                        ((uint64_t)p_sys->p_info->sequence->display_width) *
+                        p_sys->p_info->sequence->pixel_width *
+                        VOUT_ASPECT_FACTOR /
+                        p_sys->p_info->sequence->display_height /
+                        p_sys->p_info->sequence->pixel_height;
+                }
+                else
+                {
+                    /* Invalid aspect, assume 4:3.
+                     * This shouldn't happen and if it does it is a bug
+                     * in libmpeg2 (likely triggered by an invalid stream) */
+                    p_sys->i_aspect = VOUT_ASPECT_FACTOR * 4 / 3;
+                }
             }
 
             msg_Dbg( p_dec, "%dx%d, aspect %d, %u.%03u fps",