• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * GStreamer
3  * Copyright (C) 2013 Miguel Casas-Sanchez <miguelecasassanchez@gmail.com>
4  *
5  * This library is free software; you can
6  * redistribute it and/or modify it under the terms of the GNU Library
7  * General Public License as published by the Free Software Foundation;
8  * either version 2 of the License, or (at your option) any later version.
9  * This library is distributed in the hope that it will be useful, but
10  * WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library
12  * General Public License for more details. You should have received a copy
13  * of the GNU Library General Public License along with this library; if
14  * not, write to the Free Software Foundation, Inc., 51 Franklin St,
15  * Fifth Floor, Boston, MA 02110-1301, USA.
16  */
17 
18 #ifndef __GST_OPENNI2_SRC_H__
19 #define __GST_OPENNI2_SRC_H__
20 
21 #include <gst/gst.h>
22 #include <stdio.h>
23 #include <OpenNI.h>
24 
25 #include <gst/base/gstbasesrc.h>
26 #include <gst/base/gstpushsrc.h>
27 #include <gst/video/video.h>
28 
29 G_BEGIN_DECLS
30 #define GST_TYPE_OPENNI2_SRC \
31   (gst_openni2_src_get_type())
32 #define GST_OPENNI2_SRC(obj) \
33   (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_OPENNI2_SRC,GstOpenni2Src))
34 #define GST_OPENNI2_SRC_CLASS(klass) \
35   (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_OPENNI2_SRC,GstOpenni2SrcClass))
36 #define GST_IS_OPENNI2_SRC(obj) \
37   (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_OPENNI2_SRC))
38 #define GST_IS_OPENNI2_SRC_CLASS(klass) \
39   (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_OPENNI2_SRC))
40 typedef struct _GstOpenni2Src GstOpenni2Src;
41 typedef struct _GstOpenni2SrcClass GstOpenni2SrcClass;
42 
43 typedef enum
44 {
45   GST_OPENNI2_SRC_FILE_TRANSFER,
46   GST_OPENNI2_SRC_NEXT_PROGRAM_CHAIN,
47   GST_OPENNI2_SRC_INVALID_DATA
48 } GstOpenni2State;
49 
50 struct _GstOpenni2Src
51 {
52   GstPushSrc element;
53 
54   GstOpenni2State state;
55   gchar *uri_name;
56   gint sourcetype;
57   GstVideoInfo info;
58   GstCaps *gst_caps;
59 
60   /* Timestamp of the first frame */
61   GstClockTime oni_start_ts;
62 
63   /* OpenNI2 variables */
64   openni::Device *device;
65   openni::VideoStream *depth, *color;
66   openni::VideoMode depthVideoMode, colorVideoMode;
67   openni::PixelFormat depthpixfmt, colorpixfmt;
68   int width, height, fps;
69   openni::VideoFrameRef *depthFrame, *colorFrame;
70 };
71 
72 struct _GstOpenni2SrcClass
73 {
74   GstPushSrcClass parent_class;
75 };
76 
77 GType gst_openni2_src_get_type (void);
78 
79 GST_ELEMENT_REGISTER_DECLARE (openni2src);
80 
81 G_END_DECLS
82 #endif /* __GST_OPENNI2_SRC_H__ */
83