mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-25 01:30:38 +00:00
Fixing gst_element_error calls
Original commit message from CVS: Fixing gst_element_error calls
This commit is contained in:
parent
6d4f3a055b
commit
26a16e00a3
10 changed files with 278 additions and 214 deletions
|
@ -140,7 +140,7 @@ gst_v4l_get_attribute (GstElement *element,
|
|||
return gst_v4l_get_audio(v4lelement, n, value);
|
||||
}
|
||||
|
||||
gst_element_error(element, "Unknown attribute %s", name);
|
||||
g_warning("Unknown attribute %s", name);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -170,7 +170,7 @@ gst_v4l_set_attribute (GstElement *element,
|
|||
return gst_v4l_set_audio(v4lelement, n, value);
|
||||
}
|
||||
|
||||
gst_element_error(element, "Unknown attribute %s", name);
|
||||
g_warning("Unknown attribute %s", name);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
|
|
@ -294,9 +294,11 @@ gst_v4lmjpegsink_chain (GstPad *pad,
|
|||
/* check size */
|
||||
if (GST_BUFFER_SIZE(buf) > v4lmjpegsink->breq.size)
|
||||
{
|
||||
gst_element_error(GST_ELEMENT(v4lmjpegsink),
|
||||
"Buffer too big (%d KB), max. buffersize is %d KB",
|
||||
GST_BUFFER_SIZE(buf)/1024, v4lmjpegsink->breq.size/1024);
|
||||
gst_element_error(GST_ELEMENT(v4lmjpegsink), GST_ERROR_UNKNOWN,
|
||||
g_strdup(_("An unknown error occured")),
|
||||
g_strdup_printf("Buffer too big (%d KB), max. buffersize is %lu KB",
|
||||
GST_BUFFER_SIZE(buf)/1024,
|
||||
v4lmjpegsink->breq.size/1024));
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -502,8 +502,9 @@ gst_v4lmjpegsrc_get (GstPad *pad)
|
|||
buf = gst_buffer_new_from_pool(v4lmjpegsrc->bufferpool, 0, 0);
|
||||
if (!buf)
|
||||
{
|
||||
gst_element_error(GST_ELEMENT(v4lmjpegsrc),
|
||||
"Failed to create a new GstBuffer");
|
||||
gst_element_error(GST_ELEMENT(v4lmjpegsrc), GST_ERROR_UNKNOWN,
|
||||
g_strdup(_("An unknown error occured")),
|
||||
g_strdup("Failed to create a new GstBuffer"));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -840,8 +841,9 @@ gst_v4lmjpegsrc_buffer_free (GstBufferPool *pool, GstBuffer *buf, gpointer user_
|
|||
}
|
||||
|
||||
if (n == v4lmjpegsrc->breq.count)
|
||||
gst_element_error(GST_ELEMENT(v4lmjpegsrc),
|
||||
"Couldn't find the buffer");
|
||||
gst_element_error(GST_ELEMENT(v4lmjpegsrc), GST_ERROR_UNKNOWN,
|
||||
g_strdup(_("An unknown error occured")),
|
||||
g_strdup("Couldn't find the buffer"));
|
||||
|
||||
/* free the buffer struct et all */
|
||||
gst_buffer_default_free(buf);
|
||||
|
|
|
@ -578,8 +578,9 @@ gst_v4lsrc_get (GstPad *pad)
|
|||
buf = gst_buffer_new_from_pool(v4lsrc->bufferpool, 0, 0);
|
||||
if (!buf)
|
||||
{
|
||||
gst_element_error(GST_ELEMENT(v4lsrc),
|
||||
"Failed to create a new GstBuffer");
|
||||
gst_element_error(GST_ELEMENT(v4lsrc), GST_ERROR_INTERNAL,
|
||||
g_strdup(_("An internal error occured")),
|
||||
g_strdup("Failed to create a new GstBuffer"));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -811,8 +812,9 @@ gst_v4lsrc_buffer_free (GstBufferPool *pool, GstBuffer *buf, gpointer user_data)
|
|||
}
|
||||
|
||||
if (n == v4lsrc->mbuf.frames)
|
||||
gst_element_error(GST_ELEMENT(v4lsrc),
|
||||
"Couldn\'t find the buffer");
|
||||
gst_element_error(GST_ELEMENT(v4lsrc), GST_ERROR_INTERNAL,
|
||||
g_strdup(_("An internal error occured")),
|
||||
g_strdup("Couldn\'t find the buffer"));
|
||||
|
||||
/* free struct */
|
||||
gst_buffer_default_free(buf);
|
||||
|
|
|
@ -59,15 +59,18 @@ gst_v4l_set_overlay (GstV4lElement *v4lelement,
|
|||
switch (system(buff))
|
||||
{
|
||||
case -1:
|
||||
gst_element_error(GST_ELEMENT(v4lelement),
|
||||
"Could not start v4l-conf: %s", g_strerror(errno));
|
||||
gst_element_error(GST_ELEMENT(v4lelement), GST_ERROR_UNKNOWN,
|
||||
g_strdup(_("Unknown error occured")),
|
||||
g_strdup_printf("Could not start v4l-conf: %s", g_strerror(errno)));
|
||||
g_free(buff);
|
||||
return FALSE;
|
||||
case 0:
|
||||
break;
|
||||
default:
|
||||
gst_element_error(GST_ELEMENT(v4lelement),
|
||||
"v4l-conf failed to run correctly: %s", g_strerror(errno));
|
||||
gst_element_error(GST_ELEMENT(v4lelement), GST_ERROR_UNKNOWN,
|
||||
g_strdup(_("Unknown error occured")),
|
||||
g_strdup_printf("v4l-conf failed to run correctly: %s",
|
||||
g_strerror(errno)));
|
||||
g_free(buff);
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -120,9 +123,10 @@ gst_v4l_set_window (GstElement *element,
|
|||
|
||||
if (ioctl(v4lelement->video_fd, VIDIOCSWIN, &vwin) < 0)
|
||||
{
|
||||
gst_element_error(GST_ELEMENT(v4lelement),
|
||||
"Failed to set the video window: %s",
|
||||
g_strerror(errno));
|
||||
gst_element_error(GST_ELEMENT(v4lelement), GST_ERROR_DEVICE,
|
||||
g_strdup (_("Unable to set parameters on video device")),
|
||||
g_strdup_printf("Failed to set the video window: %s",
|
||||
g_strerror(errno)));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -148,9 +152,10 @@ gst_v4l_enable_overlay (GstV4lElement *v4lelement,
|
|||
|
||||
if (ioctl(v4lelement->video_fd, VIDIOCCAPTURE, &doit) < 0)
|
||||
{
|
||||
gst_element_error(GST_ELEMENT(v4lelement),
|
||||
"Failed to %s overlay display: %s",
|
||||
enable?"enable":"disable", g_strerror(errno));
|
||||
gst_element_error(GST_ELEMENT(v4lelement), GST_ERROR_DEVICE,
|
||||
g_strdup(_("Unable to set parameters on video device")),
|
||||
g_strdup_printf("Failed to %s overlay display: %s",
|
||||
enable?"enable":"disable", g_strerror(errno)));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
|
|
@ -74,9 +74,10 @@ gst_v4l_get_capabilities (GstV4lElement *v4lelement)
|
|||
|
||||
if (ioctl(v4lelement->video_fd, VIDIOCGCAP, &(v4lelement->vcap)) < 0)
|
||||
{
|
||||
gst_element_error(GST_ELEMENT(v4lelement),
|
||||
"Error getting \'%s\' capabilities: %s",
|
||||
v4lelement->videodev, g_strerror(errno));
|
||||
gst_element_error(GST_ELEMENT(v4lelement), GST_ERROR_DEVICE,
|
||||
g_strdup(_("Unable to get informations from video device")),
|
||||
g_strdup_printf("Error getting \'%s\' capabilities: %s",
|
||||
v4lelement->videodev, g_strerror(errno)));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -108,9 +109,10 @@ gst_v4l_open (GstV4lElement *v4lelement)
|
|||
v4lelement->video_fd = open(v4lelement->videodev, O_RDWR);
|
||||
if (!GST_V4L_IS_OPEN(v4lelement))
|
||||
{
|
||||
gst_element_error(GST_ELEMENT(v4lelement),
|
||||
"Failed to open device (\'%s\'): %s",
|
||||
v4lelement->videodev, g_strerror(errno));
|
||||
gst_element_error(GST_ELEMENT(v4lelement), GST_ERROR_DEVICE,
|
||||
g_strdup(_("Unable to open video device")),
|
||||
g_strdup_printf("Failed to open device (\'%s\'): %s",
|
||||
v4lelement->videodev, g_strerror(errno)));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -271,17 +273,19 @@ gst_v4l_set_chan_norm (GstV4lElement *v4lelement,
|
|||
|
||||
if (ioctl(v4lelement->video_fd, VIDIOCSCHAN, &(v4lelement->vchan)) < 0)
|
||||
{
|
||||
gst_element_error(GST_ELEMENT(v4lelement),
|
||||
"Error setting the channel/norm settings: %s",
|
||||
g_strerror(errno));
|
||||
gst_element_error(GST_ELEMENT(v4lelement), GST_ERROR_DEVICE,
|
||||
g_strdup(_("Unable to set parameters on video device")),
|
||||
g_strdup_printf("Error setting the channel/norm settings: %s",
|
||||
g_strerror(errno)));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (ioctl(v4lelement->video_fd, VIDIOCGCHAN, &(v4lelement->vchan)) < 0)
|
||||
{
|
||||
gst_element_error(GST_ELEMENT(v4lelement),
|
||||
"Error getting the channel/norm settings: %s",
|
||||
g_strerror(errno));
|
||||
gst_element_error(GST_ELEMENT(v4lelement), GST_ERROR_DEVICE,
|
||||
g_strdup(_("Unable to set parameters on video device")),
|
||||
g_strdup_printf("Error getting the channel/norm settings: %s",
|
||||
g_strerror(errno)));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -325,9 +329,9 @@ gst_v4l_get_signal (GstV4lElement *v4lelement,
|
|||
tuner.tuner = 0;
|
||||
if (ioctl(v4lelement->video_fd, VIDIOCGTUNER, &tuner) < 0)
|
||||
{
|
||||
gst_element_error(GST_ELEMENT(v4lelement),
|
||||
"Error getting tuner signal: %s",
|
||||
sys_errlist[errno]);
|
||||
gst_element_error(GST_ELEMENT(v4lelement), GST_ERROR_DEVICE,
|
||||
g_strdup(_("Unable to get informations from video device")),
|
||||
g_strdup_printf("Error getting tuner signal: %s", sys_errlist[errno]));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -355,9 +359,9 @@ gst_v4l_get_frequency (GstV4lElement *v4lelement,
|
|||
|
||||
if (ioctl(v4lelement->video_fd, VIDIOCGFREQ, frequency) < 0)
|
||||
{
|
||||
gst_element_error(GST_ELEMENT(v4lelement),
|
||||
"Error getting tuner frequency: %s",
|
||||
g_strerror(errno));
|
||||
gst_element_error(GST_ELEMENT(v4lelement), GST_ERROR_DEVICE,
|
||||
g_strdup(_("Unable to get informations from video device")),
|
||||
g_strdup_printf("Error getting tuner frequency: %s", g_strerror(errno)));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -383,9 +387,9 @@ gst_v4l_set_frequency (GstV4lElement *v4lelement,
|
|||
|
||||
if (ioctl(v4lelement->video_fd, VIDIOCSFREQ, &frequency) < 0)
|
||||
{
|
||||
gst_element_error(GST_ELEMENT(v4lelement),
|
||||
"Error setting tuner frequency: %s",
|
||||
g_strerror(errno));
|
||||
gst_element_error(GST_ELEMENT(v4lelement), GST_ERROR_DEVICE,
|
||||
g_strdup(_("Unable to set parameters on video device")),
|
||||
g_strdup_printf("Error setting tuner frequency: %s", g_strerror(errno)));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -412,9 +416,10 @@ gst_v4l_get_picture (GstV4lElement *v4lelement,
|
|||
|
||||
if (ioctl(v4lelement->video_fd, VIDIOCGPICT, &vpic) < 0)
|
||||
{
|
||||
gst_element_error(GST_ELEMENT(v4lelement),
|
||||
"Error getting picture parameters: %s",
|
||||
g_strerror(errno));
|
||||
gst_element_error(GST_ELEMENT(v4lelement), GST_ERROR_DEVICE,
|
||||
g_strdup(_("Unable to get informations from video device")),
|
||||
g_strdup_printf("Error getting picture parameters: %s",
|
||||
g_strerror(errno)));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -433,9 +438,7 @@ gst_v4l_get_picture (GstV4lElement *v4lelement,
|
|||
*value = vpic.colour;
|
||||
break;
|
||||
default:
|
||||
gst_element_error(GST_ELEMENT(v4lelement),
|
||||
"Error getting picture parameters: unknown type %d",
|
||||
type);
|
||||
g_warning("Error getting picture parameters: unknown type %d", type);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -462,9 +465,10 @@ gst_v4l_set_picture (GstV4lElement *v4lelement,
|
|||
|
||||
if (ioctl(v4lelement->video_fd, VIDIOCGPICT, &vpic) < 0)
|
||||
{
|
||||
gst_element_error(GST_ELEMENT(v4lelement),
|
||||
"Error getting picture parameters: %s",
|
||||
g_strerror(errno));
|
||||
gst_element_error(GST_ELEMENT(v4lelement), GST_ERROR_DEVICE,
|
||||
g_strdup(_("Unable to get informations from video device")),
|
||||
g_strdup_printf("Error getting picture parameters: %s",
|
||||
g_strerror(errno)));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -483,17 +487,16 @@ gst_v4l_set_picture (GstV4lElement *v4lelement,
|
|||
vpic.colour = value;
|
||||
break;
|
||||
default:
|
||||
gst_element_error(GST_ELEMENT(v4lelement),
|
||||
"Error setting picture parameters: unknown type %d",
|
||||
type);
|
||||
g_warning("Error setting picture parameters: unknown type %d", type);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (ioctl(v4lelement->video_fd, VIDIOCSPICT, &vpic) < 0)
|
||||
{
|
||||
gst_element_error(GST_ELEMENT(v4lelement),
|
||||
"Error setting picture parameters: %s",
|
||||
g_strerror(errno));
|
||||
gst_element_error(GST_ELEMENT(v4lelement), GST_ERROR_DEVICE,
|
||||
g_strdup(_("Unable to set parameters on video device")),
|
||||
g_strdup_printf("Error setting picture parameters: %s",
|
||||
g_strerror(errno)));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -538,9 +541,10 @@ gst_v4l_get_audio (GstV4lElement *v4lelement,
|
|||
|
||||
if (ioctl(v4lelement->video_fd, VIDIOCGAUDIO, &vau) < 0)
|
||||
{
|
||||
gst_element_error(GST_ELEMENT(v4lelement),
|
||||
"Error getting audio parameters: %s",
|
||||
g_strerror(errno));
|
||||
gst_element_error(GST_ELEMENT(v4lelement), GST_ERROR_DEVICE,
|
||||
g_strdup(_("Unable to get informations from video device")),
|
||||
g_strdup_printf("Error getting audio parameters: %s",
|
||||
g_strerror(errno)));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -556,9 +560,7 @@ gst_v4l_get_audio (GstV4lElement *v4lelement,
|
|||
*value = vau.mode;
|
||||
break;
|
||||
default:
|
||||
gst_element_error(GST_ELEMENT(v4lelement),
|
||||
"Error getting audio parameters: unknown type %d",
|
||||
type);
|
||||
g_warning("Error getting audio parameters: unknown type %d", type);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -588,9 +590,10 @@ gst_v4l_set_audio (GstV4lElement *v4lelement,
|
|||
|
||||
if (ioctl(v4lelement->video_fd, VIDIOCGAUDIO, &vau) < 0)
|
||||
{
|
||||
gst_element_error(GST_ELEMENT(v4lelement),
|
||||
"Error getting audio parameters: %s",
|
||||
g_strerror(errno));
|
||||
gst_element_error(GST_ELEMENT(v4lelement), GST_ERROR_DEVICE,
|
||||
g_strdup(_("Unable to get informations from video device")),
|
||||
g_strdup_printf("Error getting audio parameters: %s",
|
||||
g_strerror(errno)));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -599,8 +602,8 @@ gst_v4l_set_audio (GstV4lElement *v4lelement,
|
|||
case V4L_AUDIO_MUTE:
|
||||
if (!(vau.flags & VIDEO_AUDIO_MUTABLE))
|
||||
{
|
||||
gst_element_error(GST_ELEMENT(v4lelement),
|
||||
"Error setting audio mute: (un)setting mute is not supported");
|
||||
g_warning("Error setting audio mute: " \
|
||||
"(un)setting mute is not supported");
|
||||
return FALSE;
|
||||
}
|
||||
if (value)
|
||||
|
@ -611,8 +614,8 @@ gst_v4l_set_audio (GstV4lElement *v4lelement,
|
|||
case V4L_AUDIO_VOLUME:
|
||||
if (!(vau.flags & VIDEO_AUDIO_VOLUME))
|
||||
{
|
||||
gst_element_error(GST_ELEMENT(v4lelement),
|
||||
"Error setting audio volume: setting volume is not supported");
|
||||
g_warning("Error setting audio volume: " \
|
||||
"setting volume is not supported");
|
||||
return FALSE;
|
||||
}
|
||||
vau.volume = value;
|
||||
|
@ -621,17 +624,16 @@ gst_v4l_set_audio (GstV4lElement *v4lelement,
|
|||
vau.mode = value;
|
||||
break;
|
||||
default:
|
||||
gst_element_error(GST_ELEMENT(v4lelement),
|
||||
"Error setting audio parameters: unknown type %d",
|
||||
type);
|
||||
g_warning("Error setting audio parameters: unknown type %d", type);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (ioctl(v4lelement->video_fd, VIDIOCSAUDIO, &vau) < 0)
|
||||
{
|
||||
gst_element_error(GST_ELEMENT(v4lelement),
|
||||
"Error setting audio parameters: %s",
|
||||
g_strerror(errno));
|
||||
gst_element_error(GST_ELEMENT(v4lelement), GST_ERROR_DEVICE,
|
||||
g_strdup(_("Unable to set parameters on video device")),
|
||||
g_strdup_printf("Error setting audio parameters: %s",
|
||||
g_strerror(errno)));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#define _(string) (string)
|
||||
|
||||
/* simple check whether the device is open */
|
||||
#define GST_V4L_IS_OPEN(v4lelement) \
|
||||
|
@ -43,7 +44,9 @@ extern "C" {
|
|||
if (v4lelement->video_fd <= 0) \
|
||||
{ \
|
||||
gst_element_error(GST_ELEMENT(v4lelement), \
|
||||
"Device is not open"); \
|
||||
GST_ERROR_DEVICE, \
|
||||
g_strdup("Video device is not open"), \
|
||||
g_strdup("Device is not open")); \
|
||||
return FALSE; \
|
||||
}
|
||||
|
||||
|
@ -52,35 +55,43 @@ extern "C" {
|
|||
if (v4lelement->video_fd != -1) \
|
||||
{ \
|
||||
gst_element_error(GST_ELEMENT(v4lelement), \
|
||||
"Device is open"); \
|
||||
GST_ERROR_DEVICE, \
|
||||
g_strdup(_("Video device is open")), \
|
||||
g_strdup("Device is open")); \
|
||||
return FALSE; \
|
||||
}
|
||||
|
||||
/* checks whether the current v4lelement does video overlay */
|
||||
#define GST_V4L_CHECK_OVERLAY(v4lelement) \
|
||||
if (!(v4lelement->vcap.type & VID_TYPE_OVERLAY)) \
|
||||
{ \
|
||||
gst_element_error(GST_ELEMENT(v4lelement), \
|
||||
"Device doesn't do overlay"); \
|
||||
return FALSE; \
|
||||
if (!(v4lelement->vcap.type & VID_TYPE_OVERLAY)) \
|
||||
{ \
|
||||
gst_element_error(GST_ELEMENT(v4lelement), \
|
||||
GST_ERROR_DEVICE, \
|
||||
g_strdup(_("Video device doesn't do overlay")),\
|
||||
g_strdup("Device doesn't do overlay")); \
|
||||
return FALSE; \
|
||||
}
|
||||
|
||||
/* checks whether we're in capture mode or not */
|
||||
#define GST_V4L_CHECK_ACTIVE(v4lelement) \
|
||||
if (v4lelement->buffer == NULL) \
|
||||
{ \
|
||||
gst_element_error(GST_ELEMENT(v4lelement), \
|
||||
"Device is not in streaming mode"); \
|
||||
return FALSE; \
|
||||
#define GST_V4L_CHECK_ACTIVE(v4lelement) \
|
||||
if (v4lelement->buffer == NULL) \
|
||||
{ \
|
||||
gst_element_error(GST_ELEMENT(v4lelement), \
|
||||
GST_ERROR_DEVICE, \
|
||||
g_strdup(_("Video device is not in streaming mode")), \
|
||||
g_strdup("Device is not in streaming mode")); \
|
||||
return FALSE; \
|
||||
}
|
||||
|
||||
/* checks whether we're out of capture mode or not */
|
||||
#define GST_V4L_CHECK_NOT_ACTIVE(v4lelement) \
|
||||
if (v4lelement->buffer != NULL) \
|
||||
{ \
|
||||
gst_element_error(GST_ELEMENT(v4lelement), \
|
||||
"Device is in streaming mode"); \
|
||||
return FALSE; \
|
||||
#define GST_V4L_CHECK_NOT_ACTIVE(v4lelement) \
|
||||
if (v4lelement->buffer != NULL) \
|
||||
{ \
|
||||
gst_element_error(GST_ELEMENT(v4lelement), \
|
||||
GST_ERROR_DEVICE, \
|
||||
g_strdup(_("Video device is in streaming mode")), \
|
||||
g_strdup("Device is in streaming mode")); \
|
||||
return FALSE; \
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -80,9 +80,10 @@ gst_v4lmjpegsink_sync_thread (void *arg)
|
|||
if (ioctl(GST_V4LELEMENT(v4lmjpegsink)->video_fd, MJPIOC_SYNC,
|
||||
&(v4lmjpegsink->bsync)) < 0)
|
||||
{
|
||||
gst_element_error(GST_ELEMENT(v4lmjpegsink),
|
||||
"Failed to sync on frame %d: %s",
|
||||
frame, g_strerror(errno));
|
||||
gst_element_error(GST_ELEMENT(v4lmjpegsink), GST_ERROR_DEVICE,
|
||||
g_strdup(_("Unable to set parameters on video device")),
|
||||
g_strdup_printf("Failed to sync on frame %d: %s",
|
||||
frame, g_strerror(errno)));
|
||||
g_mutex_lock(v4lmjpegsink->mutex_queued_frames);
|
||||
v4lmjpegsink->isqueued_queued_frames[frame] = -1;
|
||||
g_cond_broadcast(v4lmjpegsink->cond_queued_frames[frame]);
|
||||
|
@ -94,8 +95,9 @@ gst_v4lmjpegsink_sync_thread (void *arg)
|
|||
/* be sure that we're not confusing */
|
||||
if (frame != v4lmjpegsink->bsync.frame)
|
||||
{
|
||||
gst_element_error(GST_ELEMENT(v4lmjpegsink),
|
||||
"Internal error: frame number confusion");
|
||||
gst_element_error(GST_ELEMENT(v4lmjpegsink), GST_ERROR_INTERNAL,
|
||||
g_strdup(_("An internal error occured")),
|
||||
g_strdup("Internal error: frame number confusion"));
|
||||
goto end;
|
||||
}
|
||||
g_mutex_lock(v4lmjpegsink->mutex_queued_frames);
|
||||
|
@ -129,9 +131,10 @@ gst_v4lmjpegsink_queue_frame (GstV4lMjpegSink *v4lmjpegsink,
|
|||
/* queue on this frame */
|
||||
if (ioctl(GST_V4LELEMENT(v4lmjpegsink)->video_fd, MJPIOC_QBUF_PLAY, &num) < 0)
|
||||
{
|
||||
gst_element_error(GST_ELEMENT(v4lmjpegsink),
|
||||
"Failed to queue frame %d: %s",
|
||||
num, g_strerror(errno));
|
||||
gst_element_error(GST_ELEMENT(v4lmjpegsink), GST_ERROR_DEVICE,
|
||||
g_strdup(_("Unable to set parameters on video device")),
|
||||
g_strdup_printf("Failed to queue frame %d: %s",
|
||||
num, g_strerror(errno)));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -226,9 +229,10 @@ gst_v4lmjpegsink_set_playback (GstV4lMjpegSink *v4lmjpegsink,
|
|||
|
||||
if (ioctl(GST_V4LELEMENT(v4lmjpegsink)->video_fd, MJPIOC_G_PARAMS, &bparm) < 0)
|
||||
{
|
||||
gst_element_error(GST_ELEMENT(v4lmjpegsink),
|
||||
"Error getting playback parameters: %s",
|
||||
g_strerror(errno));
|
||||
gst_element_error(GST_ELEMENT(v4lmjpegsink), GST_ERROR_DEVICE,
|
||||
g_strdup(_("Unable to get informations from video device")),
|
||||
g_strdup_printf("Error getting playback parameters: %s",
|
||||
g_strerror(errno)));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -244,9 +248,10 @@ gst_v4lmjpegsink_set_playback (GstV4lMjpegSink *v4lmjpegsink,
|
|||
|
||||
if (width > mw || height > mh)
|
||||
{
|
||||
gst_element_error(GST_ELEMENT(v4lmjpegsink),
|
||||
"Video dimensions (%dx%d) are larger than device max (%dx%d)",
|
||||
width, height, mw, mh);
|
||||
gst_element_error(GST_ELEMENT(v4lmjpegsink), GST_ERROR_UNKNOWN,
|
||||
g_strdup(_("An unknown error occured")),
|
||||
g_strdup_printf("Video dimensions (%dx%d) are larger than device max (%dx%d)",
|
||||
width, height, mw, mh));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -274,9 +279,10 @@ gst_v4lmjpegsink_set_playback (GstV4lMjpegSink *v4lmjpegsink,
|
|||
{
|
||||
if (height > mh/2)
|
||||
{
|
||||
gst_element_error(GST_ELEMENT(v4lmjpegsink),
|
||||
"Video dimensions (%dx%d) too large for non-interlaced playback (%dx%d)",
|
||||
width, height, mw, mh/2);
|
||||
gst_element_error(GST_ELEMENT(v4lmjpegsink), GST_ERROR_UNKNOWN,
|
||||
g_strdup(_("An unknown error occured")),
|
||||
g_strdup_printf("Video dimensions (%dx%d) too large for non-interlaced playback (%dx%d)",
|
||||
width, height, mw, mh/2));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -321,9 +327,10 @@ gst_v4lmjpegsink_set_playback (GstV4lMjpegSink *v4lmjpegsink,
|
|||
|
||||
if (ioctl(GST_V4LELEMENT(v4lmjpegsink)->video_fd, MJPIOC_S_PARAMS, &bparm) < 0)
|
||||
{
|
||||
gst_element_error(GST_ELEMENT(v4lmjpegsink),
|
||||
"Error setting playback parameters: %s",
|
||||
g_strerror(errno));
|
||||
gst_element_error(GST_ELEMENT(v4lmjpegsink), GST_ERROR_DEVICE,
|
||||
g_strdup(_("Unable to set parameters on video device")),
|
||||
g_strdup_printf("Error setting playback parameters: %s",
|
||||
g_strerror(errno)));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -349,9 +356,10 @@ gst_v4lmjpegsink_playback_init (GstV4lMjpegSink *v4lmjpegsink)
|
|||
/* Request buffers */
|
||||
if (ioctl(GST_V4LELEMENT(v4lmjpegsink)->video_fd, MJPIOC_REQBUFS, &(v4lmjpegsink->breq)) < 0)
|
||||
{
|
||||
gst_element_error(GST_ELEMENT(v4lmjpegsink),
|
||||
"Error requesting video buffers: %s",
|
||||
g_strerror(errno));
|
||||
gst_element_error(GST_ELEMENT(v4lmjpegsink), GST_ERROR_DEVICE,
|
||||
g_strdup(_("Unable to get informations from video device")),
|
||||
g_strdup_printf("Error requesting video buffers: %s",
|
||||
g_strerror(errno)));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -364,9 +372,10 @@ gst_v4lmjpegsink_playback_init (GstV4lMjpegSink *v4lmjpegsink)
|
|||
PROT_READ|PROT_WRITE, MAP_SHARED, GST_V4LELEMENT(v4lmjpegsink)->video_fd, 0);
|
||||
if (GST_V4LELEMENT(v4lmjpegsink)->buffer == MAP_FAILED)
|
||||
{
|
||||
gst_element_error(GST_ELEMENT(v4lmjpegsink),
|
||||
"Error mapping video buffers: %s",
|
||||
g_strerror(errno));
|
||||
gst_element_error(GST_ELEMENT(v4lmjpegsink), GST_ERROR_UNKNOWN,
|
||||
g_strdup(_("An unknown error occured")),
|
||||
g_strdup_printf("Error mapping video buffers: %s",
|
||||
g_strerror(errno)));
|
||||
GST_V4LELEMENT(v4lmjpegsink)->buffer = NULL;
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -377,18 +386,20 @@ gst_v4lmjpegsink_playback_init (GstV4lMjpegSink *v4lmjpegsink)
|
|||
malloc(sizeof(gint8) * v4lmjpegsink->breq.count);
|
||||
if (!v4lmjpegsink->isqueued_queued_frames)
|
||||
{
|
||||
gst_element_error(GST_ELEMENT(v4lmjpegsink),
|
||||
"Failed to create queue tracker: %s",
|
||||
g_strerror(errno));
|
||||
gst_element_error(GST_ELEMENT(v4lmjpegsink), GST_ERROR_UNKNOWN,
|
||||
g_strdup(_("An unknown error occured")),
|
||||
g_strdup_printf("Failed to create queue tracker: %s",
|
||||
g_strerror(errno)));
|
||||
return FALSE;
|
||||
}
|
||||
v4lmjpegsink->cond_queued_frames = (GCond **)
|
||||
malloc(sizeof(GCond *) * v4lmjpegsink->breq.count);
|
||||
if (!v4lmjpegsink->cond_queued_frames)
|
||||
{
|
||||
gst_element_error(GST_ELEMENT(v4lmjpegsink),
|
||||
"Failed to create queue condition holders: %s",
|
||||
g_strerror(errno));
|
||||
gst_element_error(GST_ELEMENT(v4lmjpegsink), GST_ERROR_UNKNOWN,
|
||||
g_strdup(_("An unknown error occured")),
|
||||
g_strdup_printf("Failed to create queue condition holders: %s",
|
||||
g_strerror(errno)));
|
||||
return FALSE;
|
||||
}
|
||||
for (n=0;n<v4lmjpegsink->breq.count;n++)
|
||||
|
@ -425,8 +436,9 @@ gst_v4lmjpegsink_playback_start (GstV4lMjpegSink *v4lmjpegsink)
|
|||
gst_v4lmjpegsink_sync_thread, (void *) v4lmjpegsink, TRUE, &error);
|
||||
if(!v4lmjpegsink->thread_queued_frames)
|
||||
{
|
||||
gst_element_error(GST_ELEMENT(v4lmjpegsink),
|
||||
"Failed to create sync thread: %s", error->message);
|
||||
gst_element_error(GST_ELEMENT(v4lmjpegsink), GST_ERROR_UNKNOWN,
|
||||
g_strdup(_("An unknown error occured")),
|
||||
g_strdup_printf("Failed to create sync thread: %s", error->message));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
|
|
@ -70,9 +70,10 @@ gst_v4lmjpegsrc_queue_frame (GstV4lMjpegSrc *v4lmjpegsrc,
|
|||
|
||||
if (ioctl(GST_V4LELEMENT(v4lmjpegsrc)->video_fd, MJPIOC_QBUF_CAPT, &num) < 0)
|
||||
{
|
||||
gst_element_error(GST_ELEMENT(v4lmjpegsrc),
|
||||
"Error queueing a buffer (%d): %s",
|
||||
num, g_strerror(errno));
|
||||
gst_element_error(GST_ELEMENT(v4lmjpegsrc), GST_ERROR_DEVICE,
|
||||
g_strdup(_("Unable to set parameters on video device")),
|
||||
g_strdup_printf("Error queueing a buffer (%d): %s",
|
||||
num, g_strerror(errno)));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -102,9 +103,10 @@ gst_v4lmjpegsrc_sync_next_frame (GstV4lMjpegSrc *v4lmjpegsrc,
|
|||
while (ioctl(GST_V4LELEMENT(v4lmjpegsrc)->video_fd,
|
||||
MJPIOC_SYNC, &(v4lmjpegsrc->bsync)) < 0) {
|
||||
if (errno != EINTR) {
|
||||
gst_element_error(GST_ELEMENT(v4lmjpegsrc),
|
||||
"Error syncing on a buffer: %s",
|
||||
g_strerror(errno));
|
||||
gst_element_error(GST_ELEMENT(v4lmjpegsrc), GST_ERROR_DEVICE,
|
||||
g_strdup(_("Unable to set parameters on video device")),
|
||||
g_strdup_printf("Error syncing on a buffer: %s",
|
||||
g_strerror(errno)));
|
||||
return FALSE;
|
||||
}
|
||||
DEBUG("Sync got interrupted");
|
||||
|
@ -151,9 +153,10 @@ gst_v4lmjpegsrc_set_input_norm (GstV4lMjpegSrc *v4lmjpegsrc,
|
|||
|
||||
if (ioctl(GST_V4LELEMENT(v4lmjpegsrc)->video_fd, MJPIOC_G_STATUS, &bstat) < 0)
|
||||
{
|
||||
gst_element_error(GST_ELEMENT(v4lmjpegsrc),
|
||||
"Error getting device status: %s",
|
||||
g_strerror(errno));
|
||||
gst_element_error(GST_ELEMENT(v4lmjpegsrc), GST_ERROR_DEVICE,
|
||||
g_strdup(_("Unable to get informations from video device")),
|
||||
g_strdup_printf("Error getting device status: %s",
|
||||
g_strerror(errno)));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -171,8 +174,9 @@ gst_v4lmjpegsrc_set_input_norm (GstV4lMjpegSrc *v4lmjpegsrc,
|
|||
/* check */
|
||||
if (input == V4L_MJPEG_INPUT_AUTO || norm == VIDEO_MODE_AUTO)
|
||||
{
|
||||
gst_element_error(GST_ELEMENT(v4lmjpegsrc),
|
||||
"Unable to auto-detect an input");
|
||||
gst_element_error(GST_ELEMENT(v4lmjpegsrc), GST_ERROR_UNKNOWN,
|
||||
g_strdup(_("An unknown error occured")),
|
||||
g_strdup("Unable to auto-detect an input"));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -186,9 +190,10 @@ gst_v4lmjpegsrc_set_input_norm (GstV4lMjpegSrc *v4lmjpegsrc,
|
|||
|
||||
if (ioctl(GST_V4LELEMENT(v4lmjpegsrc)->video_fd, MJPIOC_G_STATUS, &bstat) < 0)
|
||||
{
|
||||
gst_element_error(GST_ELEMENT(v4lmjpegsrc),
|
||||
"Error getting device status: %s",
|
||||
g_strerror(errno));
|
||||
gst_element_error(GST_ELEMENT(v4lmjpegsrc), GST_ERROR_DEVICE,
|
||||
g_strdup(_("Unable to get informations from video device")),
|
||||
g_strdup_printf("Error getting device status: %s",
|
||||
g_strerror(errno)));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -201,9 +206,10 @@ gst_v4lmjpegsrc_set_input_norm (GstV4lMjpegSrc *v4lmjpegsrc,
|
|||
}
|
||||
else
|
||||
{
|
||||
gst_element_error(GST_ELEMENT(v4lmjpegsrc),
|
||||
"No signal found on input %s",
|
||||
input_name[input]);
|
||||
gst_element_error(GST_ELEMENT(v4lmjpegsrc), GST_ERROR_UNKNOWN,
|
||||
g_strdup(_("An unknown error occured")),
|
||||
g_strdup_printf("No signal found on input %s",
|
||||
input_name[input]));
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
@ -259,9 +265,10 @@ gst_v4lmjpegsrc_set_capture (GstV4lMjpegSrc *v4lmjpegsrc,
|
|||
/* Query params for capture */
|
||||
if (ioctl(GST_V4LELEMENT(v4lmjpegsrc)->video_fd, MJPIOC_G_PARAMS, &bparm) < 0)
|
||||
{
|
||||
gst_element_error(GST_ELEMENT(v4lmjpegsrc),
|
||||
"Error getting video parameters: %s",
|
||||
g_strerror(errno));
|
||||
gst_element_error(GST_ELEMENT(v4lmjpegsrc), GST_ERROR_DEVICE,
|
||||
g_strdup(_("Unable to get informations from video device")),
|
||||
g_strdup_printf("Error getting video parameters: %s",
|
||||
g_strerror(errno)));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -287,9 +294,10 @@ gst_v4lmjpegsrc_set_capture (GstV4lMjpegSrc *v4lmjpegsrc,
|
|||
/* Set params for capture */
|
||||
if (ioctl(GST_V4LELEMENT(v4lmjpegsrc)->video_fd, MJPIOC_S_PARAMS, &bparm) < 0)
|
||||
{
|
||||
gst_element_error(GST_ELEMENT(v4lmjpegsrc),
|
||||
"Error setting video parameters: %s",
|
||||
g_strerror(errno));
|
||||
gst_element_error(GST_ELEMENT(v4lmjpegsrc), GST_ERROR_DEVICE,
|
||||
g_strdup(_("Unable to set parameters on video device")),
|
||||
g_strdup_printf("Error setting video parameters: %s",
|
||||
g_strerror(errno)));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -333,9 +341,10 @@ gboolean gst_v4lmjpegsrc_set_capture_m (GstV4lMjpegSrc *v4lmjpegsrc,
|
|||
/* Query params for capture */
|
||||
if (ioctl(GST_V4LELEMENT(v4lmjpegsrc)->video_fd, MJPIOC_G_PARAMS, &bparm) < 0)
|
||||
{
|
||||
gst_element_error(GST_ELEMENT(v4lmjpegsrc),
|
||||
"Error getting video parameters: %s",
|
||||
g_strerror(errno));
|
||||
gst_element_error(GST_ELEMENT(v4lmjpegsrc), GST_ERROR_DEVICE,
|
||||
g_strdup(_("Unable to get informations from video device")),
|
||||
g_strdup_printf("Error getting video parameters: %s",
|
||||
g_strerror(errno)));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -370,23 +379,26 @@ gboolean gst_v4lmjpegsrc_set_capture_m (GstV4lMjpegSrc *v4lmjpegsrc,
|
|||
|
||||
if (width + x_offset > maxwidth)
|
||||
{
|
||||
gst_element_error(GST_ELEMENT(v4lmjpegsrc),
|
||||
"Image width+offset (%d) bigger than maximum (%d)",
|
||||
width + x_offset, maxwidth);
|
||||
gst_element_error(GST_ELEMENT(v4lmjpegsrc), GST_ERROR_UNKNOWN,
|
||||
g_strdup(_("An unknown error occured")),
|
||||
g_strdup_printf("Image width+offset (%d) bigger than maximum (%d)",
|
||||
width + x_offset, maxwidth));
|
||||
return FALSE;
|
||||
}
|
||||
if ((width%(bparm.HorDcm*16))!=0)
|
||||
{
|
||||
gst_element_error(GST_ELEMENT(v4lmjpegsrc),
|
||||
"Image width (%d) not multiple of %d (required for JPEG)",
|
||||
width, bparm.HorDcm*16);
|
||||
gst_element_error(GST_ELEMENT(v4lmjpegsrc), GST_ERROR_UNKNOWN,
|
||||
g_strdup(_("An unknown error occured")),
|
||||
g_strdup_printf("Image width (%d) not multiple of %d (required for JPEG)",
|
||||
width, bparm.HorDcm*16));
|
||||
return FALSE;
|
||||
}
|
||||
if (height + y_offset > (norm==VIDEO_MODE_NTSC ? 480 : 576))
|
||||
{
|
||||
gst_element_error(GST_ELEMENT(v4lmjpegsrc),
|
||||
"Image height+offset (%d) bigger than maximum (%d)",
|
||||
height + y_offset, (norm==VIDEO_MODE_NTSC ? 480 : 576));
|
||||
gst_element_error(GST_ELEMENT(v4lmjpegsrc), GST_ERROR_UNKNOWN,
|
||||
g_strdup(_("An unknown error occured")),
|
||||
g_strdup_printf("Image height+offset (%d) bigger than maximum (%d)",
|
||||
height + y_offset, (norm==VIDEO_MODE_NTSC ? 480 : 576)));
|
||||
return FALSE;
|
||||
}
|
||||
/* RJ: Image height must only be a multiple of 8, but geom_height
|
||||
|
@ -394,9 +406,10 @@ gboolean gst_v4lmjpegsrc_set_capture_m (GstV4lMjpegSrc *v4lmjpegsrc,
|
|||
*/
|
||||
if ((height%(bparm.VerDcm*16))!=0)
|
||||
{
|
||||
gst_element_error(GST_ELEMENT(v4lmjpegsrc),
|
||||
"Image height (%d) not multiple of %d (required for JPEG)",
|
||||
height, bparm.VerDcm*16);
|
||||
gst_element_error(GST_ELEMENT(v4lmjpegsrc), GST_ERROR_UNKNOWN,
|
||||
g_strdup(_("An unknown error occured")),
|
||||
g_strdup_printf("Image height (%d) not multiple of %d (required for JPEG)"
|
||||
,height, bparm.VerDcm*16));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -417,9 +430,10 @@ gboolean gst_v4lmjpegsrc_set_capture_m (GstV4lMjpegSrc *v4lmjpegsrc,
|
|||
/* Set params for capture */
|
||||
if (ioctl(GST_V4LELEMENT(v4lmjpegsrc)->video_fd, MJPIOC_S_PARAMS, &bparm) < 0)
|
||||
{
|
||||
gst_element_error(GST_ELEMENT(v4lmjpegsrc),
|
||||
"Error setting video parameters: %s",
|
||||
g_strerror(errno));
|
||||
gst_element_error(GST_ELEMENT(v4lmjpegsrc), GST_ERROR_DEVICE,
|
||||
g_strdup(_("Unable to set parameters on video device")),
|
||||
g_strdup_printf("Error setting video parameters: %s",
|
||||
g_strerror(errno)));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -444,17 +458,19 @@ gst_v4lmjpegsrc_capture_init (GstV4lMjpegSrc *v4lmjpegsrc)
|
|||
if (ioctl(GST_V4LELEMENT(v4lmjpegsrc)->video_fd,
|
||||
MJPIOC_REQBUFS, &(v4lmjpegsrc->breq)) < 0)
|
||||
{
|
||||
gst_element_error(GST_ELEMENT(v4lmjpegsrc),
|
||||
"Error requesting video buffers: %s",
|
||||
g_strerror(errno));
|
||||
gst_element_error(GST_ELEMENT(v4lmjpegsrc), GST_ERROR_DEVICE,
|
||||
g_strdup(_("Unable to get informations from video device")),
|
||||
g_strdup_printf("Error requesting video buffers: %s",
|
||||
g_strerror(errno)));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (v4lmjpegsrc->breq.count < MIN_BUFFERS_QUEUED)
|
||||
{
|
||||
gst_element_error(GST_ELEMENT(v4lmjpegsrc),
|
||||
"Too little buffers. We got %d, we want at least %d",
|
||||
v4lmjpegsrc->breq.count, MIN_BUFFERS_QUEUED);
|
||||
gst_element_error(GST_ELEMENT(v4lmjpegsrc), GST_ERROR_UNKNOWN,
|
||||
g_strdup(_("An unknown error occured")),
|
||||
g_strdup_printf("Too little buffers. We got %lu, we want at least %d",
|
||||
v4lmjpegsrc->breq.count, MIN_BUFFERS_QUEUED));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -479,9 +495,10 @@ gst_v4lmjpegsrc_capture_init (GstV4lMjpegSrc *v4lmjpegsrc)
|
|||
PROT_READ|PROT_WRITE, MAP_SHARED, GST_V4LELEMENT(v4lmjpegsrc)->video_fd, 0);
|
||||
if (GST_V4LELEMENT(v4lmjpegsrc)->buffer == MAP_FAILED)
|
||||
{
|
||||
gst_element_error(GST_ELEMENT(v4lmjpegsrc),
|
||||
"Error mapping video buffers: %s",
|
||||
g_strerror(errno));
|
||||
gst_element_error(GST_ELEMENT(v4lmjpegsrc), GST_ERROR_UNKNOWN,
|
||||
g_strdup(_("An unknown error occured")),
|
||||
g_strdup_printf("Error mapping video buffers: %s",
|
||||
g_strerror(errno)));
|
||||
GST_V4LELEMENT(v4lmjpegsrc)->buffer = NULL;
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -622,10 +639,11 @@ gst_v4lmjpegsrc_requeue_frame (GstV4lMjpegSrc *v4lmjpegsrc,
|
|||
g_mutex_lock(v4lmjpegsrc->mutex_queue_state);
|
||||
|
||||
if (v4lmjpegsrc->frame_queue_state[num] != QUEUE_STATE_SYNCED) {
|
||||
gst_element_error(GST_ELEMENT(v4lmjpegsrc),
|
||||
"Invalid state %d (expected %d), can't requeue",
|
||||
gst_element_error(GST_ELEMENT(v4lmjpegsrc), GST_ERROR_UNKNOWN,
|
||||
g_strdup(_("An unknown error occured")),
|
||||
g_strdup_printf("Invalid state %d (expected %d), can't requeue",
|
||||
v4lmjpegsrc->frame_queue_state[num],
|
||||
QUEUE_STATE_SYNCED);
|
||||
QUEUE_STATE_SYNCED));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
|
|
@ -95,9 +95,10 @@ gst_v4lsrc_queue_frame (GstV4lSrc *v4lsrc,
|
|||
if (ioctl(GST_V4LELEMENT(v4lsrc)->video_fd,
|
||||
VIDIOCMCAPTURE, &(v4lsrc->mmap)) < 0)
|
||||
{
|
||||
gst_element_error(GST_ELEMENT(v4lsrc),
|
||||
"Error queueing a buffer (%d): %s",
|
||||
num, g_strerror(errno));
|
||||
gst_element_error(GST_ELEMENT(v4lsrc), GST_ERROR_DEVICE,
|
||||
g_strdup(_("Unable to set parameters on video device")),
|
||||
g_strdup_printf("Error queueing a buffer (%d): %s",
|
||||
num, g_strerror(errno)));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -126,9 +127,10 @@ gst_v4lsrc_sync_frame (GstV4lSrc *v4lsrc, gint num)
|
|||
/* if the sync() got interrupted, we can retry */
|
||||
if (errno != EINTR) {
|
||||
v4lsrc->frame_queue_state[num] = QUEUE_STATE_ERROR;
|
||||
gst_element_error(GST_ELEMENT(v4lsrc),
|
||||
"Error syncing on a buffer (%d): %s",
|
||||
num, g_strerror(errno));
|
||||
gst_element_error(GST_ELEMENT(v4lsrc), GST_ERROR_DEVICE,
|
||||
g_strdup(_("Unable to set parameters on video device")),
|
||||
g_strdup_printf("Error syncing on a buffer (%d): %s",
|
||||
num, g_strerror(errno)));
|
||||
return FALSE;
|
||||
}
|
||||
DEBUG("Sync got interrupted");
|
||||
|
@ -190,17 +192,19 @@ gst_v4lsrc_capture_init (GstV4lSrc *v4lsrc)
|
|||
/* request buffer info */
|
||||
if (ioctl(GST_V4LELEMENT(v4lsrc)->video_fd, VIDIOCGMBUF, &(v4lsrc->mbuf)) < 0)
|
||||
{
|
||||
gst_element_error(GST_ELEMENT(v4lsrc),
|
||||
"Error getting buffer information: %s",
|
||||
g_strerror(errno));
|
||||
gst_element_error(GST_ELEMENT(v4lsrc), GST_ERROR_DEVICE,
|
||||
g_strdup(_("Unable to get informations from video device")),
|
||||
g_strdup_printf("Error getting buffer information: %s",
|
||||
g_strerror(errno)));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (v4lsrc->mbuf.frames < MIN_BUFFERS_QUEUED)
|
||||
{
|
||||
gst_element_error(GST_ELEMENT(v4lsrc),
|
||||
"Too little buffers. We got %d, we want at least %d",
|
||||
v4lsrc->mbuf.frames, MIN_BUFFERS_QUEUED);
|
||||
gst_element_error(GST_ELEMENT(v4lsrc), GST_ERROR_UNKNOWN,
|
||||
g_strdup(_("An unknown error occured")),
|
||||
g_strdup_printf("Too little buffers. We got %d, we want at least %d",
|
||||
v4lsrc->mbuf.frames, MIN_BUFFERS_QUEUED));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -225,9 +229,10 @@ gst_v4lsrc_capture_init (GstV4lSrc *v4lsrc)
|
|||
PROT_READ|PROT_WRITE, MAP_SHARED, GST_V4LELEMENT(v4lsrc)->video_fd, 0);
|
||||
if (GST_V4LELEMENT(v4lsrc)->buffer == MAP_FAILED)
|
||||
{
|
||||
gst_element_error(GST_ELEMENT(v4lsrc),
|
||||
"Error mapping video buffers: %s",
|
||||
g_strerror(errno));
|
||||
gst_element_error(GST_ELEMENT(v4lsrc), GST_ERROR_UNKNOWN,
|
||||
g_strdup(_("An unknown error occured")),
|
||||
g_strdup_printf("Error mapping video buffers: %s",
|
||||
g_strerror(errno)));
|
||||
GST_V4LELEMENT(v4lsrc)->buffer = NULL;
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -364,10 +369,11 @@ gst_v4lsrc_requeue_frame (GstV4lSrc *v4lsrc, gint num)
|
|||
g_mutex_lock(v4lsrc->mutex_queue_state);
|
||||
|
||||
if (v4lsrc->frame_queue_state[num] != QUEUE_STATE_SYNCED) {
|
||||
gst_element_error(GST_ELEMENT(v4lsrc),
|
||||
"Invalid state %d (expected %d), can't requeue",
|
||||
gst_element_error(GST_ELEMENT(v4lsrc), GST_ERROR_UNKNOWN,
|
||||
g_strdup(_("An unknown error occured")),
|
||||
g_strdup_printf("Invalid state %d (expected %d), can't requeue",
|
||||
v4lsrc->frame_queue_state[num],
|
||||
QUEUE_STATE_SYNCED);
|
||||
QUEUE_STATE_SYNCED));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -478,9 +484,10 @@ gst_v4lsrc_try_palette (GstV4lSrc *v4lsrc,
|
|||
/* let's start by requesting a buffer and mmap()'ing it */
|
||||
if (ioctl(GST_V4LELEMENT(v4lsrc)->video_fd, VIDIOCGMBUF, &vmbuf) < 0)
|
||||
{
|
||||
gst_element_error(GST_ELEMENT(v4lsrc),
|
||||
"Error getting buffer information: %s",
|
||||
g_strerror(errno));
|
||||
gst_element_error(GST_ELEMENT(v4lsrc), GST_ERROR_DEVICE,
|
||||
g_strdup(_("Unable to get informations from video device")),
|
||||
g_strdup_printf("Error getting buffer information: %s",
|
||||
g_strerror(errno)));
|
||||
return FALSE;
|
||||
}
|
||||
/* Map the buffers */
|
||||
|
@ -488,9 +495,10 @@ gst_v4lsrc_try_palette (GstV4lSrc *v4lsrc,
|
|||
MAP_SHARED, GST_V4LELEMENT(v4lsrc)->video_fd, 0);
|
||||
if (buffer == MAP_FAILED)
|
||||
{
|
||||
gst_element_error(GST_ELEMENT(v4lsrc),
|
||||
"Error mapping our try-out buffer: %s",
|
||||
g_strerror(errno));
|
||||
gst_element_error(GST_ELEMENT(v4lsrc), GST_ERROR_UNKNOWN,
|
||||
g_strdup(_("An unknown error occured")),
|
||||
g_strdup_printf("Error mapping our try-out buffer: %s",
|
||||
g_strerror(errno)));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -502,18 +510,20 @@ gst_v4lsrc_try_palette (GstV4lSrc *v4lsrc,
|
|||
if (ioctl(GST_V4LELEMENT(v4lsrc)->video_fd, VIDIOCMCAPTURE, &vmmap) < 0)
|
||||
{
|
||||
if (errno != EINVAL) /* our format failed! */
|
||||
gst_element_error(GST_ELEMENT(v4lsrc),
|
||||
"Error queueing our try-out buffer: %s",
|
||||
g_strerror(errno));
|
||||
gst_element_error(GST_ELEMENT(v4lsrc), GST_ERROR_DEVICE,
|
||||
g_strdup(_("Unable to set parameters on video device")),
|
||||
g_strdup_printf("Error queueing our try-out buffer: %s",
|
||||
g_strerror(errno)));
|
||||
munmap(buffer, vmbuf.size);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (ioctl(GST_V4LELEMENT(v4lsrc)->video_fd, VIDIOCSYNC, &frame) < 0)
|
||||
{
|
||||
gst_element_error(GST_ELEMENT(v4lsrc),
|
||||
"Error syncing on a buffer (%d): %s",
|
||||
frame, g_strerror(errno));
|
||||
gst_element_error(GST_ELEMENT(v4lsrc), GST_ERROR_UNKNOWN,
|
||||
g_strdup(_("An unknown error occured")),
|
||||
g_strdup_printf("Error syncing on a buffer (%d): %s",
|
||||
frame, g_strerror(errno)));
|
||||
munmap(buffer, vmbuf.size);
|
||||
return FALSE;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue