2001-12-20 23:21:15 +00:00
|
|
|
/* GStreamer SDL plugin
|
2002-01-31 22:22:42 +00:00
|
|
|
* Copyright (C) 2001-2002 Ronald Bultje <rbultje@ronald.bitfreak.net>
|
2001-12-20 23:21:15 +00:00
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* let's not forget to mention that all this was based on aasink ;-) */
|
|
|
|
|
2003-06-29 19:46:13 +00:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
#include "config.h"
|
|
|
|
#endif
|
2003-11-07 12:47:02 +00:00
|
|
|
|
2001-12-20 23:21:15 +00:00
|
|
|
#include <signal.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <sys/time.h>
|
2002-02-03 20:10:03 +00:00
|
|
|
#include <stdlib.h>
|
2001-12-20 23:21:15 +00:00
|
|
|
|
2005-09-19 21:47:54 +00:00
|
|
|
#include <gst/interfaces/xoverlay.h>
|
2006-01-11 20:59:39 +00:00
|
|
|
#include <gst/interfaces/navigation.h>
|
2003-10-28 09:08:32 +00:00
|
|
|
|
2001-12-20 23:21:15 +00:00
|
|
|
#include "sdlvideosink.h"
|
|
|
|
|
2006-01-09 18:20:56 +00:00
|
|
|
GST_DEBUG_CATEGORY_EXTERN (sdl_debug);
|
|
|
|
#define GST_CAT_DEFAULT sdl_debug
|
2005-10-28 15:11:18 +00:00
|
|
|
|
|
|
|
/* These macros are adapted from videotestsrc.c
|
|
|
|
* and/or gst-plugins/gst/games/gstvideoimage.c */
|
|
|
|
#define I420_Y_ROWSTRIDE(width) (GST_ROUND_UP_4(width))
|
|
|
|
#define I420_U_ROWSTRIDE(width) (GST_ROUND_UP_8(width)/2)
|
|
|
|
#define I420_V_ROWSTRIDE(width) ((GST_ROUND_UP_8(I420_Y_ROWSTRIDE(width)))/2)
|
|
|
|
|
|
|
|
#define I420_Y_OFFSET(w,h) (0)
|
|
|
|
#define I420_U_OFFSET(w,h) (I420_Y_OFFSET(w,h)+(I420_Y_ROWSTRIDE(w)*GST_ROUND_UP_2(h)))
|
|
|
|
#define I420_V_OFFSET(w,h) (I420_U_OFFSET(w,h)+(I420_U_ROWSTRIDE(w)*GST_ROUND_UP_2(h)/2))
|
|
|
|
|
|
|
|
#define I420_SIZE(w,h) (I420_V_OFFSET(w,h)+(I420_V_ROWSTRIDE(w)*GST_ROUND_UP_2(h)/2))
|
|
|
|
|
2002-09-18 19:02:52 +00:00
|
|
|
/* elementfactory information */
|
2006-04-06 11:35:26 +00:00
|
|
|
static GstElementDetails gst_sdlvideosink_details =
|
|
|
|
GST_ELEMENT_DETAILS ("SDL video sink",
|
|
|
|
"Sink/Video",
|
|
|
|
"An SDL-based videosink",
|
|
|
|
"Ronald Bultje <rbultje@ronald.bitfreak.net>"
|
|
|
|
"Edgard Lima <edgard.lima@indt.org.br>"
|
|
|
|
"Jan Schmidt <thaytan@mad.scientist.com>");
|
2001-12-20 23:21:15 +00:00
|
|
|
|
2005-10-31 18:07:30 +00:00
|
|
|
|
|
|
|
enum
|
|
|
|
{
|
|
|
|
PROP_0,
|
|
|
|
PROP_FULLSCREEN
|
|
|
|
};
|
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
static void gst_sdlvideosink_interface_init (GstImplementsInterfaceClass *
|
|
|
|
klass);
|
|
|
|
static gboolean gst_sdlvideosink_supported (GstImplementsInterface * iface,
|
|
|
|
GType type);
|
2003-10-28 09:08:32 +00:00
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
static void gst_sdlvideosink_xoverlay_init (GstXOverlayClass * klass);
|
|
|
|
static void gst_sdlvideosink_xoverlay_set_xwindow_id
|
|
|
|
(GstXOverlay * overlay, unsigned long parent);
|
2003-10-28 09:08:32 +00:00
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
static gboolean gst_sdlvideosink_lock (GstSDLVideoSink * sdl);
|
|
|
|
static void gst_sdlvideosink_unlock (GstSDLVideoSink * sdl);
|
2003-10-28 09:08:32 +00:00
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
static gboolean gst_sdlvideosink_initsdl (GstSDLVideoSink * sdl);
|
|
|
|
static void gst_sdlvideosink_deinitsdl (GstSDLVideoSink * sdl);
|
2002-01-10 09:58:15 +00:00
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
static gboolean gst_sdlvideosink_create (GstSDLVideoSink * sdl);
|
|
|
|
static void gst_sdlvideosink_destroy (GstSDLVideoSink * sdl);
|
2002-01-10 09:58:15 +00:00
|
|
|
|
2005-09-19 21:47:54 +00:00
|
|
|
static gboolean gst_sdlvideosink_setcaps (GstBaseSink * bsink, GstCaps * caps);
|
|
|
|
|
|
|
|
static GstFlowReturn gst_sdlvideosink_show_frame (GstBaseSink * bsink,
|
|
|
|
GstBuffer * buff);
|
2004-03-14 22:34:33 +00:00
|
|
|
|
|
|
|
static void gst_sdlvideosink_set_property (GObject * object,
|
|
|
|
guint prop_id, const GValue * value, GParamSpec * pspec);
|
|
|
|
static void gst_sdlvideosink_get_property (GObject * object,
|
|
|
|
guint prop_id, GValue * value, GParamSpec * pspec);
|
2005-09-05 17:20:29 +00:00
|
|
|
static GstStateChangeReturn
|
|
|
|
gst_sdlvideosink_change_state (GstElement * element, GstStateChange transition);
|
2002-01-10 09:58:15 +00:00
|
|
|
|
2006-01-11 20:59:39 +00:00
|
|
|
static void gst_sdlvideosink_navigation_init (GstNavigationInterface * iface);
|
2002-01-10 09:58:15 +00:00
|
|
|
|
ext/sdl/sdlvideosink.*: Fix output stride copying, so that it displays correctly on framebuffer devices that don't ma...
Original commit message from CVS:
* ext/sdl/sdlvideosink.c: (gst_sdlvideosink_supported),
(gst_sdlvideosink_xoverlay_set_xwindow_id),
(gst_sdlvideosink_deinitsdl), (gst_sdlv_process_events),
(gst_sdlvideosink_event_thread), (gst_sdlvideosink_initsdl),
(gst_sdlvideosink_destroy), (gst_sdlvideosink_create),
(gst_sdlvideosink_setcaps), (gst_sdlvideosink_show_frame),
(gst_sdlvideosink_change_state),
(gst_sdlvideosink_navigation_send_event):
* ext/sdl/sdlvideosink.h:
Fix output stride copying, so that it displays correctly on
framebuffer devices that don't match our implict GStreamer stride
arrangement.
Fix locking things. Offer XOverlay only when SDL is running against
X. Make non-scaled (and ugly) embedding work via X Overlay. It can't
actually match the embedded window size because there's no way to
figure out what size that should be from the XOverlay interface.
See comment in sdlvideosink.c
2006-01-27 01:31:12 +00:00
|
|
|
static void gst_sdlv_process_events (GstSDLVideoSink * sdlvideosink);
|
|
|
|
|
2002-01-10 09:58:15 +00:00
|
|
|
static GstPadTemplate *sink_template;
|
2002-01-15 15:52:09 +00:00
|
|
|
|
2006-01-11 20:59:39 +00:00
|
|
|
static void
|
|
|
|
_do_init (GType type)
|
2001-12-20 23:21:15 +00:00
|
|
|
{
|
2006-01-11 20:59:39 +00:00
|
|
|
static const GInterfaceInfo iface_info = {
|
|
|
|
(GInterfaceInitFunc) gst_sdlvideosink_interface_init,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
};
|
|
|
|
static const GInterfaceInfo xoverlay_info = {
|
|
|
|
(GInterfaceInitFunc) gst_sdlvideosink_xoverlay_init,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
};
|
|
|
|
static const GInterfaceInfo navigation_info = {
|
|
|
|
(GInterfaceInitFunc) gst_sdlvideosink_navigation_init,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
};
|
|
|
|
|
|
|
|
g_type_add_interface_static (type,
|
|
|
|
GST_TYPE_IMPLEMENTS_INTERFACE, &iface_info);
|
|
|
|
g_type_add_interface_static (type, GST_TYPE_X_OVERLAY, &xoverlay_info);
|
|
|
|
g_type_add_interface_static (type, GST_TYPE_NAVIGATION, &navigation_info);
|
|
|
|
|
2001-12-20 23:21:15 +00:00
|
|
|
}
|
|
|
|
|
2006-01-11 20:59:39 +00:00
|
|
|
GST_BOILERPLATE_FULL (GstSDLVideoSink, gst_sdlvideosink, GstVideoSink,
|
|
|
|
GST_TYPE_VIDEO_SINK, _do_init)
|
|
|
|
|
|
|
|
static void gst_sdlvideosink_base_init (gpointer g_class)
|
2003-11-02 01:27:21 +00:00
|
|
|
{
|
|
|
|
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
|
2003-12-22 01:47:09 +00:00
|
|
|
GstCaps *capslist;
|
2003-11-02 01:27:21 +00:00
|
|
|
gint i;
|
2005-10-28 15:11:18 +00:00
|
|
|
guint32 formats[] = {
|
|
|
|
GST_MAKE_FOURCC ('I', '4', '2', '0'),
|
2004-03-14 22:34:33 +00:00
|
|
|
GST_MAKE_FOURCC ('Y', 'V', '1', '2'),
|
2005-10-28 15:11:18 +00:00
|
|
|
GST_MAKE_FOURCC ('Y', 'U', 'Y', '2')
|
2006-01-11 20:59:39 +00:00
|
|
|
/*
|
|
|
|
GST_MAKE_FOURCC ('Y', 'V', 'Y', 'U'),
|
|
|
|
GST_MAKE_FOURCC ('U', 'Y', 'V', 'Y')
|
|
|
|
*/
|
2004-03-14 22:34:33 +00:00
|
|
|
};
|
2003-11-02 01:27:21 +00:00
|
|
|
|
|
|
|
/* make a list of all available caps */
|
2004-03-14 22:34:33 +00:00
|
|
|
capslist = gst_caps_new_empty ();
|
2005-10-28 15:11:18 +00:00
|
|
|
for (i = 0; i < G_N_ELEMENTS (formats); i++) {
|
2004-03-14 22:34:33 +00:00
|
|
|
gst_caps_append_structure (capslist,
|
2004-03-15 19:32:27 +00:00
|
|
|
gst_structure_new ("video/x-raw-yuv",
|
2005-10-28 15:11:18 +00:00
|
|
|
"format", GST_TYPE_FOURCC, formats[i],
|
2004-03-15 19:32:27 +00:00
|
|
|
"width", GST_TYPE_INT_RANGE, 1, G_MAXINT,
|
|
|
|
"height", GST_TYPE_INT_RANGE, 1, G_MAXINT,
|
2005-11-23 15:36:08 +00:00
|
|
|
"framerate", GST_TYPE_FRACTION_RANGE, 0, 1, 100, 1, NULL));
|
2003-11-02 01:27:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
sink_template = gst_pad_template_new ("sink",
|
2004-03-14 22:34:33 +00:00
|
|
|
GST_PAD_SINK, GST_PAD_ALWAYS, capslist);
|
|
|
|
|
2003-11-02 01:27:21 +00:00
|
|
|
gst_element_class_add_pad_template (element_class, sink_template);
|
|
|
|
gst_element_class_set_details (element_class, &gst_sdlvideosink_details);
|
2005-10-28 15:11:18 +00:00
|
|
|
|
2003-11-02 01:27:21 +00:00
|
|
|
}
|
|
|
|
|
2003-10-28 09:08:32 +00:00
|
|
|
static void
|
Fixes a bunch of problems with finalize and dispose functions, either assumptions that dispose is only called once, o...
Original commit message from CVS:
* ext/alsa/gstalsa.c: (gst_alsa_class_init), (gst_alsa_dispose),
(gst_alsa_finalize):
* ext/cdaudio/gstcdaudio.c: (gst_cdaudio_class_init),
(gst_cdaudio_finalize):
* ext/cdparanoia/gstcdparanoia.c: (cdparanoia_class_init),
(cdparanoia_finalize):
* ext/divx/gstdivxdec.c: (gst_divxdec_dispose):
* ext/divx/gstdivxenc.c: (gst_divxenc_dispose):
* ext/dvdread/dvdreadsrc.c: (dvdreadsrc_class_init),
(dvdreadsrc_finalize):
* ext/flac/gstflacdec.c: (gst_flacdec_class_init),
(gst_flacdec_finalize):
* ext/flac/gstflacenc.c: (gst_flacenc_class_init),
(gst_flacenc_finalize):
* ext/gnomevfs/gstgnomevfssink.c: (gst_gnomevfssink_class_init),
(gst_gnomevfssink_finalize):
* ext/gnomevfs/gstgnomevfssrc.c: (gst_gnomevfssrc_class_init),
(gst_gnomevfssrc_finalize):
* ext/libfame/gstlibfame.c: (gst_fameenc_class_init),
(gst_fameenc_finalize):
* ext/nas/nassink.c: (gst_nassink_class_init),
(gst_nassink_finalize):
* ext/sdl/sdlvideosink.c: (gst_sdlvideosink_finalize),
(gst_sdlvideosink_class_init):
* ext/sndfile/gstsf.c: (gst_sf_dispose):
* gst-libs/gst/mixer/mixertrack.c: (gst_mixer_track_dispose):
* gst-libs/gst/tuner/tunerchannel.c: (gst_tuner_channel_dispose):
* gst-libs/gst/tuner/tunernorm.c: (gst_tuner_norm_dispose):
* gst-libs/gst/xwindowlistener/xwindowlistener.c:
(gst_x_window_listener_dispose):
* gst/audioscale/gstaudioscale.c:
* gst/playondemand/gstplayondemand.c: (play_on_demand_class_init),
(play_on_demand_finalize):
* gst/videofilter/gstvideobalance.c: (gst_videobalance_dispose):
* gst/videoscale/gstvideoscale.c: (gst_videoscale_chain):
* sys/cdrom/gstcdplayer.c: (cdplayer_class_init),
(cdplayer_finalize):
* sys/glsink/glimagesink.c: (gst_glimagesink_finalize),
(gst_glimagesink_class_init):
* sys/oss/gstosselement.c: (gst_osselement_class_init),
(gst_osselement_finalize):
* sys/oss/gstosssink.c: (gst_osssink_dispose):
* sys/oss/gstosssrc.c: (gst_osssrc_dispose):
* sys/v4l/gstv4lelement.c: (gst_v4lelement_dispose):
Fixes a bunch of problems with finalize and dispose functions,
either assumptions that dispose is only called once, or not calling
the parent class dispose/finalize function
2004-11-01 14:43:38 +00:00
|
|
|
gst_sdlvideosink_finalize (GObject * obj)
|
2003-10-28 09:08:32 +00:00
|
|
|
{
|
|
|
|
g_mutex_free (GST_SDLVIDEOSINK (obj)->lock);
|
|
|
|
|
ext/sdl/sdlvideosink.c: Fix SDL videosink and did some cleanups.
Original commit message from CVS:
* ext/sdl/sdlvideosink.c: (gst_sdlvideosink_finalize),
(gst_sdlvideosink_get_times), (gst_sdlvideosink_class_init),
(gst_sdlvideosink_init), (gst_sdlvideosink_lock),
(gst_sdlvideosink_initsdl), (gst_sdlvideosink_create),
(gst_sdlvideosink_show_frame), (gst_sdlvideosink_set_property),
(gst_sdlvideosink_get_property), (gst_sdlvideosink_change_state):
Fix SDL videosink and did some cleanups.
2005-10-27 20:16:40 +00:00
|
|
|
G_OBJECT_CLASS (parent_class)->finalize (obj);
|
2003-10-28 09:08:32 +00:00
|
|
|
}
|
2002-01-10 09:58:15 +00:00
|
|
|
|
2005-10-27 19:36:18 +00:00
|
|
|
static void
|
|
|
|
gst_sdlvideosink_get_times (GstBaseSink * basesink, GstBuffer * buffer,
|
|
|
|
GstClockTime * start, GstClockTime * end)
|
|
|
|
{
|
|
|
|
GstSDLVideoSink *sdlvideosink = GST_SDLVIDEOSINK (basesink);
|
|
|
|
GstClockTime timestamp, duration;
|
|
|
|
|
|
|
|
timestamp = GST_BUFFER_TIMESTAMP (buffer);
|
|
|
|
if (GST_CLOCK_TIME_IS_VALID (timestamp)) {
|
|
|
|
*start = timestamp;
|
|
|
|
duration = GST_BUFFER_DURATION (buffer);
|
|
|
|
if (GST_CLOCK_TIME_IS_VALID (duration)) {
|
|
|
|
*end = timestamp + duration;
|
|
|
|
} else {
|
2005-11-23 15:36:08 +00:00
|
|
|
if (sdlvideosink->framerate_n > 0) {
|
|
|
|
*end = timestamp +
|
|
|
|
gst_util_uint64_scale_int (GST_SECOND, sdlvideosink->framerate_d,
|
|
|
|
sdlvideosink->framerate_n);
|
2005-10-27 19:36:18 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2001-12-20 23:21:15 +00:00
|
|
|
static void
|
2004-03-14 22:34:33 +00:00
|
|
|
gst_sdlvideosink_class_init (GstSDLVideoSinkClass * klass)
|
2001-12-20 23:21:15 +00:00
|
|
|
{
|
|
|
|
GObjectClass *gobject_class;
|
|
|
|
GstElementClass *gstelement_class;
|
2005-09-19 21:47:54 +00:00
|
|
|
GstBaseSinkClass *gstvs_class;
|
2001-12-20 23:21:15 +00:00
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
gobject_class = (GObjectClass *) klass;
|
|
|
|
gstelement_class = (GstElementClass *) klass;
|
2005-09-19 21:47:54 +00:00
|
|
|
gstvs_class = (GstBaseSinkClass *) klass;
|
2004-03-14 22:34:33 +00:00
|
|
|
|
2005-10-28 15:11:18 +00:00
|
|
|
parent_class = g_type_class_peek_parent (klass);
|
2001-12-20 23:21:15 +00:00
|
|
|
|
|
|
|
gobject_class->set_property = gst_sdlvideosink_set_property;
|
|
|
|
gobject_class->get_property = gst_sdlvideosink_get_property;
|
2005-09-19 21:47:54 +00:00
|
|
|
|
Fixes a bunch of problems with finalize and dispose functions, either assumptions that dispose is only called once, o...
Original commit message from CVS:
* ext/alsa/gstalsa.c: (gst_alsa_class_init), (gst_alsa_dispose),
(gst_alsa_finalize):
* ext/cdaudio/gstcdaudio.c: (gst_cdaudio_class_init),
(gst_cdaudio_finalize):
* ext/cdparanoia/gstcdparanoia.c: (cdparanoia_class_init),
(cdparanoia_finalize):
* ext/divx/gstdivxdec.c: (gst_divxdec_dispose):
* ext/divx/gstdivxenc.c: (gst_divxenc_dispose):
* ext/dvdread/dvdreadsrc.c: (dvdreadsrc_class_init),
(dvdreadsrc_finalize):
* ext/flac/gstflacdec.c: (gst_flacdec_class_init),
(gst_flacdec_finalize):
* ext/flac/gstflacenc.c: (gst_flacenc_class_init),
(gst_flacenc_finalize):
* ext/gnomevfs/gstgnomevfssink.c: (gst_gnomevfssink_class_init),
(gst_gnomevfssink_finalize):
* ext/gnomevfs/gstgnomevfssrc.c: (gst_gnomevfssrc_class_init),
(gst_gnomevfssrc_finalize):
* ext/libfame/gstlibfame.c: (gst_fameenc_class_init),
(gst_fameenc_finalize):
* ext/nas/nassink.c: (gst_nassink_class_init),
(gst_nassink_finalize):
* ext/sdl/sdlvideosink.c: (gst_sdlvideosink_finalize),
(gst_sdlvideosink_class_init):
* ext/sndfile/gstsf.c: (gst_sf_dispose):
* gst-libs/gst/mixer/mixertrack.c: (gst_mixer_track_dispose):
* gst-libs/gst/tuner/tunerchannel.c: (gst_tuner_channel_dispose):
* gst-libs/gst/tuner/tunernorm.c: (gst_tuner_norm_dispose):
* gst-libs/gst/xwindowlistener/xwindowlistener.c:
(gst_x_window_listener_dispose):
* gst/audioscale/gstaudioscale.c:
* gst/playondemand/gstplayondemand.c: (play_on_demand_class_init),
(play_on_demand_finalize):
* gst/videofilter/gstvideobalance.c: (gst_videobalance_dispose):
* gst/videoscale/gstvideoscale.c: (gst_videoscale_chain):
* sys/cdrom/gstcdplayer.c: (cdplayer_class_init),
(cdplayer_finalize):
* sys/glsink/glimagesink.c: (gst_glimagesink_finalize),
(gst_glimagesink_class_init):
* sys/oss/gstosselement.c: (gst_osselement_class_init),
(gst_osselement_finalize):
* sys/oss/gstosssink.c: (gst_osssink_dispose):
* sys/oss/gstosssrc.c: (gst_osssrc_dispose):
* sys/v4l/gstv4lelement.c: (gst_v4lelement_dispose):
Fixes a bunch of problems with finalize and dispose functions,
either assumptions that dispose is only called once, or not calling
the parent class dispose/finalize function
2004-11-01 14:43:38 +00:00
|
|
|
gobject_class->finalize = gst_sdlvideosink_finalize;
|
2001-12-20 23:21:15 +00:00
|
|
|
|
2005-09-19 21:47:54 +00:00
|
|
|
gstelement_class->change_state =
|
|
|
|
GST_DEBUG_FUNCPTR (gst_sdlvideosink_change_state);
|
|
|
|
|
|
|
|
gstvs_class->set_caps = GST_DEBUG_FUNCPTR (gst_sdlvideosink_setcaps);
|
2005-10-27 19:36:18 +00:00
|
|
|
gstvs_class->get_times = GST_DEBUG_FUNCPTR (gst_sdlvideosink_get_times);
|
2005-09-19 21:47:54 +00:00
|
|
|
gstvs_class->preroll = GST_DEBUG_FUNCPTR (gst_sdlvideosink_show_frame);
|
|
|
|
gstvs_class->render = GST_DEBUG_FUNCPTR (gst_sdlvideosink_show_frame);
|
2004-03-14 22:34:33 +00:00
|
|
|
|
2005-10-31 18:07:30 +00:00
|
|
|
g_object_class_install_property (gobject_class, PROP_FULLSCREEN,
|
2005-10-31 20:57:42 +00:00
|
|
|
g_param_spec_boolean ("fullscreen", "Fullscreen",
|
2005-10-31 18:07:30 +00:00
|
|
|
"If true it will be Full screen", FALSE, G_PARAM_READWRITE));
|
|
|
|
|
2003-09-14 21:09:41 +00:00
|
|
|
/*gstvs_class->set_video_out = gst_sdlvideosink_set_video_out;
|
2004-03-14 22:34:33 +00:00
|
|
|
gstvs_class->push_ui_event = gst_sdlvideosink_push_ui_event;
|
|
|
|
gstvs_class->set_geometry = gst_sdlvideosink_set_geometry; */
|
2002-02-03 20:10:03 +00:00
|
|
|
}
|
|
|
|
|
2003-12-22 01:47:09 +00:00
|
|
|
#if 0
|
|
|
|
/* FIXME */
|
2003-10-28 09:08:32 +00:00
|
|
|
static GstBuffer *
|
2004-03-14 22:34:33 +00:00
|
|
|
gst_sdlvideosink_buffer_new (GstBufferPool * pool,
|
|
|
|
gint64 location, guint size, gpointer user_data)
|
2003-10-28 09:08:32 +00:00
|
|
|
{
|
|
|
|
GstSDLVideoSink *sdlvideosink = GST_SDLVIDEOSINK (user_data);
|
|
|
|
GstBuffer *buffer;
|
|
|
|
|
|
|
|
if (!sdlvideosink->overlay)
|
|
|
|
return NULL;
|
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
if (!gst_sdlvideosink_lock (sdlvideosink)) {
|
2003-10-28 09:08:32 +00:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* this protects the buffer from being written over multiple times */
|
|
|
|
g_mutex_lock (sdlvideosink->lock);
|
|
|
|
|
|
|
|
buffer = gst_buffer_new ();
|
|
|
|
GST_BUFFER_FLAG_SET (buffer, GST_BUFFER_DONTFREE);
|
|
|
|
GST_BUFFER_DATA (buffer) = sdlvideosink->overlay->pixels[0];
|
|
|
|
if (sdlvideosink->format == SDL_YV12_OVERLAY ||
|
|
|
|
sdlvideosink->format == SDL_IYUV_OVERLAY) {
|
|
|
|
GST_BUFFER_SIZE (buffer) =
|
2004-03-15 19:32:27 +00:00
|
|
|
sdlvideosink->width * sdlvideosink->height * 3 / 2;
|
2003-10-28 09:08:32 +00:00
|
|
|
} else {
|
2004-03-14 22:34:33 +00:00
|
|
|
GST_BUFFER_SIZE (buffer) = sdlvideosink->width * sdlvideosink->height * 2;
|
2003-10-28 09:08:32 +00:00
|
|
|
}
|
|
|
|
GST_BUFFER_MAXSIZE (buffer) = GST_BUFFER_SIZE (buffer);
|
|
|
|
|
|
|
|
return buffer;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2004-03-14 22:34:33 +00:00
|
|
|
gst_sdlvideosink_buffer_free (GstBufferPool * pool,
|
|
|
|
GstBuffer * buffer, gpointer user_data)
|
2003-10-28 09:08:32 +00:00
|
|
|
{
|
|
|
|
GstSDLVideoSink *sdlvideosink = GST_SDLVIDEOSINK (user_data);
|
|
|
|
|
|
|
|
g_mutex_unlock (sdlvideosink->lock);
|
2004-03-14 22:34:33 +00:00
|
|
|
gst_sdlvideosink_unlock (sdlvideosink);
|
2003-10-28 09:08:32 +00:00
|
|
|
|
|
|
|
gst_buffer_default_free (buffer);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static GstBufferPool *
|
2004-03-14 22:34:33 +00:00
|
|
|
gst_sdlvideosink_get_bufferpool (GstPad * pad)
|
2003-10-28 09:08:32 +00:00
|
|
|
{
|
|
|
|
GstSDLVideoSink *sdlvideosink = GST_SDLVIDEOSINK (gst_pad_get_parent (pad));
|
|
|
|
|
|
|
|
if (sdlvideosink->overlay)
|
|
|
|
return sdlvideosink->bufferpool;
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
2003-12-22 01:47:09 +00:00
|
|
|
#endif
|
2003-10-28 09:08:32 +00:00
|
|
|
|
2002-01-10 09:58:15 +00:00
|
|
|
static void
|
2006-01-11 20:59:39 +00:00
|
|
|
gst_sdlvideosink_init (GstSDLVideoSink * sdlvideosink,
|
|
|
|
GstSDLVideoSinkClass * g_class)
|
2002-01-10 09:58:15 +00:00
|
|
|
{
|
|
|
|
|
2003-10-28 09:08:32 +00:00
|
|
|
sdlvideosink->width = -1;
|
|
|
|
sdlvideosink->height = -1;
|
2005-11-23 15:36:08 +00:00
|
|
|
sdlvideosink->framerate_n = 0;
|
|
|
|
sdlvideosink->framerate_d = 1;
|
2005-10-31 18:07:30 +00:00
|
|
|
sdlvideosink->full_screen = FALSE;
|
2002-01-10 09:58:15 +00:00
|
|
|
|
2003-10-28 09:08:32 +00:00
|
|
|
sdlvideosink->overlay = NULL;
|
2002-01-10 09:58:15 +00:00
|
|
|
sdlvideosink->screen = NULL;
|
|
|
|
|
2003-10-28 09:08:32 +00:00
|
|
|
sdlvideosink->xwindow_id = 0;
|
2002-01-10 09:58:15 +00:00
|
|
|
|
2003-12-22 01:47:09 +00:00
|
|
|
//sdlvideosink->capslist = capslist;
|
2002-01-10 09:58:15 +00:00
|
|
|
|
2003-10-28 09:08:32 +00:00
|
|
|
sdlvideosink->init = FALSE;
|
|
|
|
|
2005-11-03 16:59:20 +00:00
|
|
|
sdlvideosink->event_thread = NULL;
|
|
|
|
sdlvideosink->running = FALSE;
|
|
|
|
|
2003-10-28 09:08:32 +00:00
|
|
|
sdlvideosink->lock = g_mutex_new ();
|
2002-01-10 09:58:15 +00:00
|
|
|
}
|
|
|
|
|
2003-10-28 09:08:32 +00:00
|
|
|
static void
|
2004-03-14 22:34:33 +00:00
|
|
|
gst_sdlvideosink_interface_init (GstImplementsInterfaceClass * klass)
|
2003-10-28 09:08:32 +00:00
|
|
|
{
|
2003-12-07 12:11:30 +00:00
|
|
|
klass->supported = gst_sdlvideosink_supported;
|
2003-10-28 09:08:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
2004-03-14 22:34:33 +00:00
|
|
|
gst_sdlvideosink_supported (GstImplementsInterface * interface,
|
|
|
|
GType iface_type)
|
2003-10-28 09:08:32 +00:00
|
|
|
{
|
ext/sdl/sdlvideosink.*: Fix output stride copying, so that it displays correctly on framebuffer devices that don't ma...
Original commit message from CVS:
* ext/sdl/sdlvideosink.c: (gst_sdlvideosink_supported),
(gst_sdlvideosink_xoverlay_set_xwindow_id),
(gst_sdlvideosink_deinitsdl), (gst_sdlv_process_events),
(gst_sdlvideosink_event_thread), (gst_sdlvideosink_initsdl),
(gst_sdlvideosink_destroy), (gst_sdlvideosink_create),
(gst_sdlvideosink_setcaps), (gst_sdlvideosink_show_frame),
(gst_sdlvideosink_change_state),
(gst_sdlvideosink_navigation_send_event):
* ext/sdl/sdlvideosink.h:
Fix output stride copying, so that it displays correctly on
framebuffer devices that don't match our implict GStreamer stride
arrangement.
Fix locking things. Offer XOverlay only when SDL is running against
X. Make non-scaled (and ugly) embedding work via X Overlay. It can't
actually match the embedded window size because there's no way to
figure out what size that should be from the XOverlay interface.
See comment in sdlvideosink.c
2006-01-27 01:31:12 +00:00
|
|
|
GstSDLVideoSink *sdlvideosink = GST_SDLVIDEOSINK (interface);
|
|
|
|
gboolean result = FALSE;
|
|
|
|
|
|
|
|
/* check SDL for whether it was compiled against X, FB, etc. */
|
|
|
|
if (iface_type == GST_TYPE_X_OVERLAY) {
|
|
|
|
gchar tmp[4];
|
|
|
|
|
|
|
|
if (!sdlvideosink->init) {
|
|
|
|
g_mutex_lock (sdlvideosink->lock);
|
|
|
|
SDL_Init (SDL_INIT_VIDEO);
|
|
|
|
|
|
|
|
/* True if the video driver is X11 */
|
|
|
|
result = (strcmp ("x11", SDL_VideoDriverName (tmp, 4)) == 0);
|
|
|
|
SDL_Quit ();
|
|
|
|
g_mutex_unlock (sdlvideosink->lock);
|
|
|
|
} else
|
|
|
|
result = sdlvideosink->is_xwindows;
|
|
|
|
} else if (iface_type == GST_TYPE_NAVIGATION)
|
|
|
|
result = TRUE;
|
|
|
|
|
|
|
|
return result;
|
2003-10-28 09:08:32 +00:00
|
|
|
}
|
|
|
|
|
ext/sdl/sdlvideosink.*: Fix output stride copying, so that it displays correctly on framebuffer devices that don't ma...
Original commit message from CVS:
* ext/sdl/sdlvideosink.c: (gst_sdlvideosink_supported),
(gst_sdlvideosink_xoverlay_set_xwindow_id),
(gst_sdlvideosink_deinitsdl), (gst_sdlv_process_events),
(gst_sdlvideosink_event_thread), (gst_sdlvideosink_initsdl),
(gst_sdlvideosink_destroy), (gst_sdlvideosink_create),
(gst_sdlvideosink_setcaps), (gst_sdlvideosink_show_frame),
(gst_sdlvideosink_change_state),
(gst_sdlvideosink_navigation_send_event):
* ext/sdl/sdlvideosink.h:
Fix output stride copying, so that it displays correctly on
framebuffer devices that don't match our implict GStreamer stride
arrangement.
Fix locking things. Offer XOverlay only when SDL is running against
X. Make non-scaled (and ugly) embedding work via X Overlay. It can't
actually match the embedded window size because there's no way to
figure out what size that should be from the XOverlay interface.
See comment in sdlvideosink.c
2006-01-27 01:31:12 +00:00
|
|
|
/* SDL Video sink and X overlay:
|
|
|
|
*
|
|
|
|
* SDL supports creating an Xv window/overlay within an existing X window
|
|
|
|
* through the horrible mechanism of setting the WINDOWID environment
|
|
|
|
* variable.
|
|
|
|
* It will then display the x overlay within that window, but not at the
|
|
|
|
* full window size. Instead, we need to explicitly tell SDL the size.
|
|
|
|
*
|
|
|
|
* Unfortunately, the XOverlay interface in GStreamer doesn't supply
|
|
|
|
* that information. The only way to get it would be to do what X[v]imagesink
|
|
|
|
* does and retrieve it using X11 calls, and linking to Xlib. That would
|
|
|
|
* defeat the whole purpose of using the SDL abstraction and plugin entirely
|
|
|
|
* however.
|
|
|
|
*
|
|
|
|
* I have no nice solution to this problem for you, dear readers.
|
|
|
|
*/
|
2003-10-28 09:08:32 +00:00
|
|
|
static void
|
2004-03-14 22:34:33 +00:00
|
|
|
gst_sdlvideosink_xoverlay_init (GstXOverlayClass * klass)
|
2003-10-28 09:08:32 +00:00
|
|
|
{
|
|
|
|
klass->set_xwindow_id = gst_sdlvideosink_xoverlay_set_xwindow_id;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2004-03-14 22:34:33 +00:00
|
|
|
gst_sdlvideosink_xoverlay_set_xwindow_id (GstXOverlay * overlay,
|
2004-03-13 00:19:26 +00:00
|
|
|
unsigned long parent)
|
2003-10-28 09:08:32 +00:00
|
|
|
{
|
|
|
|
GstSDLVideoSink *sdlvideosink = GST_SDLVIDEOSINK (overlay);
|
2002-01-10 09:58:15 +00:00
|
|
|
|
ext/sdl/sdlvideosink.*: Fix output stride copying, so that it displays correctly on framebuffer devices that don't ma...
Original commit message from CVS:
* ext/sdl/sdlvideosink.c: (gst_sdlvideosink_supported),
(gst_sdlvideosink_xoverlay_set_xwindow_id),
(gst_sdlvideosink_deinitsdl), (gst_sdlv_process_events),
(gst_sdlvideosink_event_thread), (gst_sdlvideosink_initsdl),
(gst_sdlvideosink_destroy), (gst_sdlvideosink_create),
(gst_sdlvideosink_setcaps), (gst_sdlvideosink_show_frame),
(gst_sdlvideosink_change_state),
(gst_sdlvideosink_navigation_send_event):
* ext/sdl/sdlvideosink.h:
Fix output stride copying, so that it displays correctly on
framebuffer devices that don't match our implict GStreamer stride
arrangement.
Fix locking things. Offer XOverlay only when SDL is running against
X. Make non-scaled (and ugly) embedding work via X Overlay. It can't
actually match the embedded window size because there's no way to
figure out what size that should be from the XOverlay interface.
See comment in sdlvideosink.c
2006-01-27 01:31:12 +00:00
|
|
|
if (sdlvideosink->xwindow_id == parent)
|
|
|
|
return;
|
|
|
|
|
2003-10-28 09:08:32 +00:00
|
|
|
sdlvideosink->xwindow_id = parent;
|
|
|
|
|
|
|
|
/* are we running yet? */
|
|
|
|
if (sdlvideosink->init) {
|
ext/sdl/sdlvideosink.*: Fix output stride copying, so that it displays correctly on framebuffer devices that don't ma...
Original commit message from CVS:
* ext/sdl/sdlvideosink.c: (gst_sdlvideosink_supported),
(gst_sdlvideosink_xoverlay_set_xwindow_id),
(gst_sdlvideosink_deinitsdl), (gst_sdlv_process_events),
(gst_sdlvideosink_event_thread), (gst_sdlvideosink_initsdl),
(gst_sdlvideosink_destroy), (gst_sdlvideosink_create),
(gst_sdlvideosink_setcaps), (gst_sdlvideosink_show_frame),
(gst_sdlvideosink_change_state),
(gst_sdlvideosink_navigation_send_event):
* ext/sdl/sdlvideosink.h:
Fix output stride copying, so that it displays correctly on
framebuffer devices that don't match our implict GStreamer stride
arrangement.
Fix locking things. Offer XOverlay only when SDL is running against
X. Make non-scaled (and ugly) embedding work via X Overlay. It can't
actually match the embedded window size because there's no way to
figure out what size that should be from the XOverlay interface.
See comment in sdlvideosink.c
2006-01-27 01:31:12 +00:00
|
|
|
gboolean negotiated;
|
|
|
|
|
|
|
|
g_mutex_lock (sdlvideosink->lock);
|
|
|
|
|
|
|
|
negotiated = (sdlvideosink->overlay != NULL);
|
2003-10-28 09:08:32 +00:00
|
|
|
|
|
|
|
if (negotiated)
|
|
|
|
gst_sdlvideosink_destroy (sdlvideosink);
|
|
|
|
|
ext/sdl/sdlvideosink.*: Fix output stride copying, so that it displays correctly on framebuffer devices that don't ma...
Original commit message from CVS:
* ext/sdl/sdlvideosink.c: (gst_sdlvideosink_supported),
(gst_sdlvideosink_xoverlay_set_xwindow_id),
(gst_sdlvideosink_deinitsdl), (gst_sdlv_process_events),
(gst_sdlvideosink_event_thread), (gst_sdlvideosink_initsdl),
(gst_sdlvideosink_destroy), (gst_sdlvideosink_create),
(gst_sdlvideosink_setcaps), (gst_sdlvideosink_show_frame),
(gst_sdlvideosink_change_state),
(gst_sdlvideosink_navigation_send_event):
* ext/sdl/sdlvideosink.h:
Fix output stride copying, so that it displays correctly on
framebuffer devices that don't match our implict GStreamer stride
arrangement.
Fix locking things. Offer XOverlay only when SDL is running against
X. Make non-scaled (and ugly) embedding work via X Overlay. It can't
actually match the embedded window size because there's no way to
figure out what size that should be from the XOverlay interface.
See comment in sdlvideosink.c
2006-01-27 01:31:12 +00:00
|
|
|
/* Call initsdl to set the WINDOWID env var urk */
|
2003-10-28 09:08:32 +00:00
|
|
|
gst_sdlvideosink_initsdl (sdlvideosink);
|
|
|
|
|
|
|
|
if (negotiated)
|
|
|
|
gst_sdlvideosink_create (sdlvideosink);
|
ext/sdl/sdlvideosink.*: Fix output stride copying, so that it displays correctly on framebuffer devices that don't ma...
Original commit message from CVS:
* ext/sdl/sdlvideosink.c: (gst_sdlvideosink_supported),
(gst_sdlvideosink_xoverlay_set_xwindow_id),
(gst_sdlvideosink_deinitsdl), (gst_sdlv_process_events),
(gst_sdlvideosink_event_thread), (gst_sdlvideosink_initsdl),
(gst_sdlvideosink_destroy), (gst_sdlvideosink_create),
(gst_sdlvideosink_setcaps), (gst_sdlvideosink_show_frame),
(gst_sdlvideosink_change_state),
(gst_sdlvideosink_navigation_send_event):
* ext/sdl/sdlvideosink.h:
Fix output stride copying, so that it displays correctly on
framebuffer devices that don't match our implict GStreamer stride
arrangement.
Fix locking things. Offer XOverlay only when SDL is running against
X. Make non-scaled (and ugly) embedding work via X Overlay. It can't
actually match the embedded window size because there's no way to
figure out what size that should be from the XOverlay interface.
See comment in sdlvideosink.c
2006-01-27 01:31:12 +00:00
|
|
|
|
|
|
|
g_mutex_unlock (sdlvideosink->lock);
|
2003-10-28 09:08:32 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static guint32
|
2004-03-14 22:34:33 +00:00
|
|
|
gst_sdlvideosink_get_sdl_from_fourcc (GstSDLVideoSink * sdlvideosink,
|
|
|
|
guint32 code)
|
2002-01-10 09:58:15 +00:00
|
|
|
{
|
2004-03-14 22:34:33 +00:00
|
|
|
switch (code) {
|
2005-10-28 15:11:18 +00:00
|
|
|
/* Note: SDL_IYUV_OVERLAY does not always work for I420 */
|
2004-03-14 22:34:33 +00:00
|
|
|
case GST_MAKE_FOURCC ('I', '4', '2', '0'):
|
2005-10-28 15:11:18 +00:00
|
|
|
return SDL_YV12_OVERLAY;
|
2004-03-14 22:34:33 +00:00
|
|
|
case GST_MAKE_FOURCC ('Y', 'V', '1', '2'):
|
2002-01-10 09:58:15 +00:00
|
|
|
return SDL_YV12_OVERLAY;
|
2004-03-14 22:34:33 +00:00
|
|
|
case GST_MAKE_FOURCC ('Y', 'U', 'Y', '2'):
|
2002-01-10 09:58:15 +00:00
|
|
|
return SDL_YUY2_OVERLAY;
|
2004-03-14 22:34:33 +00:00
|
|
|
case GST_MAKE_FOURCC ('U', 'Y', 'V', 'Y'):
|
2002-01-10 09:58:15 +00:00
|
|
|
return SDL_UYVY_OVERLAY;
|
2004-03-14 22:34:33 +00:00
|
|
|
case GST_MAKE_FOURCC ('Y', 'V', 'Y', 'U'):
|
2002-01-10 09:58:15 +00:00
|
|
|
return SDL_YVYU_OVERLAY;
|
2003-10-28 09:08:32 +00:00
|
|
|
default:
|
2002-01-10 09:58:15 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-01-15 15:52:09 +00:00
|
|
|
static gboolean
|
2004-03-14 22:34:33 +00:00
|
|
|
gst_sdlvideosink_lock (GstSDLVideoSink * sdlvideosink)
|
2002-02-04 19:36:21 +00:00
|
|
|
{
|
2003-10-28 09:08:32 +00:00
|
|
|
/* assure that we've got a screen */
|
ext/sdl/sdlvideosink.c: Fix SDL videosink and did some cleanups.
Original commit message from CVS:
* ext/sdl/sdlvideosink.c: (gst_sdlvideosink_finalize),
(gst_sdlvideosink_get_times), (gst_sdlvideosink_class_init),
(gst_sdlvideosink_init), (gst_sdlvideosink_lock),
(gst_sdlvideosink_initsdl), (gst_sdlvideosink_create),
(gst_sdlvideosink_show_frame), (gst_sdlvideosink_set_property),
(gst_sdlvideosink_get_property), (gst_sdlvideosink_change_state):
Fix SDL videosink and did some cleanups.
2005-10-27 20:16:40 +00:00
|
|
|
if (!sdlvideosink->screen || !sdlvideosink->overlay)
|
|
|
|
goto no_setup;
|
|
|
|
|
|
|
|
/* Lock SDL/yuv-overlay */
|
|
|
|
if (SDL_MUSTLOCK (sdlvideosink->screen)) {
|
|
|
|
if (SDL_LockSurface (sdlvideosink->screen) < 0)
|
|
|
|
goto could_not_lock;
|
|
|
|
}
|
|
|
|
if (SDL_LockYUVOverlay (sdlvideosink->overlay) < 0)
|
|
|
|
goto lock_yuv;
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
|
|
|
|
/* ERRORS */
|
|
|
|
no_setup:
|
|
|
|
{
|
2004-02-02 17:23:33 +00:00
|
|
|
GST_ELEMENT_ERROR (sdlvideosink, LIBRARY, TOO_LAZY, (NULL),
|
2004-03-15 19:32:27 +00:00
|
|
|
("Tried to lock screen without being set-up"));
|
2003-10-28 09:08:32 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
ext/sdl/sdlvideosink.c: Fix SDL videosink and did some cleanups.
Original commit message from CVS:
* ext/sdl/sdlvideosink.c: (gst_sdlvideosink_finalize),
(gst_sdlvideosink_get_times), (gst_sdlvideosink_class_init),
(gst_sdlvideosink_init), (gst_sdlvideosink_lock),
(gst_sdlvideosink_initsdl), (gst_sdlvideosink_create),
(gst_sdlvideosink_show_frame), (gst_sdlvideosink_set_property),
(gst_sdlvideosink_get_property), (gst_sdlvideosink_change_state):
Fix SDL videosink and did some cleanups.
2005-10-27 20:16:40 +00:00
|
|
|
could_not_lock:
|
|
|
|
{
|
|
|
|
GST_ELEMENT_ERROR (sdlvideosink, LIBRARY, TOO_LAZY, (NULL),
|
|
|
|
("SDL: couldn't lock the SDL video window: %s", SDL_GetError ()));
|
|
|
|
return FALSE;
|
2002-02-04 19:36:21 +00:00
|
|
|
}
|
ext/sdl/sdlvideosink.c: Fix SDL videosink and did some cleanups.
Original commit message from CVS:
* ext/sdl/sdlvideosink.c: (gst_sdlvideosink_finalize),
(gst_sdlvideosink_get_times), (gst_sdlvideosink_class_init),
(gst_sdlvideosink_init), (gst_sdlvideosink_lock),
(gst_sdlvideosink_initsdl), (gst_sdlvideosink_create),
(gst_sdlvideosink_show_frame), (gst_sdlvideosink_set_property),
(gst_sdlvideosink_get_property), (gst_sdlvideosink_change_state):
Fix SDL videosink and did some cleanups.
2005-10-27 20:16:40 +00:00
|
|
|
lock_yuv:
|
|
|
|
{
|
2004-02-02 17:23:33 +00:00
|
|
|
GST_ELEMENT_ERROR (sdlvideosink, LIBRARY, TOO_LAZY, (NULL),
|
2004-03-15 19:32:27 +00:00
|
|
|
("SDL: couldn\'t lock the SDL YUV overlay: %s", SDL_GetError ()));
|
2002-02-04 19:36:21 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void
|
2004-03-14 22:34:33 +00:00
|
|
|
gst_sdlvideosink_unlock (GstSDLVideoSink * sdlvideosink)
|
2002-02-04 19:36:21 +00:00
|
|
|
{
|
2003-10-28 09:08:32 +00:00
|
|
|
/* Unlock SDL_overlay */
|
2004-03-14 22:34:33 +00:00
|
|
|
SDL_UnlockYUVOverlay (sdlvideosink->overlay);
|
|
|
|
if (SDL_MUSTLOCK (sdlvideosink->screen))
|
|
|
|
SDL_UnlockSurface (sdlvideosink->screen);
|
2002-02-04 19:36:21 +00:00
|
|
|
}
|
|
|
|
|
ext/sdl/sdlvideosink.*: Fix output stride copying, so that it displays correctly on framebuffer devices that don't ma...
Original commit message from CVS:
* ext/sdl/sdlvideosink.c: (gst_sdlvideosink_supported),
(gst_sdlvideosink_xoverlay_set_xwindow_id),
(gst_sdlvideosink_deinitsdl), (gst_sdlv_process_events),
(gst_sdlvideosink_event_thread), (gst_sdlvideosink_initsdl),
(gst_sdlvideosink_destroy), (gst_sdlvideosink_create),
(gst_sdlvideosink_setcaps), (gst_sdlvideosink_show_frame),
(gst_sdlvideosink_change_state),
(gst_sdlvideosink_navigation_send_event):
* ext/sdl/sdlvideosink.h:
Fix output stride copying, so that it displays correctly on
framebuffer devices that don't match our implict GStreamer stride
arrangement.
Fix locking things. Offer XOverlay only when SDL is running against
X. Make non-scaled (and ugly) embedding work via X Overlay. It can't
actually match the embedded window size because there's no way to
figure out what size that should be from the XOverlay interface.
See comment in sdlvideosink.c
2006-01-27 01:31:12 +00:00
|
|
|
/* Must be called with ->lock held */
|
2003-10-28 09:08:32 +00:00
|
|
|
static void
|
2004-03-14 22:34:33 +00:00
|
|
|
gst_sdlvideosink_deinitsdl (GstSDLVideoSink * sdlvideosink)
|
2003-10-28 09:08:32 +00:00
|
|
|
{
|
|
|
|
if (sdlvideosink->init) {
|
2005-11-03 16:59:20 +00:00
|
|
|
sdlvideosink->running = FALSE;
|
|
|
|
if (sdlvideosink->event_thread) {
|
ext/sdl/sdlvideosink.*: Fix output stride copying, so that it displays correctly on framebuffer devices that don't ma...
Original commit message from CVS:
* ext/sdl/sdlvideosink.c: (gst_sdlvideosink_supported),
(gst_sdlvideosink_xoverlay_set_xwindow_id),
(gst_sdlvideosink_deinitsdl), (gst_sdlv_process_events),
(gst_sdlvideosink_event_thread), (gst_sdlvideosink_initsdl),
(gst_sdlvideosink_destroy), (gst_sdlvideosink_create),
(gst_sdlvideosink_setcaps), (gst_sdlvideosink_show_frame),
(gst_sdlvideosink_change_state),
(gst_sdlvideosink_navigation_send_event):
* ext/sdl/sdlvideosink.h:
Fix output stride copying, so that it displays correctly on
framebuffer devices that don't match our implict GStreamer stride
arrangement.
Fix locking things. Offer XOverlay only when SDL is running against
X. Make non-scaled (and ugly) embedding work via X Overlay. It can't
actually match the embedded window size because there's no way to
figure out what size that should be from the XOverlay interface.
See comment in sdlvideosink.c
2006-01-27 01:31:12 +00:00
|
|
|
g_mutex_unlock (sdlvideosink->lock);
|
2005-11-03 16:59:20 +00:00
|
|
|
g_thread_join (sdlvideosink->event_thread);
|
ext/sdl/sdlvideosink.*: Fix output stride copying, so that it displays correctly on framebuffer devices that don't ma...
Original commit message from CVS:
* ext/sdl/sdlvideosink.c: (gst_sdlvideosink_supported),
(gst_sdlvideosink_xoverlay_set_xwindow_id),
(gst_sdlvideosink_deinitsdl), (gst_sdlv_process_events),
(gst_sdlvideosink_event_thread), (gst_sdlvideosink_initsdl),
(gst_sdlvideosink_destroy), (gst_sdlvideosink_create),
(gst_sdlvideosink_setcaps), (gst_sdlvideosink_show_frame),
(gst_sdlvideosink_change_state),
(gst_sdlvideosink_navigation_send_event):
* ext/sdl/sdlvideosink.h:
Fix output stride copying, so that it displays correctly on
framebuffer devices that don't match our implict GStreamer stride
arrangement.
Fix locking things. Offer XOverlay only when SDL is running against
X. Make non-scaled (and ugly) embedding work via X Overlay. It can't
actually match the embedded window size because there's no way to
figure out what size that should be from the XOverlay interface.
See comment in sdlvideosink.c
2006-01-27 01:31:12 +00:00
|
|
|
g_mutex_lock (sdlvideosink->lock);
|
2005-11-03 16:59:20 +00:00
|
|
|
sdlvideosink->event_thread = NULL;
|
|
|
|
}
|
|
|
|
|
2003-10-28 09:08:32 +00:00
|
|
|
SDL_Quit ();
|
|
|
|
sdlvideosink->init = FALSE;
|
2005-11-03 16:59:20 +00:00
|
|
|
|
2003-10-28 09:08:32 +00:00
|
|
|
}
|
|
|
|
}
|
2002-02-04 19:36:21 +00:00
|
|
|
|
ext/sdl/sdlvideosink.*: Fix output stride copying, so that it displays correctly on framebuffer devices that don't ma...
Original commit message from CVS:
* ext/sdl/sdlvideosink.c: (gst_sdlvideosink_supported),
(gst_sdlvideosink_xoverlay_set_xwindow_id),
(gst_sdlvideosink_deinitsdl), (gst_sdlv_process_events),
(gst_sdlvideosink_event_thread), (gst_sdlvideosink_initsdl),
(gst_sdlvideosink_destroy), (gst_sdlvideosink_create),
(gst_sdlvideosink_setcaps), (gst_sdlvideosink_show_frame),
(gst_sdlvideosink_change_state),
(gst_sdlvideosink_navigation_send_event):
* ext/sdl/sdlvideosink.h:
Fix output stride copying, so that it displays correctly on
framebuffer devices that don't match our implict GStreamer stride
arrangement.
Fix locking things. Offer XOverlay only when SDL is running against
X. Make non-scaled (and ugly) embedding work via X Overlay. It can't
actually match the embedded window size because there's no way to
figure out what size that should be from the XOverlay interface.
See comment in sdlvideosink.c
2006-01-27 01:31:12 +00:00
|
|
|
/* Process pending events. Call with ->lock held */
|
|
|
|
static void
|
|
|
|
gst_sdlv_process_events (GstSDLVideoSink * sdlvideosink)
|
2005-11-03 16:59:20 +00:00
|
|
|
{
|
ext/sdl/sdlvideosink.*: Fix output stride copying, so that it displays correctly on framebuffer devices that don't ma...
Original commit message from CVS:
* ext/sdl/sdlvideosink.c: (gst_sdlvideosink_supported),
(gst_sdlvideosink_xoverlay_set_xwindow_id),
(gst_sdlvideosink_deinitsdl), (gst_sdlv_process_events),
(gst_sdlvideosink_event_thread), (gst_sdlvideosink_initsdl),
(gst_sdlvideosink_destroy), (gst_sdlvideosink_create),
(gst_sdlvideosink_setcaps), (gst_sdlvideosink_show_frame),
(gst_sdlvideosink_change_state),
(gst_sdlvideosink_navigation_send_event):
* ext/sdl/sdlvideosink.h:
Fix output stride copying, so that it displays correctly on
framebuffer devices that don't match our implict GStreamer stride
arrangement.
Fix locking things. Offer XOverlay only when SDL is running against
X. Make non-scaled (and ugly) embedding work via X Overlay. It can't
actually match the embedded window size because there's no way to
figure out what size that should be from the XOverlay interface.
See comment in sdlvideosink.c
2006-01-27 01:31:12 +00:00
|
|
|
SDL_Event event;
|
|
|
|
int numevents;
|
|
|
|
char *keysym;
|
2005-11-03 16:59:20 +00:00
|
|
|
|
ext/sdl/sdlvideosink.*: Fix output stride copying, so that it displays correctly on framebuffer devices that don't ma...
Original commit message from CVS:
* ext/sdl/sdlvideosink.c: (gst_sdlvideosink_supported),
(gst_sdlvideosink_xoverlay_set_xwindow_id),
(gst_sdlvideosink_deinitsdl), (gst_sdlv_process_events),
(gst_sdlvideosink_event_thread), (gst_sdlvideosink_initsdl),
(gst_sdlvideosink_destroy), (gst_sdlvideosink_create),
(gst_sdlvideosink_setcaps), (gst_sdlvideosink_show_frame),
(gst_sdlvideosink_change_state),
(gst_sdlvideosink_navigation_send_event):
* ext/sdl/sdlvideosink.h:
Fix output stride copying, so that it displays correctly on
framebuffer devices that don't match our implict GStreamer stride
arrangement.
Fix locking things. Offer XOverlay only when SDL is running against
X. Make non-scaled (and ugly) embedding work via X Overlay. It can't
actually match the embedded window size because there's no way to
figure out what size that should be from the XOverlay interface.
See comment in sdlvideosink.c
2006-01-27 01:31:12 +00:00
|
|
|
do {
|
2005-11-03 16:59:20 +00:00
|
|
|
SDL_PumpEvents ();
|
ext/sdl/sdlvideosink.*: Fix output stride copying, so that it displays correctly on framebuffer devices that don't ma...
Original commit message from CVS:
* ext/sdl/sdlvideosink.c: (gst_sdlvideosink_supported),
(gst_sdlvideosink_xoverlay_set_xwindow_id),
(gst_sdlvideosink_deinitsdl), (gst_sdlv_process_events),
(gst_sdlvideosink_event_thread), (gst_sdlvideosink_initsdl),
(gst_sdlvideosink_destroy), (gst_sdlvideosink_create),
(gst_sdlvideosink_setcaps), (gst_sdlvideosink_show_frame),
(gst_sdlvideosink_change_state),
(gst_sdlvideosink_navigation_send_event):
* ext/sdl/sdlvideosink.h:
Fix output stride copying, so that it displays correctly on
framebuffer devices that don't match our implict GStreamer stride
arrangement.
Fix locking things. Offer XOverlay only when SDL is running against
X. Make non-scaled (and ugly) embedding work via X Overlay. It can't
actually match the embedded window size because there's no way to
figure out what size that should be from the XOverlay interface.
See comment in sdlvideosink.c
2006-01-27 01:31:12 +00:00
|
|
|
numevents = SDL_PeepEvents (&event, 1, SDL_GETEVENT,
|
2005-11-03 16:59:20 +00:00
|
|
|
SDL_KEYDOWNMASK | SDL_KEYUPMASK |
|
ext/sdl/sdlvideosink.*: Fix output stride copying, so that it displays correctly on framebuffer devices that don't ma...
Original commit message from CVS:
* ext/sdl/sdlvideosink.c: (gst_sdlvideosink_supported),
(gst_sdlvideosink_xoverlay_set_xwindow_id),
(gst_sdlvideosink_deinitsdl), (gst_sdlv_process_events),
(gst_sdlvideosink_event_thread), (gst_sdlvideosink_initsdl),
(gst_sdlvideosink_destroy), (gst_sdlvideosink_create),
(gst_sdlvideosink_setcaps), (gst_sdlvideosink_show_frame),
(gst_sdlvideosink_change_state),
(gst_sdlvideosink_navigation_send_event):
* ext/sdl/sdlvideosink.h:
Fix output stride copying, so that it displays correctly on
framebuffer devices that don't match our implict GStreamer stride
arrangement.
Fix locking things. Offer XOverlay only when SDL is running against
X. Make non-scaled (and ugly) embedding work via X Overlay. It can't
actually match the embedded window size because there's no way to
figure out what size that should be from the XOverlay interface.
See comment in sdlvideosink.c
2006-01-27 01:31:12 +00:00
|
|
|
SDL_MOUSEMOTIONMASK | SDL_MOUSEBUTTONDOWNMASK |
|
|
|
|
SDL_MOUSEBUTTONUPMASK | SDL_QUITMASK | SDL_VIDEORESIZEMASK);
|
2005-11-03 16:59:20 +00:00
|
|
|
|
ext/sdl/sdlvideosink.*: Fix output stride copying, so that it displays correctly on framebuffer devices that don't ma...
Original commit message from CVS:
* ext/sdl/sdlvideosink.c: (gst_sdlvideosink_supported),
(gst_sdlvideosink_xoverlay_set_xwindow_id),
(gst_sdlvideosink_deinitsdl), (gst_sdlv_process_events),
(gst_sdlvideosink_event_thread), (gst_sdlvideosink_initsdl),
(gst_sdlvideosink_destroy), (gst_sdlvideosink_create),
(gst_sdlvideosink_setcaps), (gst_sdlvideosink_show_frame),
(gst_sdlvideosink_change_state),
(gst_sdlvideosink_navigation_send_event):
* ext/sdl/sdlvideosink.h:
Fix output stride copying, so that it displays correctly on
framebuffer devices that don't match our implict GStreamer stride
arrangement.
Fix locking things. Offer XOverlay only when SDL is running against
X. Make non-scaled (and ugly) embedding work via X Overlay. It can't
actually match the embedded window size because there's no way to
figure out what size that should be from the XOverlay interface.
See comment in sdlvideosink.c
2006-01-27 01:31:12 +00:00
|
|
|
if (numevents > 0 && (event.type == SDL_KEYUP || event.type == SDL_KEYDOWN)) {
|
|
|
|
keysym = SDL_GetKeyName (event.key.keysym.sym);
|
|
|
|
}
|
2005-11-03 16:59:20 +00:00
|
|
|
|
ext/sdl/sdlvideosink.*: Fix output stride copying, so that it displays correctly on framebuffer devices that don't ma...
Original commit message from CVS:
* ext/sdl/sdlvideosink.c: (gst_sdlvideosink_supported),
(gst_sdlvideosink_xoverlay_set_xwindow_id),
(gst_sdlvideosink_deinitsdl), (gst_sdlv_process_events),
(gst_sdlvideosink_event_thread), (gst_sdlvideosink_initsdl),
(gst_sdlvideosink_destroy), (gst_sdlvideosink_create),
(gst_sdlvideosink_setcaps), (gst_sdlvideosink_show_frame),
(gst_sdlvideosink_change_state),
(gst_sdlvideosink_navigation_send_event):
* ext/sdl/sdlvideosink.h:
Fix output stride copying, so that it displays correctly on
framebuffer devices that don't match our implict GStreamer stride
arrangement.
Fix locking things. Offer XOverlay only when SDL is running against
X. Make non-scaled (and ugly) embedding work via X Overlay. It can't
actually match the embedded window size because there's no way to
figure out what size that should be from the XOverlay interface.
See comment in sdlvideosink.c
2006-01-27 01:31:12 +00:00
|
|
|
if (numevents > 0) {
|
|
|
|
g_mutex_unlock (sdlvideosink->lock);
|
2005-11-03 16:59:20 +00:00
|
|
|
switch (event.type) {
|
2006-01-11 20:59:39 +00:00
|
|
|
case SDL_MOUSEMOTION:
|
|
|
|
gst_navigation_send_mouse_event (GST_NAVIGATION (sdlvideosink),
|
|
|
|
"mouse-move", 0, event.motion.x, event.motion.y);
|
|
|
|
break;
|
|
|
|
case SDL_MOUSEBUTTONDOWN:
|
|
|
|
gst_navigation_send_mouse_event (GST_NAVIGATION (sdlvideosink),
|
|
|
|
"mouse-button-press",
|
|
|
|
event.button.button, event.button.x, event.button.y);
|
|
|
|
break;
|
|
|
|
case SDL_MOUSEBUTTONUP:
|
|
|
|
gst_navigation_send_mouse_event (GST_NAVIGATION (sdlvideosink),
|
|
|
|
"mouse-button-release",
|
|
|
|
event.button.button, event.button.x, event.button.y);
|
|
|
|
break;
|
|
|
|
case SDL_KEYUP:
|
|
|
|
GST_DEBUG ("key press event %s !",
|
|
|
|
SDL_GetKeyName (event.key.keysym.sym));
|
|
|
|
gst_navigation_send_key_event (GST_NAVIGATION (sdlvideosink),
|
ext/sdl/sdlvideosink.*: Fix output stride copying, so that it displays correctly on framebuffer devices that don't ma...
Original commit message from CVS:
* ext/sdl/sdlvideosink.c: (gst_sdlvideosink_supported),
(gst_sdlvideosink_xoverlay_set_xwindow_id),
(gst_sdlvideosink_deinitsdl), (gst_sdlv_process_events),
(gst_sdlvideosink_event_thread), (gst_sdlvideosink_initsdl),
(gst_sdlvideosink_destroy), (gst_sdlvideosink_create),
(gst_sdlvideosink_setcaps), (gst_sdlvideosink_show_frame),
(gst_sdlvideosink_change_state),
(gst_sdlvideosink_navigation_send_event):
* ext/sdl/sdlvideosink.h:
Fix output stride copying, so that it displays correctly on
framebuffer devices that don't match our implict GStreamer stride
arrangement.
Fix locking things. Offer XOverlay only when SDL is running against
X. Make non-scaled (and ugly) embedding work via X Overlay. It can't
actually match the embedded window size because there's no way to
figure out what size that should be from the XOverlay interface.
See comment in sdlvideosink.c
2006-01-27 01:31:12 +00:00
|
|
|
"key-release", keysym);
|
2006-01-11 20:59:39 +00:00
|
|
|
break;
|
2005-11-03 16:59:20 +00:00
|
|
|
case SDL_KEYDOWN:
|
|
|
|
if (SDLK_ESCAPE != event.key.keysym.sym) {
|
2006-01-11 20:59:39 +00:00
|
|
|
GST_DEBUG ("key press event %s !",
|
|
|
|
SDL_GetKeyName (event.key.keysym.sym));
|
|
|
|
gst_navigation_send_key_event (GST_NAVIGATION (sdlvideosink),
|
ext/sdl/sdlvideosink.*: Fix output stride copying, so that it displays correctly on framebuffer devices that don't ma...
Original commit message from CVS:
* ext/sdl/sdlvideosink.c: (gst_sdlvideosink_supported),
(gst_sdlvideosink_xoverlay_set_xwindow_id),
(gst_sdlvideosink_deinitsdl), (gst_sdlv_process_events),
(gst_sdlvideosink_event_thread), (gst_sdlvideosink_initsdl),
(gst_sdlvideosink_destroy), (gst_sdlvideosink_create),
(gst_sdlvideosink_setcaps), (gst_sdlvideosink_show_frame),
(gst_sdlvideosink_change_state),
(gst_sdlvideosink_navigation_send_event):
* ext/sdl/sdlvideosink.h:
Fix output stride copying, so that it displays correctly on
framebuffer devices that don't match our implict GStreamer stride
arrangement.
Fix locking things. Offer XOverlay only when SDL is running against
X. Make non-scaled (and ugly) embedding work via X Overlay. It can't
actually match the embedded window size because there's no way to
figure out what size that should be from the XOverlay interface.
See comment in sdlvideosink.c
2006-01-27 01:31:12 +00:00
|
|
|
"key-press", keysym);
|
2005-11-03 16:59:20 +00:00
|
|
|
break;
|
|
|
|
} else {
|
|
|
|
/* fall through */
|
|
|
|
}
|
|
|
|
case SDL_QUIT:
|
|
|
|
sdlvideosink->running = FALSE;
|
|
|
|
GST_ELEMENT_ERROR (sdlvideosink, RESOURCE, OPEN_WRITE,
|
|
|
|
("Video output device is gone."),
|
|
|
|
("We were running fullscreen and user "
|
|
|
|
"pressed the ESC key, stopping playback."));
|
|
|
|
break;
|
ext/sdl/sdlvideosink.*: Fix output stride copying, so that it displays correctly on framebuffer devices that don't ma...
Original commit message from CVS:
* ext/sdl/sdlvideosink.c: (gst_sdlvideosink_supported),
(gst_sdlvideosink_xoverlay_set_xwindow_id),
(gst_sdlvideosink_deinitsdl), (gst_sdlv_process_events),
(gst_sdlvideosink_event_thread), (gst_sdlvideosink_initsdl),
(gst_sdlvideosink_destroy), (gst_sdlvideosink_create),
(gst_sdlvideosink_setcaps), (gst_sdlvideosink_show_frame),
(gst_sdlvideosink_change_state),
(gst_sdlvideosink_navigation_send_event):
* ext/sdl/sdlvideosink.h:
Fix output stride copying, so that it displays correctly on
framebuffer devices that don't match our implict GStreamer stride
arrangement.
Fix locking things. Offer XOverlay only when SDL is running against
X. Make non-scaled (and ugly) embedding work via X Overlay. It can't
actually match the embedded window size because there's no way to
figure out what size that should be from the XOverlay interface.
See comment in sdlvideosink.c
2006-01-27 01:31:12 +00:00
|
|
|
case SDL_VIDEORESIZE:
|
|
|
|
/* create a SDL window of the size requested by the user */
|
|
|
|
g_mutex_lock (sdlvideosink->lock);
|
|
|
|
GST_VIDEO_SINK_WIDTH (sdlvideosink) = event.resize.w;
|
|
|
|
GST_VIDEO_SINK_HEIGHT (sdlvideosink) = event.resize.h;
|
|
|
|
gst_sdlvideosink_create (sdlvideosink);
|
|
|
|
g_mutex_unlock (sdlvideosink->lock);
|
|
|
|
break;
|
2005-11-03 16:59:20 +00:00
|
|
|
}
|
ext/sdl/sdlvideosink.*: Fix output stride copying, so that it displays correctly on framebuffer devices that don't ma...
Original commit message from CVS:
* ext/sdl/sdlvideosink.c: (gst_sdlvideosink_supported),
(gst_sdlvideosink_xoverlay_set_xwindow_id),
(gst_sdlvideosink_deinitsdl), (gst_sdlv_process_events),
(gst_sdlvideosink_event_thread), (gst_sdlvideosink_initsdl),
(gst_sdlvideosink_destroy), (gst_sdlvideosink_create),
(gst_sdlvideosink_setcaps), (gst_sdlvideosink_show_frame),
(gst_sdlvideosink_change_state),
(gst_sdlvideosink_navigation_send_event):
* ext/sdl/sdlvideosink.h:
Fix output stride copying, so that it displays correctly on
framebuffer devices that don't match our implict GStreamer stride
arrangement.
Fix locking things. Offer XOverlay only when SDL is running against
X. Make non-scaled (and ugly) embedding work via X Overlay. It can't
actually match the embedded window size because there's no way to
figure out what size that should be from the XOverlay interface.
See comment in sdlvideosink.c
2006-01-27 01:31:12 +00:00
|
|
|
g_mutex_lock (sdlvideosink->lock);
|
2005-11-03 16:59:20 +00:00
|
|
|
}
|
ext/sdl/sdlvideosink.*: Fix output stride copying, so that it displays correctly on framebuffer devices that don't ma...
Original commit message from CVS:
* ext/sdl/sdlvideosink.c: (gst_sdlvideosink_supported),
(gst_sdlvideosink_xoverlay_set_xwindow_id),
(gst_sdlvideosink_deinitsdl), (gst_sdlv_process_events),
(gst_sdlvideosink_event_thread), (gst_sdlvideosink_initsdl),
(gst_sdlvideosink_destroy), (gst_sdlvideosink_create),
(gst_sdlvideosink_setcaps), (gst_sdlvideosink_show_frame),
(gst_sdlvideosink_change_state),
(gst_sdlvideosink_navigation_send_event):
* ext/sdl/sdlvideosink.h:
Fix output stride copying, so that it displays correctly on
framebuffer devices that don't match our implict GStreamer stride
arrangement.
Fix locking things. Offer XOverlay only when SDL is running against
X. Make non-scaled (and ugly) embedding work via X Overlay. It can't
actually match the embedded window size because there's no way to
figure out what size that should be from the XOverlay interface.
See comment in sdlvideosink.c
2006-01-27 01:31:12 +00:00
|
|
|
} while (numevents > 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
static gpointer
|
|
|
|
gst_sdlvideosink_event_thread (GstSDLVideoSink * sdlvideosink)
|
|
|
|
{
|
|
|
|
g_mutex_lock (sdlvideosink->lock);
|
|
|
|
while (sdlvideosink->running) {
|
|
|
|
gst_sdlv_process_events (sdlvideosink);
|
2005-11-03 16:59:20 +00:00
|
|
|
|
ext/sdl/sdlvideosink.*: Fix output stride copying, so that it displays correctly on framebuffer devices that don't ma...
Original commit message from CVS:
* ext/sdl/sdlvideosink.c: (gst_sdlvideosink_supported),
(gst_sdlvideosink_xoverlay_set_xwindow_id),
(gst_sdlvideosink_deinitsdl), (gst_sdlv_process_events),
(gst_sdlvideosink_event_thread), (gst_sdlvideosink_initsdl),
(gst_sdlvideosink_destroy), (gst_sdlvideosink_create),
(gst_sdlvideosink_setcaps), (gst_sdlvideosink_show_frame),
(gst_sdlvideosink_change_state),
(gst_sdlvideosink_navigation_send_event):
* ext/sdl/sdlvideosink.h:
Fix output stride copying, so that it displays correctly on
framebuffer devices that don't match our implict GStreamer stride
arrangement.
Fix locking things. Offer XOverlay only when SDL is running against
X. Make non-scaled (and ugly) embedding work via X Overlay. It can't
actually match the embedded window size because there's no way to
figure out what size that should be from the XOverlay interface.
See comment in sdlvideosink.c
2006-01-27 01:31:12 +00:00
|
|
|
/* Done events, sleep for 50 ms */
|
|
|
|
g_mutex_unlock (sdlvideosink->lock);
|
|
|
|
g_usleep (50000);
|
|
|
|
g_mutex_lock (sdlvideosink->lock);
|
2005-11-03 16:59:20 +00:00
|
|
|
}
|
ext/sdl/sdlvideosink.*: Fix output stride copying, so that it displays correctly on framebuffer devices that don't ma...
Original commit message from CVS:
* ext/sdl/sdlvideosink.c: (gst_sdlvideosink_supported),
(gst_sdlvideosink_xoverlay_set_xwindow_id),
(gst_sdlvideosink_deinitsdl), (gst_sdlv_process_events),
(gst_sdlvideosink_event_thread), (gst_sdlvideosink_initsdl),
(gst_sdlvideosink_destroy), (gst_sdlvideosink_create),
(gst_sdlvideosink_setcaps), (gst_sdlvideosink_show_frame),
(gst_sdlvideosink_change_state),
(gst_sdlvideosink_navigation_send_event):
* ext/sdl/sdlvideosink.h:
Fix output stride copying, so that it displays correctly on
framebuffer devices that don't match our implict GStreamer stride
arrangement.
Fix locking things. Offer XOverlay only when SDL is running against
X. Make non-scaled (and ugly) embedding work via X Overlay. It can't
actually match the embedded window size because there's no way to
figure out what size that should be from the XOverlay interface.
See comment in sdlvideosink.c
2006-01-27 01:31:12 +00:00
|
|
|
g_mutex_unlock (sdlvideosink->lock);
|
2005-11-03 16:59:20 +00:00
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
ext/sdl/sdlvideosink.*: Fix output stride copying, so that it displays correctly on framebuffer devices that don't ma...
Original commit message from CVS:
* ext/sdl/sdlvideosink.c: (gst_sdlvideosink_supported),
(gst_sdlvideosink_xoverlay_set_xwindow_id),
(gst_sdlvideosink_deinitsdl), (gst_sdlv_process_events),
(gst_sdlvideosink_event_thread), (gst_sdlvideosink_initsdl),
(gst_sdlvideosink_destroy), (gst_sdlvideosink_create),
(gst_sdlvideosink_setcaps), (gst_sdlvideosink_show_frame),
(gst_sdlvideosink_change_state),
(gst_sdlvideosink_navigation_send_event):
* ext/sdl/sdlvideosink.h:
Fix output stride copying, so that it displays correctly on
framebuffer devices that don't match our implict GStreamer stride
arrangement.
Fix locking things. Offer XOverlay only when SDL is running against
X. Make non-scaled (and ugly) embedding work via X Overlay. It can't
actually match the embedded window size because there's no way to
figure out what size that should be from the XOverlay interface.
See comment in sdlvideosink.c
2006-01-27 01:31:12 +00:00
|
|
|
/* Must be called with the SDL lock held */
|
2002-02-04 19:36:21 +00:00
|
|
|
static gboolean
|
2004-03-14 22:34:33 +00:00
|
|
|
gst_sdlvideosink_initsdl (GstSDLVideoSink * sdlvideosink)
|
2001-12-20 23:21:15 +00:00
|
|
|
{
|
2003-10-28 09:08:32 +00:00
|
|
|
gst_sdlvideosink_deinitsdl (sdlvideosink);
|
|
|
|
|
ext/sdl/sdlvideosink.*: Fix output stride copying, so that it displays correctly on framebuffer devices that don't ma...
Original commit message from CVS:
* ext/sdl/sdlvideosink.c: (gst_sdlvideosink_supported),
(gst_sdlvideosink_xoverlay_set_xwindow_id),
(gst_sdlvideosink_deinitsdl), (gst_sdlv_process_events),
(gst_sdlvideosink_event_thread), (gst_sdlvideosink_initsdl),
(gst_sdlvideosink_destroy), (gst_sdlvideosink_create),
(gst_sdlvideosink_setcaps), (gst_sdlvideosink_show_frame),
(gst_sdlvideosink_change_state),
(gst_sdlvideosink_navigation_send_event):
* ext/sdl/sdlvideosink.h:
Fix output stride copying, so that it displays correctly on
framebuffer devices that don't match our implict GStreamer stride
arrangement.
Fix locking things. Offer XOverlay only when SDL is running against
X. Make non-scaled (and ugly) embedding work via X Overlay. It can't
actually match the embedded window size because there's no way to
figure out what size that should be from the XOverlay interface.
See comment in sdlvideosink.c
2006-01-27 01:31:12 +00:00
|
|
|
if (sdlvideosink->is_xwindows && !sdlvideosink->xwindow_id) {
|
|
|
|
g_mutex_unlock (sdlvideosink->lock);
|
|
|
|
gst_x_overlay_prepare_xwindow_id (GST_X_OVERLAY (sdlvideosink));
|
|
|
|
g_mutex_lock (sdlvideosink->lock);
|
|
|
|
}
|
2004-11-10 22:01:20 +00:00
|
|
|
|
2003-10-28 09:08:32 +00:00
|
|
|
if (!sdlvideosink->xwindow_id) {
|
2004-03-14 22:34:33 +00:00
|
|
|
unsetenv ("SDL_WINDOWID");
|
2003-10-28 09:08:32 +00:00
|
|
|
} else {
|
|
|
|
char SDL_hack[32];
|
2004-03-14 22:34:33 +00:00
|
|
|
|
|
|
|
sprintf (SDL_hack, "%lu", sdlvideosink->xwindow_id);
|
|
|
|
setenv ("SDL_WINDOWID", SDL_hack, 1);
|
2003-10-28 09:08:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Initialize the SDL library */
|
ext/sdl/sdlvideosink.c: Fix SDL videosink and did some cleanups.
Original commit message from CVS:
* ext/sdl/sdlvideosink.c: (gst_sdlvideosink_finalize),
(gst_sdlvideosink_get_times), (gst_sdlvideosink_class_init),
(gst_sdlvideosink_init), (gst_sdlvideosink_lock),
(gst_sdlvideosink_initsdl), (gst_sdlvideosink_create),
(gst_sdlvideosink_show_frame), (gst_sdlvideosink_set_property),
(gst_sdlvideosink_get_property), (gst_sdlvideosink_change_state):
Fix SDL videosink and did some cleanups.
2005-10-27 20:16:40 +00:00
|
|
|
if (SDL_Init (SDL_INIT_VIDEO | SDL_INIT_NOPARACHUTE) < 0)
|
|
|
|
goto init_failed;
|
2003-10-28 09:08:32 +00:00
|
|
|
|
2004-11-10 22:01:20 +00:00
|
|
|
sdlvideosink->init = TRUE;
|
|
|
|
|
2005-11-03 16:59:20 +00:00
|
|
|
sdlvideosink->running = TRUE;
|
|
|
|
sdlvideosink->event_thread =
|
|
|
|
g_thread_create ((GThreadFunc) gst_sdlvideosink_event_thread,
|
|
|
|
sdlvideosink, TRUE, NULL);
|
|
|
|
|
2003-10-28 09:08:32 +00:00
|
|
|
return TRUE;
|
ext/sdl/sdlvideosink.c: Fix SDL videosink and did some cleanups.
Original commit message from CVS:
* ext/sdl/sdlvideosink.c: (gst_sdlvideosink_finalize),
(gst_sdlvideosink_get_times), (gst_sdlvideosink_class_init),
(gst_sdlvideosink_init), (gst_sdlvideosink_lock),
(gst_sdlvideosink_initsdl), (gst_sdlvideosink_create),
(gst_sdlvideosink_show_frame), (gst_sdlvideosink_set_property),
(gst_sdlvideosink_get_property), (gst_sdlvideosink_change_state):
Fix SDL videosink and did some cleanups.
2005-10-27 20:16:40 +00:00
|
|
|
|
|
|
|
/* ERRORS */
|
|
|
|
init_failed:
|
|
|
|
{
|
|
|
|
GST_ELEMENT_ERROR (sdlvideosink, LIBRARY, INIT, (NULL),
|
|
|
|
("Couldn't initialize SDL: %s", SDL_GetError ()));
|
|
|
|
return FALSE;
|
|
|
|
}
|
2003-10-28 09:08:32 +00:00
|
|
|
}
|
|
|
|
|
ext/sdl/sdlvideosink.*: Fix output stride copying, so that it displays correctly on framebuffer devices that don't ma...
Original commit message from CVS:
* ext/sdl/sdlvideosink.c: (gst_sdlvideosink_supported),
(gst_sdlvideosink_xoverlay_set_xwindow_id),
(gst_sdlvideosink_deinitsdl), (gst_sdlv_process_events),
(gst_sdlvideosink_event_thread), (gst_sdlvideosink_initsdl),
(gst_sdlvideosink_destroy), (gst_sdlvideosink_create),
(gst_sdlvideosink_setcaps), (gst_sdlvideosink_show_frame),
(gst_sdlvideosink_change_state),
(gst_sdlvideosink_navigation_send_event):
* ext/sdl/sdlvideosink.h:
Fix output stride copying, so that it displays correctly on
framebuffer devices that don't match our implict GStreamer stride
arrangement.
Fix locking things. Offer XOverlay only when SDL is running against
X. Make non-scaled (and ugly) embedding work via X Overlay. It can't
actually match the embedded window size because there's no way to
figure out what size that should be from the XOverlay interface.
See comment in sdlvideosink.c
2006-01-27 01:31:12 +00:00
|
|
|
/* Must be called with the sdl lock held */
|
2003-10-28 09:08:32 +00:00
|
|
|
static void
|
2004-03-14 22:34:33 +00:00
|
|
|
gst_sdlvideosink_destroy (GstSDLVideoSink * sdlvideosink)
|
2003-10-28 09:08:32 +00:00
|
|
|
{
|
|
|
|
if (sdlvideosink->overlay) {
|
2004-03-14 22:34:33 +00:00
|
|
|
SDL_FreeYUVOverlay (sdlvideosink->overlay);
|
2003-10-28 09:08:32 +00:00
|
|
|
sdlvideosink->overlay = NULL;
|
|
|
|
}
|
2002-01-10 09:58:15 +00:00
|
|
|
|
2003-10-28 09:08:32 +00:00
|
|
|
if (sdlvideosink->screen) {
|
|
|
|
SDL_FreeSurface (sdlvideosink->screen);
|
|
|
|
sdlvideosink->screen = NULL;
|
|
|
|
}
|
ext/sdl/sdlvideosink.*: Fix output stride copying, so that it displays correctly on framebuffer devices that don't ma...
Original commit message from CVS:
* ext/sdl/sdlvideosink.c: (gst_sdlvideosink_supported),
(gst_sdlvideosink_xoverlay_set_xwindow_id),
(gst_sdlvideosink_deinitsdl), (gst_sdlv_process_events),
(gst_sdlvideosink_event_thread), (gst_sdlvideosink_initsdl),
(gst_sdlvideosink_destroy), (gst_sdlvideosink_create),
(gst_sdlvideosink_setcaps), (gst_sdlvideosink_show_frame),
(gst_sdlvideosink_change_state),
(gst_sdlvideosink_navigation_send_event):
* ext/sdl/sdlvideosink.h:
Fix output stride copying, so that it displays correctly on
framebuffer devices that don't match our implict GStreamer stride
arrangement.
Fix locking things. Offer XOverlay only when SDL is running against
X. Make non-scaled (and ugly) embedding work via X Overlay. It can't
actually match the embedded window size because there's no way to
figure out what size that should be from the XOverlay interface.
See comment in sdlvideosink.c
2006-01-27 01:31:12 +00:00
|
|
|
sdlvideosink->xwindow_id = 0;
|
2003-10-28 09:08:32 +00:00
|
|
|
}
|
|
|
|
|
ext/sdl/sdlvideosink.*: Fix output stride copying, so that it displays correctly on framebuffer devices that don't ma...
Original commit message from CVS:
* ext/sdl/sdlvideosink.c: (gst_sdlvideosink_supported),
(gst_sdlvideosink_xoverlay_set_xwindow_id),
(gst_sdlvideosink_deinitsdl), (gst_sdlv_process_events),
(gst_sdlvideosink_event_thread), (gst_sdlvideosink_initsdl),
(gst_sdlvideosink_destroy), (gst_sdlvideosink_create),
(gst_sdlvideosink_setcaps), (gst_sdlvideosink_show_frame),
(gst_sdlvideosink_change_state),
(gst_sdlvideosink_navigation_send_event):
* ext/sdl/sdlvideosink.h:
Fix output stride copying, so that it displays correctly on
framebuffer devices that don't match our implict GStreamer stride
arrangement.
Fix locking things. Offer XOverlay only when SDL is running against
X. Make non-scaled (and ugly) embedding work via X Overlay. It can't
actually match the embedded window size because there's no way to
figure out what size that should be from the XOverlay interface.
See comment in sdlvideosink.c
2006-01-27 01:31:12 +00:00
|
|
|
/* Must be called with the sdl lock held */
|
2003-10-28 09:08:32 +00:00
|
|
|
static gboolean
|
2004-03-14 22:34:33 +00:00
|
|
|
gst_sdlvideosink_create (GstSDLVideoSink * sdlvideosink)
|
2003-10-28 09:08:32 +00:00
|
|
|
{
|
2005-09-19 21:47:54 +00:00
|
|
|
if (GST_VIDEO_SINK_HEIGHT (sdlvideosink) <= 0)
|
|
|
|
GST_VIDEO_SINK_HEIGHT (sdlvideosink) = sdlvideosink->height;
|
|
|
|
if (GST_VIDEO_SINK_WIDTH (sdlvideosink) <= 0)
|
|
|
|
GST_VIDEO_SINK_WIDTH (sdlvideosink) = sdlvideosink->width;
|
2003-10-28 09:08:32 +00:00
|
|
|
|
|
|
|
gst_sdlvideosink_destroy (sdlvideosink);
|
2001-12-20 23:21:15 +00:00
|
|
|
|
ext/sdl/sdlvideosink.*: Fix output stride copying, so that it displays correctly on framebuffer devices that don't ma...
Original commit message from CVS:
* ext/sdl/sdlvideosink.c: (gst_sdlvideosink_supported),
(gst_sdlvideosink_xoverlay_set_xwindow_id),
(gst_sdlvideosink_deinitsdl), (gst_sdlv_process_events),
(gst_sdlvideosink_event_thread), (gst_sdlvideosink_initsdl),
(gst_sdlvideosink_destroy), (gst_sdlvideosink_create),
(gst_sdlvideosink_setcaps), (gst_sdlvideosink_show_frame),
(gst_sdlvideosink_change_state),
(gst_sdlvideosink_navigation_send_event):
* ext/sdl/sdlvideosink.h:
Fix output stride copying, so that it displays correctly on
framebuffer devices that don't match our implict GStreamer stride
arrangement.
Fix locking things. Offer XOverlay only when SDL is running against
X. Make non-scaled (and ugly) embedding work via X Overlay. It can't
actually match the embedded window size because there's no way to
figure out what size that should be from the XOverlay interface.
See comment in sdlvideosink.c
2006-01-27 01:31:12 +00:00
|
|
|
if (sdlvideosink->is_xwindows && !sdlvideosink->xwindow_id) {
|
|
|
|
g_mutex_unlock (sdlvideosink->lock);
|
|
|
|
gst_x_overlay_prepare_xwindow_id (GST_X_OVERLAY (sdlvideosink));
|
|
|
|
g_mutex_lock (sdlvideosink->lock);
|
|
|
|
}
|
2004-11-10 22:01:20 +00:00
|
|
|
|
2002-01-10 09:58:15 +00:00
|
|
|
/* create a SDL window of the size requested by the user */
|
2005-10-31 18:07:30 +00:00
|
|
|
if (sdlvideosink->full_screen) {
|
|
|
|
sdlvideosink->screen =
|
|
|
|
SDL_SetVideoMode (GST_VIDEO_SINK_WIDTH (sdlvideosink),
|
|
|
|
GST_VIDEO_SINK_HEIGHT (sdlvideosink), 0,
|
2005-10-31 20:57:42 +00:00
|
|
|
SDL_SWSURFACE | SDL_FULLSCREEN);
|
2005-10-31 18:07:30 +00:00
|
|
|
} else {
|
|
|
|
sdlvideosink->screen =
|
|
|
|
SDL_SetVideoMode (GST_VIDEO_SINK_WIDTH (sdlvideosink),
|
|
|
|
GST_VIDEO_SINK_HEIGHT (sdlvideosink), 0, SDL_HWSURFACE | SDL_RESIZABLE);
|
|
|
|
}
|
ext/sdl/sdlvideosink.c: Fix SDL videosink and did some cleanups.
Original commit message from CVS:
* ext/sdl/sdlvideosink.c: (gst_sdlvideosink_finalize),
(gst_sdlvideosink_get_times), (gst_sdlvideosink_class_init),
(gst_sdlvideosink_init), (gst_sdlvideosink_lock),
(gst_sdlvideosink_initsdl), (gst_sdlvideosink_create),
(gst_sdlvideosink_show_frame), (gst_sdlvideosink_set_property),
(gst_sdlvideosink_get_property), (gst_sdlvideosink_change_state):
Fix SDL videosink and did some cleanups.
2005-10-27 20:16:40 +00:00
|
|
|
if (sdlvideosink->screen == NULL)
|
|
|
|
goto no_screen;
|
2002-01-10 09:58:15 +00:00
|
|
|
|
2003-10-28 09:08:32 +00:00
|
|
|
/* create a new YUV overlay */
|
2004-03-14 22:34:33 +00:00
|
|
|
sdlvideosink->overlay = SDL_CreateYUVOverlay (sdlvideosink->width,
|
|
|
|
sdlvideosink->height, sdlvideosink->format, sdlvideosink->screen);
|
ext/sdl/sdlvideosink.c: Fix SDL videosink and did some cleanups.
Original commit message from CVS:
* ext/sdl/sdlvideosink.c: (gst_sdlvideosink_finalize),
(gst_sdlvideosink_get_times), (gst_sdlvideosink_class_init),
(gst_sdlvideosink_init), (gst_sdlvideosink_lock),
(gst_sdlvideosink_initsdl), (gst_sdlvideosink_create),
(gst_sdlvideosink_show_frame), (gst_sdlvideosink_set_property),
(gst_sdlvideosink_get_property), (gst_sdlvideosink_change_state):
Fix SDL videosink and did some cleanups.
2005-10-27 20:16:40 +00:00
|
|
|
if (sdlvideosink->overlay == NULL)
|
|
|
|
goto no_overlay;
|
|
|
|
|
|
|
|
|
Update for GST_FOURCC_FORMAT API change.
Original commit message from CVS:
* ext/directfb/dfbvideosink.c:
(gst_dfbvideosink_get_format_from_caps):
* ext/sdl/sdlvideosink.c: (gst_sdlvideosink_create):
* gst/qtdemux/qtdemux.c: (gst_qtdemux_loop_header),
(qtdemux_parse), (qtdemux_type_get), (qtdemux_node_dump_foreach),
(qtdemux_dump_hdlr), (qtdemux_dump_dref), (qtdemux_dump_stsd),
(qtdemux_dump_dcom), (qtdemux_parse_trak), (qtdemux_video_caps),
(qtdemux_audio_caps):
* sys/v4l2/gstv4l2src.c: (gst_v4l2src_v4l2fourcc_to_caps):
* sys/v4l2/v4l2src_calls.c: (gst_v4l2src_fill_format_list),
(gst_v4l2src_capture_init), (gst_v4l2src_get_size_limits):
Update for GST_FOURCC_FORMAT API change.
2005-11-21 14:39:04 +00:00
|
|
|
GST_DEBUG ("Using a %dx%d %dbpp SDL screen with a %dx%d \'%"
|
ext/sdl/sdlvideosink.c: Fix SDL videosink and did some cleanups.
Original commit message from CVS:
* ext/sdl/sdlvideosink.c: (gst_sdlvideosink_finalize),
(gst_sdlvideosink_get_times), (gst_sdlvideosink_class_init),
(gst_sdlvideosink_init), (gst_sdlvideosink_lock),
(gst_sdlvideosink_initsdl), (gst_sdlvideosink_create),
(gst_sdlvideosink_show_frame), (gst_sdlvideosink_set_property),
(gst_sdlvideosink_get_property), (gst_sdlvideosink_change_state):
Fix SDL videosink and did some cleanups.
2005-10-27 20:16:40 +00:00
|
|
|
GST_FOURCC_FORMAT "\' YUV overlay", GST_VIDEO_SINK_WIDTH (sdlvideosink),
|
|
|
|
GST_VIDEO_SINK_HEIGHT (sdlvideosink),
|
|
|
|
sdlvideosink->screen->format->BitsPerPixel, sdlvideosink->width,
|
|
|
|
sdlvideosink->height, GST_FOURCC_ARGS (sdlvideosink->format));
|
2001-12-20 23:21:15 +00:00
|
|
|
|
|
|
|
sdlvideosink->rect.x = 0;
|
|
|
|
sdlvideosink->rect.y = 0;
|
2005-09-19 21:47:54 +00:00
|
|
|
sdlvideosink->rect.w = GST_VIDEO_SINK_WIDTH (sdlvideosink);
|
|
|
|
sdlvideosink->rect.h = GST_VIDEO_SINK_HEIGHT (sdlvideosink);
|
2001-12-20 23:21:15 +00:00
|
|
|
|
2004-11-10 22:01:20 +00:00
|
|
|
/*SDL_DisplayYUVOverlay (sdlvideosink->overlay, &(sdlvideosink->rect)); */
|
2001-12-20 23:21:15 +00:00
|
|
|
|
Update for GST_FOURCC_FORMAT API change.
Original commit message from CVS:
* ext/directfb/dfbvideosink.c:
(gst_dfbvideosink_get_format_from_caps):
* ext/sdl/sdlvideosink.c: (gst_sdlvideosink_create):
* gst/qtdemux/qtdemux.c: (gst_qtdemux_loop_header),
(qtdemux_parse), (qtdemux_type_get), (qtdemux_node_dump_foreach),
(qtdemux_dump_hdlr), (qtdemux_dump_dref), (qtdemux_dump_stsd),
(qtdemux_dump_dcom), (qtdemux_parse_trak), (qtdemux_video_caps),
(qtdemux_audio_caps):
* sys/v4l2/gstv4l2src.c: (gst_v4l2src_v4l2fourcc_to_caps):
* sys/v4l2/v4l2src_calls.c: (gst_v4l2src_fill_format_list),
(gst_v4l2src_capture_init), (gst_v4l2src_get_size_limits):
Update for GST_FOURCC_FORMAT API change.
2005-11-21 14:39:04 +00:00
|
|
|
GST_DEBUG ("sdlvideosink: setting %08x (%" GST_FOURCC_FORMAT ")",
|
2004-03-14 22:34:33 +00:00
|
|
|
sdlvideosink->format, GST_FOURCC_ARGS (sdlvideosink->format));
|
2001-12-20 23:21:15 +00:00
|
|
|
|
2002-01-15 15:52:09 +00:00
|
|
|
return TRUE;
|
2004-03-06 04:51:15 +00:00
|
|
|
|
ext/sdl/sdlvideosink.c: Fix SDL videosink and did some cleanups.
Original commit message from CVS:
* ext/sdl/sdlvideosink.c: (gst_sdlvideosink_finalize),
(gst_sdlvideosink_get_times), (gst_sdlvideosink_class_init),
(gst_sdlvideosink_init), (gst_sdlvideosink_lock),
(gst_sdlvideosink_initsdl), (gst_sdlvideosink_create),
(gst_sdlvideosink_show_frame), (gst_sdlvideosink_set_property),
(gst_sdlvideosink_get_property), (gst_sdlvideosink_change_state):
Fix SDL videosink and did some cleanups.
2005-10-27 20:16:40 +00:00
|
|
|
/* ERRORS */
|
|
|
|
no_screen:
|
|
|
|
{
|
|
|
|
GST_ELEMENT_ERROR (sdlvideosink, LIBRARY, TOO_LAZY, (NULL),
|
|
|
|
("SDL: Couldn't set %dx%d: %s", GST_VIDEO_SINK_WIDTH (sdlvideosink),
|
|
|
|
GST_VIDEO_SINK_HEIGHT (sdlvideosink), SDL_GetError ()));
|
|
|
|
return FALSE;
|
2004-03-06 04:51:15 +00:00
|
|
|
}
|
ext/sdl/sdlvideosink.c: Fix SDL videosink and did some cleanups.
Original commit message from CVS:
* ext/sdl/sdlvideosink.c: (gst_sdlvideosink_finalize),
(gst_sdlvideosink_get_times), (gst_sdlvideosink_class_init),
(gst_sdlvideosink_init), (gst_sdlvideosink_lock),
(gst_sdlvideosink_initsdl), (gst_sdlvideosink_create),
(gst_sdlvideosink_show_frame), (gst_sdlvideosink_set_property),
(gst_sdlvideosink_get_property), (gst_sdlvideosink_change_state):
Fix SDL videosink and did some cleanups.
2005-10-27 20:16:40 +00:00
|
|
|
no_overlay:
|
|
|
|
{
|
|
|
|
GST_ELEMENT_ERROR (sdlvideosink, LIBRARY, TOO_LAZY, (NULL),
|
Update for GST_FOURCC_FORMAT API change.
Original commit message from CVS:
* ext/directfb/dfbvideosink.c:
(gst_dfbvideosink_get_format_from_caps):
* ext/sdl/sdlvideosink.c: (gst_sdlvideosink_create):
* gst/qtdemux/qtdemux.c: (gst_qtdemux_loop_header),
(qtdemux_parse), (qtdemux_type_get), (qtdemux_node_dump_foreach),
(qtdemux_dump_hdlr), (qtdemux_dump_dref), (qtdemux_dump_stsd),
(qtdemux_dump_dcom), (qtdemux_parse_trak), (qtdemux_video_caps),
(qtdemux_audio_caps):
* sys/v4l2/gstv4l2src.c: (gst_v4l2src_v4l2fourcc_to_caps):
* sys/v4l2/v4l2src_calls.c: (gst_v4l2src_fill_format_list),
(gst_v4l2src_capture_init), (gst_v4l2src_get_size_limits):
Update for GST_FOURCC_FORMAT API change.
2005-11-21 14:39:04 +00:00
|
|
|
("SDL: Couldn't create SDL YUV overlay (%dx%d \'%" GST_FOURCC_FORMAT
|
ext/sdl/sdlvideosink.c: Fix SDL videosink and did some cleanups.
Original commit message from CVS:
* ext/sdl/sdlvideosink.c: (gst_sdlvideosink_finalize),
(gst_sdlvideosink_get_times), (gst_sdlvideosink_class_init),
(gst_sdlvideosink_init), (gst_sdlvideosink_lock),
(gst_sdlvideosink_initsdl), (gst_sdlvideosink_create),
(gst_sdlvideosink_show_frame), (gst_sdlvideosink_set_property),
(gst_sdlvideosink_get_property), (gst_sdlvideosink_change_state):
Fix SDL videosink and did some cleanups.
2005-10-27 20:16:40 +00:00
|
|
|
"\'): %s", sdlvideosink->width, sdlvideosink->height,
|
|
|
|
GST_FOURCC_ARGS (sdlvideosink->format), SDL_GetError ()));
|
|
|
|
return FALSE;
|
2004-03-06 04:51:15 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-09-19 21:47:54 +00:00
|
|
|
static gboolean
|
|
|
|
gst_sdlvideosink_setcaps (GstBaseSink * bsink, GstCaps * vscapslist)
|
2001-12-20 23:21:15 +00:00
|
|
|
{
|
2002-01-10 09:58:15 +00:00
|
|
|
GstSDLVideoSink *sdlvideosink;
|
2003-12-22 01:47:09 +00:00
|
|
|
guint32 format;
|
|
|
|
GstStructure *structure;
|
ext/sdl/sdlvideosink.*: Fix output stride copying, so that it displays correctly on framebuffer devices that don't ma...
Original commit message from CVS:
* ext/sdl/sdlvideosink.c: (gst_sdlvideosink_supported),
(gst_sdlvideosink_xoverlay_set_xwindow_id),
(gst_sdlvideosink_deinitsdl), (gst_sdlv_process_events),
(gst_sdlvideosink_event_thread), (gst_sdlvideosink_initsdl),
(gst_sdlvideosink_destroy), (gst_sdlvideosink_create),
(gst_sdlvideosink_setcaps), (gst_sdlvideosink_show_frame),
(gst_sdlvideosink_change_state),
(gst_sdlvideosink_navigation_send_event):
* ext/sdl/sdlvideosink.h:
Fix output stride copying, so that it displays correctly on
framebuffer devices that don't match our implict GStreamer stride
arrangement.
Fix locking things. Offer XOverlay only when SDL is running against
X. Make non-scaled (and ugly) embedding work via X Overlay. It can't
actually match the embedded window size because there's no way to
figure out what size that should be from the XOverlay interface.
See comment in sdlvideosink.c
2006-01-27 01:31:12 +00:00
|
|
|
gboolean res = TRUE;
|
2001-12-20 23:21:15 +00:00
|
|
|
|
2005-09-19 21:47:54 +00:00
|
|
|
sdlvideosink = GST_SDLVIDEOSINK (bsink);
|
2001-12-20 23:21:15 +00:00
|
|
|
|
2003-12-22 01:47:09 +00:00
|
|
|
structure = gst_caps_get_structure (vscapslist, 0);
|
2005-10-28 15:11:18 +00:00
|
|
|
gst_structure_get_fourcc (structure, "format", &sdlvideosink->fourcc);
|
2003-12-22 01:47:09 +00:00
|
|
|
sdlvideosink->format =
|
2005-10-28 15:11:18 +00:00
|
|
|
gst_sdlvideosink_get_sdl_from_fourcc (sdlvideosink, sdlvideosink->fourcc);
|
2003-12-22 01:47:09 +00:00
|
|
|
gst_structure_get_int (structure, "width", &sdlvideosink->width);
|
|
|
|
gst_structure_get_int (structure, "height", &sdlvideosink->height);
|
2005-11-23 15:36:08 +00:00
|
|
|
gst_structure_get_fraction (structure, "framerate",
|
|
|
|
&sdlvideosink->framerate_n, &sdlvideosink->framerate_d);
|
2002-03-30 17:06:26 +00:00
|
|
|
|
ext/sdl/sdlvideosink.*: Fix output stride copying, so that it displays correctly on framebuffer devices that don't ma...
Original commit message from CVS:
* ext/sdl/sdlvideosink.c: (gst_sdlvideosink_supported),
(gst_sdlvideosink_xoverlay_set_xwindow_id),
(gst_sdlvideosink_deinitsdl), (gst_sdlv_process_events),
(gst_sdlvideosink_event_thread), (gst_sdlvideosink_initsdl),
(gst_sdlvideosink_destroy), (gst_sdlvideosink_create),
(gst_sdlvideosink_setcaps), (gst_sdlvideosink_show_frame),
(gst_sdlvideosink_change_state),
(gst_sdlvideosink_navigation_send_event):
* ext/sdl/sdlvideosink.h:
Fix output stride copying, so that it displays correctly on
framebuffer devices that don't match our implict GStreamer stride
arrangement.
Fix locking things. Offer XOverlay only when SDL is running against
X. Make non-scaled (and ugly) embedding work via X Overlay. It can't
actually match the embedded window size because there's no way to
figure out what size that should be from the XOverlay interface.
See comment in sdlvideosink.c
2006-01-27 01:31:12 +00:00
|
|
|
g_mutex_lock (sdlvideosink->lock);
|
2004-03-14 22:34:33 +00:00
|
|
|
if (!sdlvideosink->format || !gst_sdlvideosink_create (sdlvideosink))
|
ext/sdl/sdlvideosink.*: Fix output stride copying, so that it displays correctly on framebuffer devices that don't ma...
Original commit message from CVS:
* ext/sdl/sdlvideosink.c: (gst_sdlvideosink_supported),
(gst_sdlvideosink_xoverlay_set_xwindow_id),
(gst_sdlvideosink_deinitsdl), (gst_sdlv_process_events),
(gst_sdlvideosink_event_thread), (gst_sdlvideosink_initsdl),
(gst_sdlvideosink_destroy), (gst_sdlvideosink_create),
(gst_sdlvideosink_setcaps), (gst_sdlvideosink_show_frame),
(gst_sdlvideosink_change_state),
(gst_sdlvideosink_navigation_send_event):
* ext/sdl/sdlvideosink.h:
Fix output stride copying, so that it displays correctly on
framebuffer devices that don't match our implict GStreamer stride
arrangement.
Fix locking things. Offer XOverlay only when SDL is running against
X. Make non-scaled (and ugly) embedding work via X Overlay. It can't
actually match the embedded window size because there's no way to
figure out what size that should be from the XOverlay interface.
See comment in sdlvideosink.c
2006-01-27 01:31:12 +00:00
|
|
|
res = FALSE;
|
|
|
|
g_mutex_unlock (sdlvideosink->lock);
|
2002-01-10 09:58:15 +00:00
|
|
|
|
ext/sdl/sdlvideosink.*: Fix output stride copying, so that it displays correctly on framebuffer devices that don't ma...
Original commit message from CVS:
* ext/sdl/sdlvideosink.c: (gst_sdlvideosink_supported),
(gst_sdlvideosink_xoverlay_set_xwindow_id),
(gst_sdlvideosink_deinitsdl), (gst_sdlv_process_events),
(gst_sdlvideosink_event_thread), (gst_sdlvideosink_initsdl),
(gst_sdlvideosink_destroy), (gst_sdlvideosink_create),
(gst_sdlvideosink_setcaps), (gst_sdlvideosink_show_frame),
(gst_sdlvideosink_change_state),
(gst_sdlvideosink_navigation_send_event):
* ext/sdl/sdlvideosink.h:
Fix output stride copying, so that it displays correctly on
framebuffer devices that don't match our implict GStreamer stride
arrangement.
Fix locking things. Offer XOverlay only when SDL is running against
X. Make non-scaled (and ugly) embedding work via X Overlay. It can't
actually match the embedded window size because there's no way to
figure out what size that should be from the XOverlay interface.
See comment in sdlvideosink.c
2006-01-27 01:31:12 +00:00
|
|
|
return res;
|
2001-12-20 23:21:15 +00:00
|
|
|
}
|
|
|
|
|
2002-01-10 09:58:15 +00:00
|
|
|
|
2005-09-19 21:47:54 +00:00
|
|
|
static GstFlowReturn
|
|
|
|
gst_sdlvideosink_show_frame (GstBaseSink * bsink, GstBuffer * buf)
|
2001-12-20 23:21:15 +00:00
|
|
|
{
|
2005-09-19 21:47:54 +00:00
|
|
|
|
2001-12-20 23:21:15 +00:00
|
|
|
GstSDLVideoSink *sdlvideosink;
|
2002-05-26 21:59:21 +00:00
|
|
|
SDL_Event sdl_event;
|
2001-12-20 23:21:15 +00:00
|
|
|
|
2005-09-19 21:47:54 +00:00
|
|
|
sdlvideosink = GST_SDLVIDEOSINK (bsink);
|
2001-12-20 23:21:15 +00:00
|
|
|
|
ext/sdl/sdlvideosink.*: Fix output stride copying, so that it displays correctly on framebuffer devices that don't ma...
Original commit message from CVS:
* ext/sdl/sdlvideosink.c: (gst_sdlvideosink_supported),
(gst_sdlvideosink_xoverlay_set_xwindow_id),
(gst_sdlvideosink_deinitsdl), (gst_sdlv_process_events),
(gst_sdlvideosink_event_thread), (gst_sdlvideosink_initsdl),
(gst_sdlvideosink_destroy), (gst_sdlvideosink_create),
(gst_sdlvideosink_setcaps), (gst_sdlvideosink_show_frame),
(gst_sdlvideosink_change_state),
(gst_sdlvideosink_navigation_send_event):
* ext/sdl/sdlvideosink.h:
Fix output stride copying, so that it displays correctly on
framebuffer devices that don't match our implict GStreamer stride
arrangement.
Fix locking things. Offer XOverlay only when SDL is running against
X. Make non-scaled (and ugly) embedding work via X Overlay. It can't
actually match the embedded window size because there's no way to
figure out what size that should be from the XOverlay interface.
See comment in sdlvideosink.c
2006-01-27 01:31:12 +00:00
|
|
|
g_mutex_lock (sdlvideosink->lock);
|
2004-11-10 22:01:20 +00:00
|
|
|
if (!sdlvideosink->init ||
|
ext/sdl/sdlvideosink.c: Fix SDL videosink and did some cleanups.
Original commit message from CVS:
* ext/sdl/sdlvideosink.c: (gst_sdlvideosink_finalize),
(gst_sdlvideosink_get_times), (gst_sdlvideosink_class_init),
(gst_sdlvideosink_init), (gst_sdlvideosink_lock),
(gst_sdlvideosink_initsdl), (gst_sdlvideosink_create),
(gst_sdlvideosink_show_frame), (gst_sdlvideosink_set_property),
(gst_sdlvideosink_get_property), (gst_sdlvideosink_change_state):
Fix SDL videosink and did some cleanups.
2005-10-27 20:16:40 +00:00
|
|
|
!sdlvideosink->overlay || !sdlvideosink->overlay->pixels)
|
|
|
|
goto not_init;
|
2004-11-10 22:01:20 +00:00
|
|
|
|
2005-10-28 15:11:18 +00:00
|
|
|
/* if (GST_BUFFER_DATA (buf) != sdlvideosink->overlay->pixels[0]) */
|
|
|
|
if (TRUE) {
|
ext/sdl/sdlvideosink.*: Fix output stride copying, so that it displays correctly on framebuffer devices that don't ma...
Original commit message from CVS:
* ext/sdl/sdlvideosink.c: (gst_sdlvideosink_supported),
(gst_sdlvideosink_xoverlay_set_xwindow_id),
(gst_sdlvideosink_deinitsdl), (gst_sdlv_process_events),
(gst_sdlvideosink_event_thread), (gst_sdlvideosink_initsdl),
(gst_sdlvideosink_destroy), (gst_sdlvideosink_create),
(gst_sdlvideosink_setcaps), (gst_sdlvideosink_show_frame),
(gst_sdlvideosink_change_state),
(gst_sdlvideosink_navigation_send_event):
* ext/sdl/sdlvideosink.h:
Fix output stride copying, so that it displays correctly on
framebuffer devices that don't match our implict GStreamer stride
arrangement.
Fix locking things. Offer XOverlay only when SDL is running against
X. Make non-scaled (and ugly) embedding work via X Overlay. It can't
actually match the embedded window size because there's no way to
figure out what size that should be from the XOverlay interface.
See comment in sdlvideosink.c
2006-01-27 01:31:12 +00:00
|
|
|
guint8 *out;
|
|
|
|
gint l;
|
|
|
|
|
ext/sdl/sdlvideosink.c: Fix SDL videosink and did some cleanups.
Original commit message from CVS:
* ext/sdl/sdlvideosink.c: (gst_sdlvideosink_finalize),
(gst_sdlvideosink_get_times), (gst_sdlvideosink_class_init),
(gst_sdlvideosink_init), (gst_sdlvideosink_lock),
(gst_sdlvideosink_initsdl), (gst_sdlvideosink_create),
(gst_sdlvideosink_show_frame), (gst_sdlvideosink_set_property),
(gst_sdlvideosink_get_property), (gst_sdlvideosink_change_state):
Fix SDL videosink and did some cleanups.
2005-10-27 20:16:40 +00:00
|
|
|
if (!gst_sdlvideosink_lock (sdlvideosink))
|
|
|
|
goto cannot_lock;
|
2001-12-20 23:21:15 +00:00
|
|
|
|
2003-10-28 09:08:32 +00:00
|
|
|
/* buf->yuv - FIXME: bufferpool! */
|
2005-10-28 15:11:18 +00:00
|
|
|
if (sdlvideosink->format == SDL_YV12_OVERLAY) {
|
|
|
|
guint8 *y, *u, *v;
|
|
|
|
|
|
|
|
switch (sdlvideosink->fourcc) {
|
|
|
|
case GST_MAKE_FOURCC ('I', '4', '2', '0'):
|
|
|
|
y = GST_BUFFER_DATA (buf);
|
|
|
|
/* I420 is YV12 with switched colour planes and different offsets */
|
|
|
|
v = y + I420_U_OFFSET (sdlvideosink->width, sdlvideosink->height);
|
|
|
|
u = y + I420_V_OFFSET (sdlvideosink->width, sdlvideosink->height);
|
|
|
|
break;
|
|
|
|
case GST_MAKE_FOURCC ('Y', 'V', '1', '2'):
|
|
|
|
y = GST_BUFFER_DATA (buf);
|
ext/sdl/sdlvideosink.*: Fix output stride copying, so that it displays correctly on framebuffer devices that don't ma...
Original commit message from CVS:
* ext/sdl/sdlvideosink.c: (gst_sdlvideosink_supported),
(gst_sdlvideosink_xoverlay_set_xwindow_id),
(gst_sdlvideosink_deinitsdl), (gst_sdlv_process_events),
(gst_sdlvideosink_event_thread), (gst_sdlvideosink_initsdl),
(gst_sdlvideosink_destroy), (gst_sdlvideosink_create),
(gst_sdlvideosink_setcaps), (gst_sdlvideosink_show_frame),
(gst_sdlvideosink_change_state),
(gst_sdlvideosink_navigation_send_event):
* ext/sdl/sdlvideosink.h:
Fix output stride copying, so that it displays correctly on
framebuffer devices that don't match our implict GStreamer stride
arrangement.
Fix locking things. Offer XOverlay only when SDL is running against
X. Make non-scaled (and ugly) embedding work via X Overlay. It can't
actually match the embedded window size because there's no way to
figure out what size that should be from the XOverlay interface.
See comment in sdlvideosink.c
2006-01-27 01:31:12 +00:00
|
|
|
u = y + I420_U_OFFSET (sdlvideosink->width, sdlvideosink->height);
|
|
|
|
v = y + I420_V_OFFSET (sdlvideosink->width, sdlvideosink->height);
|
2005-10-28 15:11:18 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
g_assert_not_reached ();
|
|
|
|
}
|
|
|
|
|
ext/sdl/sdlvideosink.*: Fix output stride copying, so that it displays correctly on framebuffer devices that don't ma...
Original commit message from CVS:
* ext/sdl/sdlvideosink.c: (gst_sdlvideosink_supported),
(gst_sdlvideosink_xoverlay_set_xwindow_id),
(gst_sdlvideosink_deinitsdl), (gst_sdlv_process_events),
(gst_sdlvideosink_event_thread), (gst_sdlvideosink_initsdl),
(gst_sdlvideosink_destroy), (gst_sdlvideosink_create),
(gst_sdlvideosink_setcaps), (gst_sdlvideosink_show_frame),
(gst_sdlvideosink_change_state),
(gst_sdlvideosink_navigation_send_event):
* ext/sdl/sdlvideosink.h:
Fix output stride copying, so that it displays correctly on
framebuffer devices that don't match our implict GStreamer stride
arrangement.
Fix locking things. Offer XOverlay only when SDL is running against
X. Make non-scaled (and ugly) embedding work via X Overlay. It can't
actually match the embedded window size because there's no way to
figure out what size that should be from the XOverlay interface.
See comment in sdlvideosink.c
2006-01-27 01:31:12 +00:00
|
|
|
/* Y Plane */
|
|
|
|
out = sdlvideosink->overlay->pixels[0];
|
|
|
|
for (l = 0; l < sdlvideosink->height; l++) {
|
|
|
|
memcpy (out, y, I420_Y_ROWSTRIDE (sdlvideosink->width));
|
|
|
|
out += sdlvideosink->overlay->pitches[0];
|
|
|
|
y += I420_Y_ROWSTRIDE (sdlvideosink->width);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* U plane */
|
|
|
|
out = sdlvideosink->overlay->pixels[1];
|
|
|
|
for (l = 0; l < (sdlvideosink->height / 2); l++) {
|
|
|
|
memcpy (out, u, I420_U_ROWSTRIDE (sdlvideosink->width));
|
|
|
|
out += sdlvideosink->overlay->pitches[1];
|
|
|
|
u += I420_U_ROWSTRIDE (sdlvideosink->width);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* V plane */
|
|
|
|
out = sdlvideosink->overlay->pixels[2];
|
|
|
|
for (l = 0; l < (sdlvideosink->height / 2); l++) {
|
|
|
|
memcpy (out, v, I420_V_ROWSTRIDE (sdlvideosink->width));
|
|
|
|
out += sdlvideosink->overlay->pitches[2];
|
|
|
|
v += I420_V_ROWSTRIDE (sdlvideosink->width);
|
|
|
|
}
|
2003-10-28 09:08:32 +00:00
|
|
|
} else {
|
ext/sdl/sdlvideosink.*: Fix output stride copying, so that it displays correctly on framebuffer devices that don't ma...
Original commit message from CVS:
* ext/sdl/sdlvideosink.c: (gst_sdlvideosink_supported),
(gst_sdlvideosink_xoverlay_set_xwindow_id),
(gst_sdlvideosink_deinitsdl), (gst_sdlv_process_events),
(gst_sdlvideosink_event_thread), (gst_sdlvideosink_initsdl),
(gst_sdlvideosink_destroy), (gst_sdlvideosink_create),
(gst_sdlvideosink_setcaps), (gst_sdlvideosink_show_frame),
(gst_sdlvideosink_change_state),
(gst_sdlvideosink_navigation_send_event):
* ext/sdl/sdlvideosink.h:
Fix output stride copying, so that it displays correctly on
framebuffer devices that don't match our implict GStreamer stride
arrangement.
Fix locking things. Offer XOverlay only when SDL is running against
X. Make non-scaled (and ugly) embedding work via X Overlay. It can't
actually match the embedded window size because there's no way to
figure out what size that should be from the XOverlay interface.
See comment in sdlvideosink.c
2006-01-27 01:31:12 +00:00
|
|
|
guint8 *in = GST_BUFFER_DATA (buf);
|
|
|
|
gint in_stride = sdlvideosink->width * 2;
|
|
|
|
|
|
|
|
out = sdlvideosink->overlay->pixels[0];
|
|
|
|
|
|
|
|
for (l = 0; l < sdlvideosink->height; l++) {
|
|
|
|
memcpy (out, in, in_stride);
|
|
|
|
out += sdlvideosink->overlay->pitches[0];
|
|
|
|
in += in_stride;
|
|
|
|
}
|
2003-10-28 09:08:32 +00:00
|
|
|
}
|
2004-03-14 22:34:33 +00:00
|
|
|
gst_sdlvideosink_unlock (sdlvideosink);
|
2003-10-28 09:08:32 +00:00
|
|
|
}
|
2001-12-20 23:21:15 +00:00
|
|
|
|
|
|
|
/* Show, baby, show! */
|
2004-03-14 22:34:33 +00:00
|
|
|
SDL_DisplayYUVOverlay (sdlvideosink->overlay, &(sdlvideosink->rect));
|
2001-12-20 23:21:15 +00:00
|
|
|
|
ext/sdl/sdlvideosink.*: Fix output stride copying, so that it displays correctly on framebuffer devices that don't ma...
Original commit message from CVS:
* ext/sdl/sdlvideosink.c: (gst_sdlvideosink_supported),
(gst_sdlvideosink_xoverlay_set_xwindow_id),
(gst_sdlvideosink_deinitsdl), (gst_sdlv_process_events),
(gst_sdlvideosink_event_thread), (gst_sdlvideosink_initsdl),
(gst_sdlvideosink_destroy), (gst_sdlvideosink_create),
(gst_sdlvideosink_setcaps), (gst_sdlvideosink_show_frame),
(gst_sdlvideosink_change_state),
(gst_sdlvideosink_navigation_send_event):
* ext/sdl/sdlvideosink.h:
Fix output stride copying, so that it displays correctly on
framebuffer devices that don't match our implict GStreamer stride
arrangement.
Fix locking things. Offer XOverlay only when SDL is running against
X. Make non-scaled (and ugly) embedding work via X Overlay. It can't
actually match the embedded window size because there's no way to
figure out what size that should be from the XOverlay interface.
See comment in sdlvideosink.c
2006-01-27 01:31:12 +00:00
|
|
|
/* Handle any resize */
|
|
|
|
gst_sdlv_process_events (sdlvideosink);
|
|
|
|
|
|
|
|
g_mutex_unlock (sdlvideosink->lock);
|
2004-11-10 22:01:20 +00:00
|
|
|
|
2005-09-19 21:47:54 +00:00
|
|
|
return GST_FLOW_OK;
|
|
|
|
|
ext/sdl/sdlvideosink.c: Fix SDL videosink and did some cleanups.
Original commit message from CVS:
* ext/sdl/sdlvideosink.c: (gst_sdlvideosink_finalize),
(gst_sdlvideosink_get_times), (gst_sdlvideosink_class_init),
(gst_sdlvideosink_init), (gst_sdlvideosink_lock),
(gst_sdlvideosink_initsdl), (gst_sdlvideosink_create),
(gst_sdlvideosink_show_frame), (gst_sdlvideosink_set_property),
(gst_sdlvideosink_get_property), (gst_sdlvideosink_change_state):
Fix SDL videosink and did some cleanups.
2005-10-27 20:16:40 +00:00
|
|
|
/* ERRORS */
|
|
|
|
not_init:
|
|
|
|
{
|
|
|
|
GST_ELEMENT_ERROR (sdlvideosink, CORE, NEGOTIATION, (NULL),
|
|
|
|
("not negotiated."));
|
ext/sdl/sdlvideosink.*: Fix output stride copying, so that it displays correctly on framebuffer devices that don't ma...
Original commit message from CVS:
* ext/sdl/sdlvideosink.c: (gst_sdlvideosink_supported),
(gst_sdlvideosink_xoverlay_set_xwindow_id),
(gst_sdlvideosink_deinitsdl), (gst_sdlv_process_events),
(gst_sdlvideosink_event_thread), (gst_sdlvideosink_initsdl),
(gst_sdlvideosink_destroy), (gst_sdlvideosink_create),
(gst_sdlvideosink_setcaps), (gst_sdlvideosink_show_frame),
(gst_sdlvideosink_change_state),
(gst_sdlvideosink_navigation_send_event):
* ext/sdl/sdlvideosink.h:
Fix output stride copying, so that it displays correctly on
framebuffer devices that don't match our implict GStreamer stride
arrangement.
Fix locking things. Offer XOverlay only when SDL is running against
X. Make non-scaled (and ugly) embedding work via X Overlay. It can't
actually match the embedded window size because there's no way to
figure out what size that should be from the XOverlay interface.
See comment in sdlvideosink.c
2006-01-27 01:31:12 +00:00
|
|
|
g_mutex_unlock (sdlvideosink->lock);
|
ext/sdl/sdlvideosink.c: Fix SDL videosink and did some cleanups.
Original commit message from CVS:
* ext/sdl/sdlvideosink.c: (gst_sdlvideosink_finalize),
(gst_sdlvideosink_get_times), (gst_sdlvideosink_class_init),
(gst_sdlvideosink_init), (gst_sdlvideosink_lock),
(gst_sdlvideosink_initsdl), (gst_sdlvideosink_create),
(gst_sdlvideosink_show_frame), (gst_sdlvideosink_set_property),
(gst_sdlvideosink_get_property), (gst_sdlvideosink_change_state):
Fix SDL videosink and did some cleanups.
2005-10-27 20:16:40 +00:00
|
|
|
return GST_FLOW_NOT_NEGOTIATED;
|
|
|
|
}
|
|
|
|
cannot_lock:
|
|
|
|
{
|
|
|
|
/* lock function posted detailed message */
|
ext/sdl/sdlvideosink.*: Fix output stride copying, so that it displays correctly on framebuffer devices that don't ma...
Original commit message from CVS:
* ext/sdl/sdlvideosink.c: (gst_sdlvideosink_supported),
(gst_sdlvideosink_xoverlay_set_xwindow_id),
(gst_sdlvideosink_deinitsdl), (gst_sdlv_process_events),
(gst_sdlvideosink_event_thread), (gst_sdlvideosink_initsdl),
(gst_sdlvideosink_destroy), (gst_sdlvideosink_create),
(gst_sdlvideosink_setcaps), (gst_sdlvideosink_show_frame),
(gst_sdlvideosink_change_state),
(gst_sdlvideosink_navigation_send_event):
* ext/sdl/sdlvideosink.h:
Fix output stride copying, so that it displays correctly on
framebuffer devices that don't match our implict GStreamer stride
arrangement.
Fix locking things. Offer XOverlay only when SDL is running against
X. Make non-scaled (and ugly) embedding work via X Overlay. It can't
actually match the embedded window size because there's no way to
figure out what size that should be from the XOverlay interface.
See comment in sdlvideosink.c
2006-01-27 01:31:12 +00:00
|
|
|
g_mutex_unlock (sdlvideosink->lock);
|
ext/sdl/sdlvideosink.c: Fix SDL videosink and did some cleanups.
Original commit message from CVS:
* ext/sdl/sdlvideosink.c: (gst_sdlvideosink_finalize),
(gst_sdlvideosink_get_times), (gst_sdlvideosink_class_init),
(gst_sdlvideosink_init), (gst_sdlvideosink_lock),
(gst_sdlvideosink_initsdl), (gst_sdlvideosink_create),
(gst_sdlvideosink_show_frame), (gst_sdlvideosink_set_property),
(gst_sdlvideosink_get_property), (gst_sdlvideosink_change_state):
Fix SDL videosink and did some cleanups.
2005-10-27 20:16:40 +00:00
|
|
|
return GST_FLOW_ERROR;
|
|
|
|
}
|
2001-12-20 23:21:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void
|
2004-03-14 22:34:33 +00:00
|
|
|
gst_sdlvideosink_set_property (GObject * object, guint prop_id,
|
|
|
|
const GValue * value, GParamSpec * pspec)
|
2001-12-20 23:21:15 +00:00
|
|
|
{
|
|
|
|
GstSDLVideoSink *sdlvideosink;
|
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
sdlvideosink = GST_SDLVIDEOSINK (object);
|
2001-12-20 23:21:15 +00:00
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
switch (prop_id) {
|
2005-10-31 18:07:30 +00:00
|
|
|
case PROP_FULLSCREEN:
|
|
|
|
sdlvideosink->full_screen = g_value_get_boolean (value);
|
|
|
|
break;
|
2002-01-17 12:41:05 +00:00
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
|
|
break;
|
2002-01-10 09:58:15 +00:00
|
|
|
}
|
2001-12-20 23:21:15 +00:00
|
|
|
}
|
|
|
|
|
2002-01-10 09:58:15 +00:00
|
|
|
|
2001-12-20 23:21:15 +00:00
|
|
|
static void
|
2004-03-14 22:34:33 +00:00
|
|
|
gst_sdlvideosink_get_property (GObject * object, guint prop_id, GValue * value,
|
|
|
|
GParamSpec * pspec)
|
2001-12-20 23:21:15 +00:00
|
|
|
{
|
|
|
|
GstSDLVideoSink *sdlvideosink;
|
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
sdlvideosink = GST_SDLVIDEOSINK (object);
|
2001-12-20 23:21:15 +00:00
|
|
|
|
|
|
|
switch (prop_id) {
|
2005-10-31 18:07:30 +00:00
|
|
|
case PROP_FULLSCREEN:
|
2005-10-31 20:57:42 +00:00
|
|
|
g_value_set_boolean (value, sdlvideosink->full_screen);
|
2005-10-31 18:07:30 +00:00
|
|
|
break;
|
2002-01-10 09:58:15 +00:00
|
|
|
default:
|
2002-01-17 12:41:05 +00:00
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
2001-12-20 23:21:15 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-09-05 17:20:29 +00:00
|
|
|
static GstStateChangeReturn
|
|
|
|
gst_sdlvideosink_change_state (GstElement * element, GstStateChange transition)
|
2001-12-20 23:21:15 +00:00
|
|
|
{
|
2002-01-10 09:58:15 +00:00
|
|
|
GstSDLVideoSink *sdlvideosink;
|
2005-10-27 19:36:18 +00:00
|
|
|
GstStateChangeReturn ret = GST_STATE_CHANGE_SUCCESS;
|
2004-03-14 22:34:33 +00:00
|
|
|
|
2005-09-05 17:20:29 +00:00
|
|
|
g_return_val_if_fail (GST_IS_SDLVIDEOSINK (element),
|
|
|
|
GST_STATE_CHANGE_FAILURE);
|
2004-03-14 22:34:33 +00:00
|
|
|
sdlvideosink = GST_SDLVIDEOSINK (element);
|
2001-12-20 23:21:15 +00:00
|
|
|
|
2005-09-05 17:20:29 +00:00
|
|
|
switch (transition) {
|
|
|
|
case GST_STATE_CHANGE_NULL_TO_READY:
|
ext/sdl/sdlvideosink.*: Fix output stride copying, so that it displays correctly on framebuffer devices that don't ma...
Original commit message from CVS:
* ext/sdl/sdlvideosink.c: (gst_sdlvideosink_supported),
(gst_sdlvideosink_xoverlay_set_xwindow_id),
(gst_sdlvideosink_deinitsdl), (gst_sdlv_process_events),
(gst_sdlvideosink_event_thread), (gst_sdlvideosink_initsdl),
(gst_sdlvideosink_destroy), (gst_sdlvideosink_create),
(gst_sdlvideosink_setcaps), (gst_sdlvideosink_show_frame),
(gst_sdlvideosink_change_state),
(gst_sdlvideosink_navigation_send_event):
* ext/sdl/sdlvideosink.h:
Fix output stride copying, so that it displays correctly on
framebuffer devices that don't match our implict GStreamer stride
arrangement.
Fix locking things. Offer XOverlay only when SDL is running against
X. Make non-scaled (and ugly) embedding work via X Overlay. It can't
actually match the embedded window size because there's no way to
figure out what size that should be from the XOverlay interface.
See comment in sdlvideosink.c
2006-01-27 01:31:12 +00:00
|
|
|
sdlvideosink->is_xwindows = GST_IS_X_OVERLAY (sdlvideosink);
|
|
|
|
g_mutex_lock (sdlvideosink->lock);
|
|
|
|
if (!gst_sdlvideosink_initsdl (sdlvideosink)) {
|
|
|
|
g_mutex_unlock (sdlvideosink->lock);
|
ext/sdl/sdlvideosink.c: Fix SDL videosink and did some cleanups.
Original commit message from CVS:
* ext/sdl/sdlvideosink.c: (gst_sdlvideosink_finalize),
(gst_sdlvideosink_get_times), (gst_sdlvideosink_class_init),
(gst_sdlvideosink_init), (gst_sdlvideosink_lock),
(gst_sdlvideosink_initsdl), (gst_sdlvideosink_create),
(gst_sdlvideosink_show_frame), (gst_sdlvideosink_set_property),
(gst_sdlvideosink_get_property), (gst_sdlvideosink_change_state):
Fix SDL videosink and did some cleanups.
2005-10-27 20:16:40 +00:00
|
|
|
goto init_failed;
|
ext/sdl/sdlvideosink.*: Fix output stride copying, so that it displays correctly on framebuffer devices that don't ma...
Original commit message from CVS:
* ext/sdl/sdlvideosink.c: (gst_sdlvideosink_supported),
(gst_sdlvideosink_xoverlay_set_xwindow_id),
(gst_sdlvideosink_deinitsdl), (gst_sdlv_process_events),
(gst_sdlvideosink_event_thread), (gst_sdlvideosink_initsdl),
(gst_sdlvideosink_destroy), (gst_sdlvideosink_create),
(gst_sdlvideosink_setcaps), (gst_sdlvideosink_show_frame),
(gst_sdlvideosink_change_state),
(gst_sdlvideosink_navigation_send_event):
* ext/sdl/sdlvideosink.h:
Fix output stride copying, so that it displays correctly on
framebuffer devices that don't match our implict GStreamer stride
arrangement.
Fix locking things. Offer XOverlay only when SDL is running against
X. Make non-scaled (and ugly) embedding work via X Overlay. It can't
actually match the embedded window size because there's no way to
figure out what size that should be from the XOverlay interface.
See comment in sdlvideosink.c
2006-01-27 01:31:12 +00:00
|
|
|
}
|
renamed GST_FLAGS macros to GST_OBJECT_FLAGS moved bitshift from macro to enum definition
Original commit message from CVS:
* examples/indexing/indexmpeg.c: (main):
* ext/artsd/gstartsdsink.c: (gst_artsdsink_open_audio),
(gst_artsdsink_close_audio), (gst_artsdsink_change_state):
* ext/artsd/gstartsdsink.h:
* ext/audiofile/gstafparse.c: (gst_afparse_open_file),
(gst_afparse_close_file):
* ext/audiofile/gstafparse.h:
* ext/audiofile/gstafsink.c: (gst_afsink_open_file),
(gst_afsink_close_file), (gst_afsink_chain),
(gst_afsink_change_state):
* ext/audiofile/gstafsink.h:
* ext/audiofile/gstafsrc.c: (gst_afsrc_open_file),
(gst_afsrc_close_file), (gst_afsrc_change_state):
* ext/audiofile/gstafsrc.h:
* ext/cdaudio/gstcdaudio.c: (gst_cdaudio_init):
* ext/directfb/directfbvideosink.c: (gst_directfbvideosink_init):
* ext/dts/gstdtsdec.c: (gst_dtsdec_init):
* ext/jack/gstjack.h:
* ext/jack/gstjackbin.c: (gst_jack_bin_init),
(gst_jack_bin_change_state):
* ext/musepack/gstmusepackdec.c: (gst_musepackdec_init):
* ext/musicbrainz/gsttrm.c: (gst_musicbrainz_init):
* ext/nas/nassink.c: (gst_nassink_open_audio),
(gst_nassink_close_audio), (gst_nassink_change_state):
* ext/nas/nassink.h:
* ext/polyp/polypsink.c: (gst_polypsink_init):
* ext/sdl/sdlvideosink.c: (gst_sdlvideosink_change_state):
* ext/sdl/sdlvideosink.h:
* ext/smoothwave/gstsmoothwave.c: (gst_smoothwave_init):
* ext/sndfile/gstsf.c: (gst_sf_set_property),
(gst_sf_change_state), (gst_sf_release_request_pad),
(gst_sf_open_file), (gst_sf_close_file), (gst_sf_loop):
* ext/sndfile/gstsf.h:
* ext/swfdec/gstswfdec.c: (gst_swfdec_init):
* ext/tarkin/gsttarkindec.c: (gst_tarkindec_init):
* gst/apetag/apedemux.c: (gst_ape_demux_init):
* gst/cdxaparse/gstcdxaparse.c: (gst_cdxaparse_init):
* gst/cdxaparse/gstcdxastrip.c: (gst_cdxastrip_init):
* gst/festival/gstfestival.c: (gst_festival_change_state):
* gst/festival/gstfestival.h:
* gst/mpeg2sub/gstmpeg2subt.c: (gst_mpeg2subt_init):
* gst/multifilesink/gstmultifilesink.c: (gst_multifilesink_init),
(gst_multifilesink_set_location), (gst_multifilesink_open_file),
(gst_multifilesink_close_file), (gst_multifilesink_next_file),
(gst_multifilesink_pad_query), (gst_multifilesink_handle_event),
(gst_multifilesink_chain), (gst_multifilesink_change_state):
* gst/multifilesink/gstmultifilesink.h:
* gst/videodrop/gstvideodrop.c: (gst_videodrop_init):
* sys/cdrom/gstcdplayer.c: (cdplayer_init):
* sys/dxr3/dxr3audiosink.c: (dxr3audiosink_init),
(dxr3audiosink_open), (dxr3audiosink_close),
(dxr3audiosink_chain_pcm), (dxr3audiosink_chain_ac3),
(dxr3audiosink_change_state):
* sys/dxr3/dxr3audiosink.h:
* sys/dxr3/dxr3spusink.c: (dxr3spusink_init), (dxr3spusink_open),
(dxr3spusink_close), (dxr3spusink_chain),
(dxr3spusink_change_state):
* sys/dxr3/dxr3spusink.h:
* sys/dxr3/dxr3videosink.c: (dxr3videosink_init),
(dxr3videosink_open), (dxr3videosink_close),
(dxr3videosink_write_data), (dxr3videosink_change_state):
* sys/dxr3/dxr3videosink.h:
* sys/glsink/glimagesink.c: (gst_glimagesink_init):
* sys/qcam/gstqcamsrc.c: (gst_qcamsrc_change_state),
(gst_qcamsrc_open), (gst_qcamsrc_close):
* sys/qcam/gstqcamsrc.h:
* sys/v4l2/gstv4l2src.c: (gst_v4l2src_init):
* sys/vcd/vcdsrc.c: (gst_vcdsrc_set_property), (gst_vcdsrc_get),
(gst_vcdsrc_open_file), (gst_vcdsrc_close_file),
(gst_vcdsrc_change_state), (gst_vcdsrc_recalculate):
* sys/vcd/vcdsrc.h:
renamed GST_FLAGS macros to GST_OBJECT_FLAGS
moved bitshift from macro to enum definition
2005-10-12 14:29:55 +00:00
|
|
|
GST_OBJECT_FLAG_SET (sdlvideosink, GST_SDLVIDEOSINK_OPEN);
|
ext/sdl/sdlvideosink.*: Fix output stride copying, so that it displays correctly on framebuffer devices that don't ma...
Original commit message from CVS:
* ext/sdl/sdlvideosink.c: (gst_sdlvideosink_supported),
(gst_sdlvideosink_xoverlay_set_xwindow_id),
(gst_sdlvideosink_deinitsdl), (gst_sdlv_process_events),
(gst_sdlvideosink_event_thread), (gst_sdlvideosink_initsdl),
(gst_sdlvideosink_destroy), (gst_sdlvideosink_create),
(gst_sdlvideosink_setcaps), (gst_sdlvideosink_show_frame),
(gst_sdlvideosink_change_state),
(gst_sdlvideosink_navigation_send_event):
* ext/sdl/sdlvideosink.h:
Fix output stride copying, so that it displays correctly on
framebuffer devices that don't match our implict GStreamer stride
arrangement.
Fix locking things. Offer XOverlay only when SDL is running against
X. Make non-scaled (and ugly) embedding work via X Overlay. It can't
actually match the embedded window size because there's no way to
figure out what size that should be from the XOverlay interface.
See comment in sdlvideosink.c
2006-01-27 01:31:12 +00:00
|
|
|
g_mutex_unlock (sdlvideosink->lock);
|
2002-01-10 09:58:15 +00:00
|
|
|
break;
|
2005-10-27 19:36:18 +00:00
|
|
|
default: /* do nothing */
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
ext/sdl/sdlvideosink.c: Fix SDL videosink and did some cleanups.
Original commit message from CVS:
* ext/sdl/sdlvideosink.c: (gst_sdlvideosink_finalize),
(gst_sdlvideosink_get_times), (gst_sdlvideosink_class_init),
(gst_sdlvideosink_init), (gst_sdlvideosink_lock),
(gst_sdlvideosink_initsdl), (gst_sdlvideosink_create),
(gst_sdlvideosink_show_frame), (gst_sdlvideosink_set_property),
(gst_sdlvideosink_get_property), (gst_sdlvideosink_change_state):
Fix SDL videosink and did some cleanups.
2005-10-27 20:16:40 +00:00
|
|
|
ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
|
2005-10-27 19:36:18 +00:00
|
|
|
|
|
|
|
switch (transition) {
|
2005-09-05 17:20:29 +00:00
|
|
|
case GST_STATE_CHANGE_PAUSED_TO_READY:
|
2005-11-23 15:36:08 +00:00
|
|
|
sdlvideosink->framerate_n = 0;
|
|
|
|
sdlvideosink->framerate_d = 1;
|
ext/sdl/sdlvideosink.*: Fix output stride copying, so that it displays correctly on framebuffer devices that don't ma...
Original commit message from CVS:
* ext/sdl/sdlvideosink.c: (gst_sdlvideosink_supported),
(gst_sdlvideosink_xoverlay_set_xwindow_id),
(gst_sdlvideosink_deinitsdl), (gst_sdlv_process_events),
(gst_sdlvideosink_event_thread), (gst_sdlvideosink_initsdl),
(gst_sdlvideosink_destroy), (gst_sdlvideosink_create),
(gst_sdlvideosink_setcaps), (gst_sdlvideosink_show_frame),
(gst_sdlvideosink_change_state),
(gst_sdlvideosink_navigation_send_event):
* ext/sdl/sdlvideosink.h:
Fix output stride copying, so that it displays correctly on
framebuffer devices that don't match our implict GStreamer stride
arrangement.
Fix locking things. Offer XOverlay only when SDL is running against
X. Make non-scaled (and ugly) embedding work via X Overlay. It can't
actually match the embedded window size because there's no way to
figure out what size that should be from the XOverlay interface.
See comment in sdlvideosink.c
2006-01-27 01:31:12 +00:00
|
|
|
g_mutex_lock (sdlvideosink->lock);
|
2003-10-28 09:08:32 +00:00
|
|
|
gst_sdlvideosink_destroy (sdlvideosink);
|
ext/sdl/sdlvideosink.*: Fix output stride copying, so that it displays correctly on framebuffer devices that don't ma...
Original commit message from CVS:
* ext/sdl/sdlvideosink.c: (gst_sdlvideosink_supported),
(gst_sdlvideosink_xoverlay_set_xwindow_id),
(gst_sdlvideosink_deinitsdl), (gst_sdlv_process_events),
(gst_sdlvideosink_event_thread), (gst_sdlvideosink_initsdl),
(gst_sdlvideosink_destroy), (gst_sdlvideosink_create),
(gst_sdlvideosink_setcaps), (gst_sdlvideosink_show_frame),
(gst_sdlvideosink_change_state),
(gst_sdlvideosink_navigation_send_event):
* ext/sdl/sdlvideosink.h:
Fix output stride copying, so that it displays correctly on
framebuffer devices that don't match our implict GStreamer stride
arrangement.
Fix locking things. Offer XOverlay only when SDL is running against
X. Make non-scaled (and ugly) embedding work via X Overlay. It can't
actually match the embedded window size because there's no way to
figure out what size that should be from the XOverlay interface.
See comment in sdlvideosink.c
2006-01-27 01:31:12 +00:00
|
|
|
g_mutex_unlock (sdlvideosink->lock);
|
2003-10-28 09:08:32 +00:00
|
|
|
break;
|
2005-09-05 17:20:29 +00:00
|
|
|
case GST_STATE_CHANGE_READY_TO_NULL:
|
ext/sdl/sdlvideosink.*: Fix output stride copying, so that it displays correctly on framebuffer devices that don't ma...
Original commit message from CVS:
* ext/sdl/sdlvideosink.c: (gst_sdlvideosink_supported),
(gst_sdlvideosink_xoverlay_set_xwindow_id),
(gst_sdlvideosink_deinitsdl), (gst_sdlv_process_events),
(gst_sdlvideosink_event_thread), (gst_sdlvideosink_initsdl),
(gst_sdlvideosink_destroy), (gst_sdlvideosink_create),
(gst_sdlvideosink_setcaps), (gst_sdlvideosink_show_frame),
(gst_sdlvideosink_change_state),
(gst_sdlvideosink_navigation_send_event):
* ext/sdl/sdlvideosink.h:
Fix output stride copying, so that it displays correctly on
framebuffer devices that don't match our implict GStreamer stride
arrangement.
Fix locking things. Offer XOverlay only when SDL is running against
X. Make non-scaled (and ugly) embedding work via X Overlay. It can't
actually match the embedded window size because there's no way to
figure out what size that should be from the XOverlay interface.
See comment in sdlvideosink.c
2006-01-27 01:31:12 +00:00
|
|
|
g_mutex_lock (sdlvideosink->lock);
|
2003-10-28 09:08:32 +00:00
|
|
|
gst_sdlvideosink_deinitsdl (sdlvideosink);
|
renamed GST_FLAGS macros to GST_OBJECT_FLAGS moved bitshift from macro to enum definition
Original commit message from CVS:
* examples/indexing/indexmpeg.c: (main):
* ext/artsd/gstartsdsink.c: (gst_artsdsink_open_audio),
(gst_artsdsink_close_audio), (gst_artsdsink_change_state):
* ext/artsd/gstartsdsink.h:
* ext/audiofile/gstafparse.c: (gst_afparse_open_file),
(gst_afparse_close_file):
* ext/audiofile/gstafparse.h:
* ext/audiofile/gstafsink.c: (gst_afsink_open_file),
(gst_afsink_close_file), (gst_afsink_chain),
(gst_afsink_change_state):
* ext/audiofile/gstafsink.h:
* ext/audiofile/gstafsrc.c: (gst_afsrc_open_file),
(gst_afsrc_close_file), (gst_afsrc_change_state):
* ext/audiofile/gstafsrc.h:
* ext/cdaudio/gstcdaudio.c: (gst_cdaudio_init):
* ext/directfb/directfbvideosink.c: (gst_directfbvideosink_init):
* ext/dts/gstdtsdec.c: (gst_dtsdec_init):
* ext/jack/gstjack.h:
* ext/jack/gstjackbin.c: (gst_jack_bin_init),
(gst_jack_bin_change_state):
* ext/musepack/gstmusepackdec.c: (gst_musepackdec_init):
* ext/musicbrainz/gsttrm.c: (gst_musicbrainz_init):
* ext/nas/nassink.c: (gst_nassink_open_audio),
(gst_nassink_close_audio), (gst_nassink_change_state):
* ext/nas/nassink.h:
* ext/polyp/polypsink.c: (gst_polypsink_init):
* ext/sdl/sdlvideosink.c: (gst_sdlvideosink_change_state):
* ext/sdl/sdlvideosink.h:
* ext/smoothwave/gstsmoothwave.c: (gst_smoothwave_init):
* ext/sndfile/gstsf.c: (gst_sf_set_property),
(gst_sf_change_state), (gst_sf_release_request_pad),
(gst_sf_open_file), (gst_sf_close_file), (gst_sf_loop):
* ext/sndfile/gstsf.h:
* ext/swfdec/gstswfdec.c: (gst_swfdec_init):
* ext/tarkin/gsttarkindec.c: (gst_tarkindec_init):
* gst/apetag/apedemux.c: (gst_ape_demux_init):
* gst/cdxaparse/gstcdxaparse.c: (gst_cdxaparse_init):
* gst/cdxaparse/gstcdxastrip.c: (gst_cdxastrip_init):
* gst/festival/gstfestival.c: (gst_festival_change_state):
* gst/festival/gstfestival.h:
* gst/mpeg2sub/gstmpeg2subt.c: (gst_mpeg2subt_init):
* gst/multifilesink/gstmultifilesink.c: (gst_multifilesink_init),
(gst_multifilesink_set_location), (gst_multifilesink_open_file),
(gst_multifilesink_close_file), (gst_multifilesink_next_file),
(gst_multifilesink_pad_query), (gst_multifilesink_handle_event),
(gst_multifilesink_chain), (gst_multifilesink_change_state):
* gst/multifilesink/gstmultifilesink.h:
* gst/videodrop/gstvideodrop.c: (gst_videodrop_init):
* sys/cdrom/gstcdplayer.c: (cdplayer_init):
* sys/dxr3/dxr3audiosink.c: (dxr3audiosink_init),
(dxr3audiosink_open), (dxr3audiosink_close),
(dxr3audiosink_chain_pcm), (dxr3audiosink_chain_ac3),
(dxr3audiosink_change_state):
* sys/dxr3/dxr3audiosink.h:
* sys/dxr3/dxr3spusink.c: (dxr3spusink_init), (dxr3spusink_open),
(dxr3spusink_close), (dxr3spusink_chain),
(dxr3spusink_change_state):
* sys/dxr3/dxr3spusink.h:
* sys/dxr3/dxr3videosink.c: (dxr3videosink_init),
(dxr3videosink_open), (dxr3videosink_close),
(dxr3videosink_write_data), (dxr3videosink_change_state):
* sys/dxr3/dxr3videosink.h:
* sys/glsink/glimagesink.c: (gst_glimagesink_init):
* sys/qcam/gstqcamsrc.c: (gst_qcamsrc_change_state),
(gst_qcamsrc_open), (gst_qcamsrc_close):
* sys/qcam/gstqcamsrc.h:
* sys/v4l2/gstv4l2src.c: (gst_v4l2src_init):
* sys/vcd/vcdsrc.c: (gst_vcdsrc_set_property), (gst_vcdsrc_get),
(gst_vcdsrc_open_file), (gst_vcdsrc_close_file),
(gst_vcdsrc_change_state), (gst_vcdsrc_recalculate):
* sys/vcd/vcdsrc.h:
renamed GST_FLAGS macros to GST_OBJECT_FLAGS
moved bitshift from macro to enum definition
2005-10-12 14:29:55 +00:00
|
|
|
GST_OBJECT_FLAG_UNSET (sdlvideosink, GST_SDLVIDEOSINK_OPEN);
|
ext/sdl/sdlvideosink.*: Fix output stride copying, so that it displays correctly on framebuffer devices that don't ma...
Original commit message from CVS:
* ext/sdl/sdlvideosink.c: (gst_sdlvideosink_supported),
(gst_sdlvideosink_xoverlay_set_xwindow_id),
(gst_sdlvideosink_deinitsdl), (gst_sdlv_process_events),
(gst_sdlvideosink_event_thread), (gst_sdlvideosink_initsdl),
(gst_sdlvideosink_destroy), (gst_sdlvideosink_create),
(gst_sdlvideosink_setcaps), (gst_sdlvideosink_show_frame),
(gst_sdlvideosink_change_state),
(gst_sdlvideosink_navigation_send_event):
* ext/sdl/sdlvideosink.h:
Fix output stride copying, so that it displays correctly on
framebuffer devices that don't match our implict GStreamer stride
arrangement.
Fix locking things. Offer XOverlay only when SDL is running against
X. Make non-scaled (and ugly) embedding work via X Overlay. It can't
actually match the embedded window size because there's no way to
figure out what size that should be from the XOverlay interface.
See comment in sdlvideosink.c
2006-01-27 01:31:12 +00:00
|
|
|
g_mutex_unlock (sdlvideosink->lock);
|
2002-01-10 09:58:15 +00:00
|
|
|
break;
|
2004-03-15 19:32:27 +00:00
|
|
|
default: /* do nothing */
|
2002-01-10 09:58:15 +00:00
|
|
|
break;
|
2001-12-20 23:21:15 +00:00
|
|
|
}
|
ext/sdl/sdlvideosink.c: Fix SDL videosink and did some cleanups.
Original commit message from CVS:
* ext/sdl/sdlvideosink.c: (gst_sdlvideosink_finalize),
(gst_sdlvideosink_get_times), (gst_sdlvideosink_class_init),
(gst_sdlvideosink_init), (gst_sdlvideosink_lock),
(gst_sdlvideosink_initsdl), (gst_sdlvideosink_create),
(gst_sdlvideosink_show_frame), (gst_sdlvideosink_set_property),
(gst_sdlvideosink_get_property), (gst_sdlvideosink_change_state):
Fix SDL videosink and did some cleanups.
2005-10-27 20:16:40 +00:00
|
|
|
return ret;
|
2001-12-20 23:21:15 +00:00
|
|
|
|
ext/sdl/sdlvideosink.c: Fix SDL videosink and did some cleanups.
Original commit message from CVS:
* ext/sdl/sdlvideosink.c: (gst_sdlvideosink_finalize),
(gst_sdlvideosink_get_times), (gst_sdlvideosink_class_init),
(gst_sdlvideosink_init), (gst_sdlvideosink_lock),
(gst_sdlvideosink_initsdl), (gst_sdlvideosink_create),
(gst_sdlvideosink_show_frame), (gst_sdlvideosink_set_property),
(gst_sdlvideosink_get_property), (gst_sdlvideosink_change_state):
Fix SDL videosink and did some cleanups.
2005-10-27 20:16:40 +00:00
|
|
|
init_failed:
|
|
|
|
{
|
|
|
|
/* method posted detailed error message */
|
|
|
|
GST_DEBUG_OBJECT (sdlvideosink, "init failed");
|
|
|
|
return GST_STATE_CHANGE_FAILURE;
|
|
|
|
}
|
2001-12-20 23:21:15 +00:00
|
|
|
}
|
2006-01-11 20:59:39 +00:00
|
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
gst_sdlvideosink_navigation_send_event (GstNavigation * navigation,
|
|
|
|
GstStructure * structure)
|
|
|
|
{
|
|
|
|
GstSDLVideoSink *sdlvideosink = GST_SDLVIDEOSINK (navigation);
|
|
|
|
GstEvent *event;
|
|
|
|
GstVideoRectangle src, dst, result;
|
|
|
|
gint width, height;
|
|
|
|
double x, y;
|
|
|
|
GstPad *pad = NULL;
|
|
|
|
|
|
|
|
src.w = GST_VIDEO_SINK_WIDTH (sdlvideosink);
|
|
|
|
src.h = GST_VIDEO_SINK_HEIGHT (sdlvideosink);
|
|
|
|
dst.w = sdlvideosink->width;
|
|
|
|
dst.h = sdlvideosink->height;
|
|
|
|
gst_video_sink_center_rect (src, dst, &result, FALSE);
|
|
|
|
|
|
|
|
event = gst_event_new_navigation (structure);
|
|
|
|
|
|
|
|
/* Our coordinates can be wrong here if we centered the video */
|
|
|
|
|
|
|
|
/* Converting pointer coordinates to the non scaled geometry */
|
|
|
|
if (gst_structure_get_double (structure, "pointer_x", &x)) {
|
|
|
|
double old_x = x;
|
|
|
|
|
|
|
|
if (x >= result.x && x <= (result.x + result.w)) {
|
|
|
|
x -= result.x;
|
|
|
|
x *= sdlvideosink->width;
|
|
|
|
x /= result.w;
|
|
|
|
} else {
|
|
|
|
x = 0;
|
|
|
|
}
|
|
|
|
GST_DEBUG_OBJECT (sdlvideosink, "translated navigation event x "
|
|
|
|
"coordinate from %f to %f", old_x, x);
|
|
|
|
gst_structure_set (structure, "pointer_x", G_TYPE_DOUBLE, x, NULL);
|
|
|
|
}
|
|
|
|
if (gst_structure_get_double (structure, "pointer_y", &y)) {
|
|
|
|
double old_y = y;
|
|
|
|
|
|
|
|
if (y >= result.y && y <= (result.y + result.h)) {
|
|
|
|
y -= result.y;
|
|
|
|
y *= sdlvideosink->height;
|
|
|
|
y /= result.h;
|
|
|
|
} else {
|
|
|
|
y = 0;
|
|
|
|
}
|
|
|
|
GST_DEBUG_OBJECT (sdlvideosink, "translated navigation event y "
|
ext/sdl/sdlvideosink.*: Fix output stride copying, so that it displays correctly on framebuffer devices that don't ma...
Original commit message from CVS:
* ext/sdl/sdlvideosink.c: (gst_sdlvideosink_supported),
(gst_sdlvideosink_xoverlay_set_xwindow_id),
(gst_sdlvideosink_deinitsdl), (gst_sdlv_process_events),
(gst_sdlvideosink_event_thread), (gst_sdlvideosink_initsdl),
(gst_sdlvideosink_destroy), (gst_sdlvideosink_create),
(gst_sdlvideosink_setcaps), (gst_sdlvideosink_show_frame),
(gst_sdlvideosink_change_state),
(gst_sdlvideosink_navigation_send_event):
* ext/sdl/sdlvideosink.h:
Fix output stride copying, so that it displays correctly on
framebuffer devices that don't match our implict GStreamer stride
arrangement.
Fix locking things. Offer XOverlay only when SDL is running against
X. Make non-scaled (and ugly) embedding work via X Overlay. It can't
actually match the embedded window size because there's no way to
figure out what size that should be from the XOverlay interface.
See comment in sdlvideosink.c
2006-01-27 01:31:12 +00:00
|
|
|
"coordinate from %f to %f", old_y, y);
|
2006-01-11 20:59:39 +00:00
|
|
|
gst_structure_set (structure, "pointer_y", G_TYPE_DOUBLE, y, NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
pad = gst_pad_get_peer (GST_VIDEO_SINK_PAD (sdlvideosink));
|
|
|
|
|
|
|
|
if (GST_IS_PAD (pad) && GST_IS_EVENT (event)) {
|
|
|
|
gst_pad_send_event (pad, event);
|
|
|
|
|
|
|
|
gst_object_unref (pad);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gst_sdlvideosink_navigation_init (GstNavigationInterface * iface)
|
|
|
|
{
|
|
|
|
iface->send_event = gst_sdlvideosink_navigation_send_event;
|
|
|
|
}
|