2003-11-06 21:51:14 +00:00
|
|
|
/* GStreamer
|
|
|
|
* Copyright (C) <2003> Julien Moutte <julien@moutte.net>
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Library General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Library General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Library General Public
|
|
|
|
* License along with this library; if not, write to the
|
|
|
|
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
|
|
* Boston, MA 02111-1307, USA.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
#include "config.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* Our interfaces */
|
2003-11-22 04:06:50 +00:00
|
|
|
#include <gst/navigation/navigation.h>
|
|
|
|
#include <gst/xoverlay/xoverlay.h>
|
2003-11-06 21:51:14 +00:00
|
|
|
|
|
|
|
/* Object header */
|
|
|
|
#include "ximagesink.h"
|
|
|
|
|
2004-01-15 22:03:45 +00:00
|
|
|
static void gst_ximagesink_buffer_free (GstBuffer *buffer);
|
|
|
|
|
2003-11-06 21:51:14 +00:00
|
|
|
/* ElementFactory information */
|
|
|
|
static GstElementDetails gst_ximagesink_details = GST_ELEMENT_DETAILS (
|
|
|
|
"Video sink",
|
|
|
|
"Sink/Video",
|
|
|
|
"A standard X based videosink",
|
|
|
|
"Julien Moutte <julien@moutte.net>"
|
|
|
|
);
|
|
|
|
|
|
|
|
/* Default template - initiated with class struct to allow gst-register to work
|
|
|
|
without X running */
|
2003-12-22 01:47:09 +00:00
|
|
|
static GstStaticPadTemplate gst_ximagesink_sink_template_factory =
|
|
|
|
GST_STATIC_PAD_TEMPLATE (
|
2003-11-06 21:51:14 +00:00
|
|
|
"sink",
|
|
|
|
GST_PAD_SINK,
|
|
|
|
GST_PAD_ALWAYS,
|
2003-12-22 01:47:09 +00:00
|
|
|
GST_STATIC_CAPS ("video/x-raw-rgb, "
|
2004-01-15 21:05:17 +00:00
|
|
|
"framerate = (double) [ 1.0, 100.0 ], "
|
2003-12-22 01:47:09 +00:00
|
|
|
"width = (int) [ 0, MAX ], "
|
|
|
|
"height = (int) [ 0, MAX ]")
|
|
|
|
);
|
2003-11-06 21:51:14 +00:00
|
|
|
|
gst/videofilter/gstvideobalance.c: Fixing videobalance ranges for colorbalance interface implementation.
Original commit message from CVS:
2004-01-14 Julien MOUTTE <julien@moutte.net>
* gst/videofilter/gstvideobalance.c: (gst_videobalance_init),
(gst_videobalance_colorbalance_set_value),
(gst_videobalance_colorbalance_get_value): Fixing videobalance ranges
for colorbalance interface implementation.
* sys/ximage/ximagesink.c: (gst_ximagesink_xcontext_get),
(gst_ximagesink_set_property), (gst_ximagesink_get_property),
(gst_ximagesink_dispose), (gst_ximagesink_init),
(gst_ximagesink_class_init): Adding DISPLAY property.
* sys/ximage/ximagesink.h: Adding display_name to store display.
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_xcontext_get),
(gst_xvimagesink_set_property), (gst_xvimagesink_get_property),
(gst_xvimagesink_dispose), (gst_xvimagesink_init),
(gst_xvimagesink_class_init): Adding DISPLAY property and colorbalance
properties (they still need polishing though for gst-launch use : no
xcontext yet, i ll do that tomorrow).
* sys/xvimage/xvimagesink.h: Adding display_name to store display.
2004-01-14 23:01:49 +00:00
|
|
|
enum {
|
|
|
|
ARG_0,
|
2004-01-18 12:32:19 +00:00
|
|
|
ARG_DISPLAY,
|
|
|
|
ARG_SYNCHRONOUS
|
gst/videofilter/gstvideobalance.c: Fixing videobalance ranges for colorbalance interface implementation.
Original commit message from CVS:
2004-01-14 Julien MOUTTE <julien@moutte.net>
* gst/videofilter/gstvideobalance.c: (gst_videobalance_init),
(gst_videobalance_colorbalance_set_value),
(gst_videobalance_colorbalance_get_value): Fixing videobalance ranges
for colorbalance interface implementation.
* sys/ximage/ximagesink.c: (gst_ximagesink_xcontext_get),
(gst_ximagesink_set_property), (gst_ximagesink_get_property),
(gst_ximagesink_dispose), (gst_ximagesink_init),
(gst_ximagesink_class_init): Adding DISPLAY property.
* sys/ximage/ximagesink.h: Adding display_name to store display.
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_xcontext_get),
(gst_xvimagesink_set_property), (gst_xvimagesink_get_property),
(gst_xvimagesink_dispose), (gst_xvimagesink_init),
(gst_xvimagesink_class_init): Adding DISPLAY property and colorbalance
properties (they still need polishing though for gst-launch use : no
xcontext yet, i ll do that tomorrow).
* sys/xvimage/xvimagesink.h: Adding display_name to store display.
2004-01-14 23:01:49 +00:00
|
|
|
/* FILL ME */
|
|
|
|
};
|
|
|
|
|
2003-11-19 20:43:49 +00:00
|
|
|
static GstVideoSinkClass *parent_class = NULL;
|
2004-01-28 00:29:42 +00:00
|
|
|
static gboolean error_catched = FALSE;
|
2003-11-06 21:51:14 +00:00
|
|
|
|
|
|
|
/* ============================================================= */
|
|
|
|
/* */
|
|
|
|
/* Private Methods */
|
|
|
|
/* */
|
|
|
|
/* ============================================================= */
|
|
|
|
|
|
|
|
/* X11 stuff */
|
|
|
|
|
2004-01-28 00:29:42 +00:00
|
|
|
static int
|
|
|
|
gst_ximagesink_handle_xerror (Display *display, XErrorEvent *xevent)
|
|
|
|
{
|
|
|
|
char error_msg [1024];
|
|
|
|
XGetErrorText (display, xevent->error_code, error_msg, 1024);
|
|
|
|
GST_DEBUG ("ximagesink failed to use XShm calls. error: %s",
|
|
|
|
error_msg);
|
|
|
|
error_catched = TRUE;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* This function checks that it is actually really possible to create an image
|
|
|
|
using XShm */
|
|
|
|
static gboolean
|
|
|
|
gst_ximagesink_check_xshm_calls (GstXContext *xcontext)
|
|
|
|
{
|
|
|
|
GstXImage *ximage = NULL;
|
|
|
|
int (*handler)(Display *, XErrorEvent *);
|
|
|
|
|
|
|
|
g_return_val_if_fail (xcontext != NULL, FALSE);
|
|
|
|
|
|
|
|
#ifdef HAVE_XSHM
|
|
|
|
ximage = g_new0 (GstXImage, 1);
|
|
|
|
|
|
|
|
/* Setting an error handler to catch failure */
|
|
|
|
handler = XSetErrorHandler (gst_ximagesink_handle_xerror);
|
|
|
|
|
|
|
|
ximage->size = (xcontext->bpp / 8);
|
|
|
|
|
|
|
|
/* Trying to create a 1x1 picture */
|
|
|
|
ximage->ximage = XShmCreateImage (xcontext->disp, xcontext->visual,
|
|
|
|
xcontext->depth, ZPixmap, NULL,
|
|
|
|
&ximage->SHMInfo, 1, 1);
|
|
|
|
|
|
|
|
ximage->SHMInfo.shmid = shmget (IPC_PRIVATE, ximage->size, IPC_CREAT | 0777);
|
|
|
|
ximage->SHMInfo.shmaddr = shmat (ximage->SHMInfo.shmid, 0, 0);
|
|
|
|
ximage->ximage->data = ximage->SHMInfo.shmaddr;
|
|
|
|
ximage->SHMInfo.readOnly = FALSE;
|
|
|
|
|
|
|
|
XShmAttach (xcontext->disp, &ximage->SHMInfo);
|
|
|
|
|
|
|
|
error_catched = FALSE;
|
|
|
|
|
|
|
|
XSync(xcontext->disp, 0);
|
|
|
|
|
|
|
|
XSetErrorHandler (handler);
|
|
|
|
|
|
|
|
if (error_catched)
|
|
|
|
{ /* Failed, detaching shared memory, destroying image and telling we can't
|
|
|
|
use XShm */
|
|
|
|
error_catched = FALSE;
|
|
|
|
XDestroyImage (ximage->ximage);
|
|
|
|
shmdt (ximage->SHMInfo.shmaddr);
|
|
|
|
shmctl (ximage->SHMInfo.shmid, IPC_RMID, 0);
|
|
|
|
g_free (ximage);
|
sys/: Removing some useless debugs messages, correctly cleaning the image created to check xshm calls on succes, adde...
Original commit message from CVS:
2004-01-28 Julien MOUTTE <julien@moutte.net>
* sys/ximage/ximagesink.c: (gst_ximagesink_check_xshm_calls),
(gst_ximagesink_ximage_new), (gst_ximagesink_ximage_destroy),
(gst_ximagesink_ximage_put), (gst_ximagesink_xwindow_new),
(gst_ximagesink_xwindow_destroy):
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_check_xshm_calls),
(gst_xvimagesink_xvimage_new), (gst_xvimagesink_xvimage_destroy),
(gst_xvimagesink_xwindow_new), (gst_xvimagesink_xwindow_destroy),
(gst_xvimagesink_xwindow_resize), (gst_xvimagesink_get_xv_support),
(gst_xvimagesink_xcontext_get): Removing some useless debugs messages,
correctly cleaning the image created to check xshm calls on succes,
added a lot of XSync calls in X11 functions, and fixed a segfault when
no image format was defined before negotiation happened.
2004-01-28 10:45:33 +00:00
|
|
|
XSync (xcontext->disp, FALSE);
|
2004-01-28 00:29:42 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
sys/: Removing some useless debugs messages, correctly cleaning the image created to check xshm calls on succes, adde...
Original commit message from CVS:
2004-01-28 Julien MOUTTE <julien@moutte.net>
* sys/ximage/ximagesink.c: (gst_ximagesink_check_xshm_calls),
(gst_ximagesink_ximage_new), (gst_ximagesink_ximage_destroy),
(gst_ximagesink_ximage_put), (gst_ximagesink_xwindow_new),
(gst_ximagesink_xwindow_destroy):
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_check_xshm_calls),
(gst_xvimagesink_xvimage_new), (gst_xvimagesink_xvimage_destroy),
(gst_xvimagesink_xwindow_new), (gst_xvimagesink_xwindow_destroy),
(gst_xvimagesink_xwindow_resize), (gst_xvimagesink_get_xv_support),
(gst_xvimagesink_xcontext_get): Removing some useless debugs messages,
correctly cleaning the image created to check xshm calls on succes,
added a lot of XSync calls in X11 functions, and fixed a segfault when
no image format was defined before negotiation happened.
2004-01-28 10:45:33 +00:00
|
|
|
XShmDetach (xcontext->disp, &ximage->SHMInfo);
|
|
|
|
XDestroyImage (ximage->ximage);
|
|
|
|
shmdt (ximage->SHMInfo.shmaddr);
|
|
|
|
shmctl (ximage->SHMInfo.shmid, IPC_RMID, 0);
|
|
|
|
g_free (ximage);
|
|
|
|
XSync (xcontext->disp, FALSE);
|
2004-01-28 00:29:42 +00:00
|
|
|
}
|
sys/: Removing some useless debugs messages, correctly cleaning the image created to check xshm calls on succes, adde...
Original commit message from CVS:
2004-01-28 Julien MOUTTE <julien@moutte.net>
* sys/ximage/ximagesink.c: (gst_ximagesink_check_xshm_calls),
(gst_ximagesink_ximage_new), (gst_ximagesink_ximage_destroy),
(gst_ximagesink_ximage_put), (gst_ximagesink_xwindow_new),
(gst_ximagesink_xwindow_destroy):
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_check_xshm_calls),
(gst_xvimagesink_xvimage_new), (gst_xvimagesink_xvimage_destroy),
(gst_xvimagesink_xwindow_new), (gst_xvimagesink_xwindow_destroy),
(gst_xvimagesink_xwindow_resize), (gst_xvimagesink_get_xv_support),
(gst_xvimagesink_xcontext_get): Removing some useless debugs messages,
correctly cleaning the image created to check xshm calls on succes,
added a lot of XSync calls in X11 functions, and fixed a segfault when
no image format was defined before negotiation happened.
2004-01-28 10:45:33 +00:00
|
|
|
#endif /* HAVE_XSHM */
|
|
|
|
|
|
|
|
return TRUE;
|
2004-01-28 00:29:42 +00:00
|
|
|
}
|
|
|
|
|
2003-11-11 11:32:27 +00:00
|
|
|
/* This function handles GstXImage creation depending on XShm availability */
|
2003-11-06 21:51:14 +00:00
|
|
|
static GstXImage *
|
|
|
|
gst_ximagesink_ximage_new (GstXImageSink *ximagesink, gint width, gint height)
|
|
|
|
{
|
|
|
|
GstXImage *ximage = NULL;
|
|
|
|
|
|
|
|
g_return_val_if_fail (GST_IS_XIMAGESINK (ximagesink), NULL);
|
|
|
|
|
|
|
|
ximage = g_new0 (GstXImage, 1);
|
|
|
|
|
|
|
|
ximage->width = width;
|
|
|
|
ximage->height = height;
|
|
|
|
ximage->data = NULL;
|
2004-01-11 22:52:29 +00:00
|
|
|
ximage->ximagesink = ximagesink;
|
2003-11-06 21:51:14 +00:00
|
|
|
|
|
|
|
g_mutex_lock (ximagesink->x_lock);
|
|
|
|
|
2003-11-11 11:32:27 +00:00
|
|
|
ximage->size = (ximagesink->xcontext->bpp / 8) * ximage->width * ximage->height;
|
2003-11-11 11:12:20 +00:00
|
|
|
|
2003-11-12 03:06:07 +00:00
|
|
|
#ifdef HAVE_XSHM
|
2003-11-06 21:51:14 +00:00
|
|
|
if (ximagesink->xcontext->use_xshm)
|
|
|
|
{
|
|
|
|
ximage->ximage = XShmCreateImage (ximagesink->xcontext->disp,
|
|
|
|
ximagesink->xcontext->visual,
|
|
|
|
ximagesink->xcontext->depth,
|
|
|
|
ZPixmap, NULL, &ximage->SHMInfo,
|
|
|
|
ximage->width, ximage->height);
|
|
|
|
|
|
|
|
ximage->SHMInfo.shmid = shmget (IPC_PRIVATE, ximage->size,
|
|
|
|
IPC_CREAT | 0777);
|
|
|
|
|
|
|
|
ximage->SHMInfo.shmaddr = shmat (ximage->SHMInfo.shmid, 0, 0);
|
|
|
|
ximage->ximage->data = ximage->SHMInfo.shmaddr;
|
|
|
|
|
|
|
|
ximage->SHMInfo.readOnly = FALSE;
|
|
|
|
|
|
|
|
XShmAttach (ximagesink->xcontext->disp, &ximage->SHMInfo);
|
2004-02-17 11:06:52 +00:00
|
|
|
|
|
|
|
XSync (ximagesink->xcontext->disp, FALSE);
|
|
|
|
|
|
|
|
shmctl (ximage->SHMInfo.shmid, IPC_RMID, 0);
|
|
|
|
ximage->SHMInfo.shmid = -1;
|
2003-11-06 21:51:14 +00:00
|
|
|
}
|
|
|
|
else
|
2003-11-25 04:48:04 +00:00
|
|
|
#endif /* HAVE_XSHM */
|
2003-11-06 21:51:14 +00:00
|
|
|
{
|
|
|
|
ximage->data = g_malloc (ximage->size);
|
|
|
|
|
|
|
|
ximage->ximage = XCreateImage (ximagesink->xcontext->disp,
|
|
|
|
ximagesink->xcontext->visual,
|
|
|
|
ximagesink->xcontext->depth,
|
|
|
|
ZPixmap, 0, ximage->data,
|
|
|
|
ximage->width, ximage->height,
|
|
|
|
ximagesink->xcontext->bpp,
|
|
|
|
ximage->width * (ximagesink->xcontext->bpp / 8));
|
2004-02-17 11:06:52 +00:00
|
|
|
|
sys/: Removing some useless debugs messages, correctly cleaning the image created to check xshm calls on succes, adde...
Original commit message from CVS:
2004-01-28 Julien MOUTTE <julien@moutte.net>
* sys/ximage/ximagesink.c: (gst_ximagesink_check_xshm_calls),
(gst_ximagesink_ximage_new), (gst_ximagesink_ximage_destroy),
(gst_ximagesink_ximage_put), (gst_ximagesink_xwindow_new),
(gst_ximagesink_xwindow_destroy):
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_check_xshm_calls),
(gst_xvimagesink_xvimage_new), (gst_xvimagesink_xvimage_destroy),
(gst_xvimagesink_xwindow_new), (gst_xvimagesink_xwindow_destroy),
(gst_xvimagesink_xwindow_resize), (gst_xvimagesink_get_xv_support),
(gst_xvimagesink_xcontext_get): Removing some useless debugs messages,
correctly cleaning the image created to check xshm calls on succes,
added a lot of XSync calls in X11 functions, and fixed a segfault when
no image format was defined before negotiation happened.
2004-01-28 10:45:33 +00:00
|
|
|
XSync (ximagesink->xcontext->disp, FALSE);
|
2003-11-06 21:51:14 +00:00
|
|
|
}
|
2004-02-17 11:06:52 +00:00
|
|
|
|
|
|
|
if (!ximage->ximage)
|
2003-11-06 21:51:14 +00:00
|
|
|
{
|
|
|
|
if (ximage->data)
|
|
|
|
g_free (ximage->data);
|
|
|
|
|
|
|
|
g_free (ximage);
|
|
|
|
|
|
|
|
ximage = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
g_mutex_unlock (ximagesink->x_lock);
|
|
|
|
|
|
|
|
return ximage;
|
|
|
|
}
|
|
|
|
|
2003-11-09 19:11:26 +00:00
|
|
|
/* This function destroys a GstXImage handling XShm availability */
|
2003-11-06 21:51:14 +00:00
|
|
|
static void
|
|
|
|
gst_ximagesink_ximage_destroy (GstXImageSink *ximagesink, GstXImage *ximage)
|
|
|
|
{
|
|
|
|
g_return_if_fail (ximage != NULL);
|
|
|
|
g_return_if_fail (GST_IS_XIMAGESINK (ximagesink));
|
|
|
|
|
2004-02-03 23:05:46 +00:00
|
|
|
/* If the destroyed image is the current one we destroy our reference too */
|
|
|
|
if (ximagesink->cur_image == ximage)
|
|
|
|
ximagesink->cur_image = NULL;
|
|
|
|
|
2003-11-06 21:51:14 +00:00
|
|
|
g_mutex_lock (ximagesink->x_lock);
|
|
|
|
|
2003-11-12 03:06:07 +00:00
|
|
|
#ifdef HAVE_XSHM
|
2003-11-06 21:51:14 +00:00
|
|
|
if (ximagesink->xcontext->use_xshm)
|
|
|
|
{
|
|
|
|
if (ximage->SHMInfo.shmaddr)
|
2003-11-10 19:57:57 +00:00
|
|
|
XShmDetach (ximagesink->xcontext->disp, &ximage->SHMInfo);
|
2003-11-06 21:51:14 +00:00
|
|
|
|
|
|
|
if (ximage->ximage)
|
2003-11-10 19:57:57 +00:00
|
|
|
XDestroyImage (ximage->ximage);
|
2003-11-06 21:51:14 +00:00
|
|
|
|
|
|
|
if (ximage->SHMInfo.shmaddr)
|
2003-11-10 19:57:57 +00:00
|
|
|
shmdt (ximage->SHMInfo.shmaddr);
|
2003-11-06 21:51:14 +00:00
|
|
|
|
|
|
|
if (ximage->SHMInfo.shmid > 0)
|
2003-11-10 19:57:57 +00:00
|
|
|
shmctl (ximage->SHMInfo.shmid, IPC_RMID, 0);
|
2003-11-06 21:51:14 +00:00
|
|
|
}
|
|
|
|
else
|
2003-11-26 10:12:05 +00:00
|
|
|
#endif /* HAVE_XSHM */
|
2003-11-06 21:51:14 +00:00
|
|
|
{
|
|
|
|
if (ximage->ximage)
|
2003-11-10 19:57:57 +00:00
|
|
|
XDestroyImage (ximage->ximage);
|
2003-11-06 21:51:14 +00:00
|
|
|
}
|
2004-01-28 00:29:42 +00:00
|
|
|
|
sys/: Removing some useless debugs messages, correctly cleaning the image created to check xshm calls on succes, adde...
Original commit message from CVS:
2004-01-28 Julien MOUTTE <julien@moutte.net>
* sys/ximage/ximagesink.c: (gst_ximagesink_check_xshm_calls),
(gst_ximagesink_ximage_new), (gst_ximagesink_ximage_destroy),
(gst_ximagesink_ximage_put), (gst_ximagesink_xwindow_new),
(gst_ximagesink_xwindow_destroy):
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_check_xshm_calls),
(gst_xvimagesink_xvimage_new), (gst_xvimagesink_xvimage_destroy),
(gst_xvimagesink_xwindow_new), (gst_xvimagesink_xwindow_destroy),
(gst_xvimagesink_xwindow_resize), (gst_xvimagesink_get_xv_support),
(gst_xvimagesink_xcontext_get): Removing some useless debugs messages,
correctly cleaning the image created to check xshm calls on succes,
added a lot of XSync calls in X11 functions, and fixed a segfault when
no image format was defined before negotiation happened.
2004-01-28 10:45:33 +00:00
|
|
|
XSync (ximagesink->xcontext->disp, FALSE);
|
2004-01-28 00:29:42 +00:00
|
|
|
|
2003-11-06 21:51:14 +00:00
|
|
|
g_mutex_unlock (ximagesink->x_lock);
|
|
|
|
|
|
|
|
g_free (ximage);
|
|
|
|
}
|
|
|
|
|
2003-11-09 19:11:26 +00:00
|
|
|
/* This function puts a GstXImage on a GstXImageSink's window */
|
2003-11-06 21:51:14 +00:00
|
|
|
static void
|
|
|
|
gst_ximagesink_ximage_put (GstXImageSink *ximagesink, GstXImage *ximage)
|
|
|
|
{
|
|
|
|
gint x, y;
|
2003-11-13 10:46:12 +00:00
|
|
|
|
2003-11-06 21:51:14 +00:00
|
|
|
g_return_if_fail (ximage != NULL);
|
|
|
|
g_return_if_fail (GST_IS_XIMAGESINK (ximagesink));
|
|
|
|
|
2004-02-03 23:05:46 +00:00
|
|
|
/* Store a reference to the last image we put */
|
|
|
|
if (ximagesink->cur_image != ximage)
|
|
|
|
ximagesink->cur_image = ximage;
|
|
|
|
|
2003-11-06 21:51:14 +00:00
|
|
|
/* We center the image in the window */
|
2003-11-13 10:46:12 +00:00
|
|
|
x = MAX (0, (ximagesink->xwindow->width - ximage->width) / 2);
|
|
|
|
y = MAX (0, (ximagesink->xwindow->height- ximage->height) / 2);
|
2003-11-06 21:51:14 +00:00
|
|
|
|
2003-11-15 11:48:55 +00:00
|
|
|
g_mutex_lock (ximagesink->x_lock);
|
2003-11-12 03:06:07 +00:00
|
|
|
#ifdef HAVE_XSHM
|
2003-11-06 21:51:14 +00:00
|
|
|
if (ximagesink->xcontext->use_xshm)
|
|
|
|
{
|
|
|
|
XShmPutImage (ximagesink->xcontext->disp, ximagesink->xwindow->win,
|
|
|
|
ximagesink->xwindow->gc, ximage->ximage,
|
|
|
|
0, 0, x, y, ximage->width, ximage->height,
|
|
|
|
FALSE);
|
|
|
|
}
|
|
|
|
else
|
2003-11-26 10:12:05 +00:00
|
|
|
#endif /* HAVE_XSHM */
|
2003-11-06 21:51:14 +00:00
|
|
|
{
|
|
|
|
XPutImage (ximagesink->xcontext->disp, ximagesink->xwindow->win,
|
|
|
|
ximagesink->xwindow->gc, ximage->ximage,
|
|
|
|
0, 0, x, y, ximage->width, ximage->height);
|
|
|
|
}
|
|
|
|
|
sys/: Removing some useless debugs messages, correctly cleaning the image created to check xshm calls on succes, adde...
Original commit message from CVS:
2004-01-28 Julien MOUTTE <julien@moutte.net>
* sys/ximage/ximagesink.c: (gst_ximagesink_check_xshm_calls),
(gst_ximagesink_ximage_new), (gst_ximagesink_ximage_destroy),
(gst_ximagesink_ximage_put), (gst_ximagesink_xwindow_new),
(gst_ximagesink_xwindow_destroy):
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_check_xshm_calls),
(gst_xvimagesink_xvimage_new), (gst_xvimagesink_xvimage_destroy),
(gst_xvimagesink_xwindow_new), (gst_xvimagesink_xwindow_destroy),
(gst_xvimagesink_xwindow_resize), (gst_xvimagesink_get_xv_support),
(gst_xvimagesink_xcontext_get): Removing some useless debugs messages,
correctly cleaning the image created to check xshm calls on succes,
added a lot of XSync calls in X11 functions, and fixed a segfault when
no image format was defined before negotiation happened.
2004-01-28 10:45:33 +00:00
|
|
|
XSync (ximagesink->xcontext->disp, FALSE);
|
2003-11-06 21:51:14 +00:00
|
|
|
|
|
|
|
g_mutex_unlock (ximagesink->x_lock);
|
|
|
|
}
|
|
|
|
|
2003-11-09 19:11:26 +00:00
|
|
|
/* This function handles a GstXWindow creation */
|
2003-11-06 21:51:14 +00:00
|
|
|
static GstXWindow *
|
|
|
|
gst_ximagesink_xwindow_new (GstXImageSink *ximagesink, gint width, gint height)
|
|
|
|
{
|
|
|
|
GstXWindow *xwindow = NULL;
|
|
|
|
|
|
|
|
g_return_val_if_fail (GST_IS_XIMAGESINK (ximagesink), NULL);
|
|
|
|
|
|
|
|
xwindow = g_new0 (GstXWindow, 1);
|
|
|
|
|
|
|
|
xwindow->width = width;
|
|
|
|
xwindow->height = height;
|
examples/gstplay/player.c: Adding some new lines in g_print calls.
Original commit message from CVS:
* examples/gstplay/player.c: (got_time_tick), (got_stream_length),
(got_video_size): Adding some new lines in g_print calls.
* sys/ximage/ximagesink.c: (gst_ximagesink_xwindow_new),
(gst_ximagesink_xwindow_destroy), (gst_ximagesink_xwindow_resize),
(gst_ximagesink_handle_xevents), (gst_ximagesink_fixate),
(gst_ximagesink_sinkconnect), (gst_ximagesink_change_state),
(gst_ximagesink_chain), (gst_ximagesink_buffer_new),
(gst_ximagesink_set_xwindow_id), (gst_ximagesink_get_desired_size):
Complete code review, reverting some stuff i disagree with, adding
some fixes : time synchronization on invalid timestamps, renegotiation
of private window.
* sys/ximage/ximagesink.h:
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_xwindow_destroy),
(gst_xvimagesink_xwindow_resize), (gst_xvimagesink_handle_xevents),
(gst_xvimagesink_get_xv_support), (gst_xvimagesink_xcontext_get),
(gst_xvimagesink_fixate), (gst_xvimagesink_sinkconnect),
(gst_xvimagesink_change_state), (gst_xvimagesink_chain),
(gst_xvimagesink_buffer_new),
(gst_xvimagesink_navigation_send_event),
(gst_xvimagesink_set_xwindow_id),
(gst_xvimagesink_get_desired_size),
(gst_xvimagesink_xoverlay_init): Complete code review, reverting some
stuff i disagree with, adding some fixes : Renegotiation of private
window, implementing get_desired_size.
2004-01-07 15:33:42 +00:00
|
|
|
xwindow->internal = TRUE;
|
2003-11-06 21:51:14 +00:00
|
|
|
|
|
|
|
g_mutex_lock (ximagesink->x_lock);
|
|
|
|
|
examples/gstplay/player.c: Adding some new lines in g_print calls.
Original commit message from CVS:
* examples/gstplay/player.c: (got_time_tick), (got_stream_length),
(got_video_size): Adding some new lines in g_print calls.
* sys/ximage/ximagesink.c: (gst_ximagesink_xwindow_new),
(gst_ximagesink_xwindow_destroy), (gst_ximagesink_xwindow_resize),
(gst_ximagesink_handle_xevents), (gst_ximagesink_fixate),
(gst_ximagesink_sinkconnect), (gst_ximagesink_change_state),
(gst_ximagesink_chain), (gst_ximagesink_buffer_new),
(gst_ximagesink_set_xwindow_id), (gst_ximagesink_get_desired_size):
Complete code review, reverting some stuff i disagree with, adding
some fixes : time synchronization on invalid timestamps, renegotiation
of private window.
* sys/ximage/ximagesink.h:
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_xwindow_destroy),
(gst_xvimagesink_xwindow_resize), (gst_xvimagesink_handle_xevents),
(gst_xvimagesink_get_xv_support), (gst_xvimagesink_xcontext_get),
(gst_xvimagesink_fixate), (gst_xvimagesink_sinkconnect),
(gst_xvimagesink_change_state), (gst_xvimagesink_chain),
(gst_xvimagesink_buffer_new),
(gst_xvimagesink_navigation_send_event),
(gst_xvimagesink_set_xwindow_id),
(gst_xvimagesink_get_desired_size),
(gst_xvimagesink_xoverlay_init): Complete code review, reverting some
stuff i disagree with, adding some fixes : Renegotiation of private
window, implementing get_desired_size.
2004-01-07 15:33:42 +00:00
|
|
|
xwindow->win = XCreateSimpleWindow (ximagesink->xcontext->disp,
|
|
|
|
ximagesink->xcontext->root,
|
|
|
|
0, 0, xwindow->width, xwindow->height,
|
|
|
|
0, 0, ximagesink->xcontext->black);
|
sys/: Removing some useless debugs messages, correctly cleaning the image created to check xshm calls on succes, adde...
Original commit message from CVS:
2004-01-28 Julien MOUTTE <julien@moutte.net>
* sys/ximage/ximagesink.c: (gst_ximagesink_check_xshm_calls),
(gst_ximagesink_ximage_new), (gst_ximagesink_ximage_destroy),
(gst_ximagesink_ximage_put), (gst_ximagesink_xwindow_new),
(gst_ximagesink_xwindow_destroy):
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_check_xshm_calls),
(gst_xvimagesink_xvimage_new), (gst_xvimagesink_xvimage_destroy),
(gst_xvimagesink_xwindow_new), (gst_xvimagesink_xwindow_destroy),
(gst_xvimagesink_xwindow_resize), (gst_xvimagesink_get_xv_support),
(gst_xvimagesink_xcontext_get): Removing some useless debugs messages,
correctly cleaning the image created to check xshm calls on succes,
added a lot of XSync calls in X11 functions, and fixed a segfault when
no image format was defined before negotiation happened.
2004-01-28 10:45:33 +00:00
|
|
|
|
2003-11-07 18:00:39 +00:00
|
|
|
XSelectInput (ximagesink->xcontext->disp, xwindow->win, ExposureMask |
|
|
|
|
StructureNotifyMask | PointerMotionMask | KeyPressMask |
|
|
|
|
KeyReleaseMask | ButtonPressMask | ButtonReleaseMask);
|
|
|
|
|
2003-11-06 21:51:14 +00:00
|
|
|
xwindow->gc = XCreateGC (ximagesink->xcontext->disp,
|
2003-11-17 16:32:29 +00:00
|
|
|
xwindow->win, 0, NULL);
|
examples/gstplay/player.c: Adding some new lines in g_print calls.
Original commit message from CVS:
* examples/gstplay/player.c: (got_time_tick), (got_stream_length),
(got_video_size): Adding some new lines in g_print calls.
* sys/ximage/ximagesink.c: (gst_ximagesink_xwindow_new),
(gst_ximagesink_xwindow_destroy), (gst_ximagesink_xwindow_resize),
(gst_ximagesink_handle_xevents), (gst_ximagesink_fixate),
(gst_ximagesink_sinkconnect), (gst_ximagesink_change_state),
(gst_ximagesink_chain), (gst_ximagesink_buffer_new),
(gst_ximagesink_set_xwindow_id), (gst_ximagesink_get_desired_size):
Complete code review, reverting some stuff i disagree with, adding
some fixes : time synchronization on invalid timestamps, renegotiation
of private window.
* sys/ximage/ximagesink.h:
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_xwindow_destroy),
(gst_xvimagesink_xwindow_resize), (gst_xvimagesink_handle_xevents),
(gst_xvimagesink_get_xv_support), (gst_xvimagesink_xcontext_get),
(gst_xvimagesink_fixate), (gst_xvimagesink_sinkconnect),
(gst_xvimagesink_change_state), (gst_xvimagesink_chain),
(gst_xvimagesink_buffer_new),
(gst_xvimagesink_navigation_send_event),
(gst_xvimagesink_set_xwindow_id),
(gst_xvimagesink_get_desired_size),
(gst_xvimagesink_xoverlay_init): Complete code review, reverting some
stuff i disagree with, adding some fixes : Renegotiation of private
window, implementing get_desired_size.
2004-01-07 15:33:42 +00:00
|
|
|
|
sys/: Removing some useless debugs messages, correctly cleaning the image created to check xshm calls on succes, adde...
Original commit message from CVS:
2004-01-28 Julien MOUTTE <julien@moutte.net>
* sys/ximage/ximagesink.c: (gst_ximagesink_check_xshm_calls),
(gst_ximagesink_ximage_new), (gst_ximagesink_ximage_destroy),
(gst_ximagesink_ximage_put), (gst_ximagesink_xwindow_new),
(gst_ximagesink_xwindow_destroy):
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_check_xshm_calls),
(gst_xvimagesink_xvimage_new), (gst_xvimagesink_xvimage_destroy),
(gst_xvimagesink_xwindow_new), (gst_xvimagesink_xwindow_destroy),
(gst_xvimagesink_xwindow_resize), (gst_xvimagesink_get_xv_support),
(gst_xvimagesink_xcontext_get): Removing some useless debugs messages,
correctly cleaning the image created to check xshm calls on succes,
added a lot of XSync calls in X11 functions, and fixed a segfault when
no image format was defined before negotiation happened.
2004-01-28 10:45:33 +00:00
|
|
|
XMapRaised (ximagesink->xcontext->disp, xwindow->win);
|
|
|
|
|
|
|
|
XSync (ximagesink->xcontext->disp, FALSE);
|
|
|
|
|
2003-11-06 21:51:14 +00:00
|
|
|
g_mutex_unlock (ximagesink->x_lock);
|
|
|
|
|
2004-01-29 10:02:48 +00:00
|
|
|
gst_x_overlay_got_xwindow_id (GST_X_OVERLAY (ximagesink), xwindow->win);
|
|
|
|
|
2003-11-06 21:51:14 +00:00
|
|
|
return xwindow;
|
|
|
|
}
|
|
|
|
|
2003-11-09 19:11:26 +00:00
|
|
|
/* This function destroys a GstXWindow */
|
2003-11-06 21:51:14 +00:00
|
|
|
static void
|
|
|
|
gst_ximagesink_xwindow_destroy (GstXImageSink *ximagesink, GstXWindow *xwindow)
|
|
|
|
{
|
|
|
|
g_return_if_fail (xwindow != NULL);
|
|
|
|
g_return_if_fail (GST_IS_XIMAGESINK (ximagesink));
|
|
|
|
|
|
|
|
g_mutex_lock (ximagesink->x_lock);
|
|
|
|
|
2003-11-17 16:32:29 +00:00
|
|
|
/* If we did not create that window we just free the GC and let it live */
|
examples/gstplay/player.c: Adding some new lines in g_print calls.
Original commit message from CVS:
* examples/gstplay/player.c: (got_time_tick), (got_stream_length),
(got_video_size): Adding some new lines in g_print calls.
* sys/ximage/ximagesink.c: (gst_ximagesink_xwindow_new),
(gst_ximagesink_xwindow_destroy), (gst_ximagesink_xwindow_resize),
(gst_ximagesink_handle_xevents), (gst_ximagesink_fixate),
(gst_ximagesink_sinkconnect), (gst_ximagesink_change_state),
(gst_ximagesink_chain), (gst_ximagesink_buffer_new),
(gst_ximagesink_set_xwindow_id), (gst_ximagesink_get_desired_size):
Complete code review, reverting some stuff i disagree with, adding
some fixes : time synchronization on invalid timestamps, renegotiation
of private window.
* sys/ximage/ximagesink.h:
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_xwindow_destroy),
(gst_xvimagesink_xwindow_resize), (gst_xvimagesink_handle_xevents),
(gst_xvimagesink_get_xv_support), (gst_xvimagesink_xcontext_get),
(gst_xvimagesink_fixate), (gst_xvimagesink_sinkconnect),
(gst_xvimagesink_change_state), (gst_xvimagesink_chain),
(gst_xvimagesink_buffer_new),
(gst_xvimagesink_navigation_send_event),
(gst_xvimagesink_set_xwindow_id),
(gst_xvimagesink_get_desired_size),
(gst_xvimagesink_xoverlay_init): Complete code review, reverting some
stuff i disagree with, adding some fixes : Renegotiation of private
window, implementing get_desired_size.
2004-01-07 15:33:42 +00:00
|
|
|
if (xwindow->internal)
|
2003-11-17 16:32:29 +00:00
|
|
|
XDestroyWindow (ximagesink->xcontext->disp, xwindow->win);
|
examples/gstplay/player.c: Adding some new lines in g_print calls.
Original commit message from CVS:
* examples/gstplay/player.c: (got_time_tick), (got_stream_length),
(got_video_size): Adding some new lines in g_print calls.
* sys/ximage/ximagesink.c: (gst_ximagesink_xwindow_new),
(gst_ximagesink_xwindow_destroy), (gst_ximagesink_xwindow_resize),
(gst_ximagesink_handle_xevents), (gst_ximagesink_fixate),
(gst_ximagesink_sinkconnect), (gst_ximagesink_change_state),
(gst_ximagesink_chain), (gst_ximagesink_buffer_new),
(gst_ximagesink_set_xwindow_id), (gst_ximagesink_get_desired_size):
Complete code review, reverting some stuff i disagree with, adding
some fixes : time synchronization on invalid timestamps, renegotiation
of private window.
* sys/ximage/ximagesink.h:
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_xwindow_destroy),
(gst_xvimagesink_xwindow_resize), (gst_xvimagesink_handle_xevents),
(gst_xvimagesink_get_xv_support), (gst_xvimagesink_xcontext_get),
(gst_xvimagesink_fixate), (gst_xvimagesink_sinkconnect),
(gst_xvimagesink_change_state), (gst_xvimagesink_chain),
(gst_xvimagesink_buffer_new),
(gst_xvimagesink_navigation_send_event),
(gst_xvimagesink_set_xwindow_id),
(gst_xvimagesink_get_desired_size),
(gst_xvimagesink_xoverlay_init): Complete code review, reverting some
stuff i disagree with, adding some fixes : Renegotiation of private
window, implementing get_desired_size.
2004-01-07 15:33:42 +00:00
|
|
|
else
|
2004-01-04 18:53:53 +00:00
|
|
|
XSelectInput (ximagesink->xcontext->disp, xwindow->win, 0);
|
|
|
|
|
2003-11-06 21:51:14 +00:00
|
|
|
XFreeGC (ximagesink->xcontext->disp, xwindow->gc);
|
|
|
|
|
sys/: Removing some useless debugs messages, correctly cleaning the image created to check xshm calls on succes, adde...
Original commit message from CVS:
2004-01-28 Julien MOUTTE <julien@moutte.net>
* sys/ximage/ximagesink.c: (gst_ximagesink_check_xshm_calls),
(gst_ximagesink_ximage_new), (gst_ximagesink_ximage_destroy),
(gst_ximagesink_ximage_put), (gst_ximagesink_xwindow_new),
(gst_ximagesink_xwindow_destroy):
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_check_xshm_calls),
(gst_xvimagesink_xvimage_new), (gst_xvimagesink_xvimage_destroy),
(gst_xvimagesink_xwindow_new), (gst_xvimagesink_xwindow_destroy),
(gst_xvimagesink_xwindow_resize), (gst_xvimagesink_get_xv_support),
(gst_xvimagesink_xcontext_get): Removing some useless debugs messages,
correctly cleaning the image created to check xshm calls on succes,
added a lot of XSync calls in X11 functions, and fixed a segfault when
no image format was defined before negotiation happened.
2004-01-28 10:45:33 +00:00
|
|
|
XSync (ximagesink->xcontext->disp, FALSE);
|
|
|
|
|
2003-11-06 21:51:14 +00:00
|
|
|
g_mutex_unlock (ximagesink->x_lock);
|
|
|
|
|
|
|
|
g_free (xwindow);
|
|
|
|
}
|
|
|
|
|
examples/gstplay/player.c: Adding some new lines in g_print calls.
Original commit message from CVS:
* examples/gstplay/player.c: (got_time_tick), (got_stream_length),
(got_video_size): Adding some new lines in g_print calls.
* sys/ximage/ximagesink.c: (gst_ximagesink_xwindow_new),
(gst_ximagesink_xwindow_destroy), (gst_ximagesink_xwindow_resize),
(gst_ximagesink_handle_xevents), (gst_ximagesink_fixate),
(gst_ximagesink_sinkconnect), (gst_ximagesink_change_state),
(gst_ximagesink_chain), (gst_ximagesink_buffer_new),
(gst_ximagesink_set_xwindow_id), (gst_ximagesink_get_desired_size):
Complete code review, reverting some stuff i disagree with, adding
some fixes : time synchronization on invalid timestamps, renegotiation
of private window.
* sys/ximage/ximagesink.h:
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_xwindow_destroy),
(gst_xvimagesink_xwindow_resize), (gst_xvimagesink_handle_xevents),
(gst_xvimagesink_get_xv_support), (gst_xvimagesink_xcontext_get),
(gst_xvimagesink_fixate), (gst_xvimagesink_sinkconnect),
(gst_xvimagesink_change_state), (gst_xvimagesink_chain),
(gst_xvimagesink_buffer_new),
(gst_xvimagesink_navigation_send_event),
(gst_xvimagesink_set_xwindow_id),
(gst_xvimagesink_get_desired_size),
(gst_xvimagesink_xoverlay_init): Complete code review, reverting some
stuff i disagree with, adding some fixes : Renegotiation of private
window, implementing get_desired_size.
2004-01-07 15:33:42 +00:00
|
|
|
/* This function resizes a GstXWindow */
|
|
|
|
static void
|
|
|
|
gst_ximagesink_xwindow_resize (GstXImageSink *ximagesink, GstXWindow *xwindow,
|
|
|
|
guint width, guint height)
|
|
|
|
{
|
|
|
|
g_return_if_fail (xwindow != NULL);
|
|
|
|
g_return_if_fail (GST_IS_XIMAGESINK (ximagesink));
|
|
|
|
|
|
|
|
g_mutex_lock (ximagesink->x_lock);
|
|
|
|
|
|
|
|
xwindow->width = width;
|
|
|
|
xwindow->height = height;
|
|
|
|
|
|
|
|
XResizeWindow (ximagesink->xcontext->disp, xwindow->win,
|
|
|
|
xwindow->width, xwindow->height);
|
ext/alsa/gstalsa.c: Alsa should trigger an error if it failed opening the audio device.
Original commit message from CVS:
2004-02-16 Julien MOUTTE <julien@moutte.net>
* ext/alsa/gstalsa.c: (gst_alsa_open_audio),
(gst_alsa_timestamp_to_bytes): Alsa should trigger an error if it
failed opening the audio device.
* sys/ximage/ximagesink.c: (gst_ximagesink_ximage_new),
(gst_ximagesink_ximage_destroy), (gst_ximagesink_ximage_put),
(gst_ximagesink_xwindow_new), (gst_ximagesink_xwindow_destroy),
(gst_ximagesink_xwindow_resize), (gst_ximagesink_xwindow_clear),
(gst_ximagesink_renegotiate_size), (gst_ximagesink_handle_xevents),
(gst_ximagesink_xcontext_get), (gst_ximagesink_xcontext_clear),
(gst_ximagesink_change_state), (gst_ximagesink_chain),
(gst_ximagesink_set_xwindow_id): Clearing window in READY TO PAUSED.
Removing some useless g_return_if_fail like wingo suggested.
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_xvimage_new),
(gst_xvimagesink_xvimage_destroy), (gst_xvimagesink_xvimage_put),
(gst_xvimagesink_xwindow_new), (gst_xvimagesink_xwindow_destroy),
(gst_xvimagesink_xwindow_resize), (gst_xvimagesink_xwindow_clear),
(gst_xvimagesink_update_colorbalance),
(gst_xvimagesink_handle_xevents), (gst_xvimagesink_xcontext_get),
(gst_xvimagesink_xcontext_clear),
(gst_xvimagesink_get_fourcc_from_caps),
(gst_xvimagesink_change_state), (gst_xvimagesink_chain),
(gst_xvimagesink_set_xwindow_id),
(gst_xvimagesink_colorbalance_list_channels),
(gst_xvimagesink_colorbalance_set_value),
(gst_xvimagesink_colorbalance_get_value): Clearing window in READY TO
PAUSED. Removing some useless g_return_if_fail like wingo suggested.
2004-02-16 16:24:51 +00:00
|
|
|
|
|
|
|
XSync (ximagesink->xcontext->disp, FALSE);
|
|
|
|
|
|
|
|
g_mutex_unlock (ximagesink->x_lock);
|
|
|
|
}
|
examples/gstplay/player.c: Adding some new lines in g_print calls.
Original commit message from CVS:
* examples/gstplay/player.c: (got_time_tick), (got_stream_length),
(got_video_size): Adding some new lines in g_print calls.
* sys/ximage/ximagesink.c: (gst_ximagesink_xwindow_new),
(gst_ximagesink_xwindow_destroy), (gst_ximagesink_xwindow_resize),
(gst_ximagesink_handle_xevents), (gst_ximagesink_fixate),
(gst_ximagesink_sinkconnect), (gst_ximagesink_change_state),
(gst_ximagesink_chain), (gst_ximagesink_buffer_new),
(gst_ximagesink_set_xwindow_id), (gst_ximagesink_get_desired_size):
Complete code review, reverting some stuff i disagree with, adding
some fixes : time synchronization on invalid timestamps, renegotiation
of private window.
* sys/ximage/ximagesink.h:
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_xwindow_destroy),
(gst_xvimagesink_xwindow_resize), (gst_xvimagesink_handle_xevents),
(gst_xvimagesink_get_xv_support), (gst_xvimagesink_xcontext_get),
(gst_xvimagesink_fixate), (gst_xvimagesink_sinkconnect),
(gst_xvimagesink_change_state), (gst_xvimagesink_chain),
(gst_xvimagesink_buffer_new),
(gst_xvimagesink_navigation_send_event),
(gst_xvimagesink_set_xwindow_id),
(gst_xvimagesink_get_desired_size),
(gst_xvimagesink_xoverlay_init): Complete code review, reverting some
stuff i disagree with, adding some fixes : Renegotiation of private
window, implementing get_desired_size.
2004-01-07 15:33:42 +00:00
|
|
|
|
ext/alsa/gstalsa.c: Alsa should trigger an error if it failed opening the audio device.
Original commit message from CVS:
2004-02-16 Julien MOUTTE <julien@moutte.net>
* ext/alsa/gstalsa.c: (gst_alsa_open_audio),
(gst_alsa_timestamp_to_bytes): Alsa should trigger an error if it
failed opening the audio device.
* sys/ximage/ximagesink.c: (gst_ximagesink_ximage_new),
(gst_ximagesink_ximage_destroy), (gst_ximagesink_ximage_put),
(gst_ximagesink_xwindow_new), (gst_ximagesink_xwindow_destroy),
(gst_ximagesink_xwindow_resize), (gst_ximagesink_xwindow_clear),
(gst_ximagesink_renegotiate_size), (gst_ximagesink_handle_xevents),
(gst_ximagesink_xcontext_get), (gst_ximagesink_xcontext_clear),
(gst_ximagesink_change_state), (gst_ximagesink_chain),
(gst_ximagesink_set_xwindow_id): Clearing window in READY TO PAUSED.
Removing some useless g_return_if_fail like wingo suggested.
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_xvimage_new),
(gst_xvimagesink_xvimage_destroy), (gst_xvimagesink_xvimage_put),
(gst_xvimagesink_xwindow_new), (gst_xvimagesink_xwindow_destroy),
(gst_xvimagesink_xwindow_resize), (gst_xvimagesink_xwindow_clear),
(gst_xvimagesink_update_colorbalance),
(gst_xvimagesink_handle_xevents), (gst_xvimagesink_xcontext_get),
(gst_xvimagesink_xcontext_clear),
(gst_xvimagesink_get_fourcc_from_caps),
(gst_xvimagesink_change_state), (gst_xvimagesink_chain),
(gst_xvimagesink_set_xwindow_id),
(gst_xvimagesink_colorbalance_list_channels),
(gst_xvimagesink_colorbalance_set_value),
(gst_xvimagesink_colorbalance_get_value): Clearing window in READY TO
PAUSED. Removing some useless g_return_if_fail like wingo suggested.
2004-02-16 16:24:51 +00:00
|
|
|
static void
|
|
|
|
gst_ximagesink_xwindow_clear (GstXImageSink *ximagesink, GstXWindow *xwindow)
|
|
|
|
{
|
|
|
|
g_return_if_fail (xwindow != NULL);
|
|
|
|
g_return_if_fail (GST_IS_XIMAGESINK (ximagesink));
|
|
|
|
|
|
|
|
g_mutex_lock (ximagesink->x_lock);
|
|
|
|
|
|
|
|
XSetForeground (ximagesink->xcontext->disp, xwindow->gc,
|
|
|
|
ximagesink->xcontext->black);
|
|
|
|
|
|
|
|
XFillRectangle (ximagesink->xcontext->disp, xwindow->win, xwindow->gc,
|
|
|
|
0, 0, xwindow->width, xwindow->height);
|
|
|
|
|
|
|
|
XSync (ximagesink->xcontext->disp, FALSE);
|
|
|
|
|
examples/gstplay/player.c: Adding some new lines in g_print calls.
Original commit message from CVS:
* examples/gstplay/player.c: (got_time_tick), (got_stream_length),
(got_video_size): Adding some new lines in g_print calls.
* sys/ximage/ximagesink.c: (gst_ximagesink_xwindow_new),
(gst_ximagesink_xwindow_destroy), (gst_ximagesink_xwindow_resize),
(gst_ximagesink_handle_xevents), (gst_ximagesink_fixate),
(gst_ximagesink_sinkconnect), (gst_ximagesink_change_state),
(gst_ximagesink_chain), (gst_ximagesink_buffer_new),
(gst_ximagesink_set_xwindow_id), (gst_ximagesink_get_desired_size):
Complete code review, reverting some stuff i disagree with, adding
some fixes : time synchronization on invalid timestamps, renegotiation
of private window.
* sys/ximage/ximagesink.h:
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_xwindow_destroy),
(gst_xvimagesink_xwindow_resize), (gst_xvimagesink_handle_xevents),
(gst_xvimagesink_get_xv_support), (gst_xvimagesink_xcontext_get),
(gst_xvimagesink_fixate), (gst_xvimagesink_sinkconnect),
(gst_xvimagesink_change_state), (gst_xvimagesink_chain),
(gst_xvimagesink_buffer_new),
(gst_xvimagesink_navigation_send_event),
(gst_xvimagesink_set_xwindow_id),
(gst_xvimagesink_get_desired_size),
(gst_xvimagesink_xoverlay_init): Complete code review, reverting some
stuff i disagree with, adding some fixes : Renegotiation of private
window, implementing get_desired_size.
2004-01-07 15:33:42 +00:00
|
|
|
g_mutex_unlock (ximagesink->x_lock);
|
|
|
|
}
|
|
|
|
|
2004-02-18 21:16:50 +00:00
|
|
|
static void
|
|
|
|
gst_ximagesink_xwindow_update_geometry (GstXImageSink *ximagesink,
|
|
|
|
GstXWindow *xwindow)
|
|
|
|
{
|
|
|
|
XWindowAttributes attr;
|
|
|
|
|
|
|
|
g_return_if_fail (xwindow != NULL);
|
|
|
|
g_return_if_fail (GST_IS_XIMAGESINK (ximagesink));
|
|
|
|
|
|
|
|
/* Update the window geometry */
|
|
|
|
g_mutex_lock (ximagesink->x_lock);
|
|
|
|
XGetWindowAttributes (ximagesink->xcontext->disp,
|
|
|
|
ximagesink->xwindow->win, &attr);
|
|
|
|
g_mutex_unlock (ximagesink->x_lock);
|
|
|
|
|
|
|
|
ximagesink->xwindow->width = attr.width;
|
|
|
|
ximagesink->xwindow->height = attr.height;
|
|
|
|
}
|
|
|
|
|
2004-02-02 21:59:35 +00:00
|
|
|
static void
|
2004-02-18 13:06:49 +00:00
|
|
|
gst_ximagesink_renegotiate_size (GstXImageSink *ximagesink)
|
2004-02-02 21:59:35 +00:00
|
|
|
{
|
|
|
|
g_return_if_fail (GST_IS_XIMAGESINK (ximagesink));
|
|
|
|
|
2004-02-16 23:45:55 +00:00
|
|
|
if (!ximagesink->xwindow)
|
|
|
|
return;
|
|
|
|
|
2004-02-18 21:16:50 +00:00
|
|
|
gst_ximagesink_xwindow_update_geometry (ximagesink, ximagesink->xwindow);
|
|
|
|
|
|
|
|
if (ximagesink->sw_scaling_failed)
|
|
|
|
return;
|
|
|
|
|
2004-02-18 13:06:49 +00:00
|
|
|
if (ximagesink->xwindow->width <= 1 || ximagesink->xwindow->height <= 1)
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (GST_PAD_IS_NEGOTIATING (GST_VIDEOSINK_PAD (ximagesink)) ||
|
|
|
|
!gst_pad_is_negotiated (GST_VIDEOSINK_PAD (ximagesink)))
|
|
|
|
return;
|
|
|
|
|
2004-02-02 21:59:35 +00:00
|
|
|
/* Window got resized or moved. We do caps negotiation again to get video
|
2004-02-16 23:45:55 +00:00
|
|
|
scaler to fit that new size only if size of the window differs from our
|
|
|
|
size. */
|
2004-02-02 21:59:35 +00:00
|
|
|
|
2004-02-18 13:06:49 +00:00
|
|
|
if (GST_VIDEOSINK_WIDTH (ximagesink) != ximagesink->xwindow->width ||
|
|
|
|
GST_VIDEOSINK_HEIGHT (ximagesink) != ximagesink->xwindow->height)
|
2004-02-02 21:59:35 +00:00
|
|
|
{
|
|
|
|
GstPadLinkReturn r;
|
2004-02-18 13:06:49 +00:00
|
|
|
|
2004-02-02 21:59:35 +00:00
|
|
|
r = gst_pad_try_set_caps (GST_VIDEOSINK_PAD (ximagesink),
|
|
|
|
gst_caps_new_simple ("video/x-raw-rgb",
|
|
|
|
"bpp", G_TYPE_INT, ximagesink->xcontext->bpp,
|
|
|
|
"depth", G_TYPE_INT, ximagesink->xcontext->depth,
|
|
|
|
"endianness", G_TYPE_INT, ximagesink->xcontext->endianness,
|
|
|
|
"red_mask", G_TYPE_INT, ximagesink->xcontext->visual->red_mask,
|
|
|
|
"green_mask", G_TYPE_INT, ximagesink->xcontext->visual->green_mask,
|
|
|
|
"blue_mask", G_TYPE_INT, ximagesink->xcontext->visual->blue_mask,
|
2004-02-18 13:06:49 +00:00
|
|
|
"width", G_TYPE_INT, ximagesink->xwindow->width,
|
|
|
|
"height", G_TYPE_INT, ximagesink->xwindow->height,
|
2004-02-02 21:59:35 +00:00
|
|
|
"framerate", G_TYPE_DOUBLE, ximagesink->framerate,
|
|
|
|
NULL));
|
|
|
|
|
|
|
|
if ( (r == GST_PAD_LINK_OK) || (r == GST_PAD_LINK_DONE) )
|
|
|
|
{
|
2004-02-18 13:06:49 +00:00
|
|
|
/* Renegotiation succeeded, we update our size and image */
|
|
|
|
GST_VIDEOSINK_WIDTH (ximagesink) = ximagesink->xwindow->width;
|
|
|
|
GST_VIDEOSINK_HEIGHT (ximagesink) = ximagesink->xwindow->height;
|
2004-02-02 21:59:35 +00:00
|
|
|
|
|
|
|
if ( (ximagesink->ximage) &&
|
|
|
|
( (GST_VIDEOSINK_WIDTH (ximagesink) != ximagesink->ximage->width) ||
|
|
|
|
(GST_VIDEOSINK_HEIGHT (ximagesink) != ximagesink->ximage->height) ) )
|
|
|
|
{
|
|
|
|
/* We renew our ximage only if size changed */
|
|
|
|
gst_ximagesink_ximage_destroy (ximagesink, ximagesink->ximage);
|
|
|
|
|
|
|
|
ximagesink->ximage = gst_ximagesink_ximage_new (ximagesink,
|
|
|
|
GST_VIDEOSINK_WIDTH (ximagesink),
|
|
|
|
GST_VIDEOSINK_HEIGHT (ximagesink));
|
|
|
|
}
|
|
|
|
}
|
2004-02-18 21:16:50 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
ximagesink->sw_scaling_failed = TRUE;
|
|
|
|
}
|
2004-02-02 21:59:35 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-11-09 19:11:26 +00:00
|
|
|
/* This function handles XEvents that might be in the queue. It generates
|
|
|
|
GstEvent that will be sent upstream in the pipeline to handle interactivity
|
|
|
|
and navigation. It will also listen for configure events on the window to
|
|
|
|
trigger caps renegotiation so on the fly software scaling can work. */
|
2003-11-08 14:58:35 +00:00
|
|
|
static void
|
|
|
|
gst_ximagesink_handle_xevents (GstXImageSink *ximagesink, GstPad *pad)
|
|
|
|
{
|
|
|
|
XEvent e;
|
2004-02-18 13:06:49 +00:00
|
|
|
guint pointer_x = 0, pointer_y = 0;
|
2004-02-18 21:16:50 +00:00
|
|
|
gboolean pointer_moved = FALSE;
|
2003-11-08 14:58:35 +00:00
|
|
|
|
|
|
|
g_return_if_fail (GST_IS_XIMAGESINK (ximagesink));
|
|
|
|
|
2004-02-18 21:16:50 +00:00
|
|
|
gst_ximagesink_renegotiate_size (ximagesink);
|
2004-02-02 21:59:35 +00:00
|
|
|
|
|
|
|
/* Then we get all pointer motion events, only the last position is
|
|
|
|
interesting. */
|
|
|
|
g_mutex_lock (ximagesink->x_lock);
|
|
|
|
while (XCheckWindowEvent (ximagesink->xcontext->disp,
|
|
|
|
ximagesink->xwindow->win,
|
|
|
|
PointerMotionMask, &e))
|
|
|
|
{
|
|
|
|
g_mutex_unlock (ximagesink->x_lock);
|
|
|
|
|
|
|
|
switch (e.type)
|
|
|
|
{
|
2003-11-08 14:58:35 +00:00
|
|
|
case MotionNotify:
|
2004-02-02 21:59:35 +00:00
|
|
|
pointer_x = e.xmotion.x;
|
|
|
|
pointer_y = e.xmotion.y;
|
|
|
|
pointer_moved = TRUE;
|
|
|
|
break;
|
|
|
|
default:
|
2003-11-08 14:58:35 +00:00
|
|
|
break;
|
2004-02-02 21:59:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
g_mutex_lock (ximagesink->x_lock);
|
|
|
|
}
|
|
|
|
g_mutex_unlock (ximagesink->x_lock);
|
|
|
|
|
|
|
|
if (pointer_moved)
|
|
|
|
{
|
|
|
|
GST_DEBUG ("ximagesink pointer moved over window at %d,%d",
|
|
|
|
pointer_x, pointer_y);
|
|
|
|
gst_navigation_send_mouse_event (GST_NAVIGATION (ximagesink),
|
|
|
|
"mouse-move", 0, pointer_x, pointer_y);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* We get all remaining events on our window to throw them upstream */
|
|
|
|
g_mutex_lock (ximagesink->x_lock);
|
|
|
|
while (XCheckWindowEvent (ximagesink->xcontext->disp,
|
|
|
|
ximagesink->xwindow->win,
|
|
|
|
KeyPressMask | KeyReleaseMask |
|
|
|
|
ButtonPressMask | ButtonReleaseMask, &e))
|
|
|
|
{
|
|
|
|
KeySym keysym;
|
|
|
|
|
|
|
|
/* We lock only for the X function call */
|
|
|
|
g_mutex_unlock (ximagesink->x_lock);
|
|
|
|
|
|
|
|
switch (e.type)
|
|
|
|
{
|
2003-11-08 14:58:35 +00:00
|
|
|
case ButtonPress:
|
examples/gstplay/player.c: Adding some new lines in g_print calls.
Original commit message from CVS:
* examples/gstplay/player.c: (got_time_tick), (got_stream_length),
(got_video_size): Adding some new lines in g_print calls.
* sys/ximage/ximagesink.c: (gst_ximagesink_xwindow_new),
(gst_ximagesink_xwindow_destroy), (gst_ximagesink_xwindow_resize),
(gst_ximagesink_handle_xevents), (gst_ximagesink_fixate),
(gst_ximagesink_sinkconnect), (gst_ximagesink_change_state),
(gst_ximagesink_chain), (gst_ximagesink_buffer_new),
(gst_ximagesink_set_xwindow_id), (gst_ximagesink_get_desired_size):
Complete code review, reverting some stuff i disagree with, adding
some fixes : time synchronization on invalid timestamps, renegotiation
of private window.
* sys/ximage/ximagesink.h:
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_xwindow_destroy),
(gst_xvimagesink_xwindow_resize), (gst_xvimagesink_handle_xevents),
(gst_xvimagesink_get_xv_support), (gst_xvimagesink_xcontext_get),
(gst_xvimagesink_fixate), (gst_xvimagesink_sinkconnect),
(gst_xvimagesink_change_state), (gst_xvimagesink_chain),
(gst_xvimagesink_buffer_new),
(gst_xvimagesink_navigation_send_event),
(gst_xvimagesink_set_xwindow_id),
(gst_xvimagesink_get_desired_size),
(gst_xvimagesink_xoverlay_init): Complete code review, reverting some
stuff i disagree with, adding some fixes : Renegotiation of private
window, implementing get_desired_size.
2004-01-07 15:33:42 +00:00
|
|
|
/* Mouse button pressed/released over our window. We send upstream
|
|
|
|
events for interactivity/navigation */
|
2004-01-06 16:42:10 +00:00
|
|
|
GST_DEBUG ("ximagesink button %d pressed over window at %d,%d",
|
|
|
|
e.xbutton.button, e.xbutton.x, e.xbutton.x);
|
|
|
|
gst_navigation_send_mouse_event (GST_NAVIGATION (ximagesink),
|
|
|
|
"mouse-button-press",
|
examples/gstplay/player.c: Adding some new lines in g_print calls.
Original commit message from CVS:
* examples/gstplay/player.c: (got_time_tick), (got_stream_length),
(got_video_size): Adding some new lines in g_print calls.
* sys/ximage/ximagesink.c: (gst_ximagesink_xwindow_new),
(gst_ximagesink_xwindow_destroy), (gst_ximagesink_xwindow_resize),
(gst_ximagesink_handle_xevents), (gst_ximagesink_fixate),
(gst_ximagesink_sinkconnect), (gst_ximagesink_change_state),
(gst_ximagesink_chain), (gst_ximagesink_buffer_new),
(gst_ximagesink_set_xwindow_id), (gst_ximagesink_get_desired_size):
Complete code review, reverting some stuff i disagree with, adding
some fixes : time synchronization on invalid timestamps, renegotiation
of private window.
* sys/ximage/ximagesink.h:
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_xwindow_destroy),
(gst_xvimagesink_xwindow_resize), (gst_xvimagesink_handle_xevents),
(gst_xvimagesink_get_xv_support), (gst_xvimagesink_xcontext_get),
(gst_xvimagesink_fixate), (gst_xvimagesink_sinkconnect),
(gst_xvimagesink_change_state), (gst_xvimagesink_chain),
(gst_xvimagesink_buffer_new),
(gst_xvimagesink_navigation_send_event),
(gst_xvimagesink_set_xwindow_id),
(gst_xvimagesink_get_desired_size),
(gst_xvimagesink_xoverlay_init): Complete code review, reverting some
stuff i disagree with, adding some fixes : Renegotiation of private
window, implementing get_desired_size.
2004-01-07 15:33:42 +00:00
|
|
|
e.xbutton.button,
|
2004-01-06 16:42:10 +00:00
|
|
|
e.xbutton.x, e.xbutton.y);
|
examples/gstplay/player.c: Adding some new lines in g_print calls.
Original commit message from CVS:
* examples/gstplay/player.c: (got_time_tick), (got_stream_length),
(got_video_size): Adding some new lines in g_print calls.
* sys/ximage/ximagesink.c: (gst_ximagesink_xwindow_new),
(gst_ximagesink_xwindow_destroy), (gst_ximagesink_xwindow_resize),
(gst_ximagesink_handle_xevents), (gst_ximagesink_fixate),
(gst_ximagesink_sinkconnect), (gst_ximagesink_change_state),
(gst_ximagesink_chain), (gst_ximagesink_buffer_new),
(gst_ximagesink_set_xwindow_id), (gst_ximagesink_get_desired_size):
Complete code review, reverting some stuff i disagree with, adding
some fixes : time synchronization on invalid timestamps, renegotiation
of private window.
* sys/ximage/ximagesink.h:
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_xwindow_destroy),
(gst_xvimagesink_xwindow_resize), (gst_xvimagesink_handle_xevents),
(gst_xvimagesink_get_xv_support), (gst_xvimagesink_xcontext_get),
(gst_xvimagesink_fixate), (gst_xvimagesink_sinkconnect),
(gst_xvimagesink_change_state), (gst_xvimagesink_chain),
(gst_xvimagesink_buffer_new),
(gst_xvimagesink_navigation_send_event),
(gst_xvimagesink_set_xwindow_id),
(gst_xvimagesink_get_desired_size),
(gst_xvimagesink_xoverlay_init): Complete code review, reverting some
stuff i disagree with, adding some fixes : Renegotiation of private
window, implementing get_desired_size.
2004-01-07 15:33:42 +00:00
|
|
|
break;
|
2003-11-08 14:58:35 +00:00
|
|
|
case ButtonRelease:
|
2004-01-06 16:42:10 +00:00
|
|
|
GST_DEBUG ("ximagesink button %d release over window at %d,%d",
|
2003-11-08 14:58:35 +00:00
|
|
|
e.xbutton.button, e.xbutton.x, e.xbutton.x);
|
2003-11-12 13:06:21 +00:00
|
|
|
gst_navigation_send_mouse_event (GST_NAVIGATION (ximagesink),
|
examples/gstplay/player.c: Adding some new lines in g_print calls.
Original commit message from CVS:
* examples/gstplay/player.c: (got_time_tick), (got_stream_length),
(got_video_size): Adding some new lines in g_print calls.
* sys/ximage/ximagesink.c: (gst_ximagesink_xwindow_new),
(gst_ximagesink_xwindow_destroy), (gst_ximagesink_xwindow_resize),
(gst_ximagesink_handle_xevents), (gst_ximagesink_fixate),
(gst_ximagesink_sinkconnect), (gst_ximagesink_change_state),
(gst_ximagesink_chain), (gst_ximagesink_buffer_new),
(gst_ximagesink_set_xwindow_id), (gst_ximagesink_get_desired_size):
Complete code review, reverting some stuff i disagree with, adding
some fixes : time synchronization on invalid timestamps, renegotiation
of private window.
* sys/ximage/ximagesink.h:
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_xwindow_destroy),
(gst_xvimagesink_xwindow_resize), (gst_xvimagesink_handle_xevents),
(gst_xvimagesink_get_xv_support), (gst_xvimagesink_xcontext_get),
(gst_xvimagesink_fixate), (gst_xvimagesink_sinkconnect),
(gst_xvimagesink_change_state), (gst_xvimagesink_chain),
(gst_xvimagesink_buffer_new),
(gst_xvimagesink_navigation_send_event),
(gst_xvimagesink_set_xwindow_id),
(gst_xvimagesink_get_desired_size),
(gst_xvimagesink_xoverlay_init): Complete code review, reverting some
stuff i disagree with, adding some fixes : Renegotiation of private
window, implementing get_desired_size.
2004-01-07 15:33:42 +00:00
|
|
|
"mouse-button-release",
|
|
|
|
e.xbutton.button,
|
2004-01-06 16:42:10 +00:00
|
|
|
e.xbutton.x, e.xbutton.y);
|
2003-11-08 14:58:35 +00:00
|
|
|
break;
|
|
|
|
case KeyPress:
|
|
|
|
case KeyRelease:
|
|
|
|
/* Key pressed/released over our window. We send upstream
|
|
|
|
events for interactivity/navigation */
|
|
|
|
GST_DEBUG ("ximagesink key %d pressed over window at %d,%d",
|
2003-11-11 00:43:29 +00:00
|
|
|
e.xkey.keycode, e.xkey.x, e.xkey.x);
|
2003-11-12 13:06:21 +00:00
|
|
|
keysym = XKeycodeToKeysym (ximagesink->xcontext->disp,
|
|
|
|
e.xkey.keycode, 0);
|
examples/gstplay/player.c: Adding some new lines in g_print calls.
Original commit message from CVS:
* examples/gstplay/player.c: (got_time_tick), (got_stream_length),
(got_video_size): Adding some new lines in g_print calls.
* sys/ximage/ximagesink.c: (gst_ximagesink_xwindow_new),
(gst_ximagesink_xwindow_destroy), (gst_ximagesink_xwindow_resize),
(gst_ximagesink_handle_xevents), (gst_ximagesink_fixate),
(gst_ximagesink_sinkconnect), (gst_ximagesink_change_state),
(gst_ximagesink_chain), (gst_ximagesink_buffer_new),
(gst_ximagesink_set_xwindow_id), (gst_ximagesink_get_desired_size):
Complete code review, reverting some stuff i disagree with, adding
some fixes : time synchronization on invalid timestamps, renegotiation
of private window.
* sys/ximage/ximagesink.h:
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_xwindow_destroy),
(gst_xvimagesink_xwindow_resize), (gst_xvimagesink_handle_xevents),
(gst_xvimagesink_get_xv_support), (gst_xvimagesink_xcontext_get),
(gst_xvimagesink_fixate), (gst_xvimagesink_sinkconnect),
(gst_xvimagesink_change_state), (gst_xvimagesink_chain),
(gst_xvimagesink_buffer_new),
(gst_xvimagesink_navigation_send_event),
(gst_xvimagesink_set_xwindow_id),
(gst_xvimagesink_get_desired_size),
(gst_xvimagesink_xoverlay_init): Complete code review, reverting some
stuff i disagree with, adding some fixes : Renegotiation of private
window, implementing get_desired_size.
2004-01-07 15:33:42 +00:00
|
|
|
if (keysym != NoSymbol) {
|
|
|
|
gst_navigation_send_key_event (GST_NAVIGATION (ximagesink),
|
|
|
|
e.type == KeyPress ?
|
|
|
|
"key-press" : "key-release",
|
|
|
|
XKeysymToString (keysym));
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
gst_navigation_send_key_event (GST_NAVIGATION (ximagesink),
|
|
|
|
e.type == KeyPress ?
|
|
|
|
"key-press" : "key-release",
|
|
|
|
"unknown");
|
|
|
|
}
|
2003-11-08 14:58:35 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
GST_DEBUG ("ximagesink unhandled X event (%d)", e.type);
|
|
|
|
}
|
|
|
|
|
2003-11-09 19:11:26 +00:00
|
|
|
g_mutex_lock (ximagesink->x_lock);
|
2003-11-08 14:58:35 +00:00
|
|
|
}
|
2003-11-09 19:11:26 +00:00
|
|
|
g_mutex_unlock (ximagesink->x_lock);
|
2003-11-08 14:58:35 +00:00
|
|
|
}
|
2003-11-09 19:11:26 +00:00
|
|
|
|
2003-11-11 11:32:27 +00:00
|
|
|
/* This function get the X Display and global infos about it. Everything is
|
2003-11-06 21:51:14 +00:00
|
|
|
stored in our object and will be cleaned when the object is disposed. Note
|
|
|
|
here that caps for supported format are generated without any window or
|
2003-11-11 11:32:27 +00:00
|
|
|
image creation */
|
2003-11-06 21:51:14 +00:00
|
|
|
static GstXContext *
|
|
|
|
gst_ximagesink_xcontext_get (GstXImageSink *ximagesink)
|
|
|
|
{
|
|
|
|
GstXContext *xcontext = NULL;
|
|
|
|
XPixmapFormatValues *px_formats = NULL;
|
|
|
|
gint nb_formats = 0, i;
|
|
|
|
|
2003-11-10 19:57:57 +00:00
|
|
|
g_return_val_if_fail (GST_IS_XIMAGESINK (ximagesink), NULL);
|
|
|
|
|
2003-11-06 21:51:14 +00:00
|
|
|
xcontext = g_new0 (GstXContext, 1);
|
|
|
|
|
|
|
|
g_mutex_lock (ximagesink->x_lock);
|
|
|
|
|
gst/videofilter/gstvideobalance.c: Fixing videobalance ranges for colorbalance interface implementation.
Original commit message from CVS:
2004-01-14 Julien MOUTTE <julien@moutte.net>
* gst/videofilter/gstvideobalance.c: (gst_videobalance_init),
(gst_videobalance_colorbalance_set_value),
(gst_videobalance_colorbalance_get_value): Fixing videobalance ranges
for colorbalance interface implementation.
* sys/ximage/ximagesink.c: (gst_ximagesink_xcontext_get),
(gst_ximagesink_set_property), (gst_ximagesink_get_property),
(gst_ximagesink_dispose), (gst_ximagesink_init),
(gst_ximagesink_class_init): Adding DISPLAY property.
* sys/ximage/ximagesink.h: Adding display_name to store display.
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_xcontext_get),
(gst_xvimagesink_set_property), (gst_xvimagesink_get_property),
(gst_xvimagesink_dispose), (gst_xvimagesink_init),
(gst_xvimagesink_class_init): Adding DISPLAY property and colorbalance
properties (they still need polishing though for gst-launch use : no
xcontext yet, i ll do that tomorrow).
* sys/xvimage/xvimagesink.h: Adding display_name to store display.
2004-01-14 23:01:49 +00:00
|
|
|
xcontext->disp = XOpenDisplay (ximagesink->display_name);
|
2003-11-06 21:51:14 +00:00
|
|
|
|
2003-11-10 19:57:57 +00:00
|
|
|
if (!xcontext->disp)
|
|
|
|
{
|
|
|
|
g_mutex_unlock (ximagesink->x_lock);
|
|
|
|
g_free (xcontext);
|
2004-02-02 17:23:33 +00:00
|
|
|
GST_ELEMENT_ERROR (ximagesink, RESOURCE, TOO_LAZY, (NULL),
|
2004-01-18 21:46:58 +00:00
|
|
|
("Could not open display"));
|
2003-11-10 19:57:57 +00:00
|
|
|
return NULL;
|
|
|
|
}
|
2003-11-06 21:51:14 +00:00
|
|
|
|
|
|
|
xcontext->screen = DefaultScreenOfDisplay (xcontext->disp);
|
|
|
|
xcontext->screen_num = DefaultScreen (xcontext->disp);
|
|
|
|
xcontext->visual = DefaultVisual(xcontext->disp, xcontext->screen_num);
|
|
|
|
xcontext->root = DefaultRootWindow (xcontext->disp);
|
|
|
|
xcontext->white = XWhitePixel (xcontext->disp, xcontext->screen_num);
|
|
|
|
xcontext->black = XBlackPixel (xcontext->disp, xcontext->screen_num);
|
|
|
|
xcontext->depth = DefaultDepthOfScreen (xcontext->screen);
|
|
|
|
|
|
|
|
/* We get supported pixmap formats at supported depth */
|
|
|
|
px_formats = XListPixmapFormats (xcontext->disp, &nb_formats);
|
|
|
|
|
|
|
|
if (!px_formats)
|
|
|
|
{
|
|
|
|
XCloseDisplay (xcontext->disp);
|
|
|
|
g_mutex_unlock (ximagesink->x_lock);
|
|
|
|
g_free (xcontext);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* We get bpp value corresponding to our running depth */
|
|
|
|
for (i=0; i<nb_formats; i++)
|
|
|
|
{
|
|
|
|
if (px_formats[i].depth == xcontext->depth)
|
|
|
|
xcontext->bpp = px_formats[i].bits_per_pixel;
|
|
|
|
}
|
|
|
|
|
|
|
|
XFree (px_formats);
|
|
|
|
|
2003-12-12 16:49:22 +00:00
|
|
|
xcontext->endianness = (ImageByteOrder (xcontext->disp) == LSBFirst) ? G_LITTLE_ENDIAN:G_BIG_ENDIAN;
|
2003-11-06 21:51:14 +00:00
|
|
|
|
2003-11-12 03:06:07 +00:00
|
|
|
#ifdef HAVE_XSHM
|
2003-11-06 21:51:14 +00:00
|
|
|
/* Search for XShm extension support */
|
2004-01-28 00:29:42 +00:00
|
|
|
if (XShmQueryExtension (xcontext->disp) &&
|
|
|
|
gst_ximagesink_check_xshm_calls (xcontext))
|
2003-11-06 21:51:14 +00:00
|
|
|
{
|
|
|
|
xcontext->use_xshm = TRUE;
|
|
|
|
GST_DEBUG ("ximagesink is using XShm extension");
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
xcontext->use_xshm = FALSE;
|
|
|
|
GST_DEBUG ("ximagesink is not using XShm extension");
|
|
|
|
}
|
2003-11-12 03:06:07 +00:00
|
|
|
#endif /* HAVE_XSHM */
|
2003-12-17 22:37:26 +00:00
|
|
|
|
|
|
|
/* our caps system handles 24/32bpp RGB as big-endian. */
|
|
|
|
if ((xcontext->bpp == 24 || xcontext->bpp == 32) &&
|
|
|
|
xcontext->endianness == G_LITTLE_ENDIAN) {
|
|
|
|
xcontext->endianness = G_BIG_ENDIAN;
|
2003-12-23 22:41:37 +00:00
|
|
|
xcontext->visual->red_mask = GUINT32_TO_BE (xcontext->visual->red_mask);
|
|
|
|
xcontext->visual->green_mask = GUINT32_TO_BE (xcontext->visual->green_mask);
|
|
|
|
xcontext->visual->blue_mask = GUINT32_TO_BE (xcontext->visual->blue_mask);
|
|
|
|
if (xcontext->bpp == 24) {
|
|
|
|
xcontext->visual->red_mask >>= 8;
|
|
|
|
xcontext->visual->green_mask >>= 8;
|
|
|
|
xcontext->visual->blue_mask >>= 8;
|
|
|
|
}
|
2003-12-17 22:37:26 +00:00
|
|
|
}
|
2003-11-06 21:51:14 +00:00
|
|
|
|
2003-12-22 01:47:09 +00:00
|
|
|
xcontext->caps = gst_caps_new_simple ("video/x-raw-rgb",
|
|
|
|
"bpp", G_TYPE_INT, xcontext->bpp,
|
|
|
|
"depth", G_TYPE_INT, xcontext->depth,
|
|
|
|
"endianness", G_TYPE_INT, xcontext->endianness,
|
|
|
|
"red_mask", G_TYPE_INT, xcontext->visual->red_mask,
|
|
|
|
"green_mask", G_TYPE_INT, xcontext->visual->green_mask,
|
|
|
|
"blue_mask", G_TYPE_INT, xcontext->visual->blue_mask,
|
|
|
|
"width", GST_TYPE_INT_RANGE, 0, G_MAXINT,
|
|
|
|
"height", GST_TYPE_INT_RANGE, 0, G_MAXINT,
|
sys/ximage/ximagesink.c: Change to using a framerate of [1,100] instead of [0,MAX], since 0 isn't handled correctly, ...
Original commit message from CVS:
* sys/ximage/ximagesink.c: (gst_ximagesink_handle_xevents),
(gst_ximagesink_xcontext_get), (gst_ximagesink_getcaps),
(gst_ximagesink_set_xwindow_id): Change to using a framerate
of [1,100] instead of [0,MAX], since 0 isn't handled correctly,
and neither is 100+, most likely.
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_get_xv_support),
(gst_xvimagesink_getcaps): same
2004-01-20 09:25:51 +00:00
|
|
|
"framerate", GST_TYPE_DOUBLE_RANGE, 1.0, 100.0,
|
2003-12-22 01:47:09 +00:00
|
|
|
NULL);
|
2003-11-06 21:51:14 +00:00
|
|
|
|
|
|
|
g_mutex_unlock (ximagesink->x_lock);
|
|
|
|
|
|
|
|
return xcontext;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* This function cleans the X context. Closing the Display and unrefing the
|
|
|
|
caps for supported formats. */
|
|
|
|
static void
|
|
|
|
gst_ximagesink_xcontext_clear (GstXImageSink *ximagesink)
|
|
|
|
{
|
|
|
|
g_return_if_fail (GST_IS_XIMAGESINK (ximagesink));
|
|
|
|
|
2003-12-22 01:47:09 +00:00
|
|
|
gst_caps_free (ximagesink->xcontext->caps);
|
2003-11-06 21:51:14 +00:00
|
|
|
|
|
|
|
g_mutex_lock (ximagesink->x_lock);
|
|
|
|
|
|
|
|
XCloseDisplay (ximagesink->xcontext->disp);
|
|
|
|
|
2003-11-11 11:32:27 +00:00
|
|
|
g_mutex_unlock (ximagesink->x_lock);
|
2003-11-11 11:12:20 +00:00
|
|
|
|
2003-11-11 11:32:27 +00:00
|
|
|
ximagesink->xcontext = NULL;
|
2003-11-06 21:51:14 +00:00
|
|
|
}
|
|
|
|
|
gst-libs/gst/play/gstplay.c: Reworked the pipeline from scratch. Visualization is back and switch went out as i reali...
Original commit message from CVS:
2004-01-23 Julien MOUTTE <julien@moutte.net>
* gst-libs/gst/play/gstplay.c: (gst_play_pipeline_setup),
(gst_play_set_location), (gst_play_seek_to_time),
(gst_play_set_audio_sink), (gst_play_set_visualization),
(gst_play_connect_visualization), (gst_play_get_sink_element): Reworked
the pipeline from scratch. Visualization is back and switch went out as
i realized it was not possible to use the way i wanted.
* sys/ximage/ximagesink.c: (gst_ximagesink_imagepool_clear),
(gst_ximagesink_change_state), (gst_ximagesink_dispose): Move xcontext
clearing in state change from READY to NULL. So that one can clean the
X ressources keeping the element.
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_xcontext_get),
(gst_xvimagesink_imagepool_clear), (gst_xvimagesink_change_state),
(gst_xvimagesink_colorbalance_set_value),
(gst_xvimagesink_colorbalance_get_value),
(gst_xvimagesink_set_property), (gst_xvimagesink_dispose),
(gst_xvimagesink_init): Same xcontext cleaning than ximagesink in state
change from READY to NULL and fixed some stupid bugs in colorbalance
get/set values. Also added the following feature : when nobody tries to
set some values to the colorbalance levels before the xcontext is
grabbed, then when creating channels list from Xv attributes we set the
internal values to the Xv defaults. This way we handle buggy Xv drivers
that set default hue values far from the middle of the range (Thanks
to Jon Trowbridge for pointing that issue).
* sys/xvimage/xvimagesink.h: Adding a cb_changed boolean to know if
colorbalance levels have been set before xcontext is grabbed.
2004-01-22 23:54:34 +00:00
|
|
|
static void
|
|
|
|
gst_ximagesink_imagepool_clear (GstXImageSink *ximagesink)
|
|
|
|
{
|
|
|
|
g_mutex_lock(ximagesink->pool_lock);
|
|
|
|
|
|
|
|
while (ximagesink->image_pool)
|
|
|
|
{
|
|
|
|
GstXImage *ximage = ximagesink->image_pool->data;
|
|
|
|
ximagesink->image_pool = g_slist_delete_link (ximagesink->image_pool,
|
|
|
|
ximagesink->image_pool);
|
|
|
|
gst_ximagesink_ximage_destroy (ximagesink, ximage);
|
|
|
|
}
|
|
|
|
|
|
|
|
g_mutex_unlock(ximagesink->pool_lock);
|
|
|
|
}
|
|
|
|
|
2003-11-11 11:32:27 +00:00
|
|
|
/* Element stuff */
|
|
|
|
|
2003-12-31 08:02:04 +00:00
|
|
|
static GstCaps *
|
2004-01-04 23:46:39 +00:00
|
|
|
gst_ximagesink_fixate (GstPad *pad, const GstCaps *caps)
|
2003-12-31 08:02:04 +00:00
|
|
|
{
|
|
|
|
GstStructure *structure;
|
|
|
|
GstCaps *newcaps;
|
|
|
|
|
|
|
|
if (gst_caps_get_size (caps) > 1) return NULL;
|
|
|
|
|
|
|
|
newcaps = gst_caps_copy (caps);
|
|
|
|
structure = gst_caps_get_structure (newcaps, 0);
|
|
|
|
|
|
|
|
if (gst_caps_structure_fixate_field_nearest_int (structure, "width", 320)) {
|
|
|
|
return newcaps;
|
|
|
|
}
|
|
|
|
if (gst_caps_structure_fixate_field_nearest_int (structure, "height", 240)) {
|
|
|
|
return newcaps;
|
|
|
|
}
|
|
|
|
if (gst_caps_structure_fixate_field_nearest_double (structure, "framerate",
|
examples/gstplay/player.c: Adding some new lines in g_print calls.
Original commit message from CVS:
* examples/gstplay/player.c: (got_time_tick), (got_stream_length),
(got_video_size): Adding some new lines in g_print calls.
* sys/ximage/ximagesink.c: (gst_ximagesink_xwindow_new),
(gst_ximagesink_xwindow_destroy), (gst_ximagesink_xwindow_resize),
(gst_ximagesink_handle_xevents), (gst_ximagesink_fixate),
(gst_ximagesink_sinkconnect), (gst_ximagesink_change_state),
(gst_ximagesink_chain), (gst_ximagesink_buffer_new),
(gst_ximagesink_set_xwindow_id), (gst_ximagesink_get_desired_size):
Complete code review, reverting some stuff i disagree with, adding
some fixes : time synchronization on invalid timestamps, renegotiation
of private window.
* sys/ximage/ximagesink.h:
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_xwindow_destroy),
(gst_xvimagesink_xwindow_resize), (gst_xvimagesink_handle_xevents),
(gst_xvimagesink_get_xv_support), (gst_xvimagesink_xcontext_get),
(gst_xvimagesink_fixate), (gst_xvimagesink_sinkconnect),
(gst_xvimagesink_change_state), (gst_xvimagesink_chain),
(gst_xvimagesink_buffer_new),
(gst_xvimagesink_navigation_send_event),
(gst_xvimagesink_set_xwindow_id),
(gst_xvimagesink_get_desired_size),
(gst_xvimagesink_xoverlay_init): Complete code review, reverting some
stuff i disagree with, adding some fixes : Renegotiation of private
window, implementing get_desired_size.
2004-01-07 15:33:42 +00:00
|
|
|
30.0)) {
|
2003-12-31 08:02:04 +00:00
|
|
|
return newcaps;
|
|
|
|
}
|
|
|
|
|
|
|
|
gst_caps_free (newcaps);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2003-11-11 11:32:27 +00:00
|
|
|
static GstCaps *
|
2003-12-22 01:47:09 +00:00
|
|
|
gst_ximagesink_getcaps (GstPad *pad)
|
2003-11-06 21:51:14 +00:00
|
|
|
{
|
|
|
|
GstXImageSink *ximagesink;
|
2003-11-11 11:32:27 +00:00
|
|
|
|
|
|
|
ximagesink = GST_XIMAGESINK (gst_pad_get_parent (pad));
|
|
|
|
|
|
|
|
if (ximagesink->xcontext)
|
|
|
|
return gst_caps_copy (ximagesink->xcontext->caps);
|
2003-11-06 22:48:03 +00:00
|
|
|
|
2003-12-22 01:47:09 +00:00
|
|
|
return gst_caps_from_string ("video/x-raw-rgb, "
|
sys/ximage/ximagesink.c: Change to using a framerate of [1,100] instead of [0,MAX], since 0 isn't handled correctly, ...
Original commit message from CVS:
* sys/ximage/ximagesink.c: (gst_ximagesink_handle_xevents),
(gst_ximagesink_xcontext_get), (gst_ximagesink_getcaps),
(gst_ximagesink_set_xwindow_id): Change to using a framerate
of [1,100] instead of [0,MAX], since 0 isn't handled correctly,
and neither is 100+, most likely.
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_get_xv_support),
(gst_xvimagesink_getcaps): same
2004-01-20 09:25:51 +00:00
|
|
|
"framerate = (double) [ 1, 100 ], "
|
2003-12-22 01:47:09 +00:00
|
|
|
"width = (int) [ 0, MAX ], "
|
|
|
|
"height = (int) [ 0, MAX ]");
|
2003-11-06 21:51:14 +00:00
|
|
|
}
|
|
|
|
|
2003-11-11 11:32:27 +00:00
|
|
|
static GstPadLinkReturn
|
2004-02-01 22:33:07 +00:00
|
|
|
gst_ximagesink_sink_link (GstPad *pad, const GstCaps *caps)
|
2003-11-06 21:51:14 +00:00
|
|
|
{
|
|
|
|
GstXImageSink *ximagesink;
|
2003-11-26 10:12:05 +00:00
|
|
|
char *caps_str1, *caps_str2;
|
2003-12-22 01:47:09 +00:00
|
|
|
gboolean ret;
|
|
|
|
GstStructure *structure;
|
2003-11-06 21:51:14 +00:00
|
|
|
|
2003-11-11 11:32:27 +00:00
|
|
|
ximagesink = GST_XIMAGESINK (gst_pad_get_parent (pad));
|
2003-11-06 21:51:14 +00:00
|
|
|
|
2003-11-22 04:06:50 +00:00
|
|
|
if (!ximagesink->xcontext)
|
|
|
|
return GST_PAD_LINK_DELAYED;
|
2003-11-11 11:32:27 +00:00
|
|
|
|
2003-11-26 10:12:05 +00:00
|
|
|
caps_str1 = gst_caps_to_string (ximagesink->xcontext->caps);
|
|
|
|
caps_str2 = gst_caps_to_string (caps);
|
|
|
|
|
|
|
|
GST_DEBUG ("sinkconnect %s with %s", caps_str1, caps_str2);
|
|
|
|
|
2003-12-22 01:47:09 +00:00
|
|
|
g_free (caps_str1);
|
|
|
|
g_free (caps_str2);
|
2003-11-26 10:12:05 +00:00
|
|
|
|
2003-12-22 01:47:09 +00:00
|
|
|
structure = gst_caps_get_structure (caps, 0);
|
|
|
|
ret = gst_structure_get_int (structure, "width",
|
examples/gstplay/player.c: Adding some new lines in g_print calls.
Original commit message from CVS:
* examples/gstplay/player.c: (got_time_tick), (got_stream_length),
(got_video_size): Adding some new lines in g_print calls.
* sys/ximage/ximagesink.c: (gst_ximagesink_xwindow_new),
(gst_ximagesink_xwindow_destroy), (gst_ximagesink_xwindow_resize),
(gst_ximagesink_handle_xevents), (gst_ximagesink_fixate),
(gst_ximagesink_sinkconnect), (gst_ximagesink_change_state),
(gst_ximagesink_chain), (gst_ximagesink_buffer_new),
(gst_ximagesink_set_xwindow_id), (gst_ximagesink_get_desired_size):
Complete code review, reverting some stuff i disagree with, adding
some fixes : time synchronization on invalid timestamps, renegotiation
of private window.
* sys/ximage/ximagesink.h:
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_xwindow_destroy),
(gst_xvimagesink_xwindow_resize), (gst_xvimagesink_handle_xevents),
(gst_xvimagesink_get_xv_support), (gst_xvimagesink_xcontext_get),
(gst_xvimagesink_fixate), (gst_xvimagesink_sinkconnect),
(gst_xvimagesink_change_state), (gst_xvimagesink_chain),
(gst_xvimagesink_buffer_new),
(gst_xvimagesink_navigation_send_event),
(gst_xvimagesink_set_xwindow_id),
(gst_xvimagesink_get_desired_size),
(gst_xvimagesink_xoverlay_init): Complete code review, reverting some
stuff i disagree with, adding some fixes : Renegotiation of private
window, implementing get_desired_size.
2004-01-07 15:33:42 +00:00
|
|
|
&(GST_VIDEOSINK_WIDTH (ximagesink)));
|
2003-12-22 01:47:09 +00:00
|
|
|
ret &= gst_structure_get_int (structure, "height",
|
examples/gstplay/player.c: Adding some new lines in g_print calls.
Original commit message from CVS:
* examples/gstplay/player.c: (got_time_tick), (got_stream_length),
(got_video_size): Adding some new lines in g_print calls.
* sys/ximage/ximagesink.c: (gst_ximagesink_xwindow_new),
(gst_ximagesink_xwindow_destroy), (gst_ximagesink_xwindow_resize),
(gst_ximagesink_handle_xevents), (gst_ximagesink_fixate),
(gst_ximagesink_sinkconnect), (gst_ximagesink_change_state),
(gst_ximagesink_chain), (gst_ximagesink_buffer_new),
(gst_ximagesink_set_xwindow_id), (gst_ximagesink_get_desired_size):
Complete code review, reverting some stuff i disagree with, adding
some fixes : time synchronization on invalid timestamps, renegotiation
of private window.
* sys/ximage/ximagesink.h:
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_xwindow_destroy),
(gst_xvimagesink_xwindow_resize), (gst_xvimagesink_handle_xevents),
(gst_xvimagesink_get_xv_support), (gst_xvimagesink_xcontext_get),
(gst_xvimagesink_fixate), (gst_xvimagesink_sinkconnect),
(gst_xvimagesink_change_state), (gst_xvimagesink_chain),
(gst_xvimagesink_buffer_new),
(gst_xvimagesink_navigation_send_event),
(gst_xvimagesink_set_xwindow_id),
(gst_xvimagesink_get_desired_size),
(gst_xvimagesink_xoverlay_init): Complete code review, reverting some
stuff i disagree with, adding some fixes : Renegotiation of private
window, implementing get_desired_size.
2004-01-07 15:33:42 +00:00
|
|
|
&(GST_VIDEOSINK_HEIGHT (ximagesink)));
|
2003-12-22 01:47:09 +00:00
|
|
|
ret &= gst_structure_get_double (structure,
|
examples/gstplay/player.c: Adding some new lines in g_print calls.
Original commit message from CVS:
* examples/gstplay/player.c: (got_time_tick), (got_stream_length),
(got_video_size): Adding some new lines in g_print calls.
* sys/ximage/ximagesink.c: (gst_ximagesink_xwindow_new),
(gst_ximagesink_xwindow_destroy), (gst_ximagesink_xwindow_resize),
(gst_ximagesink_handle_xevents), (gst_ximagesink_fixate),
(gst_ximagesink_sinkconnect), (gst_ximagesink_change_state),
(gst_ximagesink_chain), (gst_ximagesink_buffer_new),
(gst_ximagesink_set_xwindow_id), (gst_ximagesink_get_desired_size):
Complete code review, reverting some stuff i disagree with, adding
some fixes : time synchronization on invalid timestamps, renegotiation
of private window.
* sys/ximage/ximagesink.h:
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_xwindow_destroy),
(gst_xvimagesink_xwindow_resize), (gst_xvimagesink_handle_xevents),
(gst_xvimagesink_get_xv_support), (gst_xvimagesink_xcontext_get),
(gst_xvimagesink_fixate), (gst_xvimagesink_sinkconnect),
(gst_xvimagesink_change_state), (gst_xvimagesink_chain),
(gst_xvimagesink_buffer_new),
(gst_xvimagesink_navigation_send_event),
(gst_xvimagesink_set_xwindow_id),
(gst_xvimagesink_get_desired_size),
(gst_xvimagesink_xoverlay_init): Complete code review, reverting some
stuff i disagree with, adding some fixes : Renegotiation of private
window, implementing get_desired_size.
2004-01-07 15:33:42 +00:00
|
|
|
"framerate", &ximagesink->framerate);
|
2003-12-22 01:47:09 +00:00
|
|
|
if (!ret) return GST_PAD_LINK_REFUSED;
|
2003-11-11 11:32:27 +00:00
|
|
|
|
2003-12-22 01:47:09 +00:00
|
|
|
ximagesink->pixel_width = 1;
|
|
|
|
gst_structure_get_int (structure, "pixel_width",
|
examples/gstplay/player.c: Adding some new lines in g_print calls.
Original commit message from CVS:
* examples/gstplay/player.c: (got_time_tick), (got_stream_length),
(got_video_size): Adding some new lines in g_print calls.
* sys/ximage/ximagesink.c: (gst_ximagesink_xwindow_new),
(gst_ximagesink_xwindow_destroy), (gst_ximagesink_xwindow_resize),
(gst_ximagesink_handle_xevents), (gst_ximagesink_fixate),
(gst_ximagesink_sinkconnect), (gst_ximagesink_change_state),
(gst_ximagesink_chain), (gst_ximagesink_buffer_new),
(gst_ximagesink_set_xwindow_id), (gst_ximagesink_get_desired_size):
Complete code review, reverting some stuff i disagree with, adding
some fixes : time synchronization on invalid timestamps, renegotiation
of private window.
* sys/ximage/ximagesink.h:
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_xwindow_destroy),
(gst_xvimagesink_xwindow_resize), (gst_xvimagesink_handle_xevents),
(gst_xvimagesink_get_xv_support), (gst_xvimagesink_xcontext_get),
(gst_xvimagesink_fixate), (gst_xvimagesink_sinkconnect),
(gst_xvimagesink_change_state), (gst_xvimagesink_chain),
(gst_xvimagesink_buffer_new),
(gst_xvimagesink_navigation_send_event),
(gst_xvimagesink_set_xwindow_id),
(gst_xvimagesink_get_desired_size),
(gst_xvimagesink_xoverlay_init): Complete code review, reverting some
stuff i disagree with, adding some fixes : Renegotiation of private
window, implementing get_desired_size.
2004-01-07 15:33:42 +00:00
|
|
|
&ximagesink->pixel_width);
|
2003-11-11 11:32:27 +00:00
|
|
|
|
2003-12-22 01:47:09 +00:00
|
|
|
ximagesink->pixel_height = 1;
|
|
|
|
gst_structure_get_int (structure, "pixel_height",
|
examples/gstplay/player.c: Adding some new lines in g_print calls.
Original commit message from CVS:
* examples/gstplay/player.c: (got_time_tick), (got_stream_length),
(got_video_size): Adding some new lines in g_print calls.
* sys/ximage/ximagesink.c: (gst_ximagesink_xwindow_new),
(gst_ximagesink_xwindow_destroy), (gst_ximagesink_xwindow_resize),
(gst_ximagesink_handle_xevents), (gst_ximagesink_fixate),
(gst_ximagesink_sinkconnect), (gst_ximagesink_change_state),
(gst_ximagesink_chain), (gst_ximagesink_buffer_new),
(gst_ximagesink_set_xwindow_id), (gst_ximagesink_get_desired_size):
Complete code review, reverting some stuff i disagree with, adding
some fixes : time synchronization on invalid timestamps, renegotiation
of private window.
* sys/ximage/ximagesink.h:
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_xwindow_destroy),
(gst_xvimagesink_xwindow_resize), (gst_xvimagesink_handle_xevents),
(gst_xvimagesink_get_xv_support), (gst_xvimagesink_xcontext_get),
(gst_xvimagesink_fixate), (gst_xvimagesink_sinkconnect),
(gst_xvimagesink_change_state), (gst_xvimagesink_chain),
(gst_xvimagesink_buffer_new),
(gst_xvimagesink_navigation_send_event),
(gst_xvimagesink_set_xwindow_id),
(gst_xvimagesink_get_desired_size),
(gst_xvimagesink_xoverlay_init): Complete code review, reverting some
stuff i disagree with, adding some fixes : Renegotiation of private
window, implementing get_desired_size.
2004-01-07 15:33:42 +00:00
|
|
|
&ximagesink->pixel_height);
|
2003-11-06 21:51:14 +00:00
|
|
|
|
2003-11-11 11:32:27 +00:00
|
|
|
/* Creating our window and our image */
|
|
|
|
if (!ximagesink->xwindow)
|
|
|
|
ximagesink->xwindow = gst_ximagesink_xwindow_new (ximagesink,
|
2003-11-19 20:43:49 +00:00
|
|
|
GST_VIDEOSINK_WIDTH (ximagesink),
|
|
|
|
GST_VIDEOSINK_HEIGHT (ximagesink));
|
2004-01-02 23:11:41 +00:00
|
|
|
else
|
examples/gstplay/player.c: Adding some new lines in g_print calls.
Original commit message from CVS:
* examples/gstplay/player.c: (got_time_tick), (got_stream_length),
(got_video_size): Adding some new lines in g_print calls.
* sys/ximage/ximagesink.c: (gst_ximagesink_xwindow_new),
(gst_ximagesink_xwindow_destroy), (gst_ximagesink_xwindow_resize),
(gst_ximagesink_handle_xevents), (gst_ximagesink_fixate),
(gst_ximagesink_sinkconnect), (gst_ximagesink_change_state),
(gst_ximagesink_chain), (gst_ximagesink_buffer_new),
(gst_ximagesink_set_xwindow_id), (gst_ximagesink_get_desired_size):
Complete code review, reverting some stuff i disagree with, adding
some fixes : time synchronization on invalid timestamps, renegotiation
of private window.
* sys/ximage/ximagesink.h:
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_xwindow_destroy),
(gst_xvimagesink_xwindow_resize), (gst_xvimagesink_handle_xevents),
(gst_xvimagesink_get_xv_support), (gst_xvimagesink_xcontext_get),
(gst_xvimagesink_fixate), (gst_xvimagesink_sinkconnect),
(gst_xvimagesink_change_state), (gst_xvimagesink_chain),
(gst_xvimagesink_buffer_new),
(gst_xvimagesink_navigation_send_event),
(gst_xvimagesink_set_xwindow_id),
(gst_xvimagesink_get_desired_size),
(gst_xvimagesink_xoverlay_init): Complete code review, reverting some
stuff i disagree with, adding some fixes : Renegotiation of private
window, implementing get_desired_size.
2004-01-07 15:33:42 +00:00
|
|
|
{
|
|
|
|
if (ximagesink->xwindow->internal)
|
|
|
|
gst_ximagesink_xwindow_resize (ximagesink, ximagesink->xwindow,
|
|
|
|
GST_VIDEOSINK_WIDTH (ximagesink),
|
|
|
|
GST_VIDEOSINK_HEIGHT (ximagesink));
|
|
|
|
}
|
2003-11-06 21:51:14 +00:00
|
|
|
|
2003-11-11 11:32:27 +00:00
|
|
|
if ( (ximagesink->ximage) &&
|
2003-11-19 20:43:49 +00:00
|
|
|
( (GST_VIDEOSINK_WIDTH (ximagesink) != ximagesink->ximage->width) ||
|
|
|
|
(GST_VIDEOSINK_HEIGHT (ximagesink) != ximagesink->ximage->height) ) )
|
2003-11-11 11:32:27 +00:00
|
|
|
{ /* We renew our ximage only if size changed */
|
|
|
|
gst_ximagesink_ximage_destroy (ximagesink, ximagesink->ximage);
|
2003-11-11 11:12:20 +00:00
|
|
|
|
2003-11-11 11:32:27 +00:00
|
|
|
ximagesink->ximage = gst_ximagesink_ximage_new (ximagesink,
|
2003-11-19 20:43:49 +00:00
|
|
|
GST_VIDEOSINK_WIDTH (ximagesink),
|
|
|
|
GST_VIDEOSINK_HEIGHT (ximagesink));
|
2003-11-11 11:12:20 +00:00
|
|
|
}
|
2003-11-11 11:32:27 +00:00
|
|
|
else if (!ximagesink->ximage) /* If no ximage, creating one */
|
|
|
|
ximagesink->ximage = gst_ximagesink_ximage_new (ximagesink,
|
2003-11-19 20:43:49 +00:00
|
|
|
GST_VIDEOSINK_WIDTH (ximagesink),
|
|
|
|
GST_VIDEOSINK_HEIGHT (ximagesink));
|
2003-11-11 11:32:27 +00:00
|
|
|
|
2004-01-04 18:53:53 +00:00
|
|
|
gst_x_overlay_got_desired_size (GST_X_OVERLAY (ximagesink),
|
examples/gstplay/player.c: Adding some new lines in g_print calls.
Original commit message from CVS:
* examples/gstplay/player.c: (got_time_tick), (got_stream_length),
(got_video_size): Adding some new lines in g_print calls.
* sys/ximage/ximagesink.c: (gst_ximagesink_xwindow_new),
(gst_ximagesink_xwindow_destroy), (gst_ximagesink_xwindow_resize),
(gst_ximagesink_handle_xevents), (gst_ximagesink_fixate),
(gst_ximagesink_sinkconnect), (gst_ximagesink_change_state),
(gst_ximagesink_chain), (gst_ximagesink_buffer_new),
(gst_ximagesink_set_xwindow_id), (gst_ximagesink_get_desired_size):
Complete code review, reverting some stuff i disagree with, adding
some fixes : time synchronization on invalid timestamps, renegotiation
of private window.
* sys/ximage/ximagesink.h:
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_xwindow_destroy),
(gst_xvimagesink_xwindow_resize), (gst_xvimagesink_handle_xevents),
(gst_xvimagesink_get_xv_support), (gst_xvimagesink_xcontext_get),
(gst_xvimagesink_fixate), (gst_xvimagesink_sinkconnect),
(gst_xvimagesink_change_state), (gst_xvimagesink_chain),
(gst_xvimagesink_buffer_new),
(gst_xvimagesink_navigation_send_event),
(gst_xvimagesink_set_xwindow_id),
(gst_xvimagesink_get_desired_size),
(gst_xvimagesink_xoverlay_init): Complete code review, reverting some
stuff i disagree with, adding some fixes : Renegotiation of private
window, implementing get_desired_size.
2004-01-07 15:33:42 +00:00
|
|
|
GST_VIDEOSINK_WIDTH (ximagesink),
|
|
|
|
GST_VIDEOSINK_HEIGHT (ximagesink));
|
2003-11-17 16:32:29 +00:00
|
|
|
|
2003-11-11 11:32:27 +00:00
|
|
|
return GST_PAD_LINK_OK;
|
2003-11-06 21:51:14 +00:00
|
|
|
}
|
|
|
|
|
2003-11-11 11:32:27 +00:00
|
|
|
static GstElementStateReturn
|
|
|
|
gst_ximagesink_change_state (GstElement *element)
|
2003-11-06 21:51:14 +00:00
|
|
|
{
|
|
|
|
GstXImageSink *ximagesink;
|
2003-11-11 11:32:27 +00:00
|
|
|
|
|
|
|
ximagesink = GST_XIMAGESINK (element);
|
|
|
|
|
|
|
|
switch (GST_STATE_TRANSITION (element)) {
|
|
|
|
case GST_STATE_NULL_TO_READY:
|
|
|
|
/* Initializing the XContext */
|
2003-11-17 16:32:29 +00:00
|
|
|
if (!ximagesink->xcontext)
|
|
|
|
ximagesink->xcontext = gst_ximagesink_xcontext_get (ximagesink);
|
2003-11-11 11:32:27 +00:00
|
|
|
if (!ximagesink->xcontext)
|
|
|
|
return GST_STATE_FAILURE;
|
|
|
|
break;
|
|
|
|
case GST_STATE_READY_TO_PAUSED:
|
2004-03-05 14:40:41 +00:00
|
|
|
if (ximagesink->xwindow)
|
|
|
|
gst_ximagesink_xwindow_clear (ximagesink, ximagesink->xwindow);
|
examples/gstplay/player.c: Adding some new lines in g_print calls.
Original commit message from CVS:
* examples/gstplay/player.c: (got_time_tick), (got_stream_length),
(got_video_size): Adding some new lines in g_print calls.
* sys/ximage/ximagesink.c: (gst_ximagesink_xwindow_new),
(gst_ximagesink_xwindow_destroy), (gst_ximagesink_xwindow_resize),
(gst_ximagesink_handle_xevents), (gst_ximagesink_fixate),
(gst_ximagesink_sinkconnect), (gst_ximagesink_change_state),
(gst_ximagesink_chain), (gst_ximagesink_buffer_new),
(gst_ximagesink_set_xwindow_id), (gst_ximagesink_get_desired_size):
Complete code review, reverting some stuff i disagree with, adding
some fixes : time synchronization on invalid timestamps, renegotiation
of private window.
* sys/ximage/ximagesink.h:
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_xwindow_destroy),
(gst_xvimagesink_xwindow_resize), (gst_xvimagesink_handle_xevents),
(gst_xvimagesink_get_xv_support), (gst_xvimagesink_xcontext_get),
(gst_xvimagesink_fixate), (gst_xvimagesink_sinkconnect),
(gst_xvimagesink_change_state), (gst_xvimagesink_chain),
(gst_xvimagesink_buffer_new),
(gst_xvimagesink_navigation_send_event),
(gst_xvimagesink_set_xwindow_id),
(gst_xvimagesink_get_desired_size),
(gst_xvimagesink_xoverlay_init): Complete code review, reverting some
stuff i disagree with, adding some fixes : Renegotiation of private
window, implementing get_desired_size.
2004-01-07 15:33:42 +00:00
|
|
|
ximagesink->time = 0;
|
2003-11-11 11:32:27 +00:00
|
|
|
break;
|
|
|
|
case GST_STATE_PAUSED_TO_PLAYING:
|
|
|
|
break;
|
|
|
|
case GST_STATE_PLAYING_TO_PAUSED:
|
|
|
|
break;
|
|
|
|
case GST_STATE_PAUSED_TO_READY:
|
examples/gstplay/player.c: Adding some new lines in g_print calls.
Original commit message from CVS:
* examples/gstplay/player.c: (got_time_tick), (got_stream_length),
(got_video_size): Adding some new lines in g_print calls.
* sys/ximage/ximagesink.c: (gst_ximagesink_xwindow_new),
(gst_ximagesink_xwindow_destroy), (gst_ximagesink_xwindow_resize),
(gst_ximagesink_handle_xevents), (gst_ximagesink_fixate),
(gst_ximagesink_sinkconnect), (gst_ximagesink_change_state),
(gst_ximagesink_chain), (gst_ximagesink_buffer_new),
(gst_ximagesink_set_xwindow_id), (gst_ximagesink_get_desired_size):
Complete code review, reverting some stuff i disagree with, adding
some fixes : time synchronization on invalid timestamps, renegotiation
of private window.
* sys/ximage/ximagesink.h:
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_xwindow_destroy),
(gst_xvimagesink_xwindow_resize), (gst_xvimagesink_handle_xevents),
(gst_xvimagesink_get_xv_support), (gst_xvimagesink_xcontext_get),
(gst_xvimagesink_fixate), (gst_xvimagesink_sinkconnect),
(gst_xvimagesink_change_state), (gst_xvimagesink_chain),
(gst_xvimagesink_buffer_new),
(gst_xvimagesink_navigation_send_event),
(gst_xvimagesink_set_xwindow_id),
(gst_xvimagesink_get_desired_size),
(gst_xvimagesink_xoverlay_init): Complete code review, reverting some
stuff i disagree with, adding some fixes : Renegotiation of private
window, implementing get_desired_size.
2004-01-07 15:33:42 +00:00
|
|
|
ximagesink->framerate = 0;
|
2004-02-18 21:16:50 +00:00
|
|
|
ximagesink->sw_scaling_failed = FALSE;
|
2004-01-04 18:53:53 +00:00
|
|
|
GST_VIDEOSINK_WIDTH (ximagesink) = 0;
|
|
|
|
GST_VIDEOSINK_HEIGHT (ximagesink) = 0;
|
2003-11-11 11:32:27 +00:00
|
|
|
break;
|
|
|
|
case GST_STATE_READY_TO_NULL:
|
gst-libs/gst/play/gstplay.c: Reworked the pipeline from scratch. Visualization is back and switch went out as i reali...
Original commit message from CVS:
2004-01-23 Julien MOUTTE <julien@moutte.net>
* gst-libs/gst/play/gstplay.c: (gst_play_pipeline_setup),
(gst_play_set_location), (gst_play_seek_to_time),
(gst_play_set_audio_sink), (gst_play_set_visualization),
(gst_play_connect_visualization), (gst_play_get_sink_element): Reworked
the pipeline from scratch. Visualization is back and switch went out as
i realized it was not possible to use the way i wanted.
* sys/ximage/ximagesink.c: (gst_ximagesink_imagepool_clear),
(gst_ximagesink_change_state), (gst_ximagesink_dispose): Move xcontext
clearing in state change from READY to NULL. So that one can clean the
X ressources keeping the element.
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_xcontext_get),
(gst_xvimagesink_imagepool_clear), (gst_xvimagesink_change_state),
(gst_xvimagesink_colorbalance_set_value),
(gst_xvimagesink_colorbalance_get_value),
(gst_xvimagesink_set_property), (gst_xvimagesink_dispose),
(gst_xvimagesink_init): Same xcontext cleaning than ximagesink in state
change from READY to NULL and fixed some stupid bugs in colorbalance
get/set values. Also added the following feature : when nobody tries to
set some values to the colorbalance levels before the xcontext is
grabbed, then when creating channels list from Xv attributes we set the
internal values to the Xv defaults. This way we handle buggy Xv drivers
that set default hue values far from the middle of the range (Thanks
to Jon Trowbridge for pointing that issue).
* sys/xvimage/xvimagesink.h: Adding a cb_changed boolean to know if
colorbalance levels have been set before xcontext is grabbed.
2004-01-22 23:54:34 +00:00
|
|
|
if (ximagesink->ximage)
|
|
|
|
{
|
|
|
|
gst_ximagesink_ximage_destroy (ximagesink, ximagesink->ximage);
|
|
|
|
ximagesink->ximage = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ximagesink->image_pool)
|
|
|
|
gst_ximagesink_imagepool_clear (ximagesink);
|
|
|
|
|
|
|
|
if (ximagesink->xwindow)
|
|
|
|
{
|
|
|
|
gst_ximagesink_xwindow_destroy (ximagesink, ximagesink->xwindow);
|
|
|
|
ximagesink->xwindow = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ximagesink->xcontext)
|
|
|
|
{
|
|
|
|
gst_ximagesink_xcontext_clear (ximagesink);
|
|
|
|
ximagesink->xcontext = NULL;
|
|
|
|
}
|
2003-11-11 11:32:27 +00:00
|
|
|
break;
|
2003-11-06 21:51:14 +00:00
|
|
|
}
|
|
|
|
|
2003-11-19 22:31:46 +00:00
|
|
|
if (GST_ELEMENT_CLASS (parent_class)->change_state)
|
|
|
|
return GST_ELEMENT_CLASS (parent_class)->change_state (element);
|
2003-11-06 21:51:14 +00:00
|
|
|
|
|
|
|
return GST_STATE_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
examples/gstplay/player.c: Adding some new lines in g_print calls.
Original commit message from CVS:
* examples/gstplay/player.c: (got_time_tick), (got_stream_length),
(got_video_size): Adding some new lines in g_print calls.
* sys/ximage/ximagesink.c: (gst_ximagesink_xwindow_new),
(gst_ximagesink_xwindow_destroy), (gst_ximagesink_xwindow_resize),
(gst_ximagesink_handle_xevents), (gst_ximagesink_fixate),
(gst_ximagesink_sinkconnect), (gst_ximagesink_change_state),
(gst_ximagesink_chain), (gst_ximagesink_buffer_new),
(gst_ximagesink_set_xwindow_id), (gst_ximagesink_get_desired_size):
Complete code review, reverting some stuff i disagree with, adding
some fixes : time synchronization on invalid timestamps, renegotiation
of private window.
* sys/ximage/ximagesink.h:
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_xwindow_destroy),
(gst_xvimagesink_xwindow_resize), (gst_xvimagesink_handle_xevents),
(gst_xvimagesink_get_xv_support), (gst_xvimagesink_xcontext_get),
(gst_xvimagesink_fixate), (gst_xvimagesink_sinkconnect),
(gst_xvimagesink_change_state), (gst_xvimagesink_chain),
(gst_xvimagesink_buffer_new),
(gst_xvimagesink_navigation_send_event),
(gst_xvimagesink_set_xwindow_id),
(gst_xvimagesink_get_desired_size),
(gst_xvimagesink_xoverlay_init): Complete code review, reverting some
stuff i disagree with, adding some fixes : Renegotiation of private
window, implementing get_desired_size.
2004-01-07 15:33:42 +00:00
|
|
|
gst_ximagesink_chain (GstPad *pad, GstData *data)
|
2003-11-06 21:51:14 +00:00
|
|
|
{
|
examples/gstplay/player.c: Adding some new lines in g_print calls.
Original commit message from CVS:
* examples/gstplay/player.c: (got_time_tick), (got_stream_length),
(got_video_size): Adding some new lines in g_print calls.
* sys/ximage/ximagesink.c: (gst_ximagesink_xwindow_new),
(gst_ximagesink_xwindow_destroy), (gst_ximagesink_xwindow_resize),
(gst_ximagesink_handle_xevents), (gst_ximagesink_fixate),
(gst_ximagesink_sinkconnect), (gst_ximagesink_change_state),
(gst_ximagesink_chain), (gst_ximagesink_buffer_new),
(gst_ximagesink_set_xwindow_id), (gst_ximagesink_get_desired_size):
Complete code review, reverting some stuff i disagree with, adding
some fixes : time synchronization on invalid timestamps, renegotiation
of private window.
* sys/ximage/ximagesink.h:
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_xwindow_destroy),
(gst_xvimagesink_xwindow_resize), (gst_xvimagesink_handle_xevents),
(gst_xvimagesink_get_xv_support), (gst_xvimagesink_xcontext_get),
(gst_xvimagesink_fixate), (gst_xvimagesink_sinkconnect),
(gst_xvimagesink_change_state), (gst_xvimagesink_chain),
(gst_xvimagesink_buffer_new),
(gst_xvimagesink_navigation_send_event),
(gst_xvimagesink_set_xwindow_id),
(gst_xvimagesink_get_desired_size),
(gst_xvimagesink_xoverlay_init): Complete code review, reverting some
stuff i disagree with, adding some fixes : Renegotiation of private
window, implementing get_desired_size.
2004-01-07 15:33:42 +00:00
|
|
|
GstBuffer *buf = GST_BUFFER (data);
|
2003-11-06 21:51:14 +00:00
|
|
|
GstXImageSink *ximagesink;
|
2003-11-07 18:00:39 +00:00
|
|
|
|
2003-11-06 21:51:14 +00:00
|
|
|
g_return_if_fail (GST_IS_PAD (pad));
|
|
|
|
g_return_if_fail (buf != NULL);
|
|
|
|
|
|
|
|
ximagesink = GST_XIMAGESINK (gst_pad_get_parent (pad));
|
2003-11-07 18:00:39 +00:00
|
|
|
|
examples/gstplay/player.c: Adding some new lines in g_print calls.
Original commit message from CVS:
* examples/gstplay/player.c: (got_time_tick), (got_stream_length),
(got_video_size): Adding some new lines in g_print calls.
* sys/ximage/ximagesink.c: (gst_ximagesink_xwindow_new),
(gst_ximagesink_xwindow_destroy), (gst_ximagesink_xwindow_resize),
(gst_ximagesink_handle_xevents), (gst_ximagesink_fixate),
(gst_ximagesink_sinkconnect), (gst_ximagesink_change_state),
(gst_ximagesink_chain), (gst_ximagesink_buffer_new),
(gst_ximagesink_set_xwindow_id), (gst_ximagesink_get_desired_size):
Complete code review, reverting some stuff i disagree with, adding
some fixes : time synchronization on invalid timestamps, renegotiation
of private window.
* sys/ximage/ximagesink.h:
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_xwindow_destroy),
(gst_xvimagesink_xwindow_resize), (gst_xvimagesink_handle_xevents),
(gst_xvimagesink_get_xv_support), (gst_xvimagesink_xcontext_get),
(gst_xvimagesink_fixate), (gst_xvimagesink_sinkconnect),
(gst_xvimagesink_change_state), (gst_xvimagesink_chain),
(gst_xvimagesink_buffer_new),
(gst_xvimagesink_navigation_send_event),
(gst_xvimagesink_set_xwindow_id),
(gst_xvimagesink_get_desired_size),
(gst_xvimagesink_xoverlay_init): Complete code review, reverting some
stuff i disagree with, adding some fixes : Renegotiation of private
window, implementing get_desired_size.
2004-01-07 15:33:42 +00:00
|
|
|
if (GST_IS_EVENT (data))
|
2003-11-08 14:58:35 +00:00
|
|
|
{
|
2004-01-15 02:14:54 +00:00
|
|
|
gst_pad_event_default (pad, GST_EVENT (data));
|
2003-11-08 14:58:35 +00:00
|
|
|
return;
|
2003-11-06 21:51:14 +00:00
|
|
|
}
|
|
|
|
|
examples/gstplay/player.c: Adding some new lines in g_print calls.
Original commit message from CVS:
* examples/gstplay/player.c: (got_time_tick), (got_stream_length),
(got_video_size): Adding some new lines in g_print calls.
* sys/ximage/ximagesink.c: (gst_ximagesink_xwindow_new),
(gst_ximagesink_xwindow_destroy), (gst_ximagesink_xwindow_resize),
(gst_ximagesink_handle_xevents), (gst_ximagesink_fixate),
(gst_ximagesink_sinkconnect), (gst_ximagesink_change_state),
(gst_ximagesink_chain), (gst_ximagesink_buffer_new),
(gst_ximagesink_set_xwindow_id), (gst_ximagesink_get_desired_size):
Complete code review, reverting some stuff i disagree with, adding
some fixes : time synchronization on invalid timestamps, renegotiation
of private window.
* sys/ximage/ximagesink.h:
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_xwindow_destroy),
(gst_xvimagesink_xwindow_resize), (gst_xvimagesink_handle_xevents),
(gst_xvimagesink_get_xv_support), (gst_xvimagesink_xcontext_get),
(gst_xvimagesink_fixate), (gst_xvimagesink_sinkconnect),
(gst_xvimagesink_change_state), (gst_xvimagesink_chain),
(gst_xvimagesink_buffer_new),
(gst_xvimagesink_navigation_send_event),
(gst_xvimagesink_set_xwindow_id),
(gst_xvimagesink_get_desired_size),
(gst_xvimagesink_xoverlay_init): Complete code review, reverting some
stuff i disagree with, adding some fixes : Renegotiation of private
window, implementing get_desired_size.
2004-01-07 15:33:42 +00:00
|
|
|
buf = GST_BUFFER (data);
|
|
|
|
/* update time */
|
|
|
|
if (GST_BUFFER_TIMESTAMP_IS_VALID (buf)) {
|
|
|
|
ximagesink->time = GST_BUFFER_TIMESTAMP (buf);
|
|
|
|
}
|
|
|
|
GST_DEBUG ("videosink: clock wait: %" G_GUINT64_FORMAT, ximagesink->time);
|
2004-02-01 22:33:07 +00:00
|
|
|
|
2003-11-19 20:43:49 +00:00
|
|
|
if (GST_VIDEOSINK_CLOCK (ximagesink)) {
|
2004-01-14 00:53:52 +00:00
|
|
|
gst_element_wait (GST_ELEMENT (ximagesink), ximagesink->time);
|
2003-11-06 21:51:14 +00:00
|
|
|
}
|
|
|
|
|
ext/ffmpeg/gstffmpegcolorspace.c: Implementing gst_pad_alloc_buffer to use optimized buffer allocation.
Original commit message from CVS:
* ext/ffmpeg/gstffmpegcolorspace.c: (gst_ffmpegcsp_chain):
Implementing gst_pad_alloc_buffer to use optimized buffer allocation.
* gst-libs/gst/xoverlay/xoverlay.c:
(gst_x_overlay_got_desired_size): Updating doc for the xid being 0.
* gst/videoscale/gstvideoscale.c: (gst_videoscale_chain):
Implementing gst_pad_alloc_buffer to use optimized buffer allocation.
* gst/videotestsrc/gstvideotestsrc.c: (gst_videotestsrc_get):
Implementing gst_pad_alloc_buffer to use optimized buffer allocation.
* sys/ximage/ximagesink.c: (gst_ximagesink_chain),
(gst_ximagesink_buffer_free), (gst_ximagesink_buffer_alloc),
(gst_ximagesink_set_xwindow_id), (gst_ximagesink_init): Implementing
the bufferalloc_function to replace bufferpools, fixing the XOverlay
interface implementation to handle xid being 0 and fix some bugs
triggered by Benjamin's testcase.
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_chain),
(gst_xvimagesink_buffer_free), (gst_xvimagesink_buffer_alloc),
(gst_xvimagesink_set_xwindow_id), (gst_xvimagesink_init): Implementing
the bufferalloc_function to replace bufferpools, fixing the XOverlay
interface implementation to handle xid being 0 and fix some bugs
triggered by Benjamin's testcase.
2004-01-09 18:05:57 +00:00
|
|
|
/* If this buffer has been allocated using our buffer management we simply
|
|
|
|
put the ximage which is in the PRIVATE pointer */
|
2004-01-15 22:03:45 +00:00
|
|
|
if (GST_BUFFER_FREE_DATA_FUNC (buf) == gst_ximagesink_buffer_free)
|
ext/ffmpeg/gstffmpegcolorspace.c: Implementing gst_pad_alloc_buffer to use optimized buffer allocation.
Original commit message from CVS:
* ext/ffmpeg/gstffmpegcolorspace.c: (gst_ffmpegcsp_chain):
Implementing gst_pad_alloc_buffer to use optimized buffer allocation.
* gst-libs/gst/xoverlay/xoverlay.c:
(gst_x_overlay_got_desired_size): Updating doc for the xid being 0.
* gst/videoscale/gstvideoscale.c: (gst_videoscale_chain):
Implementing gst_pad_alloc_buffer to use optimized buffer allocation.
* gst/videotestsrc/gstvideotestsrc.c: (gst_videotestsrc_get):
Implementing gst_pad_alloc_buffer to use optimized buffer allocation.
* sys/ximage/ximagesink.c: (gst_ximagesink_chain),
(gst_ximagesink_buffer_free), (gst_ximagesink_buffer_alloc),
(gst_ximagesink_set_xwindow_id), (gst_ximagesink_init): Implementing
the bufferalloc_function to replace bufferpools, fixing the XOverlay
interface implementation to handle xid being 0 and fix some bugs
triggered by Benjamin's testcase.
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_chain),
(gst_xvimagesink_buffer_free), (gst_xvimagesink_buffer_alloc),
(gst_xvimagesink_set_xwindow_id), (gst_xvimagesink_init): Implementing
the bufferalloc_function to replace bufferpools, fixing the XOverlay
interface implementation to handle xid being 0 and fix some bugs
triggered by Benjamin's testcase.
2004-01-09 18:05:57 +00:00
|
|
|
{
|
2004-01-11 22:52:29 +00:00
|
|
|
gst_ximagesink_ximage_put (ximagesink, GST_BUFFER_PRIVATE (buf));
|
ext/ffmpeg/gstffmpegcolorspace.c: Implementing gst_pad_alloc_buffer to use optimized buffer allocation.
Original commit message from CVS:
* ext/ffmpeg/gstffmpegcolorspace.c: (gst_ffmpegcsp_chain):
Implementing gst_pad_alloc_buffer to use optimized buffer allocation.
* gst-libs/gst/xoverlay/xoverlay.c:
(gst_x_overlay_got_desired_size): Updating doc for the xid being 0.
* gst/videoscale/gstvideoscale.c: (gst_videoscale_chain):
Implementing gst_pad_alloc_buffer to use optimized buffer allocation.
* gst/videotestsrc/gstvideotestsrc.c: (gst_videotestsrc_get):
Implementing gst_pad_alloc_buffer to use optimized buffer allocation.
* sys/ximage/ximagesink.c: (gst_ximagesink_chain),
(gst_ximagesink_buffer_free), (gst_ximagesink_buffer_alloc),
(gst_ximagesink_set_xwindow_id), (gst_ximagesink_init): Implementing
the bufferalloc_function to replace bufferpools, fixing the XOverlay
interface implementation to handle xid being 0 and fix some bugs
triggered by Benjamin's testcase.
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_chain),
(gst_xvimagesink_buffer_free), (gst_xvimagesink_buffer_alloc),
(gst_xvimagesink_set_xwindow_id), (gst_xvimagesink_init): Implementing
the bufferalloc_function to replace bufferpools, fixing the XOverlay
interface implementation to handle xid being 0 and fix some bugs
triggered by Benjamin's testcase.
2004-01-09 18:05:57 +00:00
|
|
|
}
|
2003-11-06 21:51:14 +00:00
|
|
|
else /* Else we have to copy the data into our private image, */
|
|
|
|
{ /* if we have one... */
|
|
|
|
if (ximagesink->ximage)
|
|
|
|
{
|
|
|
|
memcpy (ximagesink->ximage->ximage->data,
|
|
|
|
GST_BUFFER_DATA (buf),
|
|
|
|
MIN (GST_BUFFER_SIZE (buf), ximagesink->ximage->size));
|
|
|
|
gst_ximagesink_ximage_put (ximagesink, ximagesink->ximage);
|
|
|
|
}
|
|
|
|
else /* No image available. Something went wrong during capsnego ! */
|
|
|
|
{
|
|
|
|
gst_buffer_unref (buf);
|
2004-02-02 17:23:33 +00:00
|
|
|
GST_ELEMENT_ERROR (ximagesink, CORE, NEGOTIATION, (NULL), ("no format defined before chain function"));
|
2003-11-06 21:51:14 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
ext/ffmpeg/gstffmpegcolorspace.c: Implementing gst_pad_alloc_buffer to use optimized buffer allocation.
Original commit message from CVS:
* ext/ffmpeg/gstffmpegcolorspace.c: (gst_ffmpegcsp_chain):
Implementing gst_pad_alloc_buffer to use optimized buffer allocation.
* gst-libs/gst/xoverlay/xoverlay.c:
(gst_x_overlay_got_desired_size): Updating doc for the xid being 0.
* gst/videoscale/gstvideoscale.c: (gst_videoscale_chain):
Implementing gst_pad_alloc_buffer to use optimized buffer allocation.
* gst/videotestsrc/gstvideotestsrc.c: (gst_videotestsrc_get):
Implementing gst_pad_alloc_buffer to use optimized buffer allocation.
* sys/ximage/ximagesink.c: (gst_ximagesink_chain),
(gst_ximagesink_buffer_free), (gst_ximagesink_buffer_alloc),
(gst_ximagesink_set_xwindow_id), (gst_ximagesink_init): Implementing
the bufferalloc_function to replace bufferpools, fixing the XOverlay
interface implementation to handle xid being 0 and fix some bugs
triggered by Benjamin's testcase.
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_chain),
(gst_xvimagesink_buffer_free), (gst_xvimagesink_buffer_alloc),
(gst_xvimagesink_set_xwindow_id), (gst_xvimagesink_init): Implementing
the bufferalloc_function to replace bufferpools, fixing the XOverlay
interface implementation to handle xid being 0 and fix some bugs
triggered by Benjamin's testcase.
2004-01-09 18:05:57 +00:00
|
|
|
|
examples/gstplay/player.c: Adding some new lines in g_print calls.
Original commit message from CVS:
* examples/gstplay/player.c: (got_time_tick), (got_stream_length),
(got_video_size): Adding some new lines in g_print calls.
* sys/ximage/ximagesink.c: (gst_ximagesink_xwindow_new),
(gst_ximagesink_xwindow_destroy), (gst_ximagesink_xwindow_resize),
(gst_ximagesink_handle_xevents), (gst_ximagesink_fixate),
(gst_ximagesink_sinkconnect), (gst_ximagesink_change_state),
(gst_ximagesink_chain), (gst_ximagesink_buffer_new),
(gst_ximagesink_set_xwindow_id), (gst_ximagesink_get_desired_size):
Complete code review, reverting some stuff i disagree with, adding
some fixes : time synchronization on invalid timestamps, renegotiation
of private window.
* sys/ximage/ximagesink.h:
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_xwindow_destroy),
(gst_xvimagesink_xwindow_resize), (gst_xvimagesink_handle_xevents),
(gst_xvimagesink_get_xv_support), (gst_xvimagesink_xcontext_get),
(gst_xvimagesink_fixate), (gst_xvimagesink_sinkconnect),
(gst_xvimagesink_change_state), (gst_xvimagesink_chain),
(gst_xvimagesink_buffer_new),
(gst_xvimagesink_navigation_send_event),
(gst_xvimagesink_set_xwindow_id),
(gst_xvimagesink_get_desired_size),
(gst_xvimagesink_xoverlay_init): Complete code review, reverting some
stuff i disagree with, adding some fixes : Renegotiation of private
window, implementing get_desired_size.
2004-01-07 15:33:42 +00:00
|
|
|
/* set correct time for next buffer */
|
|
|
|
if (!GST_BUFFER_TIMESTAMP_IS_VALID (buf) && ximagesink->framerate > 0) {
|
|
|
|
ximagesink->time += GST_SECOND / ximagesink->framerate;
|
|
|
|
}
|
2003-11-06 21:51:14 +00:00
|
|
|
|
|
|
|
gst_buffer_unref (buf);
|
2003-11-07 18:00:39 +00:00
|
|
|
|
2003-11-08 14:58:35 +00:00
|
|
|
gst_ximagesink_handle_xevents (ximagesink, pad);
|
2003-11-06 21:51:14 +00:00
|
|
|
}
|
|
|
|
|
ext/ffmpeg/gstffmpegcolorspace.c: Implementing gst_pad_alloc_buffer to use optimized buffer allocation.
Original commit message from CVS:
* ext/ffmpeg/gstffmpegcolorspace.c: (gst_ffmpegcsp_chain):
Implementing gst_pad_alloc_buffer to use optimized buffer allocation.
* gst-libs/gst/xoverlay/xoverlay.c:
(gst_x_overlay_got_desired_size): Updating doc for the xid being 0.
* gst/videoscale/gstvideoscale.c: (gst_videoscale_chain):
Implementing gst_pad_alloc_buffer to use optimized buffer allocation.
* gst/videotestsrc/gstvideotestsrc.c: (gst_videotestsrc_get):
Implementing gst_pad_alloc_buffer to use optimized buffer allocation.
* sys/ximage/ximagesink.c: (gst_ximagesink_chain),
(gst_ximagesink_buffer_free), (gst_ximagesink_buffer_alloc),
(gst_ximagesink_set_xwindow_id), (gst_ximagesink_init): Implementing
the bufferalloc_function to replace bufferpools, fixing the XOverlay
interface implementation to handle xid being 0 and fix some bugs
triggered by Benjamin's testcase.
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_chain),
(gst_xvimagesink_buffer_free), (gst_xvimagesink_buffer_alloc),
(gst_xvimagesink_set_xwindow_id), (gst_xvimagesink_init): Implementing
the bufferalloc_function to replace bufferpools, fixing the XOverlay
interface implementation to handle xid being 0 and fix some bugs
triggered by Benjamin's testcase.
2004-01-09 18:05:57 +00:00
|
|
|
/* Buffer management */
|
|
|
|
|
|
|
|
static void
|
2004-01-12 02:01:52 +00:00
|
|
|
gst_ximagesink_buffer_free (GstBuffer *buffer)
|
ext/ffmpeg/gstffmpegcolorspace.c: Implementing gst_pad_alloc_buffer to use optimized buffer allocation.
Original commit message from CVS:
* ext/ffmpeg/gstffmpegcolorspace.c: (gst_ffmpegcsp_chain):
Implementing gst_pad_alloc_buffer to use optimized buffer allocation.
* gst-libs/gst/xoverlay/xoverlay.c:
(gst_x_overlay_got_desired_size): Updating doc for the xid being 0.
* gst/videoscale/gstvideoscale.c: (gst_videoscale_chain):
Implementing gst_pad_alloc_buffer to use optimized buffer allocation.
* gst/videotestsrc/gstvideotestsrc.c: (gst_videotestsrc_get):
Implementing gst_pad_alloc_buffer to use optimized buffer allocation.
* sys/ximage/ximagesink.c: (gst_ximagesink_chain),
(gst_ximagesink_buffer_free), (gst_ximagesink_buffer_alloc),
(gst_ximagesink_set_xwindow_id), (gst_ximagesink_init): Implementing
the bufferalloc_function to replace bufferpools, fixing the XOverlay
interface implementation to handle xid being 0 and fix some bugs
triggered by Benjamin's testcase.
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_chain),
(gst_xvimagesink_buffer_free), (gst_xvimagesink_buffer_alloc),
(gst_xvimagesink_set_xwindow_id), (gst_xvimagesink_init): Implementing
the bufferalloc_function to replace bufferpools, fixing the XOverlay
interface implementation to handle xid being 0 and fix some bugs
triggered by Benjamin's testcase.
2004-01-09 18:05:57 +00:00
|
|
|
{
|
|
|
|
GstXImageSink *ximagesink;
|
|
|
|
GstXImage *ximage;
|
|
|
|
|
2004-01-12 02:01:52 +00:00
|
|
|
ximage = GST_BUFFER_PRIVATE (buffer);
|
2004-01-11 22:52:29 +00:00
|
|
|
|
|
|
|
g_assert (GST_IS_XIMAGESINK (ximage->ximagesink));
|
|
|
|
ximagesink = ximage->ximagesink;
|
|
|
|
|
ext/ffmpeg/gstffmpegcolorspace.c: Implementing gst_pad_alloc_buffer to use optimized buffer allocation.
Original commit message from CVS:
* ext/ffmpeg/gstffmpegcolorspace.c: (gst_ffmpegcsp_chain):
Implementing gst_pad_alloc_buffer to use optimized buffer allocation.
* gst-libs/gst/xoverlay/xoverlay.c:
(gst_x_overlay_got_desired_size): Updating doc for the xid being 0.
* gst/videoscale/gstvideoscale.c: (gst_videoscale_chain):
Implementing gst_pad_alloc_buffer to use optimized buffer allocation.
* gst/videotestsrc/gstvideotestsrc.c: (gst_videotestsrc_get):
Implementing gst_pad_alloc_buffer to use optimized buffer allocation.
* sys/ximage/ximagesink.c: (gst_ximagesink_chain),
(gst_ximagesink_buffer_free), (gst_ximagesink_buffer_alloc),
(gst_ximagesink_set_xwindow_id), (gst_ximagesink_init): Implementing
the bufferalloc_function to replace bufferpools, fixing the XOverlay
interface implementation to handle xid being 0 and fix some bugs
triggered by Benjamin's testcase.
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_chain),
(gst_xvimagesink_buffer_free), (gst_xvimagesink_buffer_alloc),
(gst_xvimagesink_set_xwindow_id), (gst_xvimagesink_init): Implementing
the bufferalloc_function to replace bufferpools, fixing the XOverlay
interface implementation to handle xid being 0 and fix some bugs
triggered by Benjamin's testcase.
2004-01-09 18:05:57 +00:00
|
|
|
/* If our geometry changed we can't reuse that image. */
|
|
|
|
if ( (ximage->width != GST_VIDEOSINK_WIDTH (ximagesink)) ||
|
|
|
|
(ximage->height != GST_VIDEOSINK_HEIGHT (ximagesink)) )
|
|
|
|
gst_ximagesink_ximage_destroy (ximagesink, ximage);
|
|
|
|
else /* In that case we can reuse the image and add it to our image pool. */
|
|
|
|
{
|
|
|
|
g_mutex_lock (ximagesink->pool_lock);
|
|
|
|
ximagesink->image_pool = g_slist_prepend (ximagesink->image_pool, ximage);
|
|
|
|
g_mutex_unlock (ximagesink->pool_lock);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static GstBuffer *
|
|
|
|
gst_ximagesink_buffer_alloc (GstPad *pad, guint64 offset, guint size)
|
2003-11-06 21:51:14 +00:00
|
|
|
{
|
|
|
|
GstXImageSink *ximagesink;
|
|
|
|
GstBuffer *buffer;
|
|
|
|
GstXImage *ximage = NULL;
|
|
|
|
gboolean not_found = TRUE;
|
|
|
|
|
ext/ffmpeg/gstffmpegcolorspace.c: Implementing gst_pad_alloc_buffer to use optimized buffer allocation.
Original commit message from CVS:
* ext/ffmpeg/gstffmpegcolorspace.c: (gst_ffmpegcsp_chain):
Implementing gst_pad_alloc_buffer to use optimized buffer allocation.
* gst-libs/gst/xoverlay/xoverlay.c:
(gst_x_overlay_got_desired_size): Updating doc for the xid being 0.
* gst/videoscale/gstvideoscale.c: (gst_videoscale_chain):
Implementing gst_pad_alloc_buffer to use optimized buffer allocation.
* gst/videotestsrc/gstvideotestsrc.c: (gst_videotestsrc_get):
Implementing gst_pad_alloc_buffer to use optimized buffer allocation.
* sys/ximage/ximagesink.c: (gst_ximagesink_chain),
(gst_ximagesink_buffer_free), (gst_ximagesink_buffer_alloc),
(gst_ximagesink_set_xwindow_id), (gst_ximagesink_init): Implementing
the bufferalloc_function to replace bufferpools, fixing the XOverlay
interface implementation to handle xid being 0 and fix some bugs
triggered by Benjamin's testcase.
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_chain),
(gst_xvimagesink_buffer_free), (gst_xvimagesink_buffer_alloc),
(gst_xvimagesink_set_xwindow_id), (gst_xvimagesink_init): Implementing
the bufferalloc_function to replace bufferpools, fixing the XOverlay
interface implementation to handle xid being 0 and fix some bugs
triggered by Benjamin's testcase.
2004-01-09 18:05:57 +00:00
|
|
|
ximagesink = GST_XIMAGESINK (gst_pad_get_parent (pad));
|
|
|
|
|
2003-11-06 21:51:14 +00:00
|
|
|
g_mutex_lock (ximagesink->pool_lock);
|
|
|
|
|
|
|
|
/* Walking through the pool cleaning unsuable images and searching for a
|
|
|
|
suitable one */
|
|
|
|
while (not_found && ximagesink->image_pool)
|
|
|
|
{
|
|
|
|
ximage = ximagesink->image_pool->data;
|
|
|
|
|
|
|
|
if (ximage)
|
|
|
|
{
|
|
|
|
/* Removing from the pool */
|
|
|
|
ximagesink->image_pool = g_slist_delete_link (ximagesink->image_pool,
|
|
|
|
ximagesink->image_pool);
|
|
|
|
|
2003-11-19 20:43:49 +00:00
|
|
|
if ( (ximage->width != GST_VIDEOSINK_WIDTH (ximagesink)) ||
|
|
|
|
(ximage->height != GST_VIDEOSINK_HEIGHT (ximagesink)) )
|
2003-11-06 21:51:14 +00:00
|
|
|
{ /* This image is unusable. Destroying... */
|
|
|
|
gst_ximagesink_ximage_destroy (ximagesink, ximage);
|
|
|
|
ximage = NULL;
|
|
|
|
}
|
|
|
|
else /* We found a suitable image */
|
ext/ffmpeg/gstffmpegcolorspace.c: Implementing gst_pad_alloc_buffer to use optimized buffer allocation.
Original commit message from CVS:
* ext/ffmpeg/gstffmpegcolorspace.c: (gst_ffmpegcsp_chain):
Implementing gst_pad_alloc_buffer to use optimized buffer allocation.
* gst-libs/gst/xoverlay/xoverlay.c:
(gst_x_overlay_got_desired_size): Updating doc for the xid being 0.
* gst/videoscale/gstvideoscale.c: (gst_videoscale_chain):
Implementing gst_pad_alloc_buffer to use optimized buffer allocation.
* gst/videotestsrc/gstvideotestsrc.c: (gst_videotestsrc_get):
Implementing gst_pad_alloc_buffer to use optimized buffer allocation.
* sys/ximage/ximagesink.c: (gst_ximagesink_chain),
(gst_ximagesink_buffer_free), (gst_ximagesink_buffer_alloc),
(gst_ximagesink_set_xwindow_id), (gst_ximagesink_init): Implementing
the bufferalloc_function to replace bufferpools, fixing the XOverlay
interface implementation to handle xid being 0 and fix some bugs
triggered by Benjamin's testcase.
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_chain),
(gst_xvimagesink_buffer_free), (gst_xvimagesink_buffer_alloc),
(gst_xvimagesink_set_xwindow_id), (gst_xvimagesink_init): Implementing
the bufferalloc_function to replace bufferpools, fixing the XOverlay
interface implementation to handle xid being 0 and fix some bugs
triggered by Benjamin's testcase.
2004-01-09 18:05:57 +00:00
|
|
|
{
|
|
|
|
break;
|
|
|
|
}
|
2003-11-06 21:51:14 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-11-11 11:32:27 +00:00
|
|
|
g_mutex_unlock (ximagesink->pool_lock);
|
|
|
|
|
|
|
|
if (!ximage) /* We found no suitable image in the pool. Creating... */
|
ext/ffmpeg/gstffmpegcolorspace.c: Implementing gst_pad_alloc_buffer to use optimized buffer allocation.
Original commit message from CVS:
* ext/ffmpeg/gstffmpegcolorspace.c: (gst_ffmpegcsp_chain):
Implementing gst_pad_alloc_buffer to use optimized buffer allocation.
* gst-libs/gst/xoverlay/xoverlay.c:
(gst_x_overlay_got_desired_size): Updating doc for the xid being 0.
* gst/videoscale/gstvideoscale.c: (gst_videoscale_chain):
Implementing gst_pad_alloc_buffer to use optimized buffer allocation.
* gst/videotestsrc/gstvideotestsrc.c: (gst_videotestsrc_get):
Implementing gst_pad_alloc_buffer to use optimized buffer allocation.
* sys/ximage/ximagesink.c: (gst_ximagesink_chain),
(gst_ximagesink_buffer_free), (gst_ximagesink_buffer_alloc),
(gst_ximagesink_set_xwindow_id), (gst_ximagesink_init): Implementing
the bufferalloc_function to replace bufferpools, fixing the XOverlay
interface implementation to handle xid being 0 and fix some bugs
triggered by Benjamin's testcase.
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_chain),
(gst_xvimagesink_buffer_free), (gst_xvimagesink_buffer_alloc),
(gst_xvimagesink_set_xwindow_id), (gst_xvimagesink_init): Implementing
the bufferalloc_function to replace bufferpools, fixing the XOverlay
interface implementation to handle xid being 0 and fix some bugs
triggered by Benjamin's testcase.
2004-01-09 18:05:57 +00:00
|
|
|
{
|
|
|
|
ximage = gst_ximagesink_ximage_new (ximagesink,
|
|
|
|
GST_VIDEOSINK_WIDTH (ximagesink),
|
|
|
|
GST_VIDEOSINK_HEIGHT (ximagesink));
|
|
|
|
}
|
2003-11-11 11:32:27 +00:00
|
|
|
|
|
|
|
if (ximage)
|
|
|
|
{
|
|
|
|
buffer = gst_buffer_new ();
|
ext/ffmpeg/gstffmpegcolorspace.c: Implementing gst_pad_alloc_buffer to use optimized buffer allocation.
Original commit message from CVS:
* ext/ffmpeg/gstffmpegcolorspace.c: (gst_ffmpegcsp_chain):
Implementing gst_pad_alloc_buffer to use optimized buffer allocation.
* gst-libs/gst/xoverlay/xoverlay.c:
(gst_x_overlay_got_desired_size): Updating doc for the xid being 0.
* gst/videoscale/gstvideoscale.c: (gst_videoscale_chain):
Implementing gst_pad_alloc_buffer to use optimized buffer allocation.
* gst/videotestsrc/gstvideotestsrc.c: (gst_videotestsrc_get):
Implementing gst_pad_alloc_buffer to use optimized buffer allocation.
* sys/ximage/ximagesink.c: (gst_ximagesink_chain),
(gst_ximagesink_buffer_free), (gst_ximagesink_buffer_alloc),
(gst_ximagesink_set_xwindow_id), (gst_ximagesink_init): Implementing
the bufferalloc_function to replace bufferpools, fixing the XOverlay
interface implementation to handle xid being 0 and fix some bugs
triggered by Benjamin's testcase.
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_chain),
(gst_xvimagesink_buffer_free), (gst_xvimagesink_buffer_alloc),
(gst_xvimagesink_set_xwindow_id), (gst_xvimagesink_init): Implementing
the bufferalloc_function to replace bufferpools, fixing the XOverlay
interface implementation to handle xid being 0 and fix some bugs
triggered by Benjamin's testcase.
2004-01-09 18:05:57 +00:00
|
|
|
|
2004-01-11 22:52:29 +00:00
|
|
|
/* Storing some pointers in the buffer */
|
|
|
|
GST_BUFFER_PRIVATE (buffer) = ximage;
|
ext/ffmpeg/gstffmpegcolorspace.c: Implementing gst_pad_alloc_buffer to use optimized buffer allocation.
Original commit message from CVS:
* ext/ffmpeg/gstffmpegcolorspace.c: (gst_ffmpegcsp_chain):
Implementing gst_pad_alloc_buffer to use optimized buffer allocation.
* gst-libs/gst/xoverlay/xoverlay.c:
(gst_x_overlay_got_desired_size): Updating doc for the xid being 0.
* gst/videoscale/gstvideoscale.c: (gst_videoscale_chain):
Implementing gst_pad_alloc_buffer to use optimized buffer allocation.
* gst/videotestsrc/gstvideotestsrc.c: (gst_videotestsrc_get):
Implementing gst_pad_alloc_buffer to use optimized buffer allocation.
* sys/ximage/ximagesink.c: (gst_ximagesink_chain),
(gst_ximagesink_buffer_free), (gst_ximagesink_buffer_alloc),
(gst_ximagesink_set_xwindow_id), (gst_ximagesink_init): Implementing
the bufferalloc_function to replace bufferpools, fixing the XOverlay
interface implementation to handle xid being 0 and fix some bugs
triggered by Benjamin's testcase.
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_chain),
(gst_xvimagesink_buffer_free), (gst_xvimagesink_buffer_alloc),
(gst_xvimagesink_set_xwindow_id), (gst_xvimagesink_init): Implementing
the bufferalloc_function to replace bufferpools, fixing the XOverlay
interface implementation to handle xid being 0 and fix some bugs
triggered by Benjamin's testcase.
2004-01-09 18:05:57 +00:00
|
|
|
|
2003-11-11 11:32:27 +00:00
|
|
|
GST_BUFFER_DATA (buffer) = ximage->ximage->data;
|
2004-01-12 02:01:52 +00:00
|
|
|
GST_BUFFER_FREE_DATA_FUNC (buffer) = gst_ximagesink_buffer_free;
|
2003-11-11 11:32:27 +00:00
|
|
|
GST_BUFFER_SIZE (buffer) = ximage->size;
|
|
|
|
return buffer;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2003-11-17 16:32:29 +00:00
|
|
|
/* Interfaces stuff */
|
|
|
|
|
|
|
|
static gboolean
|
2003-12-07 12:11:30 +00:00
|
|
|
gst_ximagesink_interface_supported (GstImplementsInterface *iface, GType type)
|
2003-11-17 16:32:29 +00:00
|
|
|
{
|
|
|
|
g_assert (type == GST_TYPE_NAVIGATION || type == GST_TYPE_X_OVERLAY);
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2003-12-07 12:11:30 +00:00
|
|
|
gst_ximagesink_interface_init (GstImplementsInterfaceClass *klass)
|
2003-11-17 16:32:29 +00:00
|
|
|
{
|
|
|
|
klass->supported = gst_ximagesink_interface_supported;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2003-11-19 20:43:49 +00:00
|
|
|
gst_ximagesink_navigation_send_event (GstNavigation *navigation,
|
|
|
|
GstStructure *structure)
|
2003-11-17 16:32:29 +00:00
|
|
|
{
|
|
|
|
GstXImageSink *ximagesink = GST_XIMAGESINK (navigation);
|
|
|
|
GstEvent *event;
|
|
|
|
gint x_offset, y_offset;
|
|
|
|
double x,y;
|
|
|
|
|
|
|
|
event = gst_event_new (GST_EVENT_NAVIGATION);
|
|
|
|
event->event_data.structure.structure = structure;
|
|
|
|
|
|
|
|
/* We are not converting the pointer coordinates as there's no hardware
|
|
|
|
scaling done here. The only possible scaling is done by videoscale and
|
|
|
|
videoscale will have to catch those events and tranform the coordinates
|
|
|
|
to match the applied scaling. So here we just add the offset if the image
|
|
|
|
is centered in the window. */
|
|
|
|
|
2003-11-19 20:43:49 +00:00
|
|
|
x_offset = ximagesink->xwindow->width - GST_VIDEOSINK_WIDTH (ximagesink);
|
|
|
|
y_offset = ximagesink->xwindow->height - GST_VIDEOSINK_HEIGHT (ximagesink);
|
2003-11-17 16:32:29 +00:00
|
|
|
|
|
|
|
if (gst_structure_get_double (structure, "pointer_x", &x))
|
|
|
|
{
|
|
|
|
x += x_offset;
|
|
|
|
gst_structure_set (structure, "pointer_x", G_TYPE_DOUBLE, x, NULL);
|
|
|
|
}
|
|
|
|
if (gst_structure_get_double (structure, "pointer_y", &y))
|
|
|
|
{
|
|
|
|
y += y_offset;
|
|
|
|
gst_structure_set (structure, "pointer_y", G_TYPE_DOUBLE, y, NULL);
|
|
|
|
}
|
|
|
|
|
2003-11-19 20:43:49 +00:00
|
|
|
gst_pad_send_event (gst_pad_get_peer (GST_VIDEOSINK_PAD (ximagesink)), event);
|
2003-11-17 16:32:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gst_ximagesink_navigation_init (GstNavigationInterface *iface)
|
|
|
|
{
|
|
|
|
iface->send_event = gst_ximagesink_navigation_send_event;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gst_ximagesink_set_xwindow_id (GstXOverlay *overlay, XID xwindow_id)
|
|
|
|
{
|
|
|
|
GstXImageSink *ximagesink = GST_XIMAGESINK (overlay);
|
examples/gstplay/player.c: Adding some new lines in g_print calls.
Original commit message from CVS:
* examples/gstplay/player.c: (got_time_tick), (got_stream_length),
(got_video_size): Adding some new lines in g_print calls.
* sys/ximage/ximagesink.c: (gst_ximagesink_xwindow_new),
(gst_ximagesink_xwindow_destroy), (gst_ximagesink_xwindow_resize),
(gst_ximagesink_handle_xevents), (gst_ximagesink_fixate),
(gst_ximagesink_sinkconnect), (gst_ximagesink_change_state),
(gst_ximagesink_chain), (gst_ximagesink_buffer_new),
(gst_ximagesink_set_xwindow_id), (gst_ximagesink_get_desired_size):
Complete code review, reverting some stuff i disagree with, adding
some fixes : time synchronization on invalid timestamps, renegotiation
of private window.
* sys/ximage/ximagesink.h:
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_xwindow_destroy),
(gst_xvimagesink_xwindow_resize), (gst_xvimagesink_handle_xevents),
(gst_xvimagesink_get_xv_support), (gst_xvimagesink_xcontext_get),
(gst_xvimagesink_fixate), (gst_xvimagesink_sinkconnect),
(gst_xvimagesink_change_state), (gst_xvimagesink_chain),
(gst_xvimagesink_buffer_new),
(gst_xvimagesink_navigation_send_event),
(gst_xvimagesink_set_xwindow_id),
(gst_xvimagesink_get_desired_size),
(gst_xvimagesink_xoverlay_init): Complete code review, reverting some
stuff i disagree with, adding some fixes : Renegotiation of private
window, implementing get_desired_size.
2004-01-07 15:33:42 +00:00
|
|
|
GstXWindow *xwindow = NULL;
|
|
|
|
XWindowAttributes attr;
|
2003-11-17 16:32:29 +00:00
|
|
|
|
|
|
|
g_return_if_fail (GST_IS_XIMAGESINK (ximagesink));
|
|
|
|
|
ext/ffmpeg/gstffmpegcolorspace.c: Implementing gst_pad_alloc_buffer to use optimized buffer allocation.
Original commit message from CVS:
* ext/ffmpeg/gstffmpegcolorspace.c: (gst_ffmpegcsp_chain):
Implementing gst_pad_alloc_buffer to use optimized buffer allocation.
* gst-libs/gst/xoverlay/xoverlay.c:
(gst_x_overlay_got_desired_size): Updating doc for the xid being 0.
* gst/videoscale/gstvideoscale.c: (gst_videoscale_chain):
Implementing gst_pad_alloc_buffer to use optimized buffer allocation.
* gst/videotestsrc/gstvideotestsrc.c: (gst_videotestsrc_get):
Implementing gst_pad_alloc_buffer to use optimized buffer allocation.
* sys/ximage/ximagesink.c: (gst_ximagesink_chain),
(gst_ximagesink_buffer_free), (gst_ximagesink_buffer_alloc),
(gst_ximagesink_set_xwindow_id), (gst_ximagesink_init): Implementing
the bufferalloc_function to replace bufferpools, fixing the XOverlay
interface implementation to handle xid being 0 and fix some bugs
triggered by Benjamin's testcase.
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_chain),
(gst_xvimagesink_buffer_free), (gst_xvimagesink_buffer_alloc),
(gst_xvimagesink_set_xwindow_id), (gst_xvimagesink_init): Implementing
the bufferalloc_function to replace bufferpools, fixing the XOverlay
interface implementation to handle xid being 0 and fix some bugs
triggered by Benjamin's testcase.
2004-01-09 18:05:57 +00:00
|
|
|
/* If we already use that window return */
|
|
|
|
if (ximagesink->xwindow && (xwindow_id == ximagesink->xwindow->win))
|
|
|
|
return;
|
|
|
|
|
|
|
|
/* If the element has not initialized the X11 context try to do so */
|
2003-11-17 16:32:29 +00:00
|
|
|
if (!ximagesink->xcontext)
|
examples/gstplay/player.c: Adding some new lines in g_print calls.
Original commit message from CVS:
* examples/gstplay/player.c: (got_time_tick), (got_stream_length),
(got_video_size): Adding some new lines in g_print calls.
* sys/ximage/ximagesink.c: (gst_ximagesink_xwindow_new),
(gst_ximagesink_xwindow_destroy), (gst_ximagesink_xwindow_resize),
(gst_ximagesink_handle_xevents), (gst_ximagesink_fixate),
(gst_ximagesink_sinkconnect), (gst_ximagesink_change_state),
(gst_ximagesink_chain), (gst_ximagesink_buffer_new),
(gst_ximagesink_set_xwindow_id), (gst_ximagesink_get_desired_size):
Complete code review, reverting some stuff i disagree with, adding
some fixes : time synchronization on invalid timestamps, renegotiation
of private window.
* sys/ximage/ximagesink.h:
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_xwindow_destroy),
(gst_xvimagesink_xwindow_resize), (gst_xvimagesink_handle_xevents),
(gst_xvimagesink_get_xv_support), (gst_xvimagesink_xcontext_get),
(gst_xvimagesink_fixate), (gst_xvimagesink_sinkconnect),
(gst_xvimagesink_change_state), (gst_xvimagesink_chain),
(gst_xvimagesink_buffer_new),
(gst_xvimagesink_navigation_send_event),
(gst_xvimagesink_set_xwindow_id),
(gst_xvimagesink_get_desired_size),
(gst_xvimagesink_xoverlay_init): Complete code review, reverting some
stuff i disagree with, adding some fixes : Renegotiation of private
window, implementing get_desired_size.
2004-01-07 15:33:42 +00:00
|
|
|
ximagesink->xcontext = gst_ximagesink_xcontext_get (ximagesink);
|
2003-11-17 16:32:29 +00:00
|
|
|
|
ext/ffmpeg/gstffmpegcolorspace.c: Implementing gst_pad_alloc_buffer to use optimized buffer allocation.
Original commit message from CVS:
* ext/ffmpeg/gstffmpegcolorspace.c: (gst_ffmpegcsp_chain):
Implementing gst_pad_alloc_buffer to use optimized buffer allocation.
* gst-libs/gst/xoverlay/xoverlay.c:
(gst_x_overlay_got_desired_size): Updating doc for the xid being 0.
* gst/videoscale/gstvideoscale.c: (gst_videoscale_chain):
Implementing gst_pad_alloc_buffer to use optimized buffer allocation.
* gst/videotestsrc/gstvideotestsrc.c: (gst_videotestsrc_get):
Implementing gst_pad_alloc_buffer to use optimized buffer allocation.
* sys/ximage/ximagesink.c: (gst_ximagesink_chain),
(gst_ximagesink_buffer_free), (gst_ximagesink_buffer_alloc),
(gst_ximagesink_set_xwindow_id), (gst_ximagesink_init): Implementing
the bufferalloc_function to replace bufferpools, fixing the XOverlay
interface implementation to handle xid being 0 and fix some bugs
triggered by Benjamin's testcase.
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_chain),
(gst_xvimagesink_buffer_free), (gst_xvimagesink_buffer_alloc),
(gst_xvimagesink_set_xwindow_id), (gst_xvimagesink_init): Implementing
the bufferalloc_function to replace bufferpools, fixing the XOverlay
interface implementation to handle xid being 0 and fix some bugs
triggered by Benjamin's testcase.
2004-01-09 18:05:57 +00:00
|
|
|
if (!ximagesink->xcontext)
|
|
|
|
{
|
|
|
|
g_warning ("ximagesink was unable to obtain the X11 context.");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Clear image pool as the images are unusable anyway */
|
|
|
|
gst_ximagesink_imagepool_clear (ximagesink);
|
|
|
|
|
|
|
|
/* Clear the ximage */
|
|
|
|
if (ximagesink->ximage)
|
|
|
|
{
|
2003-11-17 16:32:29 +00:00
|
|
|
gst_ximagesink_ximage_destroy (ximagesink, ximagesink->ximage);
|
ext/ffmpeg/gstffmpegcolorspace.c: Implementing gst_pad_alloc_buffer to use optimized buffer allocation.
Original commit message from CVS:
* ext/ffmpeg/gstffmpegcolorspace.c: (gst_ffmpegcsp_chain):
Implementing gst_pad_alloc_buffer to use optimized buffer allocation.
* gst-libs/gst/xoverlay/xoverlay.c:
(gst_x_overlay_got_desired_size): Updating doc for the xid being 0.
* gst/videoscale/gstvideoscale.c: (gst_videoscale_chain):
Implementing gst_pad_alloc_buffer to use optimized buffer allocation.
* gst/videotestsrc/gstvideotestsrc.c: (gst_videotestsrc_get):
Implementing gst_pad_alloc_buffer to use optimized buffer allocation.
* sys/ximage/ximagesink.c: (gst_ximagesink_chain),
(gst_ximagesink_buffer_free), (gst_ximagesink_buffer_alloc),
(gst_ximagesink_set_xwindow_id), (gst_ximagesink_init): Implementing
the bufferalloc_function to replace bufferpools, fixing the XOverlay
interface implementation to handle xid being 0 and fix some bugs
triggered by Benjamin's testcase.
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_chain),
(gst_xvimagesink_buffer_free), (gst_xvimagesink_buffer_alloc),
(gst_xvimagesink_set_xwindow_id), (gst_xvimagesink_init): Implementing
the bufferalloc_function to replace bufferpools, fixing the XOverlay
interface implementation to handle xid being 0 and fix some bugs
triggered by Benjamin's testcase.
2004-01-09 18:05:57 +00:00
|
|
|
ximagesink->ximage = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* If a window is there already we destroy it */
|
|
|
|
if (ximagesink->xwindow)
|
|
|
|
{
|
2003-11-17 16:32:29 +00:00
|
|
|
gst_ximagesink_xwindow_destroy (ximagesink, ximagesink->xwindow);
|
ext/ffmpeg/gstffmpegcolorspace.c: Implementing gst_pad_alloc_buffer to use optimized buffer allocation.
Original commit message from CVS:
* ext/ffmpeg/gstffmpegcolorspace.c: (gst_ffmpegcsp_chain):
Implementing gst_pad_alloc_buffer to use optimized buffer allocation.
* gst-libs/gst/xoverlay/xoverlay.c:
(gst_x_overlay_got_desired_size): Updating doc for the xid being 0.
* gst/videoscale/gstvideoscale.c: (gst_videoscale_chain):
Implementing gst_pad_alloc_buffer to use optimized buffer allocation.
* gst/videotestsrc/gstvideotestsrc.c: (gst_videotestsrc_get):
Implementing gst_pad_alloc_buffer to use optimized buffer allocation.
* sys/ximage/ximagesink.c: (gst_ximagesink_chain),
(gst_ximagesink_buffer_free), (gst_ximagesink_buffer_alloc),
(gst_ximagesink_set_xwindow_id), (gst_ximagesink_init): Implementing
the bufferalloc_function to replace bufferpools, fixing the XOverlay
interface implementation to handle xid being 0 and fix some bugs
triggered by Benjamin's testcase.
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_chain),
(gst_xvimagesink_buffer_free), (gst_xvimagesink_buffer_alloc),
(gst_xvimagesink_set_xwindow_id), (gst_xvimagesink_init): Implementing
the bufferalloc_function to replace bufferpools, fixing the XOverlay
interface implementation to handle xid being 0 and fix some bugs
triggered by Benjamin's testcase.
2004-01-09 18:05:57 +00:00
|
|
|
ximagesink->xwindow = NULL;
|
2003-11-17 16:32:29 +00:00
|
|
|
}
|
|
|
|
|
ext/ffmpeg/gstffmpegcolorspace.c: Implementing gst_pad_alloc_buffer to use optimized buffer allocation.
Original commit message from CVS:
* ext/ffmpeg/gstffmpegcolorspace.c: (gst_ffmpegcsp_chain):
Implementing gst_pad_alloc_buffer to use optimized buffer allocation.
* gst-libs/gst/xoverlay/xoverlay.c:
(gst_x_overlay_got_desired_size): Updating doc for the xid being 0.
* gst/videoscale/gstvideoscale.c: (gst_videoscale_chain):
Implementing gst_pad_alloc_buffer to use optimized buffer allocation.
* gst/videotestsrc/gstvideotestsrc.c: (gst_videotestsrc_get):
Implementing gst_pad_alloc_buffer to use optimized buffer allocation.
* sys/ximage/ximagesink.c: (gst_ximagesink_chain),
(gst_ximagesink_buffer_free), (gst_ximagesink_buffer_alloc),
(gst_ximagesink_set_xwindow_id), (gst_ximagesink_init): Implementing
the bufferalloc_function to replace bufferpools, fixing the XOverlay
interface implementation to handle xid being 0 and fix some bugs
triggered by Benjamin's testcase.
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_chain),
(gst_xvimagesink_buffer_free), (gst_xvimagesink_buffer_alloc),
(gst_xvimagesink_set_xwindow_id), (gst_xvimagesink_init): Implementing
the bufferalloc_function to replace bufferpools, fixing the XOverlay
interface implementation to handle xid being 0 and fix some bugs
triggered by Benjamin's testcase.
2004-01-09 18:05:57 +00:00
|
|
|
/* If the xid is 0 we go back to an internal window */
|
|
|
|
if (xwindow_id == 0)
|
|
|
|
{
|
|
|
|
/* If no width/height caps nego did not happen window will be created
|
|
|
|
during caps nego then */
|
|
|
|
if (GST_VIDEOSINK_WIDTH (ximagesink) &&
|
|
|
|
GST_VIDEOSINK_HEIGHT (ximagesink))
|
|
|
|
{
|
|
|
|
xwindow = gst_ximagesink_xwindow_new (ximagesink,
|
|
|
|
GST_VIDEOSINK_WIDTH (ximagesink),
|
|
|
|
GST_VIDEOSINK_HEIGHT (ximagesink));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
xwindow = g_new0 (GstXWindow, 1);
|
|
|
|
|
|
|
|
xwindow->win = xwindow_id;
|
examples/gstplay/player.c: Adding some new lines in g_print calls.
Original commit message from CVS:
* examples/gstplay/player.c: (got_time_tick), (got_stream_length),
(got_video_size): Adding some new lines in g_print calls.
* sys/ximage/ximagesink.c: (gst_ximagesink_xwindow_new),
(gst_ximagesink_xwindow_destroy), (gst_ximagesink_xwindow_resize),
(gst_ximagesink_handle_xevents), (gst_ximagesink_fixate),
(gst_ximagesink_sinkconnect), (gst_ximagesink_change_state),
(gst_ximagesink_chain), (gst_ximagesink_buffer_new),
(gst_ximagesink_set_xwindow_id), (gst_ximagesink_get_desired_size):
Complete code review, reverting some stuff i disagree with, adding
some fixes : time synchronization on invalid timestamps, renegotiation
of private window.
* sys/ximage/ximagesink.h:
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_xwindow_destroy),
(gst_xvimagesink_xwindow_resize), (gst_xvimagesink_handle_xevents),
(gst_xvimagesink_get_xv_support), (gst_xvimagesink_xcontext_get),
(gst_xvimagesink_fixate), (gst_xvimagesink_sinkconnect),
(gst_xvimagesink_change_state), (gst_xvimagesink_chain),
(gst_xvimagesink_buffer_new),
(gst_xvimagesink_navigation_send_event),
(gst_xvimagesink_set_xwindow_id),
(gst_xvimagesink_get_desired_size),
(gst_xvimagesink_xoverlay_init): Complete code review, reverting some
stuff i disagree with, adding some fixes : Renegotiation of private
window, implementing get_desired_size.
2004-01-07 15:33:42 +00:00
|
|
|
|
ext/ffmpeg/gstffmpegcolorspace.c: Implementing gst_pad_alloc_buffer to use optimized buffer allocation.
Original commit message from CVS:
* ext/ffmpeg/gstffmpegcolorspace.c: (gst_ffmpegcsp_chain):
Implementing gst_pad_alloc_buffer to use optimized buffer allocation.
* gst-libs/gst/xoverlay/xoverlay.c:
(gst_x_overlay_got_desired_size): Updating doc for the xid being 0.
* gst/videoscale/gstvideoscale.c: (gst_videoscale_chain):
Implementing gst_pad_alloc_buffer to use optimized buffer allocation.
* gst/videotestsrc/gstvideotestsrc.c: (gst_videotestsrc_get):
Implementing gst_pad_alloc_buffer to use optimized buffer allocation.
* sys/ximage/ximagesink.c: (gst_ximagesink_chain),
(gst_ximagesink_buffer_free), (gst_ximagesink_buffer_alloc),
(gst_ximagesink_set_xwindow_id), (gst_ximagesink_init): Implementing
the bufferalloc_function to replace bufferpools, fixing the XOverlay
interface implementation to handle xid being 0 and fix some bugs
triggered by Benjamin's testcase.
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_chain),
(gst_xvimagesink_buffer_free), (gst_xvimagesink_buffer_alloc),
(gst_xvimagesink_set_xwindow_id), (gst_xvimagesink_init): Implementing
the bufferalloc_function to replace bufferpools, fixing the XOverlay
interface implementation to handle xid being 0 and fix some bugs
triggered by Benjamin's testcase.
2004-01-09 18:05:57 +00:00
|
|
|
/* We get window geometry, set the event we want to receive,
|
|
|
|
and create a GC */
|
|
|
|
g_mutex_lock (ximagesink->x_lock);
|
|
|
|
XGetWindowAttributes (ximagesink->xcontext->disp, xwindow->win, &attr);
|
|
|
|
xwindow->width = attr.width;
|
|
|
|
xwindow->height = attr.height;
|
|
|
|
xwindow->internal = FALSE;
|
|
|
|
XSelectInput (ximagesink->xcontext->disp, xwindow->win, ExposureMask |
|
|
|
|
StructureNotifyMask | PointerMotionMask | KeyPressMask |
|
|
|
|
KeyReleaseMask);
|
|
|
|
|
|
|
|
xwindow->gc = XCreateGC (ximagesink->xcontext->disp,
|
|
|
|
xwindow->win, 0, NULL);
|
|
|
|
g_mutex_unlock (ximagesink->x_lock);
|
|
|
|
|
|
|
|
/* If that new window geometry differs from our one we try to
|
|
|
|
renegotiate caps */
|
2004-01-14 17:15:34 +00:00
|
|
|
if (gst_pad_is_negotiated (GST_VIDEOSINK_PAD (ximagesink)) &&
|
|
|
|
(xwindow->width != GST_VIDEOSINK_WIDTH (ximagesink) ||
|
|
|
|
xwindow->height != GST_VIDEOSINK_HEIGHT (ximagesink)))
|
ext/ffmpeg/gstffmpegcolorspace.c: Implementing gst_pad_alloc_buffer to use optimized buffer allocation.
Original commit message from CVS:
* ext/ffmpeg/gstffmpegcolorspace.c: (gst_ffmpegcsp_chain):
Implementing gst_pad_alloc_buffer to use optimized buffer allocation.
* gst-libs/gst/xoverlay/xoverlay.c:
(gst_x_overlay_got_desired_size): Updating doc for the xid being 0.
* gst/videoscale/gstvideoscale.c: (gst_videoscale_chain):
Implementing gst_pad_alloc_buffer to use optimized buffer allocation.
* gst/videotestsrc/gstvideotestsrc.c: (gst_videotestsrc_get):
Implementing gst_pad_alloc_buffer to use optimized buffer allocation.
* sys/ximage/ximagesink.c: (gst_ximagesink_chain),
(gst_ximagesink_buffer_free), (gst_ximagesink_buffer_alloc),
(gst_ximagesink_set_xwindow_id), (gst_ximagesink_init): Implementing
the bufferalloc_function to replace bufferpools, fixing the XOverlay
interface implementation to handle xid being 0 and fix some bugs
triggered by Benjamin's testcase.
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_chain),
(gst_xvimagesink_buffer_free), (gst_xvimagesink_buffer_alloc),
(gst_xvimagesink_set_xwindow_id), (gst_xvimagesink_init): Implementing
the bufferalloc_function to replace bufferpools, fixing the XOverlay
interface implementation to handle xid being 0 and fix some bugs
triggered by Benjamin's testcase.
2004-01-09 18:05:57 +00:00
|
|
|
{
|
|
|
|
GstPadLinkReturn r;
|
|
|
|
r = gst_pad_try_set_caps (GST_VIDEOSINK_PAD (ximagesink),
|
|
|
|
gst_caps_new_simple ("video/x-raw-rgb",
|
|
|
|
"bpp", G_TYPE_INT, ximagesink->xcontext->bpp,
|
|
|
|
"depth", G_TYPE_INT, ximagesink->xcontext->depth,
|
|
|
|
"endianness", G_TYPE_INT, ximagesink->xcontext->endianness,
|
|
|
|
"red_mask", G_TYPE_INT, ximagesink->xcontext->visual->red_mask,
|
|
|
|
"green_mask", G_TYPE_INT, ximagesink->xcontext->visual->green_mask,
|
|
|
|
"blue_mask", G_TYPE_INT, ximagesink->xcontext->visual->blue_mask,
|
sys/ximage/ximagesink.c: Change to using a framerate of [1,100] instead of [0,MAX], since 0 isn't handled correctly, ...
Original commit message from CVS:
* sys/ximage/ximagesink.c: (gst_ximagesink_handle_xevents),
(gst_ximagesink_xcontext_get), (gst_ximagesink_getcaps),
(gst_ximagesink_set_xwindow_id): Change to using a framerate
of [1,100] instead of [0,MAX], since 0 isn't handled correctly,
and neither is 100+, most likely.
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_get_xv_support),
(gst_xvimagesink_getcaps): same
2004-01-20 09:25:51 +00:00
|
|
|
"width", G_TYPE_INT, xwindow->width,
|
|
|
|
"height", G_TYPE_INT, xwindow->height,
|
ext/ffmpeg/gstffmpegcolorspace.c: Implementing gst_pad_alloc_buffer to use optimized buffer allocation.
Original commit message from CVS:
* ext/ffmpeg/gstffmpegcolorspace.c: (gst_ffmpegcsp_chain):
Implementing gst_pad_alloc_buffer to use optimized buffer allocation.
* gst-libs/gst/xoverlay/xoverlay.c:
(gst_x_overlay_got_desired_size): Updating doc for the xid being 0.
* gst/videoscale/gstvideoscale.c: (gst_videoscale_chain):
Implementing gst_pad_alloc_buffer to use optimized buffer allocation.
* gst/videotestsrc/gstvideotestsrc.c: (gst_videotestsrc_get):
Implementing gst_pad_alloc_buffer to use optimized buffer allocation.
* sys/ximage/ximagesink.c: (gst_ximagesink_chain),
(gst_ximagesink_buffer_free), (gst_ximagesink_buffer_alloc),
(gst_ximagesink_set_xwindow_id), (gst_ximagesink_init): Implementing
the bufferalloc_function to replace bufferpools, fixing the XOverlay
interface implementation to handle xid being 0 and fix some bugs
triggered by Benjamin's testcase.
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_chain),
(gst_xvimagesink_buffer_free), (gst_xvimagesink_buffer_alloc),
(gst_xvimagesink_set_xwindow_id), (gst_xvimagesink_init): Implementing
the bufferalloc_function to replace bufferpools, fixing the XOverlay
interface implementation to handle xid being 0 and fix some bugs
triggered by Benjamin's testcase.
2004-01-09 18:05:57 +00:00
|
|
|
"framerate", G_TYPE_DOUBLE, ximagesink->framerate,
|
|
|
|
NULL));
|
|
|
|
|
|
|
|
/* If caps nego succeded updating our size */
|
|
|
|
if ( (r == GST_PAD_LINK_OK) || (r == GST_PAD_LINK_DONE) )
|
|
|
|
{
|
sys/ximage/ximagesink.c: Change to using a framerate of [1,100] instead of [0,MAX], since 0 isn't handled correctly, ...
Original commit message from CVS:
* sys/ximage/ximagesink.c: (gst_ximagesink_handle_xevents),
(gst_ximagesink_xcontext_get), (gst_ximagesink_getcaps),
(gst_ximagesink_set_xwindow_id): Change to using a framerate
of [1,100] instead of [0,MAX], since 0 isn't handled correctly,
and neither is 100+, most likely.
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_get_xv_support),
(gst_xvimagesink_getcaps): same
2004-01-20 09:25:51 +00:00
|
|
|
GST_VIDEOSINK_WIDTH (ximagesink) = xwindow->width;
|
|
|
|
GST_VIDEOSINK_HEIGHT (ximagesink) = xwindow->height;
|
ext/ffmpeg/gstffmpegcolorspace.c: Implementing gst_pad_alloc_buffer to use optimized buffer allocation.
Original commit message from CVS:
* ext/ffmpeg/gstffmpegcolorspace.c: (gst_ffmpegcsp_chain):
Implementing gst_pad_alloc_buffer to use optimized buffer allocation.
* gst-libs/gst/xoverlay/xoverlay.c:
(gst_x_overlay_got_desired_size): Updating doc for the xid being 0.
* gst/videoscale/gstvideoscale.c: (gst_videoscale_chain):
Implementing gst_pad_alloc_buffer to use optimized buffer allocation.
* gst/videotestsrc/gstvideotestsrc.c: (gst_videotestsrc_get):
Implementing gst_pad_alloc_buffer to use optimized buffer allocation.
* sys/ximage/ximagesink.c: (gst_ximagesink_chain),
(gst_ximagesink_buffer_free), (gst_ximagesink_buffer_alloc),
(gst_ximagesink_set_xwindow_id), (gst_ximagesink_init): Implementing
the bufferalloc_function to replace bufferpools, fixing the XOverlay
interface implementation to handle xid being 0 and fix some bugs
triggered by Benjamin's testcase.
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_chain),
(gst_xvimagesink_buffer_free), (gst_xvimagesink_buffer_alloc),
(gst_xvimagesink_set_xwindow_id), (gst_xvimagesink_init): Implementing
the bufferalloc_function to replace bufferpools, fixing the XOverlay
interface implementation to handle xid being 0 and fix some bugs
triggered by Benjamin's testcase.
2004-01-09 18:05:57 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2003-11-17 16:32:29 +00:00
|
|
|
|
ext/ffmpeg/gstffmpegcolorspace.c: Implementing gst_pad_alloc_buffer to use optimized buffer allocation.
Original commit message from CVS:
* ext/ffmpeg/gstffmpegcolorspace.c: (gst_ffmpegcsp_chain):
Implementing gst_pad_alloc_buffer to use optimized buffer allocation.
* gst-libs/gst/xoverlay/xoverlay.c:
(gst_x_overlay_got_desired_size): Updating doc for the xid being 0.
* gst/videoscale/gstvideoscale.c: (gst_videoscale_chain):
Implementing gst_pad_alloc_buffer to use optimized buffer allocation.
* gst/videotestsrc/gstvideotestsrc.c: (gst_videotestsrc_get):
Implementing gst_pad_alloc_buffer to use optimized buffer allocation.
* sys/ximage/ximagesink.c: (gst_ximagesink_chain),
(gst_ximagesink_buffer_free), (gst_ximagesink_buffer_alloc),
(gst_ximagesink_set_xwindow_id), (gst_ximagesink_init): Implementing
the bufferalloc_function to replace bufferpools, fixing the XOverlay
interface implementation to handle xid being 0 and fix some bugs
triggered by Benjamin's testcase.
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_chain),
(gst_xvimagesink_buffer_free), (gst_xvimagesink_buffer_alloc),
(gst_xvimagesink_set_xwindow_id), (gst_xvimagesink_init): Implementing
the bufferalloc_function to replace bufferpools, fixing the XOverlay
interface implementation to handle xid being 0 and fix some bugs
triggered by Benjamin's testcase.
2004-01-09 18:05:57 +00:00
|
|
|
/* Recreating our ximage */
|
|
|
|
if (!ximagesink->ximage &&
|
|
|
|
GST_VIDEOSINK_WIDTH (ximagesink) &&
|
|
|
|
GST_VIDEOSINK_HEIGHT (ximagesink))
|
|
|
|
{
|
|
|
|
ximagesink->ximage = gst_ximagesink_ximage_new (
|
|
|
|
ximagesink,
|
|
|
|
GST_VIDEOSINK_WIDTH (ximagesink),
|
|
|
|
GST_VIDEOSINK_HEIGHT (ximagesink));
|
|
|
|
}
|
examples/gstplay/player.c: Adding some new lines in g_print calls.
Original commit message from CVS:
* examples/gstplay/player.c: (got_time_tick), (got_stream_length),
(got_video_size): Adding some new lines in g_print calls.
* sys/ximage/ximagesink.c: (gst_ximagesink_xwindow_new),
(gst_ximagesink_xwindow_destroy), (gst_ximagesink_xwindow_resize),
(gst_ximagesink_handle_xevents), (gst_ximagesink_fixate),
(gst_ximagesink_sinkconnect), (gst_ximagesink_change_state),
(gst_ximagesink_chain), (gst_ximagesink_buffer_new),
(gst_ximagesink_set_xwindow_id), (gst_ximagesink_get_desired_size):
Complete code review, reverting some stuff i disagree with, adding
some fixes : time synchronization on invalid timestamps, renegotiation
of private window.
* sys/ximage/ximagesink.h:
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_xwindow_destroy),
(gst_xvimagesink_xwindow_resize), (gst_xvimagesink_handle_xevents),
(gst_xvimagesink_get_xv_support), (gst_xvimagesink_xcontext_get),
(gst_xvimagesink_fixate), (gst_xvimagesink_sinkconnect),
(gst_xvimagesink_change_state), (gst_xvimagesink_chain),
(gst_xvimagesink_buffer_new),
(gst_xvimagesink_navigation_send_event),
(gst_xvimagesink_set_xwindow_id),
(gst_xvimagesink_get_desired_size),
(gst_xvimagesink_xoverlay_init): Complete code review, reverting some
stuff i disagree with, adding some fixes : Renegotiation of private
window, implementing get_desired_size.
2004-01-07 15:33:42 +00:00
|
|
|
|
ext/ffmpeg/gstffmpegcolorspace.c: Implementing gst_pad_alloc_buffer to use optimized buffer allocation.
Original commit message from CVS:
* ext/ffmpeg/gstffmpegcolorspace.c: (gst_ffmpegcsp_chain):
Implementing gst_pad_alloc_buffer to use optimized buffer allocation.
* gst-libs/gst/xoverlay/xoverlay.c:
(gst_x_overlay_got_desired_size): Updating doc for the xid being 0.
* gst/videoscale/gstvideoscale.c: (gst_videoscale_chain):
Implementing gst_pad_alloc_buffer to use optimized buffer allocation.
* gst/videotestsrc/gstvideotestsrc.c: (gst_videotestsrc_get):
Implementing gst_pad_alloc_buffer to use optimized buffer allocation.
* sys/ximage/ximagesink.c: (gst_ximagesink_chain),
(gst_ximagesink_buffer_free), (gst_ximagesink_buffer_alloc),
(gst_ximagesink_set_xwindow_id), (gst_ximagesink_init): Implementing
the bufferalloc_function to replace bufferpools, fixing the XOverlay
interface implementation to handle xid being 0 and fix some bugs
triggered by Benjamin's testcase.
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_chain),
(gst_xvimagesink_buffer_free), (gst_xvimagesink_buffer_alloc),
(gst_xvimagesink_set_xwindow_id), (gst_xvimagesink_init): Implementing
the bufferalloc_function to replace bufferpools, fixing the XOverlay
interface implementation to handle xid being 0 and fix some bugs
triggered by Benjamin's testcase.
2004-01-09 18:05:57 +00:00
|
|
|
if (xwindow)
|
|
|
|
ximagesink->xwindow = xwindow;
|
2004-01-04 18:53:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
examples/gstplay/player.c: Adding some new lines in g_print calls.
Original commit message from CVS:
* examples/gstplay/player.c: (got_time_tick), (got_stream_length),
(got_video_size): Adding some new lines in g_print calls.
* sys/ximage/ximagesink.c: (gst_ximagesink_xwindow_new),
(gst_ximagesink_xwindow_destroy), (gst_ximagesink_xwindow_resize),
(gst_ximagesink_handle_xevents), (gst_ximagesink_fixate),
(gst_ximagesink_sinkconnect), (gst_ximagesink_change_state),
(gst_ximagesink_chain), (gst_ximagesink_buffer_new),
(gst_ximagesink_set_xwindow_id), (gst_ximagesink_get_desired_size):
Complete code review, reverting some stuff i disagree with, adding
some fixes : time synchronization on invalid timestamps, renegotiation
of private window.
* sys/ximage/ximagesink.h:
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_xwindow_destroy),
(gst_xvimagesink_xwindow_resize), (gst_xvimagesink_handle_xevents),
(gst_xvimagesink_get_xv_support), (gst_xvimagesink_xcontext_get),
(gst_xvimagesink_fixate), (gst_xvimagesink_sinkconnect),
(gst_xvimagesink_change_state), (gst_xvimagesink_chain),
(gst_xvimagesink_buffer_new),
(gst_xvimagesink_navigation_send_event),
(gst_xvimagesink_set_xwindow_id),
(gst_xvimagesink_get_desired_size),
(gst_xvimagesink_xoverlay_init): Complete code review, reverting some
stuff i disagree with, adding some fixes : Renegotiation of private
window, implementing get_desired_size.
2004-01-07 15:33:42 +00:00
|
|
|
gst_ximagesink_get_desired_size (GstXOverlay *overlay,
|
|
|
|
guint *width, guint *height)
|
2004-01-04 18:53:53 +00:00
|
|
|
{
|
|
|
|
GstXImageSink *ximagesink = GST_XIMAGESINK (overlay);
|
|
|
|
|
|
|
|
*width = GST_VIDEOSINK_WIDTH (ximagesink);
|
|
|
|
*height = GST_VIDEOSINK_HEIGHT (ximagesink);
|
2003-11-17 16:32:29 +00:00
|
|
|
}
|
|
|
|
|
2004-02-03 23:05:46 +00:00
|
|
|
static void
|
|
|
|
gst_ximagesink_expose (GstXOverlay *overlay)
|
|
|
|
{
|
|
|
|
GstXImageSink *ximagesink = GST_XIMAGESINK (overlay);
|
|
|
|
|
2004-02-16 23:45:55 +00:00
|
|
|
if (!ximagesink->xwindow)
|
|
|
|
return;
|
|
|
|
|
2004-02-18 21:16:50 +00:00
|
|
|
gst_ximagesink_xwindow_update_geometry (ximagesink, ximagesink->xwindow);
|
|
|
|
|
2004-02-18 13:06:49 +00:00
|
|
|
/* We don't act on internal window from outside that could cause some thread
|
|
|
|
race with the video sink own thread checking for configure event */
|
|
|
|
if (ximagesink->xwindow->internal)
|
|
|
|
return;
|
|
|
|
|
2004-02-16 23:45:55 +00:00
|
|
|
gst_ximagesink_xwindow_clear (ximagesink, ximagesink->xwindow);
|
|
|
|
|
2004-02-18 13:06:49 +00:00
|
|
|
if (ximagesink->cur_image)
|
2004-02-03 23:05:46 +00:00
|
|
|
gst_ximagesink_ximage_put (ximagesink, ximagesink->cur_image);
|
|
|
|
}
|
|
|
|
|
2003-11-17 16:32:29 +00:00
|
|
|
static void
|
|
|
|
gst_ximagesink_xoverlay_init (GstXOverlayClass *iface)
|
|
|
|
{
|
|
|
|
iface->set_xwindow_id = gst_ximagesink_set_xwindow_id;
|
2004-01-04 18:53:53 +00:00
|
|
|
iface->get_desired_size = gst_ximagesink_get_desired_size;
|
2004-02-03 23:05:46 +00:00
|
|
|
iface->expose = gst_ximagesink_expose;
|
2003-11-17 16:32:29 +00:00
|
|
|
}
|
|
|
|
|
2003-11-11 11:32:27 +00:00
|
|
|
/* =========================================== */
|
|
|
|
/* */
|
|
|
|
/* Init & Class init */
|
|
|
|
/* */
|
|
|
|
/* =========================================== */
|
|
|
|
|
gst/videofilter/gstvideobalance.c: Fixing videobalance ranges for colorbalance interface implementation.
Original commit message from CVS:
2004-01-14 Julien MOUTTE <julien@moutte.net>
* gst/videofilter/gstvideobalance.c: (gst_videobalance_init),
(gst_videobalance_colorbalance_set_value),
(gst_videobalance_colorbalance_get_value): Fixing videobalance ranges
for colorbalance interface implementation.
* sys/ximage/ximagesink.c: (gst_ximagesink_xcontext_get),
(gst_ximagesink_set_property), (gst_ximagesink_get_property),
(gst_ximagesink_dispose), (gst_ximagesink_init),
(gst_ximagesink_class_init): Adding DISPLAY property.
* sys/ximage/ximagesink.h: Adding display_name to store display.
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_xcontext_get),
(gst_xvimagesink_set_property), (gst_xvimagesink_get_property),
(gst_xvimagesink_dispose), (gst_xvimagesink_init),
(gst_xvimagesink_class_init): Adding DISPLAY property and colorbalance
properties (they still need polishing though for gst-launch use : no
xcontext yet, i ll do that tomorrow).
* sys/xvimage/xvimagesink.h: Adding display_name to store display.
2004-01-14 23:01:49 +00:00
|
|
|
static void
|
|
|
|
gst_ximagesink_set_property (GObject *object, guint prop_id,
|
|
|
|
const GValue *value, GParamSpec *pspec)
|
|
|
|
{
|
|
|
|
GstXImageSink *ximagesink;
|
|
|
|
|
|
|
|
g_return_if_fail (GST_IS_XIMAGESINK (object));
|
|
|
|
|
|
|
|
ximagesink = GST_XIMAGESINK (object);
|
|
|
|
|
|
|
|
switch (prop_id)
|
|
|
|
{
|
|
|
|
case ARG_DISPLAY:
|
|
|
|
ximagesink->display_name = g_strdup (g_value_get_string (value));
|
|
|
|
break;
|
2004-01-18 12:32:19 +00:00
|
|
|
case ARG_SYNCHRONOUS:
|
|
|
|
ximagesink->synchronous = g_value_get_boolean (value);
|
|
|
|
if (ximagesink->xcontext) {
|
|
|
|
XSynchronize (ximagesink->xcontext->disp,
|
|
|
|
ximagesink->synchronous);
|
|
|
|
}
|
|
|
|
break;
|
gst/videofilter/gstvideobalance.c: Fixing videobalance ranges for colorbalance interface implementation.
Original commit message from CVS:
2004-01-14 Julien MOUTTE <julien@moutte.net>
* gst/videofilter/gstvideobalance.c: (gst_videobalance_init),
(gst_videobalance_colorbalance_set_value),
(gst_videobalance_colorbalance_get_value): Fixing videobalance ranges
for colorbalance interface implementation.
* sys/ximage/ximagesink.c: (gst_ximagesink_xcontext_get),
(gst_ximagesink_set_property), (gst_ximagesink_get_property),
(gst_ximagesink_dispose), (gst_ximagesink_init),
(gst_ximagesink_class_init): Adding DISPLAY property.
* sys/ximage/ximagesink.h: Adding display_name to store display.
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_xcontext_get),
(gst_xvimagesink_set_property), (gst_xvimagesink_get_property),
(gst_xvimagesink_dispose), (gst_xvimagesink_init),
(gst_xvimagesink_class_init): Adding DISPLAY property and colorbalance
properties (they still need polishing though for gst-launch use : no
xcontext yet, i ll do that tomorrow).
* sys/xvimage/xvimagesink.h: Adding display_name to store display.
2004-01-14 23:01:49 +00:00
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gst_ximagesink_get_property (GObject *object, guint prop_id,
|
|
|
|
GValue *value, GParamSpec *pspec)
|
|
|
|
{
|
|
|
|
GstXImageSink *ximagesink;
|
|
|
|
|
|
|
|
g_return_if_fail (GST_IS_XIMAGESINK (object));
|
|
|
|
|
|
|
|
ximagesink = GST_XIMAGESINK (object);
|
|
|
|
|
|
|
|
switch (prop_id)
|
|
|
|
{
|
|
|
|
case ARG_DISPLAY:
|
|
|
|
g_value_set_string (value, g_strdup (ximagesink->display_name));
|
|
|
|
break;
|
2004-01-18 12:32:19 +00:00
|
|
|
case ARG_SYNCHRONOUS:
|
|
|
|
g_value_set_boolean (value, ximagesink->synchronous);
|
|
|
|
break;
|
gst/videofilter/gstvideobalance.c: Fixing videobalance ranges for colorbalance interface implementation.
Original commit message from CVS:
2004-01-14 Julien MOUTTE <julien@moutte.net>
* gst/videofilter/gstvideobalance.c: (gst_videobalance_init),
(gst_videobalance_colorbalance_set_value),
(gst_videobalance_colorbalance_get_value): Fixing videobalance ranges
for colorbalance interface implementation.
* sys/ximage/ximagesink.c: (gst_ximagesink_xcontext_get),
(gst_ximagesink_set_property), (gst_ximagesink_get_property),
(gst_ximagesink_dispose), (gst_ximagesink_init),
(gst_ximagesink_class_init): Adding DISPLAY property.
* sys/ximage/ximagesink.h: Adding display_name to store display.
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_xcontext_get),
(gst_xvimagesink_set_property), (gst_xvimagesink_get_property),
(gst_xvimagesink_dispose), (gst_xvimagesink_init),
(gst_xvimagesink_class_init): Adding DISPLAY property and colorbalance
properties (they still need polishing though for gst-launch use : no
xcontext yet, i ll do that tomorrow).
* sys/xvimage/xvimagesink.h: Adding display_name to store display.
2004-01-14 23:01:49 +00:00
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-11-11 11:32:27 +00:00
|
|
|
static void
|
|
|
|
gst_ximagesink_dispose (GObject *object)
|
|
|
|
{
|
|
|
|
GstXImageSink *ximagesink;
|
|
|
|
|
|
|
|
ximagesink = GST_XIMAGESINK (object);
|
|
|
|
|
gst/videofilter/gstvideobalance.c: Fixing videobalance ranges for colorbalance interface implementation.
Original commit message from CVS:
2004-01-14 Julien MOUTTE <julien@moutte.net>
* gst/videofilter/gstvideobalance.c: (gst_videobalance_init),
(gst_videobalance_colorbalance_set_value),
(gst_videobalance_colorbalance_get_value): Fixing videobalance ranges
for colorbalance interface implementation.
* sys/ximage/ximagesink.c: (gst_ximagesink_xcontext_get),
(gst_ximagesink_set_property), (gst_ximagesink_get_property),
(gst_ximagesink_dispose), (gst_ximagesink_init),
(gst_ximagesink_class_init): Adding DISPLAY property.
* sys/ximage/ximagesink.h: Adding display_name to store display.
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_xcontext_get),
(gst_xvimagesink_set_property), (gst_xvimagesink_get_property),
(gst_xvimagesink_dispose), (gst_xvimagesink_init),
(gst_xvimagesink_class_init): Adding DISPLAY property and colorbalance
properties (they still need polishing though for gst-launch use : no
xcontext yet, i ll do that tomorrow).
* sys/xvimage/xvimagesink.h: Adding display_name to store display.
2004-01-14 23:01:49 +00:00
|
|
|
if (ximagesink->display_name)
|
|
|
|
{
|
|
|
|
g_free (ximagesink->display_name);
|
|
|
|
ximagesink->display_name = NULL;
|
|
|
|
}
|
gst-libs/gst/play/gstplay.c: Reworked the pipeline from scratch. Visualization is back and switch went out as i reali...
Original commit message from CVS:
2004-01-23 Julien MOUTTE <julien@moutte.net>
* gst-libs/gst/play/gstplay.c: (gst_play_pipeline_setup),
(gst_play_set_location), (gst_play_seek_to_time),
(gst_play_set_audio_sink), (gst_play_set_visualization),
(gst_play_connect_visualization), (gst_play_get_sink_element): Reworked
the pipeline from scratch. Visualization is back and switch went out as
i realized it was not possible to use the way i wanted.
* sys/ximage/ximagesink.c: (gst_ximagesink_imagepool_clear),
(gst_ximagesink_change_state), (gst_ximagesink_dispose): Move xcontext
clearing in state change from READY to NULL. So that one can clean the
X ressources keeping the element.
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_xcontext_get),
(gst_xvimagesink_imagepool_clear), (gst_xvimagesink_change_state),
(gst_xvimagesink_colorbalance_set_value),
(gst_xvimagesink_colorbalance_get_value),
(gst_xvimagesink_set_property), (gst_xvimagesink_dispose),
(gst_xvimagesink_init): Same xcontext cleaning than ximagesink in state
change from READY to NULL and fixed some stupid bugs in colorbalance
get/set values. Also added the following feature : when nobody tries to
set some values to the colorbalance levels before the xcontext is
grabbed, then when creating channels list from Xv attributes we set the
internal values to the Xv defaults. This way we handle buggy Xv drivers
that set default hue values far from the middle of the range (Thanks
to Jon Trowbridge for pointing that issue).
* sys/xvimage/xvimagesink.h: Adding a cb_changed boolean to know if
colorbalance levels have been set before xcontext is grabbed.
2004-01-22 23:54:34 +00:00
|
|
|
|
2003-11-11 11:32:27 +00:00
|
|
|
g_mutex_free (ximagesink->x_lock);
|
|
|
|
g_mutex_free (ximagesink->pool_lock);
|
|
|
|
|
|
|
|
G_OBJECT_CLASS (parent_class)->dispose (object);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gst_ximagesink_init (GstXImageSink *ximagesink)
|
|
|
|
{
|
2003-11-19 20:43:49 +00:00
|
|
|
GST_VIDEOSINK_PAD (ximagesink) = gst_pad_new_from_template (
|
2003-12-22 01:47:09 +00:00
|
|
|
gst_static_pad_template_get (&gst_ximagesink_sink_template_factory),
|
|
|
|
"sink");
|
2003-11-19 20:43:49 +00:00
|
|
|
|
|
|
|
gst_element_add_pad (GST_ELEMENT (ximagesink),
|
|
|
|
GST_VIDEOSINK_PAD (ximagesink));
|
|
|
|
|
|
|
|
gst_pad_set_chain_function (GST_VIDEOSINK_PAD (ximagesink),
|
|
|
|
gst_ximagesink_chain);
|
|
|
|
gst_pad_set_link_function (GST_VIDEOSINK_PAD (ximagesink),
|
2004-02-01 22:33:07 +00:00
|
|
|
gst_ximagesink_sink_link);
|
2003-11-19 20:43:49 +00:00
|
|
|
gst_pad_set_getcaps_function (GST_VIDEOSINK_PAD (ximagesink),
|
|
|
|
gst_ximagesink_getcaps);
|
2003-12-31 08:02:04 +00:00
|
|
|
gst_pad_set_fixate_function (GST_VIDEOSINK_PAD (ximagesink),
|
|
|
|
gst_ximagesink_fixate);
|
ext/ffmpeg/gstffmpegcolorspace.c: Implementing gst_pad_alloc_buffer to use optimized buffer allocation.
Original commit message from CVS:
* ext/ffmpeg/gstffmpegcolorspace.c: (gst_ffmpegcsp_chain):
Implementing gst_pad_alloc_buffer to use optimized buffer allocation.
* gst-libs/gst/xoverlay/xoverlay.c:
(gst_x_overlay_got_desired_size): Updating doc for the xid being 0.
* gst/videoscale/gstvideoscale.c: (gst_videoscale_chain):
Implementing gst_pad_alloc_buffer to use optimized buffer allocation.
* gst/videotestsrc/gstvideotestsrc.c: (gst_videotestsrc_get):
Implementing gst_pad_alloc_buffer to use optimized buffer allocation.
* sys/ximage/ximagesink.c: (gst_ximagesink_chain),
(gst_ximagesink_buffer_free), (gst_ximagesink_buffer_alloc),
(gst_ximagesink_set_xwindow_id), (gst_ximagesink_init): Implementing
the bufferalloc_function to replace bufferpools, fixing the XOverlay
interface implementation to handle xid being 0 and fix some bugs
triggered by Benjamin's testcase.
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_chain),
(gst_xvimagesink_buffer_free), (gst_xvimagesink_buffer_alloc),
(gst_xvimagesink_set_xwindow_id), (gst_xvimagesink_init): Implementing
the bufferalloc_function to replace bufferpools, fixing the XOverlay
interface implementation to handle xid being 0 and fix some bugs
triggered by Benjamin's testcase.
2004-01-09 18:05:57 +00:00
|
|
|
gst_pad_set_bufferalloc_function (GST_VIDEOSINK_PAD (ximagesink),
|
|
|
|
gst_ximagesink_buffer_alloc);
|
|
|
|
|
gst/videofilter/gstvideobalance.c: Fixing videobalance ranges for colorbalance interface implementation.
Original commit message from CVS:
2004-01-14 Julien MOUTTE <julien@moutte.net>
* gst/videofilter/gstvideobalance.c: (gst_videobalance_init),
(gst_videobalance_colorbalance_set_value),
(gst_videobalance_colorbalance_get_value): Fixing videobalance ranges
for colorbalance interface implementation.
* sys/ximage/ximagesink.c: (gst_ximagesink_xcontext_get),
(gst_ximagesink_set_property), (gst_ximagesink_get_property),
(gst_ximagesink_dispose), (gst_ximagesink_init),
(gst_ximagesink_class_init): Adding DISPLAY property.
* sys/ximage/ximagesink.h: Adding display_name to store display.
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_xcontext_get),
(gst_xvimagesink_set_property), (gst_xvimagesink_get_property),
(gst_xvimagesink_dispose), (gst_xvimagesink_init),
(gst_xvimagesink_class_init): Adding DISPLAY property and colorbalance
properties (they still need polishing though for gst-launch use : no
xcontext yet, i ll do that tomorrow).
* sys/xvimage/xvimagesink.h: Adding display_name to store display.
2004-01-14 23:01:49 +00:00
|
|
|
ximagesink->display_name = NULL;
|
2003-11-11 11:32:27 +00:00
|
|
|
ximagesink->xcontext = NULL;
|
|
|
|
ximagesink->xwindow = NULL;
|
|
|
|
ximagesink->ximage = NULL;
|
2004-02-03 23:05:46 +00:00
|
|
|
ximagesink->cur_image = NULL;
|
2003-11-11 11:32:27 +00:00
|
|
|
|
2003-11-12 13:06:21 +00:00
|
|
|
ximagesink->framerate = 0;
|
|
|
|
|
2003-11-11 11:32:27 +00:00
|
|
|
ximagesink->x_lock = g_mutex_new ();
|
|
|
|
|
|
|
|
ximagesink->pixel_width = ximagesink->pixel_height = 1;
|
|
|
|
|
|
|
|
ximagesink->image_pool = NULL;
|
|
|
|
ximagesink->pool_lock = g_mutex_new ();
|
2004-02-18 21:16:50 +00:00
|
|
|
|
|
|
|
ximagesink->sw_scaling_failed = FALSE;
|
|
|
|
ximagesink->synchronous = FALSE;
|
2003-11-11 11:32:27 +00:00
|
|
|
|
|
|
|
GST_FLAG_SET(ximagesink, GST_ELEMENT_THREAD_SUGGESTED);
|
2003-11-06 21:51:14 +00:00
|
|
|
GST_FLAG_SET(ximagesink, GST_ELEMENT_EVENT_AWARE);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gst_ximagesink_base_init (gpointer g_class)
|
|
|
|
{
|
|
|
|
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
|
|
|
|
|
|
|
|
gst_element_class_set_details (element_class, &gst_ximagesink_details);
|
|
|
|
|
|
|
|
gst_element_class_add_pad_template (element_class,
|
2003-12-22 01:47:09 +00:00
|
|
|
gst_static_pad_template_get (&gst_ximagesink_sink_template_factory));
|
2003-11-06 21:51:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gst_ximagesink_class_init (GstXImageSinkClass *klass)
|
|
|
|
{
|
|
|
|
GObjectClass *gobject_class;
|
|
|
|
GstElementClass *gstelement_class;
|
|
|
|
|
|
|
|
gobject_class = (GObjectClass *) klass;
|
|
|
|
gstelement_class = (GstElementClass *) klass;
|
|
|
|
|
2003-11-19 20:43:49 +00:00
|
|
|
parent_class = g_type_class_ref (GST_TYPE_VIDEOSINK);
|
2004-01-28 00:29:42 +00:00
|
|
|
|
gst/videofilter/gstvideobalance.c: Fixing videobalance ranges for colorbalance interface implementation.
Original commit message from CVS:
2004-01-14 Julien MOUTTE <julien@moutte.net>
* gst/videofilter/gstvideobalance.c: (gst_videobalance_init),
(gst_videobalance_colorbalance_set_value),
(gst_videobalance_colorbalance_get_value): Fixing videobalance ranges
for colorbalance interface implementation.
* sys/ximage/ximagesink.c: (gst_ximagesink_xcontext_get),
(gst_ximagesink_set_property), (gst_ximagesink_get_property),
(gst_ximagesink_dispose), (gst_ximagesink_init),
(gst_ximagesink_class_init): Adding DISPLAY property.
* sys/ximage/ximagesink.h: Adding display_name to store display.
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_xcontext_get),
(gst_xvimagesink_set_property), (gst_xvimagesink_get_property),
(gst_xvimagesink_dispose), (gst_xvimagesink_init),
(gst_xvimagesink_class_init): Adding DISPLAY property and colorbalance
properties (they still need polishing though for gst-launch use : no
xcontext yet, i ll do that tomorrow).
* sys/xvimage/xvimagesink.h: Adding display_name to store display.
2004-01-14 23:01:49 +00:00
|
|
|
g_object_class_install_property (gobject_class, ARG_DISPLAY,
|
|
|
|
g_param_spec_string ("display", "Display", "X Display name",
|
|
|
|
NULL, G_PARAM_READWRITE));
|
2004-01-18 12:32:19 +00:00
|
|
|
g_object_class_install_property (gobject_class, ARG_SYNCHRONOUS,
|
|
|
|
g_param_spec_boolean ("synchronous", "Synchronous", "When enabled, runs "
|
|
|
|
"the X display in synchronous mode. (used only for debugging)", FALSE,
|
|
|
|
G_PARAM_READWRITE));
|
gst/videofilter/gstvideobalance.c: Fixing videobalance ranges for colorbalance interface implementation.
Original commit message from CVS:
2004-01-14 Julien MOUTTE <julien@moutte.net>
* gst/videofilter/gstvideobalance.c: (gst_videobalance_init),
(gst_videobalance_colorbalance_set_value),
(gst_videobalance_colorbalance_get_value): Fixing videobalance ranges
for colorbalance interface implementation.
* sys/ximage/ximagesink.c: (gst_ximagesink_xcontext_get),
(gst_ximagesink_set_property), (gst_ximagesink_get_property),
(gst_ximagesink_dispose), (gst_ximagesink_init),
(gst_ximagesink_class_init): Adding DISPLAY property.
* sys/ximage/ximagesink.h: Adding display_name to store display.
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_xcontext_get),
(gst_xvimagesink_set_property), (gst_xvimagesink_get_property),
(gst_xvimagesink_dispose), (gst_xvimagesink_init),
(gst_xvimagesink_class_init): Adding DISPLAY property and colorbalance
properties (they still need polishing though for gst-launch use : no
xcontext yet, i ll do that tomorrow).
* sys/xvimage/xvimagesink.h: Adding display_name to store display.
2004-01-14 23:01:49 +00:00
|
|
|
|
2003-11-11 11:32:27 +00:00
|
|
|
gobject_class->dispose = gst_ximagesink_dispose;
|
gst/videofilter/gstvideobalance.c: Fixing videobalance ranges for colorbalance interface implementation.
Original commit message from CVS:
2004-01-14 Julien MOUTTE <julien@moutte.net>
* gst/videofilter/gstvideobalance.c: (gst_videobalance_init),
(gst_videobalance_colorbalance_set_value),
(gst_videobalance_colorbalance_get_value): Fixing videobalance ranges
for colorbalance interface implementation.
* sys/ximage/ximagesink.c: (gst_ximagesink_xcontext_get),
(gst_ximagesink_set_property), (gst_ximagesink_get_property),
(gst_ximagesink_dispose), (gst_ximagesink_init),
(gst_ximagesink_class_init): Adding DISPLAY property.
* sys/ximage/ximagesink.h: Adding display_name to store display.
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_xcontext_get),
(gst_xvimagesink_set_property), (gst_xvimagesink_get_property),
(gst_xvimagesink_dispose), (gst_xvimagesink_init),
(gst_xvimagesink_class_init): Adding DISPLAY property and colorbalance
properties (they still need polishing though for gst-launch use : no
xcontext yet, i ll do that tomorrow).
* sys/xvimage/xvimagesink.h: Adding display_name to store display.
2004-01-14 23:01:49 +00:00
|
|
|
gobject_class->set_property = gst_ximagesink_set_property;
|
|
|
|
gobject_class->get_property = gst_ximagesink_get_property;
|
2003-11-11 11:32:27 +00:00
|
|
|
|
2003-11-06 21:51:14 +00:00
|
|
|
gstelement_class->change_state = gst_ximagesink_change_state;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ============================================================= */
|
|
|
|
/* */
|
|
|
|
/* Public Methods */
|
|
|
|
/* */
|
|
|
|
/* ============================================================= */
|
|
|
|
|
|
|
|
/* =========================================== */
|
|
|
|
/* */
|
|
|
|
/* Object typing & Creation */
|
|
|
|
/* */
|
|
|
|
/* =========================================== */
|
|
|
|
|
|
|
|
GType
|
|
|
|
gst_ximagesink_get_type (void)
|
|
|
|
{
|
|
|
|
static GType ximagesink_type = 0;
|
|
|
|
|
|
|
|
if (!ximagesink_type)
|
|
|
|
{
|
|
|
|
static const GTypeInfo ximagesink_info = {
|
|
|
|
sizeof(GstXImageSinkClass),
|
|
|
|
gst_ximagesink_base_init,
|
|
|
|
NULL,
|
|
|
|
(GClassInitFunc) gst_ximagesink_class_init,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
sizeof(GstXImageSink),
|
|
|
|
0,
|
|
|
|
(GInstanceInitFunc) gst_ximagesink_init,
|
|
|
|
};
|
|
|
|
static const GInterfaceInfo iface_info = {
|
|
|
|
(GInterfaceInitFunc) gst_ximagesink_interface_init,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
};
|
2003-11-06 22:17:37 +00:00
|
|
|
static const GInterfaceInfo navigation_info = {
|
|
|
|
(GInterfaceInitFunc) gst_ximagesink_navigation_init,
|
2003-11-06 21:51:14 +00:00
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
};
|
2003-11-17 16:32:29 +00:00
|
|
|
static const GInterfaceInfo overlay_info = {
|
2003-11-06 21:51:14 +00:00
|
|
|
(GInterfaceInitFunc) gst_ximagesink_xoverlay_init,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
2003-11-17 16:32:29 +00:00
|
|
|
};
|
2003-11-06 21:51:14 +00:00
|
|
|
|
2003-11-19 20:43:49 +00:00
|
|
|
ximagesink_type = g_type_register_static (GST_TYPE_VIDEOSINK,
|
2003-11-11 11:32:27 +00:00
|
|
|
"GstXImageSink",
|
|
|
|
&ximagesink_info, 0);
|
2003-11-06 21:51:14 +00:00
|
|
|
|
2003-12-07 12:11:30 +00:00
|
|
|
g_type_add_interface_static (ximagesink_type, GST_TYPE_IMPLEMENTS_INTERFACE,
|
2003-11-17 16:32:29 +00:00
|
|
|
&iface_info);
|
2003-11-06 22:17:37 +00:00
|
|
|
g_type_add_interface_static (ximagesink_type, GST_TYPE_NAVIGATION,
|
2003-11-17 16:32:29 +00:00
|
|
|
&navigation_info);
|
|
|
|
g_type_add_interface_static (ximagesink_type, GST_TYPE_X_OVERLAY,
|
|
|
|
&overlay_info);
|
2003-11-06 21:51:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return ximagesink_type;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
plugin_init (GstPlugin *plugin)
|
|
|
|
{
|
2003-11-19 20:43:49 +00:00
|
|
|
/* Loading the library containing GstVideoSink, our parent object */
|
|
|
|
if (!gst_library_load ("gstvideo"))
|
|
|
|
return FALSE;
|
|
|
|
|
2003-11-11 11:32:27 +00:00
|
|
|
if (!gst_element_register (plugin, "ximagesink",
|
|
|
|
GST_RANK_SECONDARY, GST_TYPE_XIMAGESINK))
|
2003-11-06 21:51:14 +00:00
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
GST_PLUGIN_DEFINE (
|
|
|
|
GST_VERSION_MAJOR,
|
|
|
|
GST_VERSION_MINOR,
|
|
|
|
"ximagesink",
|
|
|
|
"XFree86 video output plugin based on standard Xlib calls",
|
|
|
|
plugin_init,
|
|
|
|
VERSION,
|
|
|
|
GST_LICENSE,
|
|
|
|
GST_PACKAGE,
|
|
|
|
GST_ORIGIN)
|