/*****************************************************************************
* Preamble
*****************************************************************************/
-#define _GNU_SOURCE
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
#include <vlc/vlc.h>
#include <vlc_input.h>
static int i_norm_list[] =
{ VIDEO_MODE_AUTO, VIDEO_MODE_SECAM, VIDEO_MODE_PAL, VIDEO_MODE_NTSC };
-static char *psz_norm_list_text[] =
+static const char *psz_norm_list_text[] =
{ N_("Automatic"), N_("SECAM"), N_("PAL"), N_("NTSC") };
vlc_module_begin();
{ VIDEO_PALETTE_RGB555, VLC_FOURCC( 'R', 'V', '1', '5' ) },
{ VIDEO_PALETTE_RGB24, VLC_FOURCC( 'R', 'V', '2', '4' ) },
{ VIDEO_PALETTE_RGB32, VLC_FOURCC( 'R', 'V', '3', '2' ) },
- { VIDEO_PALETTE_YUV422, VLC_FOURCC( 'I', '4', '2', '2' ) },
+ { VIDEO_PALETTE_YUV422, VLC_FOURCC( 'Y', 'U', 'Y', '2' ) },
+ { VIDEO_PALETTE_YUV422, VLC_FOURCC( 'Y', 'U', 'Y', 'V' ) },
+ { VIDEO_PALETTE_YUYV, VLC_FOURCC( 'Y', 'U', 'Y', '2' ) },
{ VIDEO_PALETTE_YUYV, VLC_FOURCC( 'Y', 'U', 'Y', 'V' ) },
{ VIDEO_PALETTE_UYVY, VLC_FOURCC( 'U', 'Y', 'V', 'Y' ) },
{ VIDEO_PALETTE_YUV420, VLC_FOURCC( 'I', '4', '2', 'N' ) },
}
else if( !strncmp( psz_parser, "hue=", strlen( "hue=" ) ) )
{
- p_sys->i_hue = strtol( psz_parser + strlen( "hue=" ),
+ p_sys->i_hue = strtol( psz_parser + strlen( "hue=" ),
&psz_parser, 0 );
}
else if( !strncmp( psz_parser, "contrast=", strlen( "contrast=" ) ) )
if( ( i_fd = open( psz_device, O_RDWR ) ) < 0 )
{
- msg_Err( p_demux, "cannot open device (%s)", strerror( errno ) );
+ msg_Err( p_demux, "cannot open device (%m)" );
goto vdev_failed;
}
if( ioctl( i_fd, VIDIOCGCAP, &p_sys->vid_cap ) < 0 )
{
- msg_Err( p_demux, "cannot get capabilities (%s)", strerror( errno ) );
+ msg_Err( p_demux, "cannot get capabilities (%m)" );
goto vdev_failed;
}
vid_channel.channel = p_sys->i_channel;
if( ioctl( i_fd, VIDIOCGCHAN, &vid_channel ) < 0 )
{
- msg_Err( p_demux, "cannot get channel infos (%s)",
- strerror( errno ) );
+ msg_Err( p_demux, "cannot get channel infos (%m)" );
goto vdev_failed;
}
msg_Dbg( p_demux,
vid_channel.norm = p_sys->i_norm;
if( ioctl( i_fd, VIDIOCSCHAN, &vid_channel ) < 0 )
{
- msg_Err( p_demux, "cannot set channel (%s)", strerror( errno ) );
+ msg_Err( p_demux, "cannot set channel (%m)" );
goto vdev_failed;
}
vid_tuner.tuner = p_sys->i_tuner;
if( ioctl( i_fd, VIDIOCGTUNER, &vid_tuner ) < 0 )
{
- msg_Err( p_demux, "cannot get tuner (%s)", strerror( errno ) );
+ msg_Err( p_demux, "cannot get tuner (%m)" );
goto vdev_failed;
}
msg_Dbg( p_demux, "tuner %s low=%d high=%d, flags=0x%x "
//vid_tuner.mode = p_sys->i_norm;
if( ioctl( i_fd, VIDIOCSTUNER, &vid_tuner ) < 0 )
{
- msg_Err( p_demux, "cannot set tuner (%s)", strerror( errno ) );
+ msg_Err( p_demux, "cannot set tuner (%m)" );
goto vdev_failed;
}
}
int driver_frequency = p_sys->i_frequency * 16 /1000;
if( ioctl( i_fd, VIDIOCSFREQ, &driver_frequency ) < 0 )
{
- msg_Err( p_demux, "cannot set frequency (%s)",
- strerror( errno ) );
+ msg_Err( p_demux, "cannot set frequency (%m)" );
goto vdev_failed;
}
msg_Dbg( p_demux, "frequency %d (%d)", p_sys->i_frequency,
vid_audio.audio = p_sys->i_audio;
if( ioctl( i_fd, VIDIOCGAUDIO, &vid_audio ) < 0 )
{
- msg_Err( p_demux, "cannot get audio (%s)", strerror( errno ) );
+ msg_Err( p_demux, "cannot get audio (%m)" );
goto vdev_failed;
}
if( ioctl( i_fd, VIDIOCSAUDIO, &vid_audio ) < 0 )
{
- msg_Err( p_demux, "cannot set audio (%s)", strerror( errno ) );
+ msg_Err( p_demux, "cannot set audio (%m)" );
goto vdev_failed;
}
}
if( ioctl( i_fd, MJPIOC_G_PARAMS, &mjpeg ) < 0 )
{
- msg_Err( p_demux, "cannot get mjpeg params (%s)",
- strerror( errno ) );
+ msg_Err( p_demux, "cannot get mjpeg params (%m)" );
goto vdev_failed;
}
mjpeg.input = p_sys->i_channel;
if( ioctl( i_fd, MJPIOC_S_PARAMS, &mjpeg ) < 0 )
{
- msg_Err( p_demux, "cannot set mjpeg params (%s)",
- strerror( errno ) );
+ msg_Err( p_demux, "cannot set mjpeg params (%m)" );
goto vdev_failed;
}
if( ioctl( i_fd, VIDIOCGWIN, &vid_win ) < 0 )
{
- msg_Err( p_demux, "cannot get win (%s)", strerror( errno ) );
+ msg_Err( p_demux, "cannot get win (%m)" );
goto vdev_failed;
}
p_sys->i_width = vid_win.width;
char *psz;
int i;
- vid_picture.palette = 0;
p_sys->i_fourcc = 0;
psz = var_CreateGetString( p_demux, "v4l-chroma" );
if( strlen( psz ) >= 4 )
{
+ vid_picture.palette = 0;
int i_chroma = VLC_FOURCC( psz[0], psz[1], psz[2], psz[3] );
/* Find out v4l chroma code */
if( (i_fd = open( psz_device, O_RDONLY | O_NONBLOCK )) < 0 )
{
- msg_Err( p_demux, "cannot open audio device (%s)", strerror( errno ) );
+ msg_Err( p_demux, "cannot open audio device (%m)" );
goto adev_fail;
}
|| i_format != AFMT_S16_LE )
{
msg_Err( p_demux, "cannot set audio format (16b little endian) "
- "(%s)", strerror( errno ) );
+ "(%m)" );
goto adev_fail;
}
if( ioctl( i_fd, SNDCTL_DSP_STEREO,
&p_sys->b_stereo ) < 0 )
{
- msg_Err( p_demux, "cannot set audio channels count (%s)",
- strerror( errno ) );
+ msg_Err( p_demux, "cannot set audio channels count (%m)" );
goto adev_fail;
}
if( ioctl( i_fd, SNDCTL_DSP_SPEED,
&p_sys->i_sample_rate ) < 0 )
{
- msg_Err( p_demux, "cannot set audio sample rate (%s)",
- strerror( errno ) );
+ msg_Err( p_demux, "cannot set audio sample rate (%m)" );
goto adev_fail;
}
while( ioctl(p_sys->fd_video, VIDIOCSYNC, &p_sys->i_frame_pos) < 0 )
{
- if( errno != EAGAIN && errno != EINTR )
+ if( errno != EAGAIN && errno != EINTR )
{
msg_Err( p_demux, "failed syncing new frame" );
return NULL;
/* sync on the next frame */
while( ioctl( p_sys->fd_video, MJPIOC_SYNC, &sync ) < 0 )
{
- if( errno != EAGAIN && errno != EINTR )
+ if( errno != EAGAIN && errno != EINTR )
{
msg_Err( p_demux, "failed syncing new frame" );
return NULL;