osxaudio: Overhaul of probing caps
[platform/upstream/gst-plugins-good.git] / sys / osxvideo / osxvideosink.h
1 /* GStreamer
2  * Copyright (C) 2004-6 Zaheer Abbas Merali <zaheerabbas at merali dot org>
3  * Copyright (C) 2007 Pioneers of the Inevitable <songbird@songbirdnest.com>
4  *
5  *
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.
10  *
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.
15  *
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.
20  *
21  *
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
24  * 
25  */
26  
27 #ifndef __GST_OSX_VIDEO_SINK_H__
28 #define __GST_OSX_VIDEO_SINK_H__
29
30 #include <gst/video/video.h>
31 #include <gst/video/gstvideosink.h>
32
33 #include <string.h>
34 #include <math.h>
35 #include <objc/runtime.h>
36 #include <Cocoa/Cocoa.h>
37
38 #include <QuickTime/QuickTime.h>
39 #import "cocoawindow.h"
40
41 GST_DEBUG_CATEGORY_EXTERN (gst_debug_osx_video_sink);
42 #define GST_CAT_DEFAULT gst_debug_osx_video_sink
43
44 G_BEGIN_DECLS
45
46 #define GST_TYPE_OSX_VIDEO_SINK \
47   (gst_osx_video_sink_get_type())
48 #define GST_OSX_VIDEO_SINK(obj) \
49   (G_TYPE_CHECK_INSTANCE_CAST((obj), GST_TYPE_OSX_VIDEO_SINK, GstOSXVideoSink))
50 #define GST_OSX_VIDEO_SINK_CLASS(klass) \
51   (G_TYPE_CHECK_CLASS_CAST((klass), GST_TYPE_OSX_VIDEO_SINK, GstOSXVideoSinkClass))
52 #define GST_IS_OSX_VIDEO_SINK(obj) \
53   (G_TYPE_CHECK_INSTANCE_TYPE((obj), GST_TYPE_OSX_VIDEO_SINK))
54 #define GST_IS_OSX_VIDEO_SINK_CLASS(klass) \
55   (G_TYPE_CHECK_CLASS_TYPE((klass), GST_TYPE_OSX_VIDEO_SINK))
56
57 typedef struct _GstOSXWindow GstOSXWindow;
58
59 typedef struct _GstOSXVideoSink GstOSXVideoSink;
60 typedef struct _GstOSXVideoSinkClass GstOSXVideoSinkClass;
61
62 #define GST_TYPE_OSXVIDEOBUFFER (gst_osxvideobuffer_get_type())
63
64 typedef enum {
65   GST_OSX_VIDEO_SINK_RUN_LOOP_STATE_NOT_RUNNING = 0,
66   GST_OSX_VIDEO_SINK_RUN_LOOP_STATE_RUNNING = 1,
67   GST_OSX_VIDEO_SINK_RUN_LOOP_STATE_UNKNOWN = 2,
68 } GstOSXVideoSinkRunLoopState;
69
70 /* OSXWindow stuff */
71 struct _GstOSXWindow {
72   gint width, height;
73   gboolean closed;
74   gboolean internal;
75   GstGLView* gstview;
76   GstOSXVideoSinkWindow* win;
77 };
78
79 struct _GstOSXVideoSink {
80   /* Our element stuff */
81   GstVideoSink videosink;
82   GstOSXWindow *osxwindow;
83   void *osxvideosinkobject;
84   NSView *superview;
85   gboolean keep_par;
86   GstVideoInfo info;
87 };
88
89 struct _GstOSXVideoSinkClass {
90   GstVideoSinkClass parent_class;
91
92   GstOSXVideoSinkRunLoopState run_loop_state;
93   NSThread *ns_app_thread;
94 };
95
96 GType gst_osx_video_sink_get_type(void);
97
98 @interface NSApplication(AppleMenu)
99 - (void)setAppleMenu:(NSMenu *)menu;
100 @end
101
102 @interface GstBufferObject : NSObject
103 {
104   @public
105   GstBuffer *buf;
106 }
107
108 -(id) initWithBuffer: (GstBuffer *) buf;
109 @end
110
111
112 @interface GstWindowDelegate : NSObject <NSWindowDelegate>
113 {
114   @public
115   GstOSXVideoSink *osxvideosink;
116 }
117 -(id) initWithSink: (GstOSXVideoSink *) sink;
118 @end
119
120 @interface GstOSXVideoSinkObject : NSObject
121 {
122   @public
123   GstOSXVideoSink *osxvideosink;
124 }
125
126 -(id) initWithSink: (GstOSXVideoSink *) sink;
127 -(void) createInternalWindow;
128 -(void) resize;
129 -(void) destroy;
130 -(void) showFrame: (GstBufferObject*) buf;
131 -(void) setView: (NSView*) view;
132 + (BOOL) isMainThread;
133 #ifndef GSTREAMER_GLIB_COCOA_NSAPPLICATION
134 -(void) nsAppThread;
135 -(void) checkMainRunLoop;
136 #endif
137 @end
138
139 G_END_DECLS
140
141 #endif /* __GST_OSX_VIDEO_SINK_H__ */
142