[vlc-commits] commit: Allow demux to select the PTS delay, fallback to access ( Rémi Denis-Courmont )

git at videolan.org git at videolan.org
Wed Nov 17 22:42:34 CET 2010


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Wed Nov 17 23:40:36 2010 +0200| [991aa6aaeed4212f8155bda43fdccbd6b0cc4e9f] | committer: Rémi Denis-Courmont 

Allow demux to select the PTS delay, fallback to access

This will allow the SDP parsers to set their PTS delay according
to rtsp-caching/rtp-caching rather than the caching value of the
access module. The access module is irrelevant in that particular
case.

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

 modules/demux/mp4/mp4.c  |    1 +
 modules/demux/subtitle.c |    1 +
 modules/demux/vobsub.c   |    1 +
 src/input/demux.c        |    1 +
 src/input/input.c        |   28 ++++++++++++++++++----------
 5 files changed, 22 insertions(+), 10 deletions(-)

diff --git a/modules/demux/mp4/mp4.c b/modules/demux/mp4/mp4.c
index 0527d2a..04854f8 100644
--- a/modules/demux/mp4/mp4.c
+++ b/modules/demux/mp4/mp4.c
@@ -1019,6 +1019,7 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
         case DEMUX_SET_GROUP:
         case DEMUX_HAS_UNSUPPORTED_META:
         case DEMUX_GET_ATTACHMENTS:
+        case DEMUX_GET_PTS_DELAY:
             return VLC_EGENERIC;
 
         default:
diff --git a/modules/demux/subtitle.c b/modules/demux/subtitle.c
index e46c836..f0f7e03 100644
--- a/modules/demux/subtitle.c
+++ b/modules/demux/subtitle.c
@@ -636,6 +636,7 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
             p_sys->i_next_demux_date = (int64_t)va_arg( args, int64_t );
             return VLC_SUCCESS;
 
+        case DEMUX_GET_PTS_DELAY:
         case DEMUX_GET_FPS:
         case DEMUX_GET_META:
         case DEMUX_GET_ATTACHMENTS:
diff --git a/modules/demux/vobsub.c b/modules/demux/vobsub.c
index 2082842..e999096 100644
--- a/modules/demux/vobsub.c
+++ b/modules/demux/vobsub.c
@@ -329,6 +329,7 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
             p_sys->i_next_demux_date = (int64_t)va_arg( args, int64_t );
             return VLC_SUCCESS;
 
+        case DEMUX_GET_PTS_DELAY:
         case DEMUX_GET_FPS:
         case DEMUX_GET_META:
         case DEMUX_GET_TITLE_INFO:
diff --git a/src/input/demux.c b/src/input/demux.c
index 049645e..b0d7dae 100644
--- a/src/input/demux.c
+++ b/src/input/demux.c
@@ -312,6 +312,7 @@ int demux_vaControlHelper( stream_t *s,
             }
             return VLC_EGENERIC;
 
+        case DEMUX_GET_PTS_DELAY:
         case DEMUX_GET_FPS:
         case DEMUX_GET_META:
         case DEMUX_HAS_UNSUPPORTED_META:
diff --git a/src/input/input.c b/src/input/input.c
index b827753..8a0e070 100644
--- a/src/input/input.c
+++ b/src/input/input.c
@@ -2388,12 +2388,6 @@ static int InputSourceInit( input_thread_t *p_input,
     if( in->p_demux )
     {
         /* Get infos from access_demux */
-        int i_ret = demux_Control( in->p_demux,
-                                   DEMUX_GET_PTS_DELAY, &in->i_pts_delay );
-        assert( !i_ret );
-        in->i_pts_delay = __MAX( 0, __MIN( in->i_pts_delay, INPUT_PTS_DELAY_MAX ) );
-
-
         in->b_title_demux = true;
         if( demux_Control( in->p_demux, DEMUX_GET_TITLE_INFO,
                             &in->title, &in->i_title,
@@ -2454,9 +2448,6 @@ static int InputSourceInit( input_thread_t *p_input,
         if( !p_input->b_preparsing )
         {
             bool b_can_seek;
-            access_Control( in->p_access,
-                             ACCESS_GET_PTS_DELAY, &in->i_pts_delay );
-            in->i_pts_delay = __MAX( 0, __MIN( in->i_pts_delay, INPUT_PTS_DELAY_MAX ) );
 
             in->b_title_demux = false;
             if( access_Control( in->p_access, ACCESS_GET_TITLE_INFO,
@@ -2603,7 +2594,7 @@ static int InputSourceInit( input_thread_t *p_input,
 
     /* get attachment
      * FIXME improve for b_preparsing: move it after GET_META and check psz_arturl */
-    if( 1 || !p_input->b_preparsing )
+    if( !p_input->b_preparsing )
     {
         int i_attachment;
         input_attachment_t **attachment;
@@ -2615,7 +2606,24 @@ static int InputSourceInit( input_thread_t *p_input,
                               i_attachment, attachment );
             vlc_mutex_unlock( &p_input->p->p_item->lock );
         }
+
+        /* PTS delay: request from demux first. This is required for
+         * access_demux and some special cases like SDP demux. Otherwise,
+         * fallback to access */
+        if( demux_Control( in->p_demux, DEMUX_GET_PTS_DELAY,
+                           &in->i_pts_delay ) )
+        {
+            /* GET_PTS_DELAY is mandatory for access_demux */
+            assert( in->p_access );
+            access_Control( in->p_access,
+                            ACCESS_GET_PTS_DELAY, &in->i_pts_delay );
+        }
+        if( in->i_pts_delay > INPUT_PTS_DELAY_MAX )
+            in->i_pts_delay = INPUT_PTS_DELAY_MAX;
+        else if( in->i_pts_delay < 0 )
+            in->i_pts_delay = 0;
     }
+
     if( !demux_Control( in->p_demux, DEMUX_GET_FPS, &f_fps ) && f_fps > 0.0 )
     {
         vlc_mutex_lock( &p_input->p->p_item->lock );



More information about the vlc-commits mailing list