[vlc-commits] shm: cannot be paused

Rémi Denis-Courmont git at videolan.org
Sun Nov 25 10:56:46 CET 2012


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sun Nov 25 11:54:15 2012 +0200| [823a433bb1e81ab8c20f7ae443400427d6d2575a] | committer: Rémi Denis-Courmont

shm: cannot be paused

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

 modules/access/Modules.am |    2 +-
 modules/access/shm.c      |   29 ++++++++---------------------
 2 files changed, 9 insertions(+), 22 deletions(-)

diff --git a/modules/access/Modules.am b/modules/access/Modules.am
index 3f0c337..c04485d 100644
--- a/modules/access/Modules.am
+++ b/modules/access/Modules.am
@@ -121,7 +121,7 @@ endif
 
 libshm_plugin_la_SOURCES = shm.c
 libshm_plugin_la_CFLAGS = $(AM_CFLAGS)
-libshm_plugin_la_LIBADD = $(AM_LIBADD)
+libshm_plugin_la_LIBADD = $(AM_LIBADD) $(LIBM)
 libvlc_LTLIBRARIES += libshm_plugin.la
 
 libv4l2_plugin_la_SOURCES = \
diff --git a/modules/access/shm.c b/modules/access/shm.c
index 20adf14..61f7c33 100644
--- a/modules/access/shm.c
+++ b/modules/access/shm.c
@@ -25,6 +25,7 @@
 #endif
 
 #include <stdarg.h>
+#include <math.h>
 #include <fcntl.h>
 #ifdef HAVE_SYS_SHM_H
 # include <sys/ipc.h>
@@ -128,7 +129,6 @@ struct demux_sys_t
         } mem;
     };
     es_out_id_t *es;
-    mtime_t      interval;
     vlc_timer_t  timer;
     void (*detach) (demux_sys_t *);
 };
@@ -211,8 +211,8 @@ static int Open (vlc_object_t *obj)
     if (rate <= 0.)
         goto error;
 
-    sys->interval = (float)CLOCK_FREQ / rate;
-    if (!sys->interval)
+    mtime_t interval = llroundf((float)CLOCK_FREQ / rate);
+    if (!interval)
         goto error;
 
     es_format_t fmt;
@@ -230,7 +230,7 @@ static int Open (vlc_object_t *obj)
     /* Initializes demux */
     if (vlc_timer_create (&sys->timer, Demux, demux))
         goto error;
-    vlc_timer_schedule (sys->timer, false, 1, sys->interval);
+    vlc_timer_schedule (sys->timer, false, 1, interval);
 
     demux->p_sys = sys;
     demux->pf_demux   = NULL;
@@ -267,8 +267,6 @@ static void no_detach (demux_sys_t *sys)
  */
 static int Control (demux_t *demux, int query, va_list args)
 {
-    demux_sys_t *sys = demux->p_sys;
-
     switch (query)
     {
         case DEMUX_GET_POSITION:
@@ -294,28 +292,17 @@ static int Control (demux_t *demux, int query, va_list args)
         }
 
         case DEMUX_CAN_PAUSE:
-        {
-            bool *v = (bool *)va_arg (args, bool *);
-            *v = true;
-            return VLC_SUCCESS;
-        }
-
-        case DEMUX_SET_PAUSE_STATE:
-        {
-            bool pausing = va_arg (args, int);
-
-            vlc_timer_schedule (sys->timer, false, !pausing, sys->interval);
-            return VLC_SUCCESS;
-        }
-
         case DEMUX_CAN_CONTROL_PACE:
         case DEMUX_CAN_CONTROL_RATE:
         case DEMUX_CAN_SEEK:
         {
-            bool *v = (bool *)va_arg (args, bool *);
+            bool *v = va_arg (args, bool *);
             *v = false;
             return VLC_SUCCESS;
         }
+
+        case DEMUX_SET_PAUSE_STATE:
+            return VLC_SUCCESS; /* should not happen */
     }
 
     return VLC_EGENERIC;



More information about the vlc-commits mailing list