1 /* GStreamer
2  * Copyright (C) <2011> Sebastian Dröge <sebastian.droege@collabora.co.uk>
3  * Copyright (C) <2011> Vincent Penquerc'h <vincent.penquerch@collabora.co.uk>
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 #include <gst/gst.h>
22 
23 #ifndef __GST_PLAY_SINK_CONVERT_BIN_H__
24 #define __GST_PLAY_SINK_CONVERT_BIN_H__
25 
26 G_BEGIN_DECLS
27 #define GST_TYPE_PLAY_SINK_CONVERT_BIN \
28   (gst_play_sink_convert_bin_get_type())
29 #define GST_PLAY_SINK_CONVERT_BIN(obj) \
30   (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_PLAY_SINK_CONVERT_BIN, GstPlaySinkConvertBin))
31 #define GST_PLAY_SINK_CONVERT_BIN_CAST(obj) \
32   ((GstPlaySinkConvertBin *) obj)
33 #define GST_PLAY_SINK_CONVERT_BIN_CLASS(klass) \
34   (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_PLAY_SINK_CONVERT_BIN, GstPlaySinkConvertBinClass))
35 #define GST_IS_PLAY_SINK_CONVERT_BIN(obj) \
36   (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_PLAY_SINK_CONVERT_BIN))
37 #define GST_IS_PLAY_SINK_CONVERT_BIN_CLASS(klass) \
38   (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_PLAY_SINK_CONVERT_BIN))
39 
40 #define GST_PLAY_SINK_CONVERT_BIN_LOCK(obj) G_STMT_START {                   \
41     GST_LOG_OBJECT (obj,                                                \
42                     "locking from thread %p",                           \
43                     g_thread_self ());                                  \
44     g_mutex_lock (&GST_PLAY_SINK_CONVERT_BIN_CAST(obj)->lock);                \
45     GST_LOG_OBJECT (obj,                                                \
46                     "locked from thread %p",                            \
47                     g_thread_self ());                                  \
48 } G_STMT_END
49 
50 #define GST_PLAY_SINK_CONVERT_BIN_UNLOCK(obj) G_STMT_START {                 \
51     GST_LOG_OBJECT (obj,                                                \
52                     "unlocking from thread %p",                         \
53                     g_thread_self ());                                  \
54     g_mutex_unlock (&GST_PLAY_SINK_CONVERT_BIN_CAST(obj)->lock);              \
55 } G_STMT_END
56 
57 typedef struct _GstPlaySinkConvertBin GstPlaySinkConvertBin;
58 typedef struct _GstPlaySinkConvertBinClass GstPlaySinkConvertBinClass;
59 
60 struct _GstPlaySinkConvertBin
61 {
62   GstBin parent;
63 
64   /* < private > */
65   GMutex lock;
66 
67   GstPad *sinkpad, *sink_proxypad;
68   guint sink_proxypad_block_id;
69 
70   GstPad *srcpad;
71 
72   gboolean raw;
73   GList *conversion_elements;
74   GstElement *identity;
75 
76   GstCaps *converter_caps;
77 
78   /* configuration for derived classes */
79   gboolean audio;
80 };
81 
82 struct _GstPlaySinkConvertBinClass
83 {
84   GstBinClass parent;
85 };
86 
87 GType gst_play_sink_convert_bin_get_type (void);
88 GstElement *
89 gst_play_sink_convert_bin_add_conversion_element_factory (GstPlaySinkConvertBin *self,
90     const char *factory, const char *name);
91 void
92 gst_play_sink_convert_bin_add_conversion_element (GstPlaySinkConvertBin *self,
93     GstElement *el);
94 void
95 gst_play_sink_convert_bin_cache_converter_caps (GstPlaySinkConvertBin * self);
96 void
97 gst_play_sink_convert_bin_remove_elements (GstPlaySinkConvertBin * self);
98 void
99 gst_play_sink_convert_bin_add_identity (GstPlaySinkConvertBin * self);
100 
101 G_END_DECLS
102 #endif /* __GST_PLAY_SINK_CONVERT_BIN_H__ */
103