[vlc-commits] Ogg: parse and create Vorbis Comment Chapter Extension seekpoints

Jean-Baptiste Kempf git at videolan.org
Thu Dec 6 12:25:54 CET 2012


vlc | branch: master | Jean-Baptiste Kempf <jb at videolan.org> | Thu Dec  6 12:22:05 2012 +0100| [cab4efd532bb656b5bc7dc85f557179bf0a908a0] | committer: Jean-Baptiste Kempf

Ogg: parse and create Vorbis Comment Chapter Extension seekpoints

This does not actually seek to the right position yet
Ref #6895

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

 modules/demux/ogg.c    |   40 ++++++++++++++++++++++++++++++++++++++++
 modules/demux/vorbis.h |    4 +++-
 2 files changed, 43 insertions(+), 1 deletion(-)

diff --git a/modules/demux/ogg.c b/modules/demux/ogg.c
index ce66263..52bf76b 100644
--- a/modules/demux/ogg.c
+++ b/modules/demux/ogg.c
@@ -510,6 +510,41 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
             *pi64 = p_sys->i_length * 1000000;
             return VLC_SUCCESS;
 
+        case DEMUX_GET_TITLE_INFO:
+        {
+            input_title_t ***ppp_title = (input_title_t***)va_arg( args, input_title_t*** );
+            int *pi_int    = (int*)va_arg( args, int* );
+            int *pi_title_offset = (int*)va_arg( args, int* );
+            int *pi_seekpoint_offset = (int*)va_arg( args, int* );
+
+            if( p_sys->i_seekpoints > 0 )
+            {
+                *pi_int = 1;
+                *ppp_title = malloc( sizeof( input_title_t**) );
+                input_title_t *p_title = (*ppp_title)[0] = vlc_input_title_New();
+                for( int i = 0; i < p_sys->i_seekpoints; i++ )
+                {
+                    TAB_APPEND( p_title->i_seekpoint, p_title->seekpoint, p_sys->pp_seekpoints[i] );
+                }
+                *pi_title_offset = 0;
+                *pi_seekpoint_offset = 0;
+            }
+            return VLC_SUCCESS;
+        }
+        case DEMUX_SET_TITLE:
+        {
+            const int i_title = (int)va_arg( args, int );
+            if( i_title > 1 )
+                return VLC_EGENERIC;
+            return VLC_SUCCESS;
+        }
+        case DEMUX_SET_SEEKPOINT:
+        {
+            const int i_seekpoint = (int)va_arg( args, int );
+            if( i_seekpoint > p_sys->i_seekpoints )
+                return VLC_EGENERIC;
+            return VLC_EGENERIC;// Seek( p_demux, p_sys->pp_seekpoints[i_seekpoint]->i_time_offset );
+        }
 
         default:
             return demux_vaControlHelper( p_demux->s, 0, -1, p_sys->i_bitrate,
@@ -1789,6 +1824,11 @@ static void Ogg_ExtractXiphMeta( demux_t *p_demux, const void *p_headers, unsign
                              &p_ogg->i_attachments, &p_ogg->attachments,
                              &p_ogg->i_seekpoints, &p_ogg->pp_seekpoints );
 
+    if( p_ogg->i_seekpoints > 1 )
+    {
+        p_demux->info.i_update |= INPUT_UPDATE_TITLE_LIST;
+    }
+
     for( unsigned i = 0; i < i_count; i++ )
         free( pp_data[i] );
 }
diff --git a/modules/demux/vorbis.h b/modules/demux/vorbis.h
index 1fec373..2642c4b 100644
--- a/modules/demux/vorbis.h
+++ b/modules/demux/vorbis.h
@@ -79,6 +79,7 @@ static inline void vorbis_ParseComment( vlc_meta_t **pp_meta,
     int n;
     int i_comment;
     int i_attach = 0;
+    seekpoint_t *sk = NULL;
 
     if( i_data < 8 )
         return;
@@ -198,6 +199,7 @@ static inline void vorbis_ParseComment( vlc_meta_t **pp_meta,
             {
                 char *p = strchr( psz_comment, '=' );
                 *p++ = '\0';
+                sk->psz_name = strdup( p );
             }
             else if( sscanf( psz_comment, "chapter %i=", &i_chapt ) == 1 )
             {
@@ -207,7 +209,7 @@ static inline void vorbis_ParseComment( vlc_meta_t **pp_meta,
 
                 if( sscanf( p, "%d:%d:%d.%d", &h, &m, &s, &ms ) == 4 )
                 {
-                    seekpoint_t *sk = vlc_seekpoint_New();
+                    sk = vlc_seekpoint_New();
                     sk->i_time_offset = ((h * 3600 + m * 60 + s) *1000 + ms) * 1000;
                     TAB_APPEND_CAST( (seekpoint_t**), *i_seekpoint, *ppp_seekpoint, sk );
                 }



More information about the vlc-commits mailing list