]> git.sesse.net Git - vlc/blobdiff - modules/access/shm.c
Fix YV12 support in opengl output (when shader is in use).
[vlc] / modules / access / shm.c
index f98746def0decc97eb50b6f8b475dbbf8ea9303a..440a8df21908141dfe8a35c29142543f7bb75714 100644 (file)
 
 #include <stdarg.h>
 #include <fcntl.h>
-#include <sys/ipc.h>
-#include <sys/shm.h>
+#ifdef HAVE_SYS_SHM_H
+# include <sys/ipc.h>
+# include <sys/shm.h>
+#endif
 #include <sys/mman.h>
 
 #include <vlc_common.h>
 #include <vlc_fs.h>
 #include <vlc_plugin.h>
 
-#define CACHING_TEXT N_("Caching value in ms")
-#define CACHING_LONGTEXT N_( \
-    "Caching value for frame buffer capture. " \
-    "This value should be set in milliseconds.")
-
 #define FPS_TEXT N_("Frame rate")
 #define FPS_LONGTEXT N_( \
     "How many times the screen content should be refreshed per second.")
@@ -87,8 +84,6 @@ vlc_module_begin ()
     set_capability ("access_demux", 0)
     set_callbacks (Open, Close)
 
-    add_integer ("shm-caching", DEFAULT_PTS_DELAY * 1000 / CLOCK_FREQ,
-                 CACHING_TEXT, CACHING_LONGTEXT, true)
     add_float ("shm-fps", 10.0, FPS_TEXT, FPS_LONGTEXT, true)
     add_integer ("shm-width", 800, WIDTH_TEXT, WIDTH_LONGTEXT, false)
         change_integer_range (0, 65535)
@@ -105,16 +100,19 @@ vlc_module_begin ()
      * memory location via an unsafe variable rather than the URL. */
     add_string ("shm-file", NULL, FILE_TEXT, FILE_LONGTEXT, false)
         change_volatile ()
+#ifdef HAVE_SYS_SHM_H
     add_integer ("shm-id", (int64_t)IPC_PRIVATE, ID_TEXT, ID_LONGTEXT, false)
         change_volatile ()
-
+#endif
     add_shortcut ("shm")
 vlc_module_end ()
 
 static void Demux (void *);
 static int Control (demux_t *, int, va_list);
 static void map_detach (demux_sys_t *);
+#ifdef HAVE_SYS_SHM_H
 static void sysv_detach (demux_sys_t *);
+#endif
 static void no_detach (demux_sys_t *);
 
 struct demux_sys_t
@@ -198,6 +196,7 @@ static int Open (vlc_object_t *obj)
     }
     else
     {
+#ifdef HAVE_SYS_SHM_H
         int id = var_InheritInteger (demux, "shm-id");
         if (id == IPC_PRIVATE)
             goto error;
@@ -210,6 +209,9 @@ static int Open (vlc_object_t *obj)
         }
         sys->addr = mem;
         sys->detach = sysv_detach;
+#else
+        goto error;
+#endif
     }
 
     /* Initializes format */
@@ -235,8 +237,6 @@ static int Open (vlc_object_t *obj)
     sys->es = es_out_Add (demux->out, &fmt);
 
     /* Initializes demux */
-    var_Create (obj, "shm-caching", VLC_VAR_INTEGER|VLC_VAR_DOINHERIT);
-
     vlc_mutex_init (&sys->lock);
     if (vlc_timer_create (&sys->timer, Demux, demux))
         goto error;
@@ -274,11 +274,12 @@ static void map_detach (demux_sys_t *sys)
     munmap ((void *)sys->addr, sys->length);
 }
 
-
+#ifdef HAVE_SYS_SHM_H
 static void sysv_detach (demux_sys_t *sys)
 {
     shmdt (sys->addr);
 }
+#endif
 
 static void no_detach (demux_sys_t *sys)
 {
@@ -312,7 +313,7 @@ static int Control (demux_t *demux, int query, va_list args)
         case DEMUX_GET_PTS_DELAY:
         {
             int64_t *v = va_arg (args, int64_t *);
-            *v = var_GetInteger (demux, "shm-caching") * UINT64_C(1000);
+            *v = INT64_C(1000) * var_GetInteger (demux, "live-caching");
             return VLC_SUCCESS;
         }