diff options
Diffstat (limited to 'sys')
-rw-r--r-- | sys/v4l2/gstv4l2element.c | 29 | ||||
-rw-r--r-- | sys/v4l2/gstv4l2element.h | 3 | ||||
-rw-r--r-- | sys/v4l2/v4l2-overlay_calls.c | 73 | ||||
-rw-r--r-- | sys/v4l2/v4l2_calls.c | 10 | ||||
-rw-r--r-- | sys/v4l2/v4l2_calls.h | 3 |
5 files changed, 28 insertions, 90 deletions
diff --git a/sys/v4l2/gstv4l2element.c b/sys/v4l2/gstv4l2element.c index 01f0fa1c..2c3a304d 100644 --- a/sys/v4l2/gstv4l2element.c +++ b/sys/v4l2/gstv4l2element.c @@ -61,7 +61,6 @@ enum { ARG_DEVICE_HAS_CODEC, ARG_DISPLAY, ARG_VIDEOWINDOW, - ARG_CLIPPING, ARG_DO_OVERLAY, }; @@ -185,9 +184,6 @@ gst_v4l2element_class_init (GstV4l2ElementClass *klass) g_object_class_install_property(G_OBJECT_CLASS(klass), ARG_VIDEOWINDOW, g_param_spec_pointer("videowindow","videowindow","videowindow", G_PARAM_WRITABLE)); - g_object_class_install_property(G_OBJECT_CLASS(klass), ARG_CLIPPING, - g_param_spec_pointer("videowindowclip","videowindowclip","videowindowclip", - G_PARAM_WRITABLE)); gobject_class->set_property = gst_v4l2element_set_property; gobject_class->get_property = gst_v4l2element_get_property; @@ -278,28 +274,11 @@ gst_v4l2element_set_property (GObject *object, break; case ARG_VIDEOWINDOW: if (GST_V4L2_IS_OPEN(v4l2element)) { + GByteArray *array = (GByteArray *) g_value_get_pointer(value); + struct v4l2_clip *clips = (struct v4l2_clip *) array->data; gst_v4l2_set_window(v4l2element, - ((GstV4l2Rect*)g_value_get_pointer(value))->x, - ((GstV4l2Rect*)g_value_get_pointer(value))->y, - ((GstV4l2Rect*)g_value_get_pointer(value))->w, - ((GstV4l2Rect*)g_value_get_pointer(value))->h); - } - break; - case ARG_CLIPPING: - if (GST_V4L2_IS_OPEN(v4l2element)) { - gint i; - struct v4l2_clip *clips; - GList *list = (GList*)g_value_get_pointer(value); - clips = g_malloc(sizeof(struct v4l2_clip) * g_list_length(list)); - for (i=0;i<g_list_length(list);i++) - { - clips[i].x = ((GstV4l2Rect*)g_list_nth_data(list, i))->x; - clips[i].y = ((GstV4l2Rect*)g_list_nth_data(list, i))->y; - clips[i].width = ((GstV4l2Rect*)g_list_nth_data(list, i))->w; - clips[i].height = ((GstV4l2Rect*)g_list_nth_data(list, i))->h; - } - gst_v4l2_set_clips(v4l2element, clips, g_list_length(list)); - g_free(clips); + clips->x, clips->y, clips->width, clips->height, + &clips[1], array->len/sizeof(struct v4l2_clip)-1); } break; case ARG_DO_OVERLAY: diff --git a/sys/v4l2/gstv4l2element.h b/sys/v4l2/gstv4l2element.h index 617aad6d..b0e9fb7c 100644 --- a/sys/v4l2/gstv4l2element.h +++ b/sys/v4l2/gstv4l2element.h @@ -90,9 +90,6 @@ struct _GstV4l2Element { GList /*v4l2_queryctrl*/ *controls; GList /*GList:v4l2_querymenu*/ *menus; - /* and last but not least, the current video window */ - struct v4l2_window vwin; - /* caching values */ gint channel; gint output; diff --git a/sys/v4l2/v4l2-overlay_calls.c b/sys/v4l2/v4l2-overlay_calls.c index c8ee053c..7eecb49d 100644 --- a/sys/v4l2/v4l2-overlay_calls.c +++ b/sys/v4l2/v4l2-overlay_calls.c @@ -75,69 +75,42 @@ gst_v4l2_set_display (GstV4l2Element *v4l2element, /****************************************************** - * gst_v4l2_set_vwin(): - * does the VIDIOC_S_WIN ioctl() - * return value: TRUE on success, FALSE on error - ******************************************************/ - -static gboolean -gst_v4l2_set_vwin (GstV4l2Element *v4l2element) -{ - if (ioctl(v4l2element->video_fd, VIDIOC_S_WIN, &(v4l2element->vwin)) < 0) { - gst_element_error(GST_ELEMENT(v4l2element), - "Failed to set the video window on device %s: %s", - v4l2element->device, sys_errlist[errno]); - return FALSE; - } - - return TRUE; -} - - -/****************************************************** * gst_v4l2_set_window(): * sets the window where to display the video overlay * return value: TRUE on success, FALSE on error ******************************************************/ gboolean -gst_v4l2_set_window (GstV4l2Element *v4l2element, - gint x, gint y, - gint w, gint h) +gst_v4l2_set_window (GstV4l2Element *v4l2element, + gint x, + gint y, + gint w, + gint h, + struct v4l2_clip *clips, + gint num_clips) { + struct v4l2_window vwin; + DEBUG("trying to set video window to %dx%d,%d,%d", x,y,w,h); GST_V4L2_CHECK_OVERLAY(v4l2element); GST_V4L2_CHECK_OPEN(v4l2element); - v4l2element->vwin.clipcount = 0; - v4l2element->vwin.x = x; - v4l2element->vwin.y = y; - v4l2element->vwin.width = w; - v4l2element->vwin.height = h; - - return gst_v4l2_set_vwin(v4l2element); -} - + vwin.clipcount = 0; + vwin.x = x; + vwin.y = y; + vwin.width = w; + vwin.height = h; + vwin.clips = clips; + vwin.clipcount = num_clips; -/****************************************************** - * gst_v4l_set_clips(): - * sets video overlay clips - * return value: TRUE on success, FALSE on error - ******************************************************/ - -gboolean -gst_v4l2_set_clips (GstV4l2Element *v4l2element, - struct v4l2_clip *clips, - gint num_clips) -{ - DEBUG("trying to set video clipping information"); - GST_V4L2_CHECK_OPEN(v4l2element); - GST_V4L2_CHECK_OVERLAY(v4l2element); - - v4l2element->vwin.clips = clips; - v4l2element->vwin.clipcount = num_clips; + if (ioctl(v4l2element->video_fd, VIDIOC_S_WIN, &vwin) < 0) { + gst_element_error(GST_ELEMENT(v4l2element), + "Failed to set the video window on device %s: %s", + v4l2element->device, sys_errlist[errno]); + return FALSE; + } - return gst_v4l2_set_vwin(v4l2element); + return TRUE; } diff --git a/sys/v4l2/v4l2_calls.c b/sys/v4l2/v4l2_calls.c index c29951fb..82ef14f4 100644 --- a/sys/v4l2/v4l2_calls.c +++ b/sys/v4l2/v4l2_calls.c @@ -270,16 +270,6 @@ gst_v4l2_open (GstV4l2Element *v4l2element) goto error; } - /* and get the video window */ - if (GST_V4L2_IS_OVERLAY(v4l2element)) { - if (ioctl(v4l2element->video_fd, VIDIOC_G_WIN, &(v4l2element->vwin)) < 0) { - gst_element_error(GST_ELEMENT(v4l2element), - "Failed to get video window properties of %s: %s", - v4l2element->device, sys_errlist[errno]); - goto error; - } - } - /* create enumerations */ if (!gst_v4l2_fill_lists(v4l2element)) goto error; diff --git a/sys/v4l2/v4l2_calls.h b/sys/v4l2/v4l2_calls.h index ce562d47..de0bbc9e 100644 --- a/sys/v4l2/v4l2_calls.h +++ b/sys/v4l2/v4l2_calls.h @@ -125,8 +125,7 @@ gboolean gst_v4l2_set_display (GstV4l2Element *v4l2element, const gchar *display); gboolean gst_v4l2_set_window (GstV4l2Element *v4l2element, gint x, gint y, - gint w, gint h); -gboolean gst_v4l2_set_clips (GstV4l2Element *v4l2element, + gint w, gint h, struct v4l2_clip *clips, gint num_clips); gboolean gst_v4l2_enable_overlay (GstV4l2Element *v4l2element, |