Commit d9964088 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

V4L: use vlc_strerror_c()

parent 983ca412
...@@ -123,7 +123,8 @@ int InitVideo (access_t *access, int fd, uint32_t caps) ...@@ -123,7 +123,8 @@ int InitVideo (access_t *access, int fd, uint32_t caps)
struct v4l2_format fmt = { .type = V4L2_BUF_TYPE_VIDEO_CAPTURE }; struct v4l2_format fmt = { .type = V4L2_BUF_TYPE_VIDEO_CAPTURE };
if (v4l2_ioctl (fd, VIDIOC_G_FMT, &fmt) < 0) if (v4l2_ioctl (fd, VIDIOC_G_FMT, &fmt) < 0)
{ {
msg_Err (access, "cannot get default format: %m"); msg_Err (access, "cannot get default format: %s",
vlc_strerror_c(errno));
return -1; return -1;
} }
pixfmt = fmt.fmt.pix.pixelformat; pixfmt = fmt.fmt.pix.pixelformat;
...@@ -210,7 +211,7 @@ static int AccessPoll (access_t *access) ...@@ -210,7 +211,7 @@ static int AccessPoll (access_t *access)
case 0: case 0:
/* FIXME: kill this case (arbitrary timeout) */ /* FIXME: kill this case (arbitrary timeout) */
return -1; return -1;
msg_Err (access, "poll error: %m"); msg_Err (access, "poll error: %s", vlc_strerror_c(errno));
access->info.b_eof = true; access->info.b_eof = true;
return -1; return -1;
} }
...@@ -249,7 +250,7 @@ static block_t *ReadBlock (access_t *access) ...@@ -249,7 +250,7 @@ static block_t *ReadBlock (access_t *access)
if (val < 0) if (val < 0)
{ {
block_Release (block); block_Release (block);
msg_Err (access, "cannot read buffer: %m"); msg_Err (access, "cannot read buffer: %s", vlc_strerror_c(errno));
access->info.b_eof = true; access->info.b_eof = true;
return NULL; return NULL;
} }
......
...@@ -30,6 +30,7 @@ ...@@ -30,6 +30,7 @@
#include <stdio.h> #include <stdio.h>
#include <ctype.h> #include <ctype.h>
#include <assert.h> #include <assert.h>
#include <errno.h>
#include <sys/ioctl.h> #include <sys/ioctl.h>
#include <vlc_common.h> #include <vlc_common.h>
...@@ -176,7 +177,7 @@ static int ControlSetCallback (vlc_object_t *obj, const char *var, ...@@ -176,7 +177,7 @@ static int ControlSetCallback (vlc_object_t *obj, const char *var,
if (ret) if (ret)
{ {
msg_Err (obj, "cannot set control %s: %m", var); msg_Err (obj, "cannot set control %s: %s", var, vlc_strerror_c(errno));
return VLC_EGENERIC; return VLC_EGENERIC;
} }
(void) old; (void) old;
......
...@@ -503,7 +503,8 @@ static block_t *UserPtrQueue (vlc_object_t *obj, int fd, size_t length) ...@@ -503,7 +503,8 @@ static block_t *UserPtrQueue (vlc_object_t *obj, int fd, size_t length)
MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
if (ptr == MAP_FAILED) if (ptr == MAP_FAILED)
{ {
msg_Err (obj, "cannot allocate %zu-bytes buffer: %m", length); msg_Err (obj, "cannot allocate %zu-bytes buffer: %s", length,
vlc_strerror_c(errno));
return NULL; return NULL;
} }
...@@ -525,7 +526,7 @@ static block_t *UserPtrQueue (vlc_object_t *obj, int fd, size_t length) ...@@ -525,7 +526,7 @@ static block_t *UserPtrQueue (vlc_object_t *obj, int fd, size_t length)
if (v4l2_ioctl (fd, VIDIOC_QBUF, &buf) < 0) if (v4l2_ioctl (fd, VIDIOC_QBUF, &buf) < 0)
{ {
msg_Err (obj, "cannot queue buffer: %m"); msg_Err (obj, "cannot queue buffer: %s", vlc_strerror_c(errno));
block_Release (block); block_Release (block);
return NULL; return NULL;
} }
...@@ -559,13 +560,14 @@ static void *UserPtrThread (void *data) ...@@ -559,13 +560,14 @@ static void *UserPtrThread (void *data)
block_cleanup_push (block); block_cleanup_push (block);
while (poll (ufd, numfds, -1) == -1) while (poll (ufd, numfds, -1) == -1)
if (errno != EINTR) if (errno != EINTR)
msg_Err (demux, "poll error: %m"); msg_Err (demux, "poll error: %s", vlc_strerror_c(errno));
vlc_cleanup_pop (); vlc_cleanup_pop ();
canc = vlc_savecancel (); canc = vlc_savecancel ();
if (v4l2_ioctl (fd, VIDIOC_DQBUF, &buf) < 0) if (v4l2_ioctl (fd, VIDIOC_DQBUF, &buf) < 0)
{ {
msg_Err (demux, "cannot dequeue buffer: %m"); msg_Err (demux, "cannot dequeue buffer: %s",
vlc_strerror_c(errno));
block_Release (block); block_Release (block);
continue; continue;
} }
...@@ -607,7 +609,7 @@ static void *MmapThread (void *data) ...@@ -607,7 +609,7 @@ static void *MmapThread (void *data)
if (poll (ufd, numfds, -1) == -1) if (poll (ufd, numfds, -1) == -1)
{ {
if (errno != EINTR) if (errno != EINTR)
msg_Err (demux, "poll error: %m"); msg_Err (demux, "poll error: %s", vlc_strerror_c(errno));
continue; continue;
} }
...@@ -658,7 +660,7 @@ static void *ReadThread (void *data) ...@@ -658,7 +660,7 @@ static void *ReadThread (void *data)
if (poll (ufd, numfds, -1) == -1) if (poll (ufd, numfds, -1) == -1)
{ {
if (errno != EINTR) if (errno != EINTR)
msg_Err (demux, "poll error: %m"); msg_Err (demux, "poll error: %s", vlc_strerror_c(errno));
continue; continue;
} }
...@@ -667,7 +669,7 @@ static void *ReadThread (void *data) ...@@ -667,7 +669,7 @@ static void *ReadThread (void *data)
block_t *block = block_Alloc (sys->blocksize); block_t *block = block_Alloc (sys->blocksize);
if (unlikely(block == NULL)) if (unlikely(block == NULL))
{ {
msg_Err (demux, "read error: %m"); msg_Err (demux, "read error: %s", vlc_strerror_c(errno));
v4l2_read (fd, NULL, 0); /* discard frame */ v4l2_read (fd, NULL, 0); /* discard frame */
continue; continue;
} }
......
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <assert.h> #include <assert.h>
#include <errno.h>
#include <sys/types.h> #include <sys/types.h>
#include <fcntl.h> #include <fcntl.h>
...@@ -470,14 +470,16 @@ int OpenDevice (vlc_object_t *obj, const char *path, uint32_t *restrict caps) ...@@ -470,14 +470,16 @@ int OpenDevice (vlc_object_t *obj, const char *path, uint32_t *restrict caps)
int rawfd = vlc_open (path, O_RDWR); int rawfd = vlc_open (path, O_RDWR);
if (rawfd == -1) if (rawfd == -1)
{ {
msg_Err (obj, "cannot open device '%s': %m", path); msg_Err (obj, "cannot open device '%s': %s", path,
vlc_strerror_c(errno));
return -1; return -1;
} }
int fd = v4l2_fd_open (rawfd, 0); int fd = v4l2_fd_open (rawfd, 0);
if (fd == -1) if (fd == -1)
{ {
msg_Warn (obj, "cannot initialize user-space library: %m"); msg_Warn (obj, "cannot initialize user-space library: %s",
vlc_strerror_c(errno));
/* fallback to direct kernel mode anyway */ /* fallback to direct kernel mode anyway */
fd = rawfd; fd = rawfd;
} }
...@@ -486,7 +488,8 @@ int OpenDevice (vlc_object_t *obj, const char *path, uint32_t *restrict caps) ...@@ -486,7 +488,8 @@ int OpenDevice (vlc_object_t *obj, const char *path, uint32_t *restrict caps)
struct v4l2_capability cap; struct v4l2_capability cap;
if (v4l2_ioctl (fd, VIDIOC_QUERYCAP, &cap) < 0) if (v4l2_ioctl (fd, VIDIOC_QUERYCAP, &cap) < 0)
{ {
msg_Err (obj, "cannot get device capabilities: %m"); msg_Err (obj, "cannot get device capabilities: %s",
vlc_strerror_c(errno));
v4l2_close (fd); v4l2_close (fd);
return -1; return -1;
} }
......
...@@ -53,7 +53,8 @@ vlc_v4l2_vbi_t *OpenVBI (demux_t *demux, const char *psz_device) ...@@ -53,7 +53,8 @@ vlc_v4l2_vbi_t *OpenVBI (demux_t *demux, const char *psz_device)
int rawfd = vlc_open (psz_device, O_RDWR); int rawfd = vlc_open (psz_device, O_RDWR);
if (rawfd == -1) if (rawfd == -1)
{ {
msg_Err (demux, "cannot open device '%s': %m", psz_device); msg_Err (demux, "cannot open device '%s': %s", psz_device,
vlc_strerror_c(errno));
goto err; goto err;
} }
...@@ -110,7 +111,7 @@ void GrabVBI (demux_t *p_demux, vlc_v4l2_vbi_t *vbi) ...@@ -110,7 +111,7 @@ void GrabVBI (demux_t *p_demux, vlc_v4l2_vbi_t *vbi)
int r = vbi_capture_pull_sliced (vbi->cap, &sliced_bytes, &timeout); int r = vbi_capture_pull_sliced (vbi->cap, &sliced_bytes, &timeout);
switch (r) { switch (r) {
case -1: case -1:
msg_Err (p_demux, "error reading VBI: %m"); msg_Err (p_demux, "error reading VBI: %s", vlc_strerror_c(errno));
case 0: /* nothing avail */ case 0: /* nothing avail */
break; break;
case 1: /* got data */ case 1: /* got data */
......
...@@ -61,7 +61,8 @@ static int SetupStandard (vlc_object_t *obj, int fd, ...@@ -61,7 +61,8 @@ static int SetupStandard (vlc_object_t *obj, int fd,
} }
if (v4l2_ioctl (fd, VIDIOC_S_STD, std) < 0) if (v4l2_ioctl (fd, VIDIOC_S_STD, std) < 0)
{ {
msg_Err (obj, "cannot set video standard 0x%"PRIx64": %m", *std); msg_Err (obj, "cannot set video standard 0x%"PRIx64": %s", *std,
vlc_strerror_c(errno));
return -1; return -1;
} }
msg_Dbg (obj, "video standard set to 0x%"PRIx64":", *std); msg_Dbg (obj, "video standard set to 0x%"PRIx64":", *std);
...@@ -95,7 +96,8 @@ static int SetupAudio (vlc_object_t *obj, int fd, ...@@ -95,7 +96,8 @@ static int SetupAudio (vlc_object_t *obj, int fd,
if (v4l2_ioctl (fd, VIDIOC_ENUMAUDIO, &enumaudio) < 0) if (v4l2_ioctl (fd, VIDIOC_ENUMAUDIO, &enumaudio) < 0)
{ {
msg_Err (obj, "cannot get audio input %"PRIu32" properties: %m", idx); msg_Err (obj, "cannot get audio input %"PRIu32" properties: %s", idx,
vlc_strerror_c(errno));
return -1; return -1;
} }
...@@ -111,7 +113,8 @@ static int SetupAudio (vlc_object_t *obj, int fd, ...@@ -111,7 +113,8 @@ static int SetupAudio (vlc_object_t *obj, int fd,
if (v4l2_ioctl (fd, VIDIOC_S_AUDIO, &audio) < 0) if (v4l2_ioctl (fd, VIDIOC_S_AUDIO, &audio) < 0)
{ {
msg_Err (obj, "cannot select audio input %"PRIu32": %m", idx); msg_Err (obj, "cannot select audio input %"PRIu32": %s", idx,
vlc_strerror_c(errno));
return -1; return -1;
} }
msg_Dbg (obj, "selected audio input %"PRIu32, idx); msg_Dbg (obj, "selected audio input %"PRIu32, idx);
...@@ -124,7 +127,8 @@ int SetupTuner (vlc_object_t *obj, int fd, uint32_t idx) ...@@ -124,7 +127,8 @@ int SetupTuner (vlc_object_t *obj, int fd, uint32_t idx)
if (v4l2_ioctl (fd, VIDIOC_G_TUNER, &tuner) < 0) if (v4l2_ioctl (fd, VIDIOC_G_TUNER, &tuner) < 0)
{ {
msg_Err (obj, "cannot get tuner %"PRIu32" properties: %m", idx); msg_Err (obj, "cannot get tuner %"PRIu32" properties: %s", idx,
vlc_strerror_c(errno));
return -1; return -1;
} }
...@@ -181,7 +185,8 @@ int SetupTuner (vlc_object_t *obj, int fd, uint32_t idx) ...@@ -181,7 +185,8 @@ int SetupTuner (vlc_object_t *obj, int fd, uint32_t idx)
if (v4l2_ioctl (fd, VIDIOC_S_TUNER, &tuner) < 0) if (v4l2_ioctl (fd, VIDIOC_S_TUNER, &tuner) < 0)
{ {
msg_Err (obj, "cannot set tuner %"PRIu32" audio mode: %m", idx); msg_Err (obj, "cannot set tuner %"PRIu32" audio mode: %s", idx,
vlc_strerror_c(errno));
return -1; return -1;
} }
msg_Dbg (obj, "tuner %"PRIu32" audio mode %u set", idx, tuner.audmode); msg_Dbg (obj, "tuner %"PRIu32" audio mode %u set", idx, tuner.audmode);
...@@ -199,7 +204,8 @@ int SetupTuner (vlc_object_t *obj, int fd, uint32_t idx) ...@@ -199,7 +204,8 @@ int SetupTuner (vlc_object_t *obj, int fd, uint32_t idx)
if (v4l2_ioctl (fd, VIDIOC_S_FREQUENCY, &frequency) < 0) if (v4l2_ioctl (fd, VIDIOC_S_FREQUENCY, &frequency) < 0)
{ {
msg_Err (obj, "cannot tune tuner %"PRIu32 msg_Err (obj, "cannot tune tuner %"PRIu32
" to frequency %u %sHz: %m", idx, freq, mult); " to frequency %u %sHz: %s", idx, freq, mult,
vlc_strerror_c(errno));
return -1; return -1;
} }
msg_Dbg (obj, "tuner %"PRIu32" tuned to frequency %"PRIu32" %sHz", msg_Dbg (obj, "tuner %"PRIu32" tuned to frequency %"PRIu32" %sHz",
...@@ -218,7 +224,8 @@ static int ResetCrop (vlc_object_t *obj, int fd) ...@@ -218,7 +224,8 @@ static int ResetCrop (vlc_object_t *obj, int fd)
* In practice, it does not. */ * In practice, it does not. */
if (v4l2_ioctl (fd, VIDIOC_CROPCAP, &cropcap) < 0) if (v4l2_ioctl (fd, VIDIOC_CROPCAP, &cropcap) < 0)
{ {
msg_Dbg (obj, "cannot get cropping properties: %m"); msg_Dbg (obj, "cannot get cropping properties: %s",
vlc_strerror_c(errno));
return 0; return 0;
} }
...@@ -230,7 +237,8 @@ static int ResetCrop (vlc_object_t *obj, int fd) ...@@ -230,7 +237,8 @@ static int ResetCrop (vlc_object_t *obj, int fd)
if (v4l2_ioctl (fd, VIDIOC_S_CROP, &crop) < 0) if (v4l2_ioctl (fd, VIDIOC_S_CROP, &crop) < 0)
{ {
msg_Warn (obj, "cannot reset cropping limits: %m"); msg_Warn (obj, "cannot reset cropping limits: %s",
vlc_strerror_c(errno));
return -1; return -1;
} }
return 0; return 0;
...@@ -243,7 +251,8 @@ int SetupInput (vlc_object_t *obj, int fd, v4l2_std_id *std) ...@@ -243,7 +251,8 @@ int SetupInput (vlc_object_t *obj, int fd, v4l2_std_id *std)
input.index = var_InheritInteger (obj, CFG_PREFIX"input"); input.index = var_InheritInteger (obj, CFG_PREFIX"input");
if (v4l2_ioctl (fd, VIDIOC_ENUMINPUT, &input) < 0) if (v4l2_ioctl (fd, VIDIOC_ENUMINPUT, &input) < 0)
{ {
msg_Err (obj, "invalid video input %"PRIu32": %m", input.index); msg_Err (obj, "invalid video input %"PRIu32": %s", input.index,
vlc_strerror_c(errno));
return -1; return -1;
} }
...@@ -264,7 +273,8 @@ int SetupInput (vlc_object_t *obj, int fd, v4l2_std_id *std) ...@@ -264,7 +273,8 @@ int SetupInput (vlc_object_t *obj, int fd, v4l2_std_id *std)
/* Select input */ /* Select input */
if (v4l2_ioctl (fd, VIDIOC_S_INPUT, &input.index) < 0) if (v4l2_ioctl (fd, VIDIOC_S_INPUT, &input.index) < 0)
{ {
msg_Err (obj, "cannot select input %"PRIu32": %m", input.index); msg_Err (obj, "cannot select input %"PRIu32": %s", input.index,
vlc_strerror_c(errno));
return -1; return -1;
} }
msg_Dbg (obj, "selected input %"PRIu32, input.index); msg_Dbg (obj, "selected input %"PRIu32, input.index);
...@@ -318,7 +328,7 @@ static int FindMaxRate (vlc_object_t *obj, int fd, ...@@ -318,7 +328,7 @@ static int FindMaxRate (vlc_object_t *obj, int fd,
if (v4l2_ioctl (fd, VIDIOC_ENUM_FRAMEINTERVALS, &fie) < 0) if (v4l2_ioctl (fd, VIDIOC_ENUM_FRAMEINTERVALS, &fie) < 0)
{ {
msg_Dbg (obj, " unknown frame intervals: %m"); msg_Dbg (obj, " unknown frame intervals: %s", vlc_strerror_c(errno));
/* Frame intervals cannot be enumerated. Set the format and then /* Frame intervals cannot be enumerated. Set the format and then
* get the streaming parameters to figure out the default frame * get the streaming parameters to figure out the default frame
* interval. This is not necessarily the maximum though. */ * interval. This is not necessarily the maximum though. */
...@@ -389,7 +399,7 @@ int SetupFormat (vlc_object_t *obj, int fd, uint32_t fourcc, ...@@ -389,7 +399,7 @@ int SetupFormat (vlc_object_t *obj, int fd, uint32_t fourcc,
if (v4l2_ioctl (fd, VIDIOC_G_FMT, fmt) < 0) if (v4l2_ioctl (fd, VIDIOC_G_FMT, fmt) < 0)
{ {
msg_Err (obj, "cannot get default format: %m"); msg_Err (obj, "cannot get default format: %s", vlc_strerror_c(errno));
return -1; return -1;
} }
fmt->fmt.pix.pixelformat = fourcc; fmt->fmt.pix.pixelformat = fourcc;
...@@ -414,7 +424,7 @@ int SetupFormat (vlc_object_t *obj, int fd, uint32_t fourcc, ...@@ -414,7 +424,7 @@ int SetupFormat (vlc_object_t *obj, int fd, uint32_t fourcc,
if (v4l2_ioctl (fd, VIDIOC_ENUM_FRAMESIZES, &fse) < 0) if (v4l2_ioctl (fd, VIDIOC_ENUM_FRAMESIZES, &fse) < 0)
{ {
/* Fallback to current format, try to maximize frame rate */ /* Fallback to current format, try to maximize frame rate */
msg_Dbg (obj, " unknown frame sizes: %m"); msg_Dbg (obj, " unknown frame sizes: %s", vlc_strerror_c(errno));
msg_Dbg (obj, " current frame size: %"PRIu32"x%"PRIu32, msg_Dbg (obj, " current frame size: %"PRIu32"x%"PRIu32,
fmt->fmt.pix.width, fmt->fmt.pix.height); fmt->fmt.pix.width, fmt->fmt.pix.height);
FindMaxRate (obj, fd, fmt, &best_it); FindMaxRate (obj, fd, fmt, &best_it);
...@@ -491,14 +501,15 @@ int SetupFormat (vlc_object_t *obj, int fd, uint32_t fourcc, ...@@ -491,14 +501,15 @@ int SetupFormat (vlc_object_t *obj, int fd, uint32_t fourcc,
/* Set the final format */ /* Set the final format */
if (v4l2_ioctl (fd, VIDIOC_S_FMT, fmt) < 0) if (v4l2_ioctl (fd, VIDIOC_S_FMT, fmt) < 0)
{ {
msg_Err (obj, "cannot set format: %m"); msg_Err (obj, "cannot set format: %s", vlc_strerror_c(errno));
return -1; return -1;
} }
/* Now that the final format is set, fetch and override parameters */ /* Now that the final format is set, fetch and override parameters */
if (v4l2_ioctl (fd, VIDIOC_G_PARM, parm) < 0) if (v4l2_ioctl (fd, VIDIOC_G_PARM, parm) < 0)
{ {
msg_Err (obj, "cannot get streaming parameters: %m"); msg_Err (obj, "cannot get streaming parameters: %s",
vlc_strerror_c(errno));
memset (parm, 0, sizeof (*parm)); memset (parm, 0, sizeof (*parm));
parm->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; parm->type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
} }
...@@ -507,7 +518,8 @@ int SetupFormat (vlc_object_t *obj, int fd, uint32_t fourcc, ...@@ -507,7 +518,8 @@ int SetupFormat (vlc_object_t *obj, int fd, uint32_t fourcc,
if (best_it.denominator != 0) if (best_it.denominator != 0)
parm->parm.capture.timeperframe = best_it; parm->parm.capture.timeperframe = best_it;
if (v4l2_ioctl (fd, VIDIOC_S_PARM, parm) < 0) if (v4l2_ioctl (fd, VIDIOC_S_PARM, parm) < 0)
msg_Warn (obj, "cannot set streaming parameters: %m"); msg_Warn (obj, "cannot set streaming parameters: %s",
vlc_strerror_c(errno));
ResetCrop (obj, fd); /* crop depends on frame size */ ResetCrop (obj, fd); /* crop depends on frame size */
...@@ -555,7 +567,7 @@ block_t *GrabVideo (vlc_object_t *demux, int fd, ...@@ -555,7 +567,7 @@ block_t *GrabVideo (vlc_object_t *demux, int fd,
/* Could ignore EIO, see spec. */ /* Could ignore EIO, see spec. */
/* fall through */ /* fall through */
default: default:
msg_Err (demux, "dequeue error: %m"); msg_Err (demux, "dequeue error: %s", vlc_strerror_c(errno));
return NULL; return NULL;
} }
} }
...@@ -570,7 +582,7 @@ block_t *GrabVideo (vlc_object_t *demux, int fd, ...@@ -570,7 +582,7 @@ block_t *GrabVideo (vlc_object_t *demux, int fd,
/* Unlock */ /* Unlock */
if (v4l2_ioctl (fd, VIDIOC_QBUF, &buf) < 0) if (v4l2_ioctl (fd, VIDIOC_QBUF, &buf) < 0)
{ {
msg_Err (demux, "queue error: %m"); msg_Err (demux, "queue error: %s", vlc_strerror_c(errno));
block_Release (block); block_Release (block);
return NULL; return NULL;
} }
...@@ -590,12 +602,13 @@ int StartUserPtr (vlc_object_t *obj, int fd) ...@@ -590,12 +602,13 @@ int StartUserPtr (vlc_object_t *obj, int fd)
if (v4l2_ioctl (fd, VIDIOC_REQBUFS, &reqbuf) < 0) if (v4l2_ioctl (fd, VIDIOC_REQBUFS, &reqbuf) < 0)
{ {
msg_Dbg (obj, "cannot reserve user buffers: %m"); msg_Dbg (obj, "cannot reserve user buffers: %s",
vlc_strerror_c(errno));
return -1; return -1;
} }
if (v4l2_ioctl (fd, VIDIOC_STREAMON, &reqbuf.type) < 0) if (v4l2_ioctl (fd, VIDIOC_STREAMON, &reqbuf.type) < 0)
{ {
msg_Err (obj, "cannot start streaming: %m"); msg_Err (obj, "cannot start streaming: %s", vlc_strerror_c(errno));
return -1; return -1;
} }
return 0; return 0;
...@@ -616,7 +629,7 @@ struct buffer_t *StartMmap (vlc_object_t *obj, int fd, uint32_t *restrict n) ...@@ -616,7 +629,7 @@ struct buffer_t *StartMmap (vlc_object_t *obj, int fd, uint32_t *restrict n)
if (v4l2_ioctl (fd, VIDIOC_REQBUFS, &req) < 0) if (v4l2_ioctl (fd, VIDIOC_REQBUFS, &req) < 0)
{ {
msg_Err (obj, "cannot allocate buffers: %m" ); msg_Err (obj, "cannot allocate buffers: %s", vlc_strerror_c(errno));
return NULL; return NULL;
} }
...@@ -641,7 +654,8 @@ struct buffer_t *StartMmap (vlc_object_t *obj, int fd, uint32_t *restrict n) ...@@ -641,7 +654,8 @@ struct buffer_t *StartMmap (vlc_object_t *obj, int fd, uint32_t *restrict n)
if (v4l2_ioctl (fd, VIDIOC_QUERYBUF, &buf) < 0) if (v4l2_ioctl (fd, VIDIOC_QUERYBUF, &buf) < 0)
{ {
msg_Err (obj, "cannot query buffer %"PRIu32": %m", bufc); msg_Err (obj, "cannot query buffer %"PRIu32": %s", bufc,
vlc_strerror_c(errno));
goto error; goto error;
} }
...@@ -649,7 +663,8 @@ struct buffer_t *StartMmap (vlc_object_t *obj, int fd, uint32_t *restrict n) ...@@ -649,7 +663,8 @@ struct buffer_t *StartMmap (vlc_object_t *obj, int fd, uint32_t *restrict n)
MAP_SHARED, fd, buf.m.offset); MAP_SHARED, fd, buf.m.offset);
if (bufv[bufc].start == MAP_FAILED) if (bufv[bufc].start == MAP_FAILED)
{ {
msg_Err (obj, "cannot map buffer %"PRIu32": %m", bufc); msg_Err (obj, "cannot map buffer %"PRIu32": %s", bufc,
vlc_strerror_c(errno));
goto error; goto error;
} }
bufv[bufc].length = buf.length; bufv[bufc].length = buf.length;
...@@ -658,7 +673,8 @@ struct buffer_t *StartMmap (vlc_object_t *obj, int fd, uint32_t *restrict n) ...@@ -658,7 +673,8 @@ struct buffer_t *StartMmap (vlc_object_t *obj, int fd, uint32_t *restrict n)
/* Some drivers refuse to queue buffers before they are mapped. Bug? */ /* Some drivers refuse to queue buffers before they are mapped. Bug? */
if (v4l2_ioctl (fd, VIDIOC_QBUF, &buf) < 0) if (v4l2_ioctl (fd, VIDIOC_QBUF, &buf) < 0)
{ {
msg_Err (obj, "cannot queue buffer %"PRIu32": %m", bufc); msg_Err (obj, "cannot queue buffer %"PRIu32": %s", bufc,
vlc_strerror_c(errno));
goto error; goto error;
} }
} }
...@@ -666,7 +682,7 @@ struct buffer_t *StartMmap (vlc_object_t *obj, int fd, uint32_t *restrict n) ...@@ -666,7 +682,7 @@ struct buffer_t *StartMmap (vlc_object_t *obj, int fd, uint32_t *restrict n)
enum v4l2_buf_type type = V4L2_BUF_TYPE_VIDEO_CAPTURE; enum v4l2_buf_type type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
if (v4l2_ioctl (fd, VIDIOC_STREAMON, &type) < 0) if (v4l2_ioctl (fd, VIDIOC_STREAMON, &type) < 0)
{ {
msg_Err (obj, "cannot start streaming: %m"); msg_Err (obj, "cannot start streaming: %s", vlc_strerror_c(errno));
goto error; goto error;
} }
*n = bufc; *n = bufc;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment