2 * Copyright (C) 2004-6 Zaheer Abbas Merali <zaheerabbas at merali dot org>
3 * Copyright (C) 2007 Pioneers of the Inevitable <songbird@songbirdnest.com>
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Library General Public License for more details.
16 * You should have received a copy of the GNU Library General Public
17 * License along with this library; if not, write to the
18 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
19 * Boston, MA 02110-1301, USA.
22 * The development of this code was made possible due to the involvement of Pioneers
23 * of the Inevitable, the creators of the Songbird Music player
27 #ifndef __GST_OSX_VIDEO_SINK_H__
28 #define __GST_OSX_VIDEO_SINK_H__
30 #include <gst/video/gstvideosink.h>
34 #include <objc/runtime.h>
35 #include <Cocoa/Cocoa.h>
37 #include <QuickTime/QuickTime.h>
38 #import "cocoawindow.h"
40 GST_DEBUG_CATEGORY_EXTERN (gst_debug_osx_video_sink);
41 #define GST_CAT_DEFAULT gst_debug_osx_video_sink
45 #define GST_TYPE_OSX_VIDEO_SINK \
46 (gst_osx_video_sink_get_type())
47 #define GST_OSX_VIDEO_SINK(obj) \
48 (G_TYPE_CHECK_INSTANCE_CAST((obj), GST_TYPE_OSX_VIDEO_SINK, GstOSXVideoSink))
49 #define GST_OSX_VIDEO_SINK_CLASS(klass) \
50 (G_TYPE_CHECK_CLASS_CAST((klass), GST_TYPE_OSX_VIDEO_SINK, GstOSXVideoSinkClass))
51 #define GST_IS_OSX_VIDEO_SINK(obj) \
52 (G_TYPE_CHECK_INSTANCE_TYPE((obj), GST_TYPE_OSX_VIDEO_SINK))
53 #define GST_IS_OSX_VIDEO_SINK_CLASS(klass) \
54 (G_TYPE_CHECK_CLASS_TYPE((klass), GST_TYPE_OSX_VIDEO_SINK))
56 typedef struct _GstOSXWindow GstOSXWindow;
58 typedef struct _GstOSXVideoSink GstOSXVideoSink;
59 typedef struct _GstOSXVideoSinkClass GstOSXVideoSinkClass;
61 #define GST_TYPE_OSXVIDEOBUFFER (gst_osxvideobuffer_get_type())
64 GST_OSX_VIDEO_SINK_RUN_LOOP_STATE_NOT_RUNNING = 0,
65 GST_OSX_VIDEO_SINK_RUN_LOOP_STATE_RUNNING = 1,
66 GST_OSX_VIDEO_SINK_RUN_LOOP_STATE_UNKNOWN = 2,
67 } GstOSXVideoSinkRunLoopState;
70 struct _GstOSXWindow {
75 GstOSXVideoSinkWindow* win;
78 struct _GstOSXVideoSink {
79 /* Our element stuff */
80 GstVideoSink videosink;
81 GstOSXWindow *osxwindow;
82 void *osxvideosinkobject;
88 struct _GstOSXVideoSinkClass {
89 GstVideoSinkClass parent_class;
91 GstOSXVideoSinkRunLoopState run_loop_state;
92 NSThread *ns_app_thread;
95 GType gst_osx_video_sink_get_type(void);
97 @interface NSApplication(AppleMenu)
98 - (void)setAppleMenu:(NSMenu *)menu;
101 @interface GstBufferObject : NSObject
107 -(id) initWithBuffer: (GstBuffer *) buf;
111 @interface GstWindowDelegate : NSObject <NSWindowDelegate>
114 GstOSXVideoSink *osxvideosink;
116 -(id) initWithSink: (GstOSXVideoSink *) sink;
119 @interface GstOSXVideoSinkObject : NSObject
122 GstOSXVideoSink *osxvideosink;
125 -(id) initWithSink: (GstOSXVideoSink *) sink;
126 -(void) createInternalWindow;
129 -(void) showFrame: (GstBufferObject*) buf;
130 -(void) setView: (NSView*) view;
131 + (BOOL) isMainThread;
133 -(void) checkMainRunLoop;
138 #endif /* __GST_OSX_VIDEO_SINK_H__ */