[vlc-commits] demux: ps: seek directly on cdxa sectors

Francois Cartegnie git at videolan.org
Thu Mar 9 16:31:50 CET 2017


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Thu Mar  9 15:11:35 2017 +0100| [578cd1d8846ca88bdb661475129688ac63577398] | committer: Francois Cartegnie

demux: ps: seek directly on cdxa sectors

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

 modules/demux/mpeg/ps.c | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/modules/demux/mpeg/ps.c b/modules/demux/mpeg/ps.c
index 2ecc65d..4f9ebae 100644
--- a/modules/demux/mpeg/ps.c
+++ b/modules/demux/mpeg/ps.c
@@ -48,6 +48,8 @@
 
 #define PS_PACKET_PROBE 3
 #define CDXA_HEADER_SIZE 44
+#define CDXA_SECTOR_SIZE 2352
+#define CDXA_SECTOR_HEADER_SIZE 24
 
 /*****************************************************************************
  * Module descriptor
@@ -648,7 +650,17 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
             p_sys->i_current_pts = 0;
             p_sys->i_last_scr = -1;
 
-            i_ret = vlc_stream_Seek( p_demux->s, p_sys->i_start_byte + (int64_t)(i64 * f) );
+            if( p_sys->format == CDXA_PS )
+            {
+                i64 = (int64_t)(i64  * f); /* Align to sector payload */
+                i64 = p_sys->i_start_byte + i64 - (i64 % CDXA_SECTOR_SIZE) + CDXA_SECTOR_HEADER_SIZE;
+            }
+            else
+            {
+                i64 = p_sys->i_start_byte + (int64_t)(i64 * f);
+            }
+
+            i_ret = vlc_stream_Seek( p_demux->s, i64 );
             if( i_ret == VLC_SUCCESS )
             {
                 NotifyDiscontinuity( p_sys->tk, p_demux->out );



More information about the vlc-commits mailing list