summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEdward Hervey <bilboed@bilboed.com>2007-05-17 09:41:48 +0000
committerEdward Hervey <bilboed@bilboed.com>2007-05-17 09:41:48 +0000
commit23ff18c522766dfe2f1fab3f0238104ba24e3d6f (patch)
tree22f8b272ca13d987cdf4984f684c91d5894e557a
parenta6ec2ff8d59fb06a7ff323ce2e1dd91d09db25d6 (diff)
downloadgst-plugins-bad-23ff18c522766dfe2f1fab3f0238104ba24e3d6f.tar.gz
gst-plugins-bad-23ff18c522766dfe2f1fab3f0238104ba24e3d6f.tar.bz2
gst-plugins-bad-23ff18c522766dfe2f1fab3f0238104ba24e3d6f.zip
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.
-rw-r--r--ChangeLog8
-rw-r--r--sys/osxvideo/osxvideosink.h2
-rw-r--r--sys/osxvideo/osxvideosink.m20
3 files changed, 27 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index b40014cb..6239ba42 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2007-05-17 Edward Hervey <edward@fluendo.com>
+
+ * 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.
+
2007-05-16 Tim-Philipp Müller <tim at centricular dot net>
* gst/real/gstrealaudiodec.c: (gst_real_audio_dec_chain),
diff --git a/sys/osxvideo/osxvideosink.h b/sys/osxvideo/osxvideosink.h
index d7fba966..4aef99f4 100644
--- a/sys/osxvideo/osxvideosink.h
+++ b/sys/osxvideo/osxvideosink.h
@@ -84,6 +84,8 @@ struct _GstOSXVideoSink {
gboolean embed;
gboolean fullscreen;
gboolean sw_scaling_failed;
+ GstTask *event_loop;
+ GStaticRecMutex loop_lock;
};
struct _GstOSXVideoSinkClass {
diff --git a/sys/osxvideo/osxvideosink.m b/sys/osxvideo/osxvideosink.m
index 8e94a9c6..9fb9d89f 100644
--- a/sys/osxvideo/osxvideosink.m
+++ b/sys/osxvideo/osxvideosink.m
@@ -51,7 +51,7 @@ GST_STATIC_PAD_TEMPLATE ("sink",
"framerate = (fraction) [ 0, MAX ], "
"width = (int) [ 1, MAX ], "
"height = (int) [ 1, MAX ], "
-#ifdef G_BYTE_ORDER == G_BIG_ENDIAN
+#if G_BYTE_ORDER == G_BIG_ENDIAN
"format = (fourcc) YUY2")
#else
"format = (fourcc) UYVY")
@@ -92,7 +92,10 @@ gint
cocoa_event_loop (GstOSXVideoSink * vsink)
{
NSAutoreleasePool *pool;
+ gboolean ret = TRUE;
+ GST_DEBUG_OBJECT (vsink, "Entering event loop");
+
pool = [[NSAutoreleasePool alloc] init];
if ([NSApp isRunning]) {
@@ -110,7 +113,9 @@ cocoa_event_loop (GstOSXVideoSink * vsink)
[pool release];
- return TRUE;
+ GST_DEBUG_OBJECT (vsink, "Leaving event loop with ret : %d", ret);
+
+ return ret;
}
static NSString *
@@ -254,7 +259,10 @@ gst_osx_video_sink_osxwindow_new (GstOSXVideoSink * osxvideosink, gint width,
[NSApp setRunning];
// 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 {
GstStructure *s;
GstMessage *msg;
@@ -294,6 +302,8 @@ gst_osx_video_sink_osxwindow_destroy (GstOSXVideoSink * osxvideosink,
g_return_if_fail (GST_IS_OSX_VIDEO_SINK (osxvideosink));
[osxwindow->pool release];
+ if (osxvideosink->event_loop)
+ gst_task_stop (osxvideosink->event_loop);
g_free (osxwindow);
}
@@ -379,6 +389,10 @@ gst_osx_video_sink_change_state (GstElement * 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) {
case GST_STATE_CHANGE_NULL_TO_READY:
/* Creating our window and our image */