]> git.sesse.net Git - vlc/blobdiff - modules/access/v4l.c
dshow: try to improve multithreading code for RAW sample grabbing
[vlc] / modules / access / v4l.c
index 9709f0070a750903ebe7182c67e804908dfeaa13..d54bcd40e8e175c36dd8da9a3b17f27ae87c821f 100644 (file)
@@ -47,6 +47,7 @@
 #include <sys/mman.h>
 #include <errno.h>
 #include <fcntl.h>
+#include <arpa/inet.h>
 
 /* From GStreamer's v4l plugin:
  * Because of some really cool feature in video4linux1, also known as
@@ -141,7 +142,7 @@ static void Close( vlc_object_t * );
 #define FPS_LONGTEXT N_( "Framerate to capture, if applicable " \
     "(-1 for autodetect)." )
 
-static int i_norm_list[] =
+static const int i_norm_list[] =
     { VIDEO_MODE_AUTO, VIDEO_MODE_SECAM, VIDEO_MODE_PAL, VIDEO_MODE_NTSC };
 static const char *const psz_norm_list_text[] =
     { N_("Automatic"), N_("SECAM"), N_("PAL"),  N_("NTSC") };
@@ -168,7 +169,7 @@ vlc_module_begin();
     add_integer( "v4l-tuner", -1, NULL, TUNER_TEXT, TUNER_LONGTEXT, true );
     add_integer( "v4l-norm", VIDEO_MODE_AUTO, NULL, NORM_TEXT, NORM_LONGTEXT,
                 false );
-        change_integer_list( i_norm_list, psz_norm_list_text, 0 );
+        change_integer_list( i_norm_list, psz_norm_list_text, NULL );
     add_integer( "v4l-frequency", -1, NULL, FREQUENCY_TEXT, FREQUENCY_LONGTEXT,
                 false );
     add_integer( "v4l-audio", -1, NULL, AUDIO_TEXT, AUDIO_LONGTEXT, true );
@@ -225,7 +226,7 @@ struct quicktime_mjpeg_app1
     uint32_t    i_data_offset;          /* following SOS marker data */
 };
 
-static struct
+static const struct
 {
     int i_v4l;
     int i_fourcc;
@@ -503,12 +504,24 @@ static int Open( vlc_object_t *p_this )
         fmt.video.i_aspect = 4 * VOUT_ASPECT_FACTOR / 3;
 
         /* Setup rgb mask for RGB formats */
-        if( p_sys->i_fourcc == VLC_FOURCC('R','V','2','4') )
+        switch( p_sys->i_fourcc )
         {
-            /* This is in BGR format */
-            fmt.video.i_bmask = 0x00ff0000;
-            fmt.video.i_gmask = 0x0000ff00;
-            fmt.video.i_rmask = 0x000000ff;
+            case VLC_FOURCC('R','V','1','5'):
+                fmt.video.i_rmask = 0x001f;
+                fmt.video.i_gmask = 0x03e0;
+                fmt.video.i_bmask = 0x7c00;
+                break;
+            case VLC_FOURCC('R','V','1','6'):
+                fmt.video.i_rmask = 0x001f;
+                fmt.video.i_gmask = 0x07e0;
+                fmt.video.i_bmask = 0xf800;
+                break;
+            case VLC_FOURCC('R','V','2','4'):
+            case VLC_FOURCC('R','V','3','2'):
+                fmt.video.i_rmask = 0x00ff0000;
+                fmt.video.i_gmask = 0x0000ff00;
+                fmt.video.i_bmask = 0x000000ff;
+                break;
         }
 
         msg_Dbg( p_demux, "added new video es %4.4s %dx%d",
@@ -1440,7 +1453,7 @@ static uint8_t *GrabCapture( demux_t *p_demux )
             return NULL;
         }
 
-        if( p_demux->b_die )
+        if( !vlc_object_alive (p_demux) )
         {
             return NULL;
         }