7ce49460a165a3909f507af72d0197d4cfedd776
[platform/upstream/gstreamer.git] / docs / random / omega / padtemplates
1 typedef gpointer GstCapsFactoryEntry;
2 typedef GstCapsFactoryEntry GstCapsFactory[];
3 typedef GstCapsFactory *GstCapsListFactory[];
4
5 typedef gpointer GstPadFactoryEntry;
6 typedef GstPadFactoryEntry GstPadFactory[];
7 typedef GstPadFactory *GstPadListFactory[];
8
9 #define GST_PADFACTORY_SRC      GINT_TO_POINTER (GST_PAD_SRC)
10 #define GST_PADFACTORY_ALWAYS   GINT_TO_POINTER (GST_PAD_ALWAYS)
11
12 typedef struct GstPadTemplate {
13   gchar *name_template;
14   gint direction;
15   gint presence;
16   GList *caps;
17 };
18
19 GstPadFactory mpg123_src_padfactory = {
20   "src"
21   GST_PADFACTORY_SRC,
22   GST_PADFACTORY_ALWAYS,
23
24   "audio/raw"
25   "samplerate", GST_PROPS_INT (44100),
26   . . .
27   NULL
28 };
29
30 static GstPadTemplate *srcpadtemplate;
31
32 mpg123_new(GstMpg123 *mpg123) {
33   mpg123->srcpad = gst_pad_new_template("src", srcpadtemplate);
34   . . .
35 }
36
37 plugin_init() {
38   GstElementFactory *factory;
39
40   factory = gst_elementfactory_new("mpg123",. . .);
41   srcpadtemplate = gst_padfactory_new(mpg123_src_padfactory);
42   get_elementfactory_add_padtemplate (srcpadtemplate);
43 }