]> git.sesse.net Git - vlc/commitdiff
* MPEG-1 aspect ratio patch, courtesy of Vladimir Chernyshov
authorChristophe Massiot <massiot@videolan.org>
Mon, 10 Dec 2001 10:59:14 +0000 (10:59 +0000)
committerChristophe Massiot <massiot@videolan.org>
Mon, 10 Dec 2001 10:59:14 +0000 (10:59 +0000)
  <greengrass@writeme.com> ;
* Seeking patch for X11, courtesy of Peter Surda <shurdeek@panorama.sth.ac.at>.

plugins/mpeg_vdec/vpar_headers.c
plugins/x11/vout_xvideo.c

index 9d197d19be405d4d7b5e8b66fb688c057af913f4..76ce2b3f618b5a2f34ffd1c295e5a81b5221636e 100644 (file)
@@ -2,7 +2,7 @@
  * vpar_headers.c : headers parsing
  *****************************************************************************
  * Copyright (C) 1999-2001 VideoLAN
- * $Id: vpar_headers.c,v 1.2 2001/11/28 15:08:05 massiot Exp $
+ * $Id: vpar_headers.c,v 1.2.2.1 2001/12/10 10:59:14 massiot Exp $
  *
  * Authors: Christophe Massiot <massiot@via.ecp.fr>
  *          Stéphane Borel <stef@via.ecp.fr>
@@ -382,6 +382,43 @@ static void SequenceHeader( vpar_thread_t * p_vpar )
     else
     {
         /* It's an MPEG-1 stream. Put adequate parameters. */
+        int i_xyratio;
+        static int pi_mpeg1ratio[15] = {
+            10000,
+            10000,
+             6735,
+             7031,
+             7615,
+             8055,
+             8437,
+             8935,
+             9157,
+             9815,
+            10255,
+            10695,
+            10950,
+            11575,
+            12015
+        };
+
+        if( p_vpar->sequence.i_aspect_ratio > 1 )
+        {
+                i_xyratio = p_vpar->sequence.i_height *
+                        pi_mpeg1ratio[p_vpar->sequence.i_aspect_ratio] /
+                        p_vpar->sequence.i_width;
+                if( 7450 < i_xyratio && i_xyratio < 7550 )
+                {
+                        p_vpar->sequence.i_aspect_ratio = 2;
+                }
+                else if( 5575 < i_xyratio && i_xyratio < 5675 )
+                {
+                        p_vpar->sequence.i_aspect_ratio = 3;
+                }
+                else if( 4475 < i_xyratio && i_xyratio < 4575 )
+                {
+                        p_vpar->sequence.i_aspect_ratio = 4;
+                }
+        }
 
         p_vpar->sequence.b_mpeg2 = 0;
         p_vpar->sequence.b_progressive = 1;
index a50612f20387d296b494a58274b2e4b2190346b0..b16920f8ba02048df0c8be559ad8d8a698f9edcf 100644 (file)
@@ -2,7 +2,7 @@
  * vout_xvideo.c: Xvideo video output display method
  *****************************************************************************
  * Copyright (C) 1998-2001 VideoLAN
- * $Id: vout_xvideo.c,v 1.36 2001/12/07 18:33:08 sam Exp $
+ * $Id: vout_xvideo.c,v 1.36.2.1 2001/12/10 10:59:14 massiot Exp $
  *
  * Authors: Shane Harper <shanegh@optusnet.com.au>
  *          Vincent Seguin <seguin@via.ecp.fr>
@@ -403,6 +403,24 @@ static void vout_Destroy( vout_thread_t *p_vout )
  * XXX  Should "factor-out" common code in this and the "same" fn in the x11
  * XXX  plugin!
  *****************************************************************************/
+static __inline__ void vout_Seek( int i_seek )
+{
+    int i_tell = p_main->p_intf->p_input->stream.p_selected_area->i_tell;
+
+    i_tell += i_seek * 50 * p_main->p_intf->p_input->stream.i_mux_rate;
+
+    if( i_tell < p_main->p_intf->p_input->stream.p_selected_area->i_start )
+    {
+        i_tell = p_main->p_intf->p_input->stream.p_selected_area->i_start;
+    }
+    else if( i_tell > p_main->p_intf->p_input->stream.p_selected_area->i_size )
+    {
+        i_tell = p_main->p_intf->p_input->stream.p_selected_area->i_size;
+    }
+
+    input_Seek( p_main->p_intf->p_input, i_tell );
+}
+
 static int vout_Manage( vout_thread_t *p_vout )
 {
     XEvent      xevent;                                         /* X11 event */
@@ -461,6 +479,36 @@ static int vout_Manage( vout_thread_t *p_vout )
                  case XK_Menu:
                      p_main->p_intf->b_menu_change = 1;
                      break;
+                 case XK_Left:
+                     vout_Seek( -5 );
+                     break;
+                 case XK_Right:
+                     vout_Seek( 5 );
+                     break;
+                 case XK_Up:
+                     vout_Seek( 60 );
+                     break;
+                 case XK_Down:
+                     vout_Seek( -60 );
+                     break;
+                 case XK_Home:
+                     input_Seek( p_main->p_intf->p_input,
+                     p_main->p_intf->p_input->stream.p_selected_area->i_start );                     break;
+                 case XK_End:
+                     input_Seek( p_main->p_intf->p_input,
+                     p_main->p_intf->p_input->stream.p_selected_area->i_size );
+                     break;
+                 case XK_Page_Up:
+                     vout_Seek( 900 );
+                     break;
+                 case XK_Page_Down:
+                     vout_Seek( -900 );
+                     break;
+                 case XK_space:
+                     input_SetStatus( p_main->p_intf->p_input,
+                                      INPUT_STATUS_PAUSE );
+                     break;
+
                  default:
                      /* "Normal Keys"
                       * The reason why I use this instead of XK_0 is that