1 /*
2  * This file is part of gtkD.
3  *
4  * gtkD is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU Lesser General Public License
6  * as published by the Free Software Foundation; either version 3
7  * of the License, or (at your option) any later version, with
8  * some exceptions, please read the COPYING file.
9  *
10  * gtkD 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
13  * GNU Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public License
16  * along with gtkD; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
18  */
19 
20 // generated automatically - do not change
21 // find conversion definition on APILookup.txt
22 // implement new conversion functionalities on the wrap.utils pakage
23 
24 
25 module gstreamer.ParseContext;
26 
27 private import glib.ConstructionException;
28 private import glib.Str;
29 private import gobject.ObjectG;
30 private import gstreamer.c.functions;
31 public  import gstreamer.c.types;
32 public  import gstreamerc.gstreamertypes;
33 private import gtkd.Loader;
34 
35 
36 /**
37  * Opaque structure.
38  */
39 public class ParseContext
40 {
41 	/** the main Gtk struct */
42 	protected GstParseContext* gstParseContext;
43 	protected bool ownedRef;
44 
45 	/** Get the main Gtk struct */
46 	public GstParseContext* getParseContextStruct(bool transferOwnership = false)
47 	{
48 		if (transferOwnership)
49 			ownedRef = false;
50 		return gstParseContext;
51 	}
52 
53 	/** the main Gtk struct as a void* */
54 	protected void* getStruct()
55 	{
56 		return cast(void*)gstParseContext;
57 	}
58 
59 	/**
60 	 * Sets our main struct and passes it to the parent class.
61 	 */
62 	public this (GstParseContext* gstParseContext, bool ownedRef = false)
63 	{
64 		this.gstParseContext = gstParseContext;
65 		this.ownedRef = ownedRef;
66 	}
67 
68 	~this ()
69 	{
70 		if ( Linker.isLoaded(LIBRARY_GSTREAMER) && ownedRef )
71 			gst_parse_context_free(gstParseContext);
72 	}
73 
74 
75 	/** */
76 	public static GType getType()
77 	{
78 		return gst_parse_context_get_type();
79 	}
80 
81 	/**
82 	 * Allocates a parse context for use with gst_parse_launch_full() or
83 	 * gst_parse_launchv_full().
84 	 *
85 	 * Free-function: gst_parse_context_free
86 	 *
87 	 * Returns: a newly-allocated parse context. Free
88 	 *     with gst_parse_context_free() when no longer needed.
89 	 *
90 	 * Throws: ConstructionException GTK+ fails to create the object.
91 	 */
92 	public this()
93 	{
94 		auto p = gst_parse_context_new();
95 
96 		if(p is null)
97 		{
98 			throw new ConstructionException("null returned by new");
99 		}
100 
101 		this(cast(GstParseContext*) p);
102 	}
103 
104 	/**
105 	 * Copies the @context.
106 	 *
107 	 * Returns: A copied #GstParseContext
108 	 */
109 	public ParseContext copy()
110 	{
111 		auto p = gst_parse_context_copy(gstParseContext);
112 
113 		if(p is null)
114 		{
115 			return null;
116 		}
117 
118 		return ObjectG.getDObject!(ParseContext)(cast(GstParseContext*) p, true);
119 	}
120 
121 	/**
122 	 * Frees a parse context previously allocated with gst_parse_context_new().
123 	 */
124 	public void free()
125 	{
126 		gst_parse_context_free(gstParseContext);
127 		ownedRef = false;
128 	}
129 
130 	/**
131 	 * Retrieve missing elements from a previous run of gst_parse_launch_full()
132 	 * or gst_parse_launchv_full(). Will only return results if an error code
133 	 * of %GST_PARSE_ERROR_NO_SUCH_ELEMENT was returned.
134 	 *
135 	 * Returns: a
136 	 *     %NULL-terminated array of element factory name strings of missing
137 	 *     elements. Free with g_strfreev() when no longer needed.
138 	 */
139 	public string[] getMissingElements()
140 	{
141 		auto retStr = gst_parse_context_get_missing_elements(gstParseContext);
142 
143 		scope(exit) Str.freeStringArray(retStr);
144 		return Str.toStringArray(retStr);
145 	}
146 }