mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-24 02:31:03 +00:00
sys/osxvideo/osxvideosink.*: Fix a stupid #if vs #ifdef bug. Should use the proper colorspace now.
Original commit message from CVS: * sys/osxvideo/osxvideosink.h: * sys/osxvideo/osxvideosink.m: Fix a stupid #if vs #ifdef bug. Should use the proper colorspace now. Use a separate thread/task for the cocoa event_loop, else it wouldn't stop.
This commit is contained in:
parent
ee21b60cd7
commit
284c7f0ff9
2 changed files with 19 additions and 3 deletions
|
@ -84,6 +84,8 @@ struct _GstOSXVideoSink {
|
||||||
gboolean embed;
|
gboolean embed;
|
||||||
gboolean fullscreen;
|
gboolean fullscreen;
|
||||||
gboolean sw_scaling_failed;
|
gboolean sw_scaling_failed;
|
||||||
|
GstTask *event_loop;
|
||||||
|
GStaticRecMutex loop_lock;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _GstOSXVideoSinkClass {
|
struct _GstOSXVideoSinkClass {
|
||||||
|
|
|
@ -51,7 +51,7 @@ GST_STATIC_PAD_TEMPLATE ("sink",
|
||||||
"framerate = (fraction) [ 0, MAX ], "
|
"framerate = (fraction) [ 0, MAX ], "
|
||||||
"width = (int) [ 1, MAX ], "
|
"width = (int) [ 1, MAX ], "
|
||||||
"height = (int) [ 1, MAX ], "
|
"height = (int) [ 1, MAX ], "
|
||||||
#ifdef G_BYTE_ORDER == G_BIG_ENDIAN
|
#if G_BYTE_ORDER == G_BIG_ENDIAN
|
||||||
"format = (fourcc) YUY2")
|
"format = (fourcc) YUY2")
|
||||||
#else
|
#else
|
||||||
"format = (fourcc) UYVY")
|
"format = (fourcc) UYVY")
|
||||||
|
@ -92,7 +92,10 @@ gint
|
||||||
cocoa_event_loop (GstOSXVideoSink * vsink)
|
cocoa_event_loop (GstOSXVideoSink * vsink)
|
||||||
{
|
{
|
||||||
NSAutoreleasePool *pool;
|
NSAutoreleasePool *pool;
|
||||||
|
gboolean ret = TRUE;
|
||||||
|
|
||||||
|
GST_DEBUG_OBJECT (vsink, "Entering event loop");
|
||||||
|
|
||||||
pool = [[NSAutoreleasePool alloc] init];
|
pool = [[NSAutoreleasePool alloc] init];
|
||||||
|
|
||||||
if ([NSApp isRunning]) {
|
if ([NSApp isRunning]) {
|
||||||
|
@ -110,7 +113,9 @@ cocoa_event_loop (GstOSXVideoSink * vsink)
|
||||||
|
|
||||||
[pool release];
|
[pool release];
|
||||||
|
|
||||||
return TRUE;
|
GST_DEBUG_OBJECT (vsink, "Leaving event loop with ret : %d", ret);
|
||||||
|
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static NSString *
|
static NSString *
|
||||||
|
@ -254,7 +259,10 @@ gst_osx_video_sink_osxwindow_new (GstOSXVideoSink * osxvideosink, gint width,
|
||||||
|
|
||||||
[NSApp setRunning];
|
[NSApp setRunning];
|
||||||
// insert event dispatch in the glib main loop
|
// insert event dispatch in the glib main loop
|
||||||
g_idle_add ((GSourceFunc) cocoa_event_loop, osxvideosink);
|
g_static_rec_mutex_init (&osxvideosink->loop_lock);
|
||||||
|
osxvideosink->event_loop = gst_task_create ((GstTaskFunction) cocoa_event_loop, osxvideosink);
|
||||||
|
gst_task_set_lock (osxvideosink->event_loop, &osxvideosink->loop_lock);
|
||||||
|
gst_task_start (osxvideosink->event_loop);
|
||||||
} else {
|
} else {
|
||||||
GstStructure *s;
|
GstStructure *s;
|
||||||
GstMessage *msg;
|
GstMessage *msg;
|
||||||
|
@ -294,6 +302,8 @@ gst_osx_video_sink_osxwindow_destroy (GstOSXVideoSink * osxvideosink,
|
||||||
g_return_if_fail (GST_IS_OSX_VIDEO_SINK (osxvideosink));
|
g_return_if_fail (GST_IS_OSX_VIDEO_SINK (osxvideosink));
|
||||||
|
|
||||||
[osxwindow->pool release];
|
[osxwindow->pool release];
|
||||||
|
if (osxvideosink->event_loop)
|
||||||
|
gst_task_stop (osxvideosink->event_loop);
|
||||||
|
|
||||||
g_free (osxwindow);
|
g_free (osxwindow);
|
||||||
}
|
}
|
||||||
|
@ -379,6 +389,10 @@ gst_osx_video_sink_change_state (GstElement * element,
|
||||||
|
|
||||||
osxvideosink = GST_OSX_VIDEO_SINK (element);
|
osxvideosink = GST_OSX_VIDEO_SINK (element);
|
||||||
|
|
||||||
|
GST_DEBUG_OBJECT (osxvideosink, "%s => %s",
|
||||||
|
gst_element_state_get_name(GST_STATE_TRANSITION_CURRENT (transition)),
|
||||||
|
gst_element_state_get_name(GST_STATE_TRANSITION_NEXT (transition)));
|
||||||
|
|
||||||
switch (transition) {
|
switch (transition) {
|
||||||
case GST_STATE_CHANGE_NULL_TO_READY:
|
case GST_STATE_CHANGE_NULL_TO_READY:
|
||||||
/* Creating our window and our image */
|
/* Creating our window and our image */
|
||||||
|
|
Loading…
Reference in a new issue