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 * Conversion parameters: 26 * inFile = GstTagSetter.html 27 * outPack = gstreamer 28 * outFile = TagSetter 29 * strct = GstTagSetter 30 * realStrct= 31 * ctorStrct= 32 * clss = TagSetter 33 * interf = 34 * class Code: No 35 * interface Code: No 36 * template for: 37 * extend = 38 * implements: 39 * prefixes: 40 * - gst_tag_setter_ 41 * - gst_ 42 * omit structs: 43 * omit prefixes: 44 * omit code: 45 * omit signals: 46 * imports: 47 * - glib.Str 48 * - gstreamer.TagList 49 * structWrap: 50 * - GstTagList* -> TagList 51 * - GstTagSetter* -> TagSetter 52 * module aliases: 53 * local aliases: 54 * overrides: 55 */ 56 57 module gstreamer.TagSetter; 58 59 public import gstreamerc.gstreamertypes; 60 61 private import gstreamerc.gstreamer; 62 private import glib.ConstructionException; 63 private import gobject.ObjectG; 64 65 66 private import glib.Str; 67 private import gstreamer.TagList; 68 69 70 71 72 /** 73 * Description 74 * Element interface that allows setting of media metadata. 75 * Elements that support changing a stream's metadata will implement this 76 * interface. Examples of such elements are 'vorbisenc', 'theoraenc' and 77 * 'id3v2mux'. 78 * If you just want to retrieve metadata in your application then all you 79 * need to do is watch for tag messages on your pipeline's bus. This 80 * interface is only for setting metadata, not for extracting it. To set tags 81 * from the application, find tagsetter elements and set tags using e.g. 82 * gst_tag_setter_merge_tags() or gst_tag_setter_add_tags(). The application 83 * should do that before the element goes to GST_STATE_PAUSED. 84 * Elements implementing the GstTagSetter interface often have to merge 85 * any tags received from upstream and the tags set by the application via 86 * the interface. This can be done like this: 87 * GstTagMergeMode merge_mode; 88 * const GstTagList *application_tags; 89 * const GstTagList *event_tags; 90 * GstTagSetter *tagsetter; 91 * GstTagList *result; 92 * tagsetter = GST_TAG_SETTER (element); 93 * merge_mode = gst_tag_setter_get_tag_merge_mode (tagsetter); 94 * tagsetter_tags = gst_tag_setter_get_tag_list (tagsetter); 95 * event_tags = (const GstTagList *) element->event_tags; 96 * GST_LOG_OBJECT (tagsetter, "merging tags, merge mode = %d", merge_mode); 97 * GST_LOG_OBJECT (tagsetter, "event tags: %" GST_PTR_FORMAT, event_tags); 98 * GST_LOG_OBJECT (tagsetter, "set tags: %" GST_PTR_FORMAT, application_tags); 99 * result = gst_tag_list_merge (application_tags, event_tags, merge_mode); 100 * GST_LOG_OBJECT (tagsetter, "final tags: %" GST_PTR_FORMAT, result); 101 * Last reviewed on 2006-05-18 (0.10.6) 102 */ 103 public class TagSetter 104 { 105 106 /** the main Gtk struct */ 107 protected GstTagSetter* gstTagSetter; 108 109 110 public GstTagSetter* getTagSetterStruct() 111 { 112 return gstTagSetter; 113 } 114 115 116 /** the main Gtk struct as a void* */ 117 protected void* getStruct() 118 { 119 return cast(void*)gstTagSetter; 120 } 121 122 /** 123 * Sets our main struct and passes it to the parent class 124 */ 125 public this (GstTagSetter* gstTagSetter) 126 { 127 this.gstTagSetter = gstTagSetter; 128 } 129 130 /** 131 */ 132 133 /** 134 * Merges the given list into the setter's list using the given mode. 135 * Params: 136 * list = a tag list to merge from 137 * mode = the mode to merge with 138 */ 139 public void mergeTags(TagList list, GstTagMergeMode mode) 140 { 141 // void gst_tag_setter_merge_tags (GstTagSetter *setter, const GstTagList *list, GstTagMergeMode mode); 142 gst_tag_setter_merge_tags(gstTagSetter, (list is null) ? null : list.getTagListStruct(), mode); 143 } 144 145 /** 146 * Adds the given tag / value pairs on the setter using the given merge mode. 147 * The list must be terminated with NULL. 148 * Params: 149 * mode = the mode to use 150 * tag = tag to set 151 * varArgs = tag / value pairs to set 152 */ 153 public void addTagValist(GstTagMergeMode mode, string tag, void* varArgs) 154 { 155 // void gst_tag_setter_add_tag_valist (GstTagSetter *setter, GstTagMergeMode mode, const gchar *tag, va_list var_args); 156 gst_tag_setter_add_tag_valist(gstTagSetter, mode, Str.toStringz(tag), varArgs); 157 } 158 159 /** 160 * Adds the given tag / GValue pairs on the setter using the given merge mode. 161 * The list must be terminated with NULL. 162 * Params: 163 * mode = the mode to use 164 * tag = tag to set 165 * varArgs = tag / GValue pairs to set 166 */ 167 public void addTagValistValues(GstTagMergeMode mode, string tag, void* varArgs) 168 { 169 // void gst_tag_setter_add_tag_valist_values (GstTagSetter *setter, GstTagMergeMode mode, const gchar *tag, va_list var_args); 170 gst_tag_setter_add_tag_valist_values(gstTagSetter, mode, Str.toStringz(tag), varArgs); 171 } 172 173 /** 174 * Returns the current list of tags the setter uses. The list should not be 175 * modified or freed. 176 * Returns: a current snapshot of the taglist used in the setter or NULL if none is used. 177 */ 178 public TagList getTagList() 179 { 180 // const GstTagList* gst_tag_setter_get_tag_list (GstTagSetter *setter); 181 auto p = gst_tag_setter_get_tag_list(gstTagSetter); 182 183 if(p is null) 184 { 185 return null; 186 } 187 188 return ObjectG.getDObject!(TagList)(cast(GstTagList*) p); 189 } 190 191 /** 192 * Sets the given merge mode that is used for adding tags from events to tags 193 * specified by this interface. The default is GST_TAG_MERGE_KEEP, which keeps 194 * the tags set with this interface and discards tags from events. 195 * Params: 196 * mode = The mode with which tags are added 197 */ 198 public void setTagMergeMode(GstTagMergeMode mode) 199 { 200 // void gst_tag_setter_set_tag_merge_mode (GstTagSetter *setter, GstTagMergeMode mode); 201 gst_tag_setter_set_tag_merge_mode(gstTagSetter, mode); 202 } 203 204 /** 205 * Queries the mode by which tags inside the setter are overwritten by tags 206 * from events 207 * Returns: the merge mode used inside the element. 208 */ 209 public GstTagMergeMode getTagMergeMode() 210 { 211 // GstTagMergeMode gst_tag_setter_get_tag_merge_mode (GstTagSetter *setter); 212 return gst_tag_setter_get_tag_merge_mode(gstTagSetter); 213 } 214 }