• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * GStreamer
3  * Copyright (C) 2015 Matthew Waters <matthew@centricular.com>
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Library General Public
7  * License as published by the Free Software Foundation; either
8  * version 2 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  * Library General Public License for more details.
14  *
15  * You should have received a copy of the GNU Library General Public
16  * License along with this library; if not, write to the
17  * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
18  * Boston, MA 02110-1301, USA.
19  */
20 
21 #ifndef _AV_SINK_H_
22 #define _AV_SINK_H_
23 
24 #include <gst/gst.h>
25 #include <gst/video/gstvideosink.h>
26 #include <gst/video/video.h>
27 
28 #include <QuartzCore/QuartzCore.h>
29 #include <CoreFoundation/CoreFoundation.h>
30 #include <CoreMedia/CoreMedia.h>
31 #include <AVFoundation/AVFoundation.h>
32 
33 G_BEGIN_DECLS
34 
35 #define GST_TYPE_AV_SAMPLE_VIDEO_SINK \
36     (gst_av_sample_video_sink_get_type())
37 #define GST_AV_SAMPLE_VIDEO_SINK(obj) \
38     (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_AV_SAMPLE_VIDEO_SINK,GstAVSampleVideoSink))
39 #define GST_AV_SAMPLE_VIDEO_SINK_CLASS(klass) \
40     (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_AV_SAMPLE_VIDEO_SINK,GstAVSampleVideoSinkClass))
41 #define GST_IS_AV_SAMPLE_VIDEO_SINK(obj) \
42     (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_AV_SAMPLE_VIDEO_SINK))
43 #define GST_IS_AV_SAMPLE_VIDEO_SINK_CLASS(klass) \
44     (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_AV_SAMPLE_VIDEO_SINK))
45 #define GST_AV_SAMPLE_VIDEO_SINK_LAYER(obj) \
46     ((__bridge AVSampleBufferDisplayLayer *)(obj->layer))
47 
48 typedef struct _GstAVSampleVideoSink GstAVSampleVideoSink;
49 typedef struct _GstAVSampleVideoSinkClass GstAVSampleVideoSinkClass;
50 
51 struct _GstAVSampleVideoSink
52 {
53     GstVideoSink video_sink;
54 
55     /* NOTE: ARC no longer allows Objective-C pointers in structs. */
56     /* Instead, use gpointer with explicit __bridge_* calls */
57     gpointer layer;
58 
59     GstVideoInfo info;
60 
61     gboolean keep_aspect_ratio;
62 
63     GstBufferPool *pool;
64 
65     gboolean layer_requesting_data;
66 
67     GMutex render_lock;
68     GstBuffer *buffer;
69     GstFlowReturn render_flow_return;
70 };
71 
72 struct _GstAVSampleVideoSinkClass
73 {
74     GstVideoSinkClass video_sink_class;
75 };
76 
77 GType gst_av_sample_video_sink_get_type(void);
78 
79 G_END_DECLS
80 
81 #endif
82