2 * Copyright (C) 2019 Seungha Yang <seungha.yang@navercorp.com>
3 * Copyright (C) 2020 Seungha Yang <seungha@centricular.com>
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.
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.
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.
21 #ifndef __GST_MF_SOURCE_OBJECT_H__
22 #define __GST_MF_SOURCE_OBJECT_H__
25 #include "gstmfutils.h"
29 #define GST_TYPE_MF_SOURCE_OBJECT (gst_mf_source_object_get_type())
30 #define GST_MF_SOURCE_OBJECT(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), GST_TYPE_MF_SOURCE_OBJECT, GstMFSourceObject))
31 #define GST_MF_SOURCE_OBJECT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), GST_TYPE_MF_SOURCE_OBJECT, GstMFSourceObjectClass))
32 #define GST_IS_MF_SOURCE_OBJECT(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), GST_TYPE_MF_SOURCE_OBJECT))
33 #define GST_IS_MF_SOURCE_OBJECT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), GST_TYPE_MF_SOURCE_OBJECT))
34 #define GST_MF_SOURCE_OBJECT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), GST_TYPE_MF_SOURCE_OBJECT, GstMFSourceObjectClass))
36 typedef struct _GstMFSourceObject GstMFSourceObject;
37 typedef struct _GstMFSourceObjectClass GstMFSourceObjectClass;
41 GST_MF_SOURCE_TYPE_VIDEO,
44 #define GST_TYPE_MF_SOURCE_TYPE (gst_mf_source_type_get_type())
45 GType gst_mf_source_type_get_type (void);
47 struct _GstMFSourceObject
53 GstMFSourceType source_type;
61 struct _GstMFSourceObjectClass
63 GstObjectClass parent_class;
65 gboolean (*start) (GstMFSourceObject * object);
67 gboolean (*stop) (GstMFSourceObject * object);
69 GstFlowReturn (*fill) (GstMFSourceObject * object,
72 GstFlowReturn (*create) (GstMFSourceObject * object,
75 GstFlowReturn (*get_sample) (GstMFSourceObject * object,
78 gboolean (*unlock) (GstMFSourceObject * object);
80 gboolean (*unlock_stop) (GstMFSourceObject * object);
82 GstCaps * (*get_caps) (GstMFSourceObject * object);
84 gboolean (*set_caps) (GstMFSourceObject * object,
88 GType gst_mf_source_object_get_type (void);
90 gboolean gst_mf_source_object_start (GstMFSourceObject * object);
92 gboolean gst_mf_source_object_stop (GstMFSourceObject * object);
94 /* Used for raw format */
95 GstFlowReturn gst_mf_source_object_fill (GstMFSourceObject * object,
98 /* Used for compressed/raw format */
99 GstFlowReturn gst_mf_source_object_create (GstMFSourceObject * object,
100 GstBuffer ** buffer);
102 /* DirectShow filter */
103 GstFlowReturn gst_mf_source_object_get_sample (GstMFSourceObject * object,
104 GstSample ** sample);
106 void gst_mf_source_object_set_flushing (GstMFSourceObject * object,
109 GstCaps * gst_mf_source_object_get_caps (GstMFSourceObject * object);
111 gboolean gst_mf_source_object_set_caps (GstMFSourceObject * object,
114 gboolean gst_mf_source_object_set_client (GstMFSourceObject * object,
115 GstElement * element);
117 GstClockTime gst_mf_source_object_get_running_time (GstMFSourceObject * object);
119 /* A factory method for subclass impl. selection */
120 GstMFSourceObject * gst_mf_source_object_new (GstMFSourceType type,
122 const gchar * device_name,
123 const gchar * device_path,
124 gpointer dispatcher);
126 /* Utility methods */
127 gint gst_mf_source_object_caps_compare (GstCaps * caps1,
130 G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstMFSourceObject, gst_object_unref)
134 #endif /* __GST_MF_SOURCE_OBJECT_H__ */