1 /* GStreamer Editing Services 2 * Copyright (C) 2009 Edward Hervey <edward.hervey@collabora.co.uk> 3 * 2009 Nokia Corporation 4 * 5 * This library is free software; you can redistribute it and/or 6 * modify it under the terms of the GNU Library General Public 7 * License as published by the Free Software Foundation; either 8 * version 2 of the License, or (at your option) any later version. 9 * 10 * This library 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 GNU 13 * Library General Public License for more details. 14 * 15 * You should have received a copy of the GNU Library General Public 16 * License along with this library; if not, write to the 17 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, 18 * Boston, MA 02110-1301, USA. 19 */ 20 21 #ifndef _GES_CONTAINER 22 #define _GES_CONTAINER 23 24 #include <glib-object.h> 25 #include <gst/gst.h> 26 #include <ges/ges-timeline-element.h> 27 #include <ges/ges-types.h> 28 #include <ges/ges-track.h> 29 30 G_BEGIN_DECLS 31 32 #define GES_TYPE_CONTAINER ges_container_get_type() 33 #define GES_CONTAINER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GES_TYPE_CONTAINER, GESContainer)) 34 #define GES_CONTAINER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GES_TYPE_CONTAINER, GESContainerClass)) 35 #define GES_IS_CONTAINER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GES_TYPE_CONTAINER)) 36 #define GES_IS_CONTAINER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GES_TYPE_CONTAINER)) 37 #define GES_CONTAINER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GES_TYPE_CONTAINER, GESContainerClass)) 38 39 typedef struct _GESContainerPrivate GESContainerPrivate; 40 41 /* To be used by sublcasses only */ 42 typedef enum 43 { 44 GES_CHILDREN_UPDATE, 45 GES_CHILDREN_IGNORE_NOTIFIES, 46 GES_CHILDREN_UPDATE_OFFSETS, 47 GES_CHILDREN_UPDATE_ALL_VALUES, 48 GES_CHILDREN_LAST 49 } GESChildrenControlMode; 50 51 /** 52 * GES_CONTAINER_HEIGHT: 53 * @obj: a #GESContainer 54 * 55 * The span of priorities this object occupies. 56 */ 57 #define GES_CONTAINER_HEIGHT(obj) (((GESContainer*)obj)->height) 58 59 /** 60 * GES_CONTAINER_CHILDREN: 61 * @obj: a #GESContainer 62 * 63 * A #GList containing the children of @object 64 */ 65 #define GES_CONTAINER_CHILDREN(obj) (((GESContainer*)obj)->children) 66 67 /** 68 * GESContainer: 69 * @children: (element-type GES.TimelineElement): A list of TimelineElement 70 * controlled by this Container. NOTE: Do not modify. 71 * @height: The span of priorities this container occupies 72 * 73 * The #GESContainer base class. 74 */ 75 struct _GESContainer 76 { 77 GESTimelineElement parent; 78 79 /*< public > */ 80 /*< readonly >*/ 81 GList *children; 82 83 /* We don't add those properties to the priv struct for optimization and code 84 * readability purposes */ 85 guint32 height; /* the span of priorities this object needs */ 86 87 /* <protected> */ 88 GESChildrenControlMode children_control_mode; 89 /*< readonly >*/ 90 GESTimelineElement *initiated_move; 91 92 /*< private >*/ 93 GESContainerPrivate *priv; 94 95 /* Padding for API extension */ 96 gpointer _ges_reserved[GES_PADDING_LARGE]; 97 }; 98 99 /** 100 * GESContainerClass: 101 * @child_added: Virtual method that is called right after a #GESTimelineElement is added 102 * @child_removed: Virtual method that is called right after a #GESTimelineElement is removed 103 * @remove_child: Virtual method to remove a child 104 * @add_child: Virtual method to add a child 105 * @ungroup: Ungroups the #GESTimelineElement contained in this #GESContainer, creating new 106 * @group: Groups the #GESContainers together 107 * #GESContainer containing those #GESTimelineElement apropriately. 108 */ 109 struct _GESContainerClass 110 { 111 /*< private > */ 112 GESTimelineElementClass parent_class; 113 114 /*< public > */ 115 /* signals */ 116 void (*child_added) (GESContainer *container, GESTimelineElement *element); 117 void (*child_removed) (GESContainer *container, GESTimelineElement *element); 118 gboolean (*add_child) (GESContainer *container, GESTimelineElement *element); 119 gboolean (*remove_child) (GESContainer *container, GESTimelineElement *element); 120 GList* (*ungroup) (GESContainer *container, gboolean recursive); 121 GESContainer * (*group) (GList *containers); 122 gboolean (*edit) (GESContainer * container, 123 GList * layers, gint new_layer_priority, 124 GESEditMode mode, 125 GESEdge edge, 126 guint64 position); 127 128 129 130 /*< private >*/ 131 guint grouping_priority; 132 133 /* Padding for API extension */ 134 gpointer _ges_reserved[GES_PADDING_LARGE]; 135 }; 136 137 GES_API 138 GType ges_container_get_type (void); 139 140 /* Children handling */ 141 GES_API 142 GList* ges_container_get_children (GESContainer *container, gboolean recursive); 143 GES_API 144 gboolean ges_container_add (GESContainer *container, GESTimelineElement *child); 145 GES_API 146 gboolean ges_container_remove (GESContainer *container, GESTimelineElement *child); 147 GES_API 148 GList * ges_container_ungroup (GESContainer * container, gboolean recursive); 149 GES_API 150 GESContainer *ges_container_group (GList *containers); 151 152 GES_API 153 gboolean ges_container_edit (GESContainer * container, 154 GList * layers, gint new_layer_priority, 155 GESEditMode mode, 156 GESEdge edge, 157 guint64 position); 158 159 G_END_DECLS 160 #endif /* _GES_CONTAINER */ 161