I'm such an idiot - these files should have been in a week ago

Original commit message from CVS:
I'm such an idiot - these files should have been in a week ago
This commit is contained in:
Ronald S. Bultje 2002-09-28 11:05:39 +00:00
parent 895c730a13
commit 5264e71774
5 changed files with 39 additions and 99 deletions

View file

@ -62,7 +62,6 @@ enum {
ARG_DEVICE_IS_MPEG_PLAYBACK,
ARG_DISPLAY,
ARG_VIDEOWINDOW,
ARG_CLIPPING,
ARG_DO_OVERLAY,
};
@ -205,9 +204,6 @@ gst_v4lelement_class_init (GstV4lElementClass *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_v4lelement_set_property;
gobject_class->get_property = gst_v4lelement_get_property;
@ -357,29 +353,13 @@ gst_v4lelement_set_property (GObject *object,
v4lelement->display = g_strdup(g_value_get_string(value));
break;
case ARG_VIDEOWINDOW:
if (GST_V4L_IS_OPEN(v4lelement))
gst_v4l_set_window(v4lelement,
((GstV4lRect*)g_value_get_pointer(value))->x,
((GstV4lRect*)g_value_get_pointer(value))->y,
((GstV4lRect*)g_value_get_pointer(value))->w,
((GstV4lRect*)g_value_get_pointer(value))->h);
break;
case ARG_CLIPPING:
if (GST_V4L_IS_OPEN(v4lelement))
{
gint i;
struct video_clip *clips;
GList *list = (GList*)g_value_get_pointer(value);
clips = g_malloc(sizeof(struct video_clip) * g_list_length(list));
for (i=0;i<g_list_length(list);i++)
{
clips[i].x = ((GstV4lRect*)g_list_nth_data(list, i))->x;
clips[i].y = ((GstV4lRect*)g_list_nth_data(list, i))->y;
clips[i].width = ((GstV4lRect*)g_list_nth_data(list, i))->w;
clips[i].height = ((GstV4lRect*)g_list_nth_data(list, i))->h;
}
gst_v4l_set_clips(v4lelement, clips, g_list_length(list));
g_free(clips);
GByteArray *array = (GByteArray *) g_value_get_pointer(value);
struct video_clip *clips = (struct video_clip *) array->data;
gst_v4l_set_window(v4lelement,
clips->x, clips->y, clips->width, clips->height,
&clips[1], array->len/sizeof(struct video_clip)-1);
}
break;
default:

View file

@ -65,9 +65,6 @@ struct _GstV4lElement {
/* some more info about the current input's capabilities */
struct video_channel vchan;
/* and last but not least, the current video window */
struct video_window vwin;
/* caching values */
gint channel;
gint norm;

View file

@ -73,26 +73,6 @@ gst_v4l_set_overlay (GstV4lElement *v4lelement,
}
/******************************************************
* gst_v4l_set_vwin():
* does the VIDIOCSVWIN ioctl()
* return value: TRUE on success, FALSE on error
******************************************************/
static gboolean
gst_v4l_set_vwin (GstV4lElement *v4lelement)
{
if (ioctl(v4lelement->video_fd, VIDIOCSWIN, &(v4lelement->vwin)) < 0)
{
gst_element_error(GST_ELEMENT(v4lelement),
"Failed to set the video window: %s",
sys_errlist[errno]);
return FALSE;
}
return TRUE;
}
/******************************************************
* gst_v4l_set_window():
* sets the window where to display the video overlay
@ -100,52 +80,48 @@ gst_v4l_set_vwin (GstV4lElement *v4lelement)
******************************************************/
gboolean
gst_v4l_set_window (GstV4lElement *v4lelement,
gint x, gint y,
gint w, gint h)
gst_v4l_set_window (GstV4lElement *v4lelement,
gint x,
gint y,
gint w,
gint h,
struct video_clip *clips,
gint num_clips)
{
struct video_window vwin;
DEBUG("setting video window to position (x,y/wxh) = %d,%d/%dx%d",
x, y, w, h);
GST_V4L_CHECK_OVERLAY(v4lelement);
v4lelement->vwin.clipcount = 0;
v4lelement->vwin.x = x;
v4lelement->vwin.y = y;
v4lelement->vwin.width = w;
v4lelement->vwin.height = h;
v4lelement->vwin.flags = 0;
return gst_v4l_set_vwin(v4lelement);
}
/******************************************************
* gst_v4l_set_clips():
* sets video overlay clips
* return value: TRUE on success, FALSE on error
******************************************************/
gboolean
gst_v4l_set_clips (GstV4lElement *v4lelement,
struct video_clip *clips,
gint num_clips)
{
DEBUG("setting video window clips");
GST_V4L_CHECK_OPEN(v4lelement);
GST_V4L_CHECK_OVERLAY(v4lelement);
if (!(v4lelement->vcap.type & VID_TYPE_CLIPPING))
vwin.x = x;
vwin.y = y;
vwin.width = w;
vwin.height = h;
vwin.flags = 0;
if (clips && !(v4lelement->vcap.type & VID_TYPE_CLIPPING))
{
DEBUG("Device \'%s\' doesn't do clipping",
v4lelement->videodev?v4lelement->videodev:"/dev/video");
vwin.clips = 0;
}
else
{
vwin.clips = clips;
vwin.clipcount = num_clips;
}
if (ioctl(v4lelement->video_fd, VIDIOCSWIN, &vwin) < 0)
{
gst_element_error(GST_ELEMENT(v4lelement),
"Device \'%s\' doesn't do clipping",
v4lelement->videodev?v4lelement->videodev:"/dev/video");
"Failed to set the video window: %s",
sys_errlist[errno]);
return FALSE;
}
v4lelement->vwin.clips = clips;
v4lelement->vwin.clipcount = num_clips;
return gst_v4l_set_vwin(v4lelement);
return TRUE;
}

View file

@ -97,20 +97,6 @@ gst_v4l_open (GstV4lElement *v4lelement)
return FALSE;
}
/* and get the video window */
if (GST_V4L_IS_OVERLAY(v4lelement))
{
if (ioctl(v4lelement->video_fd, VIDIOCGWIN, &(v4lelement->vwin)) < 0)
{
close(v4lelement->video_fd);
v4lelement->video_fd = -1;
gst_element_error(GST_ELEMENT(v4lelement),
"Failed to get video window properties of \'%s\': %s",
v4lelement->videodev, sys_errlist[errno]);
return FALSE;
}
}
gst_info("Opened device \'%s\' (\'%s\') successfully\n",
v4lelement->vcap.name, v4lelement->videodev);

View file

@ -130,8 +130,9 @@ gboolean gst_v4l_set_audio (GstV4lElement *v4lelement, GstV4lAudioType type
/* overlay */
gboolean gst_v4l_set_overlay (GstV4lElement *v4lelement, gchar *display);
gboolean gst_v4l_set_window (GstV4lElement *v4lelement, gint x, gint y, gint w, gint h);
gboolean gst_v4l_set_clips (GstV4lElement *v4lelement, struct video_clip *clips, gint num_clips);
gboolean gst_v4l_set_window (GstV4lElement *v4lelement, gint x, gint y,
gint w, gint h,
struct video_clip *clips, gint num_clips);
gboolean gst_v4l_enable_overlay (GstV4lElement *v4lelement, gboolean enable);