[vlc-commits] mpeg: implement title/seekpoint controls (refs #8455)

Rémi Denis-Courmont git at videolan.org
Mon Aug 26 21:47:59 CEST 2013


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Mon Aug 26 22:26:30 2013 +0300| [49b528cd804d3da82e2bf8428eaede5770f9fd96] | committer: Rémi Denis-Courmont

mpeg: implement title/seekpoint controls (refs #8455)

This is intended for VDR directories and Video CDs.

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

 include/vlc_demux.h |   20 ++++++++++++++++++++
 include/vlc_input.h |    2 +-
 modules/demux/ps.c  |   17 +++++++++++++++++
 modules/demux/ts.c  |   17 +++++++++++++++++
 4 files changed, 55 insertions(+), 1 deletion(-)

diff --git a/include/vlc_demux.h b/include/vlc_demux.h
index 1d56db0..6bc0507 100644
--- a/include/vlc_demux.h
+++ b/include/vlc_demux.h
@@ -172,6 +172,26 @@ enum demux_query_e
 
 VLC_API int demux_vaControlHelper( stream_t *, int64_t i_start, int64_t i_end, int64_t i_bitrate, int i_align, int i_query, va_list args );
 
+static inline void demux_UpdateTitleFromStream( demux_t *demux )
+{
+    stream_t *s = demux->s;
+    unsigned title, seekpoint;
+
+    if( stream_Control( s, STREAM_GET_TITLE, &title ) == VLC_SUCCESS
+     && title != (unsigned)demux->info.i_title )
+    {
+        demux->info.i_title = title;
+        demux->info.i_update = INPUT_UPDATE_TITLE;
+    }
+
+    if( stream_Control( s, STREAM_GET_SEEKPOINT, &seekpoint ) == VLC_SUCCESS
+     && seekpoint != (unsigned)demux->info.i_seekpoint )
+    {
+        demux->info.i_seekpoint = seekpoint;
+        demux->info.i_update = INPUT_UPDATE_SEEKPOINT;
+    }
+}
+
 /*************************************************************************
  * Miscellaneous helpers for demuxers
  *************************************************************************/
diff --git a/include/vlc_input.h b/include/vlc_input.h
index 491c329..42e1388 100644
--- a/include/vlc_input.h
+++ b/include/vlc_input.h
@@ -77,7 +77,7 @@ static inline seekpoint_t *vlc_seekpoint_Duplicate( const seekpoint_t *src )
 /*****************************************************************************
  * Title:
  *****************************************************************************/
-typedef struct
+typedef struct input_title_t
 {
     char        *psz_name;
 
diff --git a/modules/demux/ps.c b/modules/demux/ps.c
index e15e5a1..7dc9aa7 100644
--- a/modules/demux/ps.c
+++ b/modules/demux/ps.c
@@ -444,6 +444,7 @@ static int Demux( demux_t *p_demux )
         break;
     }
 
+    demux_UpdateTitleFromStream( p_demux );
     return 1;
 }
 
@@ -530,6 +531,22 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
             }
             return VLC_EGENERIC;
 
+        case DEMUX_GET_TITLE_INFO:
+        {
+            struct input_title_t ***v = va_arg( args, struct input_title_t*** );
+            int *c = va_arg( args, int * );
+
+            *va_arg( args, int* ) = 0; /* Title offset */
+            *va_arg( args, int* ) = 0; /* Chapter offset */
+            return stream_Control( p_demux->s, STREAM_GET_TITLE_INFO, v, c );
+        }
+
+        case DEMUX_SET_TITLE:
+            return stream_Control( p_demux->s, STREAM_SET_TITLE, args );
+
+        case DEMUX_SET_SEEKPOINT:
+            return stream_Control( p_demux->s, STREAM_SET_SEEKPOINT, args );
+
         case DEMUX_GET_META:
             return stream_Control( p_demux->s, STREAM_GET_META, args );
 
diff --git a/modules/demux/ts.c b/modules/demux/ts.c
index 666995a..b958408 100644
--- a/modules/demux/ts.c
+++ b/modules/demux/ts.c
@@ -1019,6 +1019,7 @@ static int Demux( demux_t *p_demux )
                    p_sys->i_ts_read * p_sys->i_packet_size );
     }
 
+    demux_UpdateTitleFromStream( p_demux );
     return 1;
 }
 
@@ -1189,6 +1190,22 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
         return VLC_SUCCESS;
     }
 
+    case DEMUX_GET_TITLE_INFO:
+    {
+        struct input_title_t ***v = va_arg( args, struct input_title_t*** );
+        int *c = va_arg( args, int * );
+
+        *va_arg( args, int* ) = 0; /* Title offset */
+        *va_arg( args, int* ) = 0; /* Chapter offset */
+        return stream_Control( p_demux->s, STREAM_GET_TITLE_INFO, v, c );
+    }
+
+    case DEMUX_SET_TITLE:
+        return stream_Control( p_demux->s, STREAM_SET_TITLE, args );
+
+    case DEMUX_SET_SEEKPOINT:
+        return stream_Control( p_demux->s, STREAM_SET_SEEKPOINT, args );
+
     case DEMUX_GET_META:
         return stream_Control( p_demux->s, STREAM_GET_META, args );
 



More information about the vlc-commits mailing list