]> git.sesse.net Git - vlc/commitdiff
Patch from Paul Corke for rawdv to advance the timestamp when it is about to fall...
authorJean-Paul Saman <jpsaman@videolan.org>
Wed, 25 Apr 2007 19:15:39 +0000 (19:15 +0000)
committerJean-Paul Saman <jpsaman@videolan.org>
Wed, 25 Apr 2007 19:15:39 +0000 (19:15 +0000)
THANKS
modules/demux/rawdv.c

diff --git a/THANKS b/THANKS
index 1ef42301932025ac28e32c191362e4cef0c5aace..3e21241b1dfb09eeda376b8c068f9c9067885e6a 100644 (file)
--- a/THANKS
+++ b/THANKS
@@ -143,6 +143,7 @@ Ondrej Kuda aka Albert <kuda at natur dot cuni dot cz> - HTTP interface tips and
 Patrick Horn <patrickd0thorn at mindspring d0t com> - DirectShow patch
 Patrick McLean <chutzpah at gentoo d0t org> - Libcdio update patch
 Paul Corke <paul.corke at datatote dot co do uk> - pvr patch for newer ivtv drivers
+Paul Corke <paul.corke at datatote dot co do uk> - dv patch to keep up with the hardware
 Paul Mackerras <paulus at linuxcare.com.au> - AltiVec IDCT and motion
 Pavlov Konstantin “thresh” - several Linux build system fixes
 Petr Vacek - FTP cleartext authentication
index eaebda8322f51b90f5a3affa1cbeee0102a14977..9a2c0a4cc3b63f2fcc88d0641b6dd3bba74d9ec2 100644 (file)
@@ -5,6 +5,7 @@
  * $Id$
  *
  * Authors: Gildas Bazin <gbazin@netcourrier.com>
+ *          Paul Corke <paul dot corke at datatote dot co dot uk>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
 /*****************************************************************************
  * Module descriptor
  *****************************************************************************/
+#define HURRYUP_TEXT N_( "Hurry up" )
+#define HURRYUP_LONGTEXT N_( "The demuxer will advance timestamps if the " \
+                "input can't keep up with the rate." )
+
 static int  Open ( vlc_object_t * );
 static void Close( vlc_object_t * );
 
@@ -41,6 +46,7 @@ vlc_module_begin();
     set_capability( "demux2", 2 );
     set_category( CAT_INPUT );
     set_subcategory( SUBCAT_INPUT_DEMUX );
+    add_bool( "rawdv-hurry-up", 0, NULL, HURRYUP_TEXT, HURRYUP_LONGTEXT, VLC_FALSE );
     set_callbacks( Open, Close );
     add_shortcut( "rawdv" );
 vlc_module_end();
@@ -104,6 +110,7 @@ struct demux_sys_t
 
     /* program clock reference (in units of 90kHz) */
     mtime_t i_pcr;
+    vlc_bool_t b_hurry_up;
 };
 
 /*****************************************************************************
@@ -196,11 +203,15 @@ static int Open( vlc_object_t * p_this )
 
     p_peek += 72;                                  /* skip rest of DIF block */
 
-
     /* Set p_input field */
     p_demux->pf_demux   = Demux;
     p_demux->pf_control = Control;
     p_demux->p_sys      = p_sys = malloc( sizeof( demux_sys_t ) );
+    if( !p_sys )
+        return VLC_ENOMEM;
+
+    p_sys->b_hurry_up = var_CreateGetBool( p_demux, "rawdv-hurry-up" );
+    msg_Dbg( p_demux, "Realtime DV Source: %s", (p_sys->b_hurry_up)?"Yes":"No" );
 
     p_sys->i_dsf = dv_header.dsf;
     p_sys->frame_size = dv_header.dsf ? 12 * 150 * 80 : 10 * 150 * 80;
@@ -264,6 +275,7 @@ static void Close( vlc_object_t *p_this )
     demux_t     *p_demux = (demux_t*)p_this;
     demux_sys_t *p_sys  = p_demux->p_sys;
 
+    var_Destroy( p_demux, "rawdv-hurry-up");
     free( p_sys );
 }
 
@@ -278,10 +290,16 @@ static int Demux( demux_t *p_demux )
     block_t     *p_block;
     vlc_bool_t  b_audio = VLC_FALSE;
 
+    if( p_sys->b_hurry_up )
+    {
+         /* 3 frames */
+        p_sys->i_pcr = mdate() + (p_sys->i_dsf ? 120000 : 90000);
+    }
+
     /* Call the pace control */
     es_out_Control( p_demux->out, ES_OUT_SET_PCR, p_sys->i_pcr );
-
-    if( ( p_block = stream_Block( p_demux->s, p_sys->frame_size ) ) == NULL )
+    p_block = stream_Block( p_demux->s, p_sys->frame_size );
+    if( p_block == NULL )
     {
         /* EOF */
         return 0;
@@ -309,7 +327,10 @@ static int Demux( demux_t *p_demux )
 
     es_out_Send( p_demux->out, p_sys->p_es_video, p_block );
 
-    p_sys->i_pcr += ( I64C(1000000) / p_sys->f_rate );
+    if( !p_sys->b_hurry_up )
+    {
+        p_sys->i_pcr += ( I64C(1000000) / p_sys->f_rate );
+    }
 
     return 1;
 }
@@ -472,5 +493,3 @@ static block_t *dv_extract_audio( demux_t *p_demux,
 
     return p_block;
 }
-
-