[vlc-commits] SHM: add proper support for XWD frame buffers (fixes #7608)

Rémi Denis-Courmont git at videolan.org
Sun Nov 25 11:16:52 CET 2012


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sun Nov 25 12:07:40 2012 +0200| [7662ed1978dea618b8bbebd5723dd808aaf46a31] | committer: Rémi Denis-Courmont

SHM: add proper support for XWD frame buffers (fixes #7608)

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

 modules/access/shm.c |   32 ++++++++++++++++++++------------
 1 file changed, 20 insertions(+), 12 deletions(-)

diff --git a/modules/access/shm.c b/modules/access/shm.c
index 61f7c33..c511de5 100644
--- a/modules/access/shm.c
+++ b/modules/access/shm.c
@@ -41,17 +41,17 @@
 #define FPS_LONGTEXT N_( \
     "How many times the screen content should be refreshed per second.")
 
+#define DEPTH_TEXT N_("Frame buffer depth")
+#define DEPTH_LONGTEXT N_( \
+    "Pixel depth of the frame buffer, or zero for XWD file")
+
 #define WIDTH_TEXT N_("Frame buffer width")
 #define WIDTH_LONGTEXT N_( \
-    "Pixel width of the frame buffer")
+    "Pixel width of the frame buffer (ignored for XWD file)")
 
 #define HEIGHT_TEXT N_("Frame buffer height")
 #define HEIGHT_LONGTEXT N_( \
-    "Pixel height of the frame buffer")
-
-#define DEPTH_TEXT N_("Frame buffer depth")
-#define DEPTH_LONGTEXT N_( \
-    "Pixel depth of the frame buffer")
+    "Pixel height of the frame buffer (ignored for XWD file)")
 
 #define ID_TEXT N_("Frame buffer segment ID")
 #define ID_LONGTEXT N_( \
@@ -66,10 +66,11 @@ static int  Open (vlc_object_t *);
 static void Close (vlc_object_t *);
 
 static const int depths[] = {
-    8, 15, 16, 24, 32,
+    0, 8, 15, 16, 24, 32,
 };
 
 static const char *const depth_texts[] = {
+    N_("XWD file (autodetect)"),
     N_("8 bits"), N_("15 bits"), N_("16 bits"), N_("24 bits"), N_("32 bits"),
 };
 
@@ -85,15 +86,15 @@ vlc_module_begin ()
     set_callbacks (Open, Close)
 
     add_float ("shm-fps", 10.0, FPS_TEXT, FPS_LONGTEXT, true)
+    add_integer ("shm-depth", 0, DEPTH_TEXT, DEPTH_LONGTEXT, true)
+        change_integer_list (depths, depth_texts)
+        change_safe ()
     add_integer ("shm-width", 800, WIDTH_TEXT, WIDTH_LONGTEXT, false)
         change_integer_range (0, 65535)
         change_safe ()
     add_integer ("shm-height", 480, HEIGHT_TEXT, HEIGHT_LONGTEXT, false)
         change_integer_range (0, 65535)
         change_safe ()
-    add_integer ("shm-depth", 32, DEPTH_TEXT, DEPTH_LONGTEXT, true)
-        change_integer_list (depths, depth_texts)
-        change_safe ()
 
     /* We need to "trust" the memory segment. If it were shrunk while we copy
      * its content our process may crash - or worse. So we pass the shared
@@ -141,9 +142,8 @@ static int Open (vlc_object_t *obj)
         return VLC_ENOMEM;
     sys->detach = no_detach;
 
-    uint16_t width = var_InheritInteger (demux, "shm-width");
-    uint16_t height = var_InheritInteger (demux, "shm-height");
     uint32_t chroma;
+    uint16_t width = 0, height = 0;
     uint8_t bpp;
     switch (var_InheritInteger (demux, "shm-depth"))
     {
@@ -162,9 +162,17 @@ static int Open (vlc_object_t *obj)
         case 8:
             chroma = VLC_CODEC_RGB8; bpp = 8;
             break;
+        case 0:
+            chroma = VLC_CODEC_XWD; bpp = 0;
+            break;
         default:
             goto error;
     }
+    if (bpp != 0)
+    {
+        width = var_InheritInteger (demux, "shm-width");
+        height = var_InheritInteger (demux, "shm-height");
+    }
 
     static void (*Demux) (void *);
 



More information about the vlc-commits mailing list