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.BaseParseFrame; 26 27 private import glib.ConstructionException; 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 gtkd.Loader; 33 34 35 /** 36 * Frame (context) data passed to each frame parsing virtual methods. In 37 * addition to providing the data to be checked for a valid frame or an already 38 * identified frame, it conveys additional metadata or control information 39 * from and to the subclass w.r.t. the particular frame in question (rather 40 * than global parameters). Some of these may apply to each parsing stage, others 41 * only to some a particular one. These parameters are effectively zeroed at start 42 * of each frame's processing, i.e. parsing virtual method invocation sequence. 43 */ 44 public class BaseParseFrame 45 { 46 /** the main Gtk struct */ 47 protected GstBaseParseFrame* gstBaseParseFrame; 48 protected bool ownedRef; 49 50 /** Get the main Gtk struct */ 51 public GstBaseParseFrame* getBaseParseFrameStruct(bool transferOwnership = false) 52 { 53 if (transferOwnership) 54 ownedRef = false; 55 return gstBaseParseFrame; 56 } 57 58 /** the main Gtk struct as a void* */ 59 protected void* getStruct() 60 { 61 return cast(void*)gstBaseParseFrame; 62 } 63 64 /** 65 * Sets our main struct and passes it to the parent class. 66 */ 67 public this (GstBaseParseFrame* gstBaseParseFrame, bool ownedRef = false) 68 { 69 this.gstBaseParseFrame = gstBaseParseFrame; 70 this.ownedRef = ownedRef; 71 } 72 73 ~this () 74 { 75 if ( Linker.isLoaded(LIBRARY_GSTBASE) && ownedRef ) 76 gst_base_parse_frame_free(gstBaseParseFrame); 77 } 78 79 80 /** */ 81 public static GType getType() 82 { 83 return gst_base_parse_frame_get_type(); 84 } 85 86 /** 87 * Allocates a new #GstBaseParseFrame. This function is mainly for bindings, 88 * elements written in C should usually allocate the frame on the stack and 89 * then use gst_base_parse_frame_init() to initialise it. 90 * 91 * Params: 92 * buffer = a #GstBuffer 93 * flags = the flags 94 * overhead = number of bytes in this frame which should be counted as 95 * metadata overhead, ie. not used to calculate the average bitrate. 96 * Set to -1 to mark the entire frame as metadata. If in doubt, set to 0. 97 * 98 * Returns: a newly-allocated #GstBaseParseFrame. Free with 99 * gst_base_parse_frame_free() when no longer needed. 100 * 101 * Throws: ConstructionException GTK+ fails to create the object. 102 */ 103 public this(Buffer buffer, GstBaseParseFrameFlags flags, int overhead) 104 { 105 auto p = gst_base_parse_frame_new((buffer is null) ? null : buffer.getBufferStruct(), flags, overhead); 106 107 if(p is null) 108 { 109 throw new ConstructionException("null returned by new"); 110 } 111 112 this(cast(GstBaseParseFrame*) p); 113 } 114 115 /** */ 116 public BaseParseFrame copy() 117 { 118 auto p = gst_base_parse_frame_copy(gstBaseParseFrame); 119 120 if(p is null) 121 { 122 return null; 123 } 124 125 return ObjectG.getDObject!(BaseParseFrame)(cast(GstBaseParseFrame*) p, true); 126 } 127 128 /** */ 129 public void free() 130 { 131 gst_base_parse_frame_free(gstBaseParseFrame); 132 ownedRef = false; 133 } 134 135 /** 136 * Sets a #GstBaseParseFrame to initial state. Currently this means 137 * all public fields are zero-ed and a private flag is set to make 138 * sure gst_base_parse_frame_free() only frees the contents but not 139 * the actual frame. Use this function to initialise a #GstBaseParseFrame 140 * allocated on the stack. 141 */ 142 public void init() 143 { 144 gst_base_parse_frame_init(gstBaseParseFrame); 145 } 146 }