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.TagSetterT;
26 
27 public  import glib.Str;
28 public  import gobject.ObjectG;
29 public  import gobject.Value;
30 public  import gstreamer.TagList;
31 public  import gstreamer.c.functions;
32 public  import gstreamer.c.types;
33 public  import gstreamerc.gstreamertypes;
34 
35 
36 /**
37  * Element interface that allows setting of media metadata.
38  * 
39  * Elements that support changing a stream's metadata will implement this
40  * interface. Examples of such elements are 'vorbisenc', 'theoraenc' and
41  * 'id3v2mux'.
42  * 
43  * If you just want to retrieve metadata in your application then all you
44  * need to do is watch for tag messages on your pipeline's bus. This
45  * interface is only for setting metadata, not for extracting it. To set tags
46  * from the application, find tagsetter elements and set tags using e.g.
47  * gst_tag_setter_merge_tags() or gst_tag_setter_add_tags(). Also consider
48  * setting the #GstTagMergeMode that is used for tag events that arrive at the
49  * tagsetter element (default mode is to keep existing tags).
50  * The application should do that before the element goes to %GST_STATE_PAUSED.
51  * 
52  * Elements implementing the #GstTagSetter interface often have to merge
53  * any tags received from upstream and the tags set by the application via
54  * the interface. This can be done like this:
55  * 
56  * |[<!-- language="C" -->
57  * GstTagMergeMode merge_mode;
58  * const GstTagList *application_tags;
59  * const GstTagList *event_tags;
60  * GstTagSetter *tagsetter;
61  * GstTagList *result;
62  * 
63  * tagsetter = GST_TAG_SETTER (element);
64  * 
65  * merge_mode = gst_tag_setter_get_tag_merge_mode (tagsetter);
66  * application_tags = gst_tag_setter_get_tag_list (tagsetter);
67  * event_tags = (const GstTagList *) element->event_tags;
68  * 
69  * GST_LOG_OBJECT (tagsetter, "merging tags, merge mode = %d", merge_mode);
70  * GST_LOG_OBJECT (tagsetter, "event tags: %" GST_PTR_FORMAT, event_tags);
71  * GST_LOG_OBJECT (tagsetter, "set   tags: %" GST_PTR_FORMAT, application_tags);
72  * 
73  * result = gst_tag_list_merge (application_tags, event_tags, merge_mode);
74  * 
75  * GST_LOG_OBJECT (tagsetter, "final tags: %" GST_PTR_FORMAT, result);
76  * ]|
77  */
78 public template TagSetterT(TStruct)
79 {
80 	/** Get the main Gtk struct */
81 	public GstTagSetter* getTagSetterStruct(bool transferOwnership = false)
82 	{
83 		if (transferOwnership)
84 			ownedRef = false;
85 		return cast(GstTagSetter*)getStruct();
86 	}
87 
88 
89 	/**
90 	 * Adds the given tag / value pairs on the setter using the given merge mode.
91 	 * The list must be terminated with %NULL.
92 	 *
93 	 * Params:
94 	 *     mode = the mode to use
95 	 *     tag = tag to set
96 	 *     varArgs = tag / value pairs to set
97 	 */
98 	public void addTagValist(GstTagMergeMode mode, string tag, void* varArgs)
99 	{
100 		gst_tag_setter_add_tag_valist(getTagSetterStruct(), mode, Str.toStringz(tag), varArgs);
101 	}
102 
103 	/**
104 	 * Adds the given tag / GValue pairs on the setter using the given merge mode.
105 	 * The list must be terminated with %NULL.
106 	 *
107 	 * Params:
108 	 *     mode = the mode to use
109 	 *     tag = tag to set
110 	 *     varArgs = tag / GValue pairs to set
111 	 */
112 	public void addTagValistValues(GstTagMergeMode mode, string tag, void* varArgs)
113 	{
114 		gst_tag_setter_add_tag_valist_values(getTagSetterStruct(), mode, Str.toStringz(tag), varArgs);
115 	}
116 
117 	/**
118 	 * Adds the given tag / GValue pair on the setter using the given merge mode.
119 	 *
120 	 * Params:
121 	 *     mode = the mode to use
122 	 *     tag = tag to set
123 	 *     value = GValue to set for the tag
124 	 */
125 	public void addTagValue(GstTagMergeMode mode, string tag, Value value)
126 	{
127 		gst_tag_setter_add_tag_value(getTagSetterStruct(), mode, Str.toStringz(tag), (value is null) ? null : value.getValueStruct());
128 	}
129 
130 	/**
131 	 * Returns the current list of tags the setter uses.  The list should not be
132 	 * modified or freed.
133 	 *
134 	 * This function is not thread-safe.
135 	 *
136 	 * Returns: a current snapshot of the
137 	 *     taglist used in the setter or %NULL if none is used.
138 	 */
139 	public TagList getTagList()
140 	{
141 		auto p = gst_tag_setter_get_tag_list(getTagSetterStruct());
142 
143 		if(p is null)
144 		{
145 			return null;
146 		}
147 
148 		return ObjectG.getDObject!(TagList)(cast(GstTagList*) p);
149 	}
150 
151 	/**
152 	 * Queries the mode by which tags inside the setter are overwritten by tags
153 	 * from events
154 	 *
155 	 * Returns: the merge mode used inside the element.
156 	 */
157 	public GstTagMergeMode getTagMergeMode()
158 	{
159 		return gst_tag_setter_get_tag_merge_mode(getTagSetterStruct());
160 	}
161 
162 	/**
163 	 * Merges the given list into the setter's list using the given mode.
164 	 *
165 	 * Params:
166 	 *     list = a tag list to merge from
167 	 *     mode = the mode to merge with
168 	 */
169 	public void mergeTags(TagList list, GstTagMergeMode mode)
170 	{
171 		gst_tag_setter_merge_tags(getTagSetterStruct(), (list is null) ? null : list.getTagListStruct(), mode);
172 	}
173 
174 	/**
175 	 * Reset the internal taglist. Elements should call this from within the
176 	 * state-change handler.
177 	 */
178 	public void resetTags()
179 	{
180 		gst_tag_setter_reset_tags(getTagSetterStruct());
181 	}
182 
183 	/**
184 	 * Sets the given merge mode that is used for adding tags from events to tags
185 	 * specified by this interface. The default is #GST_TAG_MERGE_KEEP, which keeps
186 	 * the tags set with this interface and discards tags from events.
187 	 *
188 	 * Params:
189 	 *     mode = The mode with which tags are added
190 	 */
191 	public void setTagMergeMode(GstTagMergeMode mode)
192 	{
193 		gst_tag_setter_set_tag_merge_mode(getTagSetterStruct(), mode);
194 	}
195 }