]> git.sesse.net Git - vlc/blobdiff - modules/access/v4l.c
objects: vlc_object_yield() returns the same object type.
[vlc] / modules / access / v4l.c
index 67172dbb66084a8f9e64ee8682b64c384a0ebc8f..eaa73b0f3631710b05dd622b346109a1825b8ee1 100644 (file)
@@ -32,7 +32,8 @@
 # include "config.h"
 #endif
 
-#include <vlc/vlc.h>
+#include <vlc_common.h>
+#include <vlc_plugin.h>
 #include <vlc_input.h>
 #include <vlc_demux.h>
 #include <vlc_access.h>
@@ -140,14 +141,14 @@ 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 *psz_norm_list_text[] =
+static const char *const psz_norm_list_text[] =
     { N_("Automatic"), N_("SECAM"), N_("PAL"),  N_("NTSC") };
 
 vlc_module_begin();
-    set_shortname( _("Video4Linux") );
-    set_description( _("Video4Linux input") );
+    set_shortname( N_("Video4Linux") );
+    set_description( N_("Video4Linux input") );
     set_category( CAT_INPUT );
     set_subcategory( SUBCAT_INPUT_ACCESS );
 
@@ -167,7 +168,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 );
@@ -224,7 +225,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;
@@ -502,12 +503,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",
@@ -1415,7 +1428,7 @@ static block_t *GrabAudio( demux_t *p_demux )
     }
 
     p_block->i_pts = p_block->i_dts =
-        mdate() - I64C(1000000) * (mtime_t)i_correct /
+        mdate() - INT64_C(1000000) * (mtime_t)i_correct /
         2 / ( p_sys->b_stereo ? 2 : 1) / p_sys->i_sample_rate;
 
     return p_block;
@@ -1439,7 +1452,7 @@ static uint8_t *GrabCapture( demux_t *p_demux )
             return NULL;
         }
 
-        if( p_demux->b_die )
+        if( !vlc_object_alive (p_demux) )
         {
             return NULL;
         }