1 /*
2  * Copyright (C) 2008 Ole André Vadla Ravnås <ole.andre.ravnas@tandberg.com>
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Library General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Library General Public License for more details.
13  *
14  * You should have received a copy of the GNU Library General Public
15  * License along with this library; if not, write to the
16  * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
17  * Boston, MA 02110-1301, USA.
18  */
19 
20 #ifndef __GST_KS_VIDEO_DEVICE_H__
21 #define __GST_KS_VIDEO_DEVICE_H__
22 
23 #include "gstksclock.h"
24 
25 #include <gst/gst.h>
26 
27 #include <windows.h>
28 #include <ks.h>
29 
30 G_BEGIN_DECLS
31 
32 #define GST_TYPE_KS_VIDEO_DEVICE \
33   (gst_ks_video_device_get_type ())
34 #define GST_KS_VIDEO_DEVICE(obj) \
35   (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_KS_VIDEO_DEVICE, GstKsVideoDevice))
36 #define GST_KS_VIDEO_DEVICE_CLASS(klass) \
37   (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_KS_VIDEO_DEVICE, GstKsVideoDeviceClass))
38 #define GST_IS_KS_VIDEO_DEVICE(obj) \
39   (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_KS_VIDEO_DEVICE))
40 #define GST_IS_KS_VIDEO_DEVICE_CLASS(klass) \
41   (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_KS_VIDEO_DEVICE))
42 
43 typedef struct _GstKsVideoDevice        GstKsVideoDevice;
44 typedef struct _GstKsVideoDeviceClass   GstKsVideoDeviceClass;
45 typedef struct _GstKsVideoDevicePrivate GstKsVideoDevicePrivate;
46 
47 typedef GstBuffer * (* GstKsAllocFunction)(guint buf_size, guint alignment, gpointer user_data);
48 
49 struct _GstKsVideoDevice
50 {
51   GObject parent;
52 
53   GstKsAllocFunction allocfunc;
54   gpointer allocfunc_data;
55 
56   GstKsVideoDevicePrivate *priv;
57 };
58 
59 struct _GstKsVideoDeviceClass
60 {
61   GObjectClass parent_class;
62 };
63 
64 GType gst_ks_video_device_get_type (void);
65 
66 GstKsVideoDevice * gst_ks_video_device_new (const gchar * device_path, GstKsClock * clock, GstKsAllocFunction allocfunc, gpointer allocfunc_data);
67 gboolean gst_ks_video_device_open (GstKsVideoDevice * self);
68 void gst_ks_video_device_close (GstKsVideoDevice * self);
69 
70 GstCaps * gst_ks_video_device_get_available_caps (GstKsVideoDevice * self);
71 gboolean gst_ks_video_device_has_caps (GstKsVideoDevice * self);
72 gboolean gst_ks_video_device_set_caps (GstKsVideoDevice * self, GstCaps * caps);
73 
74 gboolean gst_ks_video_device_set_state (GstKsVideoDevice * self, KSSTATE state, gulong * error_code);
75 
76 GstClockTime gst_ks_video_device_get_duration (GstKsVideoDevice * self);
77 gboolean gst_ks_video_device_get_latency (GstKsVideoDevice * self, GstClockTime * min_latency, GstClockTime * max_latency);
78 
79 GstFlowReturn gst_ks_video_device_read_frame (GstKsVideoDevice * self, GstBuffer ** buf, GstClockTime * presentation_time, gulong * error_code, gchar ** error_str);
80 gboolean gst_ks_video_device_postprocess_frame (GstKsVideoDevice * self, GstBuffer **buf);
81 void gst_ks_video_device_cancel (GstKsVideoDevice * self);
82 void gst_ks_video_device_cancel_stop (GstKsVideoDevice * self);
83 
84 gboolean gst_ks_video_device_stream_is_muxed (GstKsVideoDevice * self);
85 
86 G_END_DECLS
87 
88 #endif /* __GST_KS_VIDEO_DEVICE_H__ */
89