=================================================================== RCS file: /cvs/gstreamer/gst-plugins/sys/ximage/Attic/ximagesrc.c,v rcsdiff: /cvs/gstreamer/gst-plugins/sys/ximage/Attic/ximagesrc.c,v: warning: Unknown phrases like `commitid ...;' are present. retrieving revision 1.1.2.2 retrieving revision 1.1.2.3 diff -u -r1.1.2.2 -r1.1.2.3 --- ximagesrc.c 2005/05/25 11:36:11 1.1.2.2 +++ ximagesrc.c 2005/06/03 10:53:19 1.1.2.3 @@ -153,8 +153,9 @@ "width", G_TYPE_INT, s->width, "height", G_TYPE_INT, s->height, "framerate", GST_TYPE_DOUBLE_RANGE, 1., 100., NULL); - else - return gst_caps_new_empty (); + + return gst_caps_copy (gst_pad_template_get_caps (gst_static_pad_template_get + (&gst_ximagesrc_src_template_factory))); } static GstPadLinkReturn @@ -225,6 +226,16 @@ case GST_STATE_PAUSED_TO_READY: s->frame = 0; break; + case GST_STATE_NULL_TO_READY: + if (!(s->display = XOpenDisplay (g_getenv ("DISPLAY")))) { + GST_ELEMENT_ERROR (element, RESOURCE, OPEN_READ, (NULL), (NULL)); + return GST_STATE_FAILURE; + } + break; + case GST_STATE_READY_TO_NULL: + XCloseDisplay (s->display); + s->display = NULL; + break; default: break; } @@ -248,7 +259,7 @@ gst_pad_set_get_function (pad, gst_ximagesrc_get); gst_element_add_pad (GST_ELEMENT (s), pad); - s->display = XOpenDisplay (NULL); + s->display = NULL; s->framerate = 10.; s->clock = NULL; s->sync = DEFAULT_PROP_SYNC; @@ -290,7 +301,11 @@ switch (prop_id) { case PROP_DISPLAY_NAME: - g_value_set_string (value, DisplayString (src->display)); + if (src->display) { + g_value_set_string (value, DisplayString (src->display)); + } else { + g_value_set_string (value, NULL); + } break; case PROP_SCREEN_NUM: g_value_set_uint (value, src->screen_num); @@ -309,8 +324,6 @@ { GstElementClass *element_class = GST_ELEMENT_CLASS (g_class); - element_class->change_state = gst_ximagesrc_change_state; - gst_element_class_set_details (element_class, &ximagesrc_details); gst_element_class_add_pad_template (element_class, @@ -354,6 +367,7 @@ gobject_class->get_property = gst_ximagesrc_get_property; gobject_class->finalize = gst_ximagesrc_finalize; + gstelement_class->change_state = gst_ximagesrc_change_state; gstelement_class->set_clock = gst_ximagesrc_set_clock; GST_DEBUG_CATEGORY_INIT (ximagesrc_debug, "ximagesrc", 0,