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 = gstreamer-GstTypeFind.html 27 * outPack = gstreamer 28 * outFile = TypeFind 29 * strct = GstTypeFind 30 * realStrct= 31 * ctorStrct= 32 * clss = TypeFind 33 * interf = 34 * class Code: Yes 35 * interface Code: No 36 * template for: 37 * extend = 38 * implements: 39 * prefixes: 40 * - gst_type_find_ 41 * omit structs: 42 * omit prefixes: 43 * omit code: 44 * - gst_type_find_peek 45 * omit signals: 46 * imports: 47 * - glib.Str 48 * - gstreamer.Caps 49 * - gstreamer.Plugin 50 * structWrap: 51 * - GstCaps* -> Caps 52 * - GstPlugin* -> Plugin 53 * module aliases: 54 * local aliases: 55 * overrides: 56 */ 57 58 module gstreamer.TypeFind; 59 60 public import gstreamerc.gstreamertypes; 61 62 private import gstreamerc.gstreamer; 63 private import glib.ConstructionException; 64 private import gobject.ObjectG; 65 66 private import glib.Str; 67 private import gstreamer.Caps; 68 private import gstreamer.Plugin; 69 70 71 72 /** 73 * The following functions allow you to detect the media type of an unknown 74 * stream. 75 * 76 * Last reviewed on 2005-11-09 (0.9.4) 77 */ 78 public class TypeFind 79 { 80 81 /** the main Gtk struct */ 82 protected GstTypeFind* gstTypeFind; 83 84 85 /** Get the main Gtk struct */ 86 public GstTypeFind* getTypeFindStruct() 87 { 88 return gstTypeFind; 89 } 90 91 92 /** the main Gtk struct as a void* */ 93 protected void* getStruct() 94 { 95 return cast(void*)gstTypeFind; 96 } 97 98 /** 99 * Sets our main struct and passes it to the parent class 100 */ 101 public this (GstTypeFind* gstTypeFind) 102 { 103 this.gstTypeFind = gstTypeFind; 104 } 105 106 /** 107 * Returns the size bytes of the stream to identify beginning at offset. If 108 * offset is a positive number, the offset is relative to the beginning of the 109 * stream, if offset is a negative number the offset is relative to the end of 110 * the stream. The returned memory is valid until the typefinding function 111 * returns and must not be freed. 112 * Params: 113 * offset = The offset 114 * size = The number of bytes to return 115 * Returns: the requested data, or NULL if that data is not available. 116 */ 117 public ubyte[] peek(long offset, uint size) 118 { 119 // guint8* gst_type_find_peek (GstTypeFind *find, gint64 offset, guint size); 120 ubyte* buff = gst_type_find_peek(gstTypeFind, offset, size); 121 122 return buff[0 .. size]; 123 } 124 125 /** 126 */ 127 128 /** 129 * If a GstTypeFindFunction calls this function it suggests the caps with the 130 * given probability. A GstTypeFindFunction may supply different suggestions 131 * in one call. 132 * It is up to the caller of the GstTypeFindFunction to interpret these values. 133 * Params: 134 * probability = The probability in percent that the suggestion is right 135 * caps = The fixed GstCaps to suggest 136 */ 137 public void suggest(uint probability, Caps caps) 138 { 139 // void gst_type_find_suggest (GstTypeFind *find, guint probability, GstCaps *caps); 140 gst_type_find_suggest(gstTypeFind, probability, (caps is null) ? null : caps.getCapsStruct()); 141 } 142 143 /** 144 * Get the length of the data stream. 145 * Returns: The length of the data stream, or 0 if it is not available. 146 */ 147 public ulong getLength() 148 { 149 // guint64 gst_type_find_get_length (GstTypeFind *find); 150 return gst_type_find_get_length(gstTypeFind); 151 } 152 153 /** 154 * Registers a new typefind function to be used for typefinding. After 155 * registering this function will be available for typefinding. 156 * This function is typically called during an element's plugin initialization. 157 * Params: 158 * plugin = A GstPlugin, or NULL for a static typefind function. [allow-none] 159 * name = The name for registering 160 * rank = The rank (or importance) of this typefind function 161 * func = The GstTypeFindFunction to use 162 * extensions = Optional comma-separated list of extensions 163 * that could belong to this type. [allow-none] 164 * possibleCaps = Optionally the caps that could be returned when typefinding 165 * succeeds 166 * data = Optional user data. This user data must be available until the plugin 167 * is unloaded. 168 * dataNotify = a GDestroyNotify that will be called on data when the plugin 169 * is unloaded. 170 * Returns: TRUE on success, FALSE otherwise 171 */ 172 public static int register(Plugin plugin, string name, uint rank, GstTypeFindFunction func, string extensions, Caps possibleCaps, void* data, GDestroyNotify dataNotify) 173 { 174 // gboolean gst_type_find_register (GstPlugin *plugin, const gchar *name, guint rank, GstTypeFindFunction func, const gchar *extensions, GstCaps *possible_caps, gpointer data, GDestroyNotify data_notify); 175 return gst_type_find_register((plugin is null) ? null : plugin.getPluginStruct(), Str.toStringz(name), rank, func, Str.toStringz(extensions), (possibleCaps is null) ? null : possibleCaps.getCapsStruct(), data, dataNotify); 176 } 177 }