2007-01-30 17:19:33 +00:00
|
|
|
/* GStreamer
|
2008-01-15 16:04:44 +00:00
|
|
|
* Copyright (C) 2004-6 Zaheer Abbas Merali <zaheerabbas at merali dot org>
|
|
|
|
* Copyright (C) 2007 Pioneers of the Inevitable <songbird@songbirdnest.com>
|
|
|
|
*
|
2007-01-30 17:19:33 +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
|
2012-11-04 00:07:18 +00:00
|
|
|
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
|
|
|
|
* Boston, MA 02110-1301, USA.
|
2008-01-15 16:04:44 +00:00
|
|
|
*
|
|
|
|
*
|
|
|
|
* The development of this code was made possible due to the involvement of Pioneers
|
|
|
|
* of the Inevitable, the creators of the Songbird Music player
|
|
|
|
*
|
2007-01-30 17:19:33 +00:00
|
|
|
*/
|
|
|
|
|
2008-01-15 16:04:44 +00:00
|
|
|
#ifndef __GST_OSX_VIDEO_SINK_H__
|
|
|
|
#define __GST_OSX_VIDEO_SINK_H__
|
2007-01-30 17:19:33 +00:00
|
|
|
|
2014-03-19 19:18:11 +00:00
|
|
|
#include <gst/video/video.h>
|
2007-01-30 17:19:33 +00:00
|
|
|
#include <gst/video/gstvideosink.h>
|
|
|
|
|
|
|
|
#include <string.h>
|
|
|
|
#include <math.h>
|
2012-05-22 14:45:28 +00:00
|
|
|
#include <objc/runtime.h>
|
2008-01-15 16:04:44 +00:00
|
|
|
#include <Cocoa/Cocoa.h>
|
2007-01-30 17:19:33 +00:00
|
|
|
|
|
|
|
#include <QuickTime/QuickTime.h>
|
|
|
|
#import "cocoawindow.h"
|
2008-01-15 16:04:44 +00:00
|
|
|
|
|
|
|
GST_DEBUG_CATEGORY_EXTERN (gst_debug_osx_video_sink);
|
|
|
|
#define GST_CAT_DEFAULT gst_debug_osx_video_sink
|
2007-01-30 17:19:33 +00:00
|
|
|
|
|
|
|
G_BEGIN_DECLS
|
|
|
|
|
2008-01-15 16:04:44 +00:00
|
|
|
#define GST_TYPE_OSX_VIDEO_SINK \
|
|
|
|
(gst_osx_video_sink_get_type())
|
|
|
|
#define GST_OSX_VIDEO_SINK(obj) \
|
|
|
|
(G_TYPE_CHECK_INSTANCE_CAST((obj), GST_TYPE_OSX_VIDEO_SINK, GstOSXVideoSink))
|
|
|
|
#define GST_OSX_VIDEO_SINK_CLASS(klass) \
|
|
|
|
(G_TYPE_CHECK_CLASS_CAST((klass), GST_TYPE_OSX_VIDEO_SINK, GstOSXVideoSinkClass))
|
|
|
|
#define GST_IS_OSX_VIDEO_SINK(obj) \
|
|
|
|
(G_TYPE_CHECK_INSTANCE_TYPE((obj), GST_TYPE_OSX_VIDEO_SINK))
|
|
|
|
#define GST_IS_OSX_VIDEO_SINK_CLASS(klass) \
|
|
|
|
(G_TYPE_CHECK_CLASS_TYPE((klass), GST_TYPE_OSX_VIDEO_SINK))
|
2007-01-30 17:19:33 +00:00
|
|
|
|
|
|
|
typedef struct _GstOSXWindow GstOSXWindow;
|
|
|
|
|
|
|
|
typedef struct _GstOSXVideoSink GstOSXVideoSink;
|
|
|
|
typedef struct _GstOSXVideoSinkClass GstOSXVideoSinkClass;
|
|
|
|
|
2008-01-15 16:04:44 +00:00
|
|
|
#define GST_TYPE_OSXVIDEOBUFFER (gst_osxvideobuffer_get_type())
|
|
|
|
|
2013-07-07 19:14:22 +00:00
|
|
|
typedef enum {
|
|
|
|
GST_OSX_VIDEO_SINK_RUN_LOOP_STATE_NOT_RUNNING = 0,
|
|
|
|
GST_OSX_VIDEO_SINK_RUN_LOOP_STATE_RUNNING = 1,
|
|
|
|
GST_OSX_VIDEO_SINK_RUN_LOOP_STATE_UNKNOWN = 2,
|
|
|
|
} GstOSXVideoSinkRunLoopState;
|
|
|
|
|
2007-01-30 17:19:33 +00:00
|
|
|
/* OSXWindow stuff */
|
|
|
|
struct _GstOSXWindow {
|
|
|
|
gint width, height;
|
2012-05-14 16:01:02 +00:00
|
|
|
gboolean closed;
|
2007-01-30 17:19:33 +00:00
|
|
|
gboolean internal;
|
|
|
|
GstGLView* gstview;
|
2012-05-14 16:01:02 +00:00
|
|
|
GstOSXVideoSinkWindow* win;
|
2007-01-30 17:19:33 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct _GstOSXVideoSink {
|
|
|
|
/* Our element stuff */
|
|
|
|
GstVideoSink videosink;
|
|
|
|
GstOSXWindow *osxwindow;
|
2012-05-11 16:24:08 +00:00
|
|
|
void *osxvideosinkobject;
|
2010-05-11 08:52:58 +00:00
|
|
|
NSView *superview;
|
2012-05-16 16:52:45 +00:00
|
|
|
gboolean keep_par;
|
2012-05-16 19:52:45 +00:00
|
|
|
gboolean embed;
|
2014-03-19 19:18:11 +00:00
|
|
|
GstVideoInfo info;
|
2007-01-30 17:19:33 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct _GstOSXVideoSinkClass {
|
|
|
|
GstVideoSinkClass parent_class;
|
2013-07-07 19:14:22 +00:00
|
|
|
|
|
|
|
GstOSXVideoSinkRunLoopState run_loop_state;
|
|
|
|
NSThread *ns_app_thread;
|
2008-01-15 15:22:41 +00:00
|
|
|
};
|
2007-03-14 16:30:19 +00:00
|
|
|
|
2008-01-15 16:04:44 +00:00
|
|
|
GType gst_osx_video_sink_get_type(void);
|
|
|
|
|
2012-05-14 16:01:02 +00:00
|
|
|
@interface NSApplication(AppleMenu)
|
|
|
|
- (void)setAppleMenu:(NSMenu *)menu;
|
|
|
|
@end
|
|
|
|
|
2012-05-11 16:24:08 +00:00
|
|
|
@interface GstBufferObject : NSObject
|
|
|
|
{
|
|
|
|
@public
|
|
|
|
GstBuffer *buf;
|
|
|
|
}
|
|
|
|
|
|
|
|
-(id) initWithBuffer: (GstBuffer *) buf;
|
|
|
|
@end
|
|
|
|
|
|
|
|
|
2012-05-30 14:03:55 +00:00
|
|
|
@interface GstWindowDelegate : NSObject <NSWindowDelegate>
|
2012-05-14 16:01:02 +00:00
|
|
|
{
|
|
|
|
@public
|
|
|
|
GstOSXVideoSink *osxvideosink;
|
|
|
|
}
|
|
|
|
-(id) initWithSink: (GstOSXVideoSink *) sink;
|
|
|
|
@end
|
|
|
|
|
2012-05-11 16:24:08 +00:00
|
|
|
@interface GstOSXVideoSinkObject : NSObject
|
|
|
|
{
|
|
|
|
@public
|
|
|
|
GstOSXVideoSink *osxvideosink;
|
|
|
|
}
|
|
|
|
|
|
|
|
-(id) initWithSink: (GstOSXVideoSink *) sink;
|
2012-05-14 16:01:02 +00:00
|
|
|
-(void) createInternalWindow;
|
2012-05-11 16:24:08 +00:00
|
|
|
-(void) resize;
|
|
|
|
-(void) destroy;
|
|
|
|
-(void) showFrame: (GstBufferObject*) buf;
|
2013-07-09 13:34:04 +00:00
|
|
|
-(void) setView: (NSView*) view;
|
2012-05-31 08:26:27 +00:00
|
|
|
+ (BOOL) isMainThread;
|
2012-05-24 18:43:16 +00:00
|
|
|
-(void) nsAppThread;
|
2012-08-01 23:48:29 +00:00
|
|
|
-(void) checkMainRunLoop;
|
2012-05-11 16:24:08 +00:00
|
|
|
@end
|
|
|
|
|
2007-01-30 17:19:33 +00:00
|
|
|
G_END_DECLS
|
|
|
|
|
2008-01-15 16:04:44 +00:00
|
|
|
#endif /* __GST_OSX_VIDEO_SINK_H__ */
|
|
|
|
|