[vlc-commits] access: dvdnav: impl SET_TIME using jump_to_sector_by_time

Francois Cartegnie git at videolan.org
Fri Feb 28 16:41:16 CET 2020


vlc/vlc-3.0 | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Wed Jan 22 08:58:32 2020 +0100| [17ac618fff7c80f2d7d6ade12006fa700b0e8bc9] | committer: Francois Cartegnie

access: dvdnav: impl SET_TIME using jump_to_sector_by_time

allows resuming playback with start-time

(cherry picked from commit 59ea3e67fbc7ff5a649cc549ec512ffe55d62a51)

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

 modules/access/dvdnav.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/modules/access/dvdnav.c b/modules/access/dvdnav.c
index 7dcd4c4ec0..7fb341e3d7 100644
--- a/modules/access/dvdnav.c
+++ b/modules/access/dvdnav.c
@@ -59,6 +59,8 @@
 
 
 #include <dvdnav/dvdnav.h>
+/* Expose without patching headers */
+dvdnav_status_t dvdnav_jump_to_sector_by_time(dvdnav_t *, uint64_t, int32_t);
 
 #include "../demux/mpeg/pes.h"
 #include "../demux/mpeg/ps.h"
@@ -609,6 +611,17 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
             }
             break;
 
+        case DEMUX_SET_TIME:
+        {
+            mtime_t i_time = va_arg( args, mtime_t );
+            if( dvdnav_jump_to_sector_by_time( p_sys->dvdnav,
+                                               i_time * 9 / 100,
+                                               SEEK_SET ) == DVDNAV_STATUS_OK )
+                return VLC_SUCCESS;
+            msg_Err( p_demux, "can't set time to %" PRId64, i_time );
+            return VLC_EGENERIC;
+        }
+
         /* Special for access_demux */
         case DEMUX_CAN_PAUSE:
         case DEMUX_CAN_SEEK:



More information about the vlc-commits mailing list