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