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 gst.base.Base; 26 27 private import glib.Str; 28 private import gobject.ObjectG; 29 private import gst.base.c.functions; 30 public import gst.base.c.types; 31 private import gstreamer.Buffer; 32 private import gstreamer.Caps; 33 private import gstreamer.ObjectGst; 34 private import gstreamer.Pad; 35 36 37 /** */ 38 public struct Base 39 { 40 41 /** 42 * Tries to find what type of data is flowing from the given source #GstPad. 43 * 44 * Free-function: gst_caps_unref 45 * 46 * Params: 47 * src = A source #GstPad 48 * size = The length in bytes 49 * 50 * Returns: the #GstCaps corresponding to the data 51 * stream. Returns %NULL if no #GstCaps matches the data stream. 52 */ 53 public static Caps typeFindHelper(Pad src, ulong size) 54 { 55 auto p = gst_type_find_helper((src is null) ? null : src.getPadStruct(), size); 56 57 if(p is null) 58 { 59 return null; 60 } 61 62 return ObjectG.getDObject!(Caps)(cast(GstCaps*) p, true); 63 } 64 65 /** 66 * Tries to find what type of data is contained in the given #GstBuffer, the 67 * assumption being that the buffer represents the beginning of the stream or 68 * file. 69 * 70 * All available typefinders will be called on the data in order of rank. If 71 * a typefinding function returns a probability of %GST_TYPE_FIND_MAXIMUM, 72 * typefinding is stopped immediately and the found caps will be returned 73 * right away. Otherwise, all available typefind functions will the tried, 74 * and the caps with the highest probability will be returned, or %NULL if 75 * the content of the buffer could not be identified. 76 * 77 * Free-function: gst_caps_unref 78 * 79 * Params: 80 * obj = object doing the typefinding, or %NULL (used for logging) 81 * buf = a #GstBuffer with data to typefind 82 * prob = location to store the probability of the found 83 * caps, or %NULL 84 * 85 * Returns: the #GstCaps corresponding to the data, 86 * or %NULL if no type could be found. The caller should free the caps 87 * returned with gst_caps_unref(). 88 */ 89 public static Caps typeFindHelperForBuffer(ObjectGst obj, Buffer buf, out GstTypeFindProbability prob) 90 { 91 auto p = gst_type_find_helper_for_buffer((obj is null) ? null : obj.getObjectGstStruct(), (buf is null) ? null : buf.getBufferStruct(), &prob); 92 93 if(p is null) 94 { 95 return null; 96 } 97 98 return ObjectG.getDObject!(Caps)(cast(GstCaps*) p, true); 99 } 100 101 /** 102 * Tries to find what type of data is contained in the given @data, the 103 * assumption being that the data represents the beginning of the stream or 104 * file. 105 * 106 * All available typefinders will be called on the data in order of rank. If 107 * a typefinding function returns a probability of %GST_TYPE_FIND_MAXIMUM, 108 * typefinding is stopped immediately and the found caps will be returned 109 * right away. Otherwise, all available typefind functions will the tried, 110 * and the caps with the highest probability will be returned, or %NULL if 111 * the content of @data could not be identified. 112 * 113 * Free-function: gst_caps_unref 114 * 115 * Params: 116 * obj = object doing the typefinding, or %NULL (used for logging) 117 * data = a pointer with data to typefind 118 * prob = location to store the probability of the found 119 * caps, or %NULL 120 * 121 * Returns: the #GstCaps corresponding to the data, 122 * or %NULL if no type could be found. The caller should free the caps 123 * returned with gst_caps_unref(). 124 */ 125 public static Caps typeFindHelperForData(ObjectGst obj, ubyte[] data, out GstTypeFindProbability prob) 126 { 127 auto p = gst_type_find_helper_for_data((obj is null) ? null : obj.getObjectGstStruct(), data.ptr, cast(size_t)data.length, &prob); 128 129 if(p is null) 130 { 131 return null; 132 } 133 134 return ObjectG.getDObject!(Caps)(cast(GstCaps*) p, true); 135 } 136 137 /** 138 * Tries to find the best #GstCaps associated with @extension. 139 * 140 * All available typefinders will be checked against the extension in order 141 * of rank. The caps of the first typefinder that can handle @extension will be 142 * returned. 143 * 144 * Free-function: gst_caps_unref 145 * 146 * Params: 147 * obj = object doing the typefinding, or %NULL (used for logging) 148 * extension = an extension 149 * 150 * Returns: the #GstCaps corresponding to 151 * @extension, or %NULL if no type could be found. The caller should free 152 * the caps returned with gst_caps_unref(). 153 */ 154 public static Caps typeFindHelperForExtension(ObjectGst obj, string extension) 155 { 156 auto p = gst_type_find_helper_for_extension((obj is null) ? null : obj.getObjectGstStruct(), Str.toStringz(extension)); 157 158 if(p is null) 159 { 160 return null; 161 } 162 163 return ObjectG.getDObject!(Caps)(cast(GstCaps*) p, true); 164 } 165 166 /** 167 * Utility function to do pull-based typefinding. Unlike gst_type_find_helper() 168 * however, this function will use the specified function @func to obtain the 169 * data needed by the typefind functions, rather than operating on a given 170 * source pad. This is useful mostly for elements like tag demuxers which 171 * strip off data at the beginning and/or end of a file and want to typefind 172 * the stripped data stream before adding their own source pad (the specified 173 * callback can then call the upstream peer pad with offsets adjusted for the 174 * tag size, for example). 175 * 176 * When @extension is not %NULL, this function will first try the typefind 177 * functions for the given extension, which might speed up the typefinding 178 * in many cases. 179 * 180 * Free-function: gst_caps_unref 181 * 182 * Params: 183 * obj = A #GstObject that will be passed as first argument to @func 184 * parent = the parent of @obj or %NULL 185 * func = A generic #GstTypeFindHelperGetRangeFunction that will 186 * be used to access data at random offsets when doing the typefinding 187 * size = The length in bytes 188 * extension = extension of the media 189 * prob = location to store the probability of the found 190 * caps, or %NULL 191 * 192 * Returns: the #GstCaps corresponding to the data 193 * stream. Returns %NULL if no #GstCaps matches the data stream. 194 */ 195 public static Caps typeFindHelperGetRange(ObjectGst obj, ObjectGst parent, GstTypeFindHelperGetRangeFunction func, ulong size, string extension, out GstTypeFindProbability prob) 196 { 197 auto p = gst_type_find_helper_get_range((obj is null) ? null : obj.getObjectGstStruct(), (parent is null) ? null : parent.getObjectGstStruct(), func, size, Str.toStringz(extension), &prob); 198 199 if(p is null) 200 { 201 return null; 202 } 203 204 return ObjectG.getDObject!(Caps)(cast(GstCaps*) p, true); 205 } 206 }