g_free (ximagesink->par);
ximagesink->par = NULL;
+ if (xcontext->last_caps)
+ gst_caps_replace (&xcontext->last_caps, NULL);
+
g_mutex_lock (ximagesink->x_lock);
XCloseDisplay (xcontext->disp);
gboolean alloc_unref = FALSE;
gint width, height;
GstVideoRectangle dst, src, result;
+ gboolean caps_accepted = FALSE;
ximagesink = GST_XIMAGESINK (bsink);
GST_TYPE_FRACTION, nom, den, NULL);
}
+
/* see if peer accepts our new suggestion, if there is no peer, this
* function returns true. */
- if (gst_pad_peer_accept_caps (GST_VIDEO_SINK_PAD (ximagesink),
- desired_caps)) {
+ if (!ximagesink->xcontext->last_caps ||
+ !gst_caps_is_equal (desired_caps, ximagesink->xcontext->last_caps)) {
+ caps_accepted =
+ gst_pad_peer_accept_caps (GST_VIDEO_SINK_PAD (ximagesink),
+ desired_caps);
+
+ /* Suggestion failed, prevent future attempts for the same caps
+ * to fail as well. */
+ if (!caps_accepted)
+ gst_caps_replace (&ximagesink->xcontext->last_caps, desired_caps);
+ }
+
+ if (caps_accepted) {
/* we will not alloc a buffer of the new suggested caps. Make sure
* we also unref this new caps after we set it on the buffer. */
alloc_caps = desired_caps;
(GClassInitFunc) gst_ximagesink_class_init,
NULL,
NULL,
- sizeof (GstXImageSink),
- 0,
- (GInstanceInitFunc) gst_ximagesink_init,
+ sizeof (GstXImageSink), 0, (GInstanceInitFunc) gst_ximagesink_init,
};
static const GInterfaceInfo iface_info = {
- (GInterfaceInitFunc) gst_ximagesink_interface_init,
- NULL,
- NULL,
+ (GInterfaceInitFunc) gst_ximagesink_interface_init, NULL, NULL,
};
static const GInterfaceInfo navigation_info = {
- (GInterfaceInitFunc) gst_ximagesink_navigation_init,
- NULL,
- NULL,
+ (GInterfaceInitFunc) gst_ximagesink_navigation_init, NULL, NULL,
};
static const GInterfaceInfo overlay_info = {
- (GInterfaceInitFunc) gst_ximagesink_xoverlay_init,
- NULL,
- NULL,
+ (GInterfaceInitFunc) gst_ximagesink_xoverlay_init, NULL, NULL,
};
ximagesink_type = g_type_register_static (GST_TYPE_VIDEO_SINK,
#include <math.h>
G_BEGIN_DECLS
-
#define GST_TYPE_XIMAGESINK \
(gst_ximagesink_get_type())
#define GST_XIMAGESINK(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE((obj), GST_TYPE_XIMAGESINK))
#define GST_IS_XIMAGESINK_CLASS(klass) \
(G_TYPE_CHECK_CLASS_TYPE((klass), GST_TYPE_XIMAGESINK))
-
typedef struct _GstXContext GstXContext;
typedef struct _GstXWindow GstXWindow;
* Structure used to store various informations collected/calculated for a
* Display.
*/
-struct _GstXContext {
+struct _GstXContext
+{
Display *disp;
Screen *screen;
gboolean use_xshm;
GstCaps *caps;
+ GstCaps *last_caps;
};
/*
*
* Structure used to store informations about a Window.
*/
-struct _GstXWindow {
+struct _GstXWindow
+{
Window win;
gint width, height;
gboolean internal;
*
* Subclass of #GstBuffer containing additional information about an XImage.
*/
-struct _GstXImageBuffer {
+struct _GstXImageBuffer
+{
GstBuffer buffer;
/* Reference to the ximagesink we belong to */
#ifdef HAVE_XSHM
XShmSegmentInfo SHMInfo;
-#endif /* HAVE_XSHM */
+#endif /* HAVE_XSHM */
gint width, height;
size_t size;
*
* The #GstXImageSink data structure.
*/
-struct _GstXImageSink {
+struct _GstXImageSink
+{
/* Our element stuff */
GstVideoSink videosink;
GstXWindow *xwindow;
GstXImageBuffer *ximage;
GstXImageBuffer *cur_image;
-
+
GThread *event_thread;
gboolean running;
GMutex *x_lock;
GMutex *flow_lock;
-
+
/* object-set pixel aspect ratio */
GValue *par;
gboolean handle_events;
gboolean handle_expose;
gboolean draw_border;
-
+
/* stream metadata */
gchar *media_title;
};
-struct _GstXImageSinkClass {
+struct _GstXImageSinkClass
+{
GstVideoSinkClass parent_class;
};
-GType gst_ximagesink_get_type(void);
+GType gst_ximagesink_get_type (void);
G_END_DECLS
-
#endif /* __GST_XIMAGESINK_H__ */