diff --git a/docs/libs/ges-docs.sgml b/docs/libs/ges-docs.sgml index d66764f779..014af1bbbe 100644 --- a/docs/libs/ges-docs.sgml +++ b/docs/libs/ges-docs.sgml @@ -35,10 +35,12 @@ platform as well as Windows. It is released under the GNU Library General Public + + diff --git a/docs/libs/ges-sections.txt b/docs/libs/ges-sections.txt index 2437b6d5d6..9451522f1d 100644 --- a/docs/libs/ges-sections.txt +++ b/docs/libs/ges-sections.txt @@ -68,6 +68,24 @@ GES_IS_TRACK_SOURCE_CLASS ges_track_source_get_type +
+ges-track-filesource +GESTrackFileSource +GESTrackFileSource +GESTrackFileSourceClass +ges_track_filesource_new + +GES_TRACK_FILESOURCE +GES_TRACK_FILESOURCE_CLASS +GES_TRACK_FILESOURCE_GET_CLASS +GES_TYPE_TRACK_FILESOURCE +GES_IS_TRACK_FILESOURCE +GES_IS_TRACK_FILESOURCE_CLASS +ges_track_filesource_get_type +
+ + +
ges-timeline GESTimeline @@ -171,6 +189,22 @@ GES_TIMELINE_SOURCE_GET_CLASS GES_TYPE_TIMELINE_SOURCE
+
+ges-timeline-filesource +GESTimelineFileSource +GESTimelineFileSource +GESTimelineFileSourceClass +ges_timeline_filesource_new + +ges_tl_filesource_get_type +GES_IS_TIMELINE_FILE_SOURCE +GES_IS_TIMELINE_FILE_SOURCE_CLASS +GES_TIMELINE_FILE_SOURCE +GES_TIMELINE_FILE_SOURCE_CLASS +GES_TIMELINE_FILE_SOURCE_GET_CLASS +GES_TYPE_TIMELINE_FILE_SOURCE +
+
ges-timeline-transition diff --git a/ges/Makefile.am b/ges/Makefile.am index 4cbcdb394e..bb35c70101 100644 --- a/ges/Makefile.am +++ b/ges/Makefile.am @@ -16,10 +16,12 @@ libges_@GST_MAJORMINOR@_la_SOURCES = \ ges-timeline-object.c \ ges-timeline-pipeline.c \ ges-timeline-source.c \ + ges-timeline-file-source.c \ ges-timeline-transition.c \ ges-track.c \ ges-track-object.c \ - ges-track-source.c + ges-track-source.c \ + ges-track-filesource.c libges_@GST_MAJORMINOR@includedir = $(includedir)/gstreamer-@GST_MAJORMINOR@/ges/ libges_@GST_MAJORMINOR@include_HEADERS = \ @@ -33,10 +35,12 @@ libges_@GST_MAJORMINOR@include_HEADERS = \ ges-timeline-object.h \ ges-timeline-pipeline.h \ ges-timeline-source.h \ + ges-timeline-file-source.h \ ges-timeline-transition.h \ ges-track.h \ ges-track-object.h \ - ges-track-source.h + ges-track-source.h \ + ges-track-filesource.h libges_@GST_MAJORMINOR@_la_CFLAGS = -I$(top_srcdir) $(GST_PLUGINS_BASE_CFLAGS) $(GST_CFLAGS) diff --git a/ges/ges-timeline-file-source.c b/ges/ges-timeline-file-source.c new file mode 100644 index 0000000000..ed18df1c4e --- /dev/null +++ b/ges/ges-timeline-file-source.c @@ -0,0 +1,135 @@ +/* GStreamer Editing Services + * Copyright (C) 2009 Edward Hervey + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#include "ges-internal.h" +#include "ges-timeline-file-source.h" +#include "ges-timeline-source.h" +#include "ges-track-filesource.h" + +G_DEFINE_TYPE (GESTimelineFileSource, ges_tl_filesource, + GES_TYPE_TIMELINE_SOURCE); + +enum +{ + PROP_0, + PROP_URI +}; + +static GESTrackObject + * ges_tl_filesource_create_track_object (GESTimelineObject * obj, + GESTrack * track); + +static void +ges_tl_filesource_get_property (GObject * object, guint property_id, + GValue * value, GParamSpec * pspec) +{ + GESTimelineFileSource *tfs = GES_TIMELINE_FILE_SOURCE (object); + + switch (property_id) { + case PROP_URI: + g_value_set_string (value, tfs->uri); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + } +} + +static void +ges_tl_filesource_set_property (GObject * object, guint property_id, + const GValue * value, GParamSpec * pspec) +{ + GESTimelineFileSource *tfs = GES_TIMELINE_FILE_SOURCE (object); + + switch (property_id) { + case PROP_URI: + tfs->uri = g_value_dup_string (value); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + } +} + +static void +ges_tl_filesource_dispose (GObject * object) +{ + G_OBJECT_CLASS (ges_tl_filesource_parent_class)->dispose (object); +} + +static void +ges_tl_filesource_finalize (GObject * object) +{ + G_OBJECT_CLASS (ges_tl_filesource_parent_class)->finalize (object); +} + +static void +ges_tl_filesource_class_init (GESTimelineFileSourceClass * klass) +{ + GObjectClass *object_class = G_OBJECT_CLASS (klass); + GESTimelineObjectClass *timobj_class = GES_TIMELINE_OBJECT_CLASS (klass); + + object_class->get_property = ges_tl_filesource_get_property; + object_class->set_property = ges_tl_filesource_set_property; + object_class->dispose = ges_tl_filesource_dispose; + object_class->finalize = ges_tl_filesource_finalize; + + + /** + * GESTimelineFileSource:uri + * + * The location of the file/resource to use. + */ + g_object_class_install_property (object_class, PROP_URI, + g_param_spec_string ("uri", "URI", "uri of the resource", + NULL, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); + + timobj_class->create_track_object = ges_tl_filesource_create_track_object; + timobj_class->need_fill_track = FALSE; +} + +static void +ges_tl_filesource_init (GESTimelineFileSource * self) +{ +} + +static GESTrackObject * +ges_tl_filesource_create_track_object (GESTimelineObject * obj, + GESTrack * track) +{ + GST_DEBUG ("Creating a GESTrackFileSource"); + + /* FIXME : Implement properly ! */ + return (GESTrackObject *) ges_track_filesource_new (((GESTimelineFileSource *) + obj)->uri); +} + +/** + * ges_timeline_filesource_new: + * @uri: the URI the source should control + * + * Creates a new #GESTimelineFileSource for the provided @uri. + * + * Returns: The newly created #GESTimelineFileSource, or NULL if there was an + * error. + */ +GESTimelineFileSource * +ges_timeline_filesource_new (gchar * uri) +{ + /* FIXME : Check for validity/existence of URI */ + return g_object_new (GES_TYPE_TIMELINE_FILE_SOURCE, "uri", uri, NULL); +} diff --git a/ges/ges-timeline-file-source.h b/ges/ges-timeline-file-source.h new file mode 100644 index 0000000000..8ad6148104 --- /dev/null +++ b/ges/ges-timeline-file-source.h @@ -0,0 +1,65 @@ +/* GStreamer Editing Services + * Copyright (C) 2009 Edward Hervey + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#ifndef _GES_TL_FILESOURCE +#define _GES_TL_FILESOURCE + +#include +#include +#include + +G_BEGIN_DECLS + +#define GES_TYPE_TIMELINE_FILE_SOURCE ges_tl_filesource_get_type() + +#define GES_TIMELINE_FILE_SOURCE(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST ((obj), GES_TYPE_TIMELINE_FILE_SOURCE, GESTimelineFileSource)) + +#define GES_TIMELINE_FILE_SOURCE_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_CAST ((klass), GES_TYPE_TIMELINE_FILE_SOURCE, GESTimelineFileSourceClass)) + +#define GES_IS_TIMELINE_FILE_SOURCE(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GES_TYPE_TIMELINE_FILE_SOURCE)) + +#define GES_IS_TIMELINE_FILE_SOURCE_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_TYPE ((klass), GES_TYPE_TIMELINE_FILE_SOURCE)) + +#define GES_TIMELINE_FILE_SOURCE_GET_CLASS(obj) \ + (G_TYPE_INSTANCE_GET_CLASS ((obj), GES_TYPE_TIMELINE_FILE_SOURCE, GESTimelineFileSourceClass)) + + +struct _GESTimelineFileSource { + GESTimelineSource parent; + + /*< private >*/ + gchar *uri; +}; + +struct _GESTimelineFileSourceClass { + GESTimelineSourceClass parent_class; +}; + +GType ges_tl_filesource_get_type (void); + +GESTimelineFileSource* ges_timeline_filesource_new (gchar *uri); + +G_END_DECLS + +#endif /* _GES_TL_FILESOURCE */ + diff --git a/ges/ges-timeline-object.c b/ges/ges-timeline-object.c index 106f063887..a804be076d 100644 --- a/ges/ges-timeline-object.c +++ b/ges/ges-timeline-object.c @@ -147,6 +147,8 @@ ges_timeline_object_class_init (GESTimelineObjectClass * klass) g_object_class_install_property (object_class, PROP_PRIORITY, g_param_spec_uint ("priority", "Priority", "The priority of the object", 0, G_MAXUINT, 0, G_PARAM_READWRITE)); + + klass->need_fill_track = TRUE; } static void @@ -159,7 +161,9 @@ ges_timeline_object_init (GESTimelineObject * self) * @object: The origin #GESTimelineObject * @track: The #GESTrack to create a #GESTrackObject for. * - * Creates a #GESTrackObject for the provided @track. + * Creates a #GESTrackObject for the provided @track. The timeline object + * keep a reference to the newly created trackobject, you therefore need to + * call @ges_timeline_object_release_track_object when you are done with it. * * Returns: A #GESTrackObject. Returns NULL if the #GESTrackObject could not * be created. @@ -187,7 +191,8 @@ ges_timeline_object_create_track_object (GESTimelineObject * object, ges_track_object_set_timeline_object (res, object); GST_DEBUG ("Adding TrackObject to the list of controlled track objects"); - object->trackobjects = g_list_append (object->trackobjects, res); + object->trackobjects = + g_list_append (object->trackobjects, g_object_ref (res)); } @@ -196,6 +201,11 @@ ges_timeline_object_create_track_object (GESTimelineObject * object, return res; } +/** + * ges_timeline_object_release_track_object: + * @object: a #GESTimelineObject + * @trobj: the #GESTrackObject to release + */ gboolean ges_timeline_object_release_track_object (GESTimelineObject * object, GESTrackObject * trobj) @@ -213,6 +223,8 @@ ges_timeline_object_release_track_object (GESTimelineObject * object, ges_track_object_set_timeline_object (trobj, NULL); + g_object_unref (trobj); + return TRUE; } @@ -230,19 +242,21 @@ ges_timeline_object_fill_track_object (GESTimelineObject * object, GESTrackObject * trackobj, GstElement * gnlobj) { GESTimelineObjectClass *class; - gboolean res; + gboolean res = TRUE; GST_DEBUG ("object:%p, trackobject:%p, gnlobject:%p", object, trackobj, gnlobj); class = GES_TIMELINE_OBJECT_GET_CLASS (object); - if (G_UNLIKELY (class->fill_track_object == NULL)) { - GST_WARNING ("No 'fill_track_object' implementation available"); - return FALSE; - } + if (class->need_fill_track) { + if (G_UNLIKELY (class->fill_track_object == NULL)) { + GST_WARNING ("No 'fill_track_object' implementation available"); + return FALSE; + } - res = class->fill_track_object (object, trackobj, gnlobj); + res = class->fill_track_object (object, trackobj, gnlobj); + } if (G_LIKELY (res)) { GST_DEBUG ("Setting properties"); diff --git a/ges/ges-timeline-object.h b/ges/ges-timeline-object.h index fb67c7d91c..d2e95f58d3 100644 --- a/ges/ges-timeline-object.h +++ b/ges/ges-timeline-object.h @@ -90,6 +90,7 @@ struct _GESTimelineObject { * @parent_class: object parent class * @create_track_object: method to create a #GESTrackObject for a given #GESTrack. * @fill_track_object: method to fill an associated #GESTrackObject. + * @need_fill_track: Set to TRUE if @fill_track_object needs to be called. * * Subclasses can override the @create_track_object and @fill_track_object methods. */ @@ -100,6 +101,7 @@ struct _GESTimelineObjectClass { GESTrack * track); /* FIXME : might need a release_track_object */ FillTrackObjectFunc fill_track_object; + gboolean need_fill_track; }; GType ges_timeline_object_get_type (void); diff --git a/ges/ges-track-filesource.c b/ges/ges-track-filesource.c new file mode 100644 index 0000000000..79e196103e --- /dev/null +++ b/ges/ges-track-filesource.c @@ -0,0 +1,120 @@ +/* GStreamer Editing Services + * Copyright (C) 2009 Edward Hervey + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +/** + * SECTION:ges-track-source + * @short_description: Base Class for single-media sources + */ + +#include "ges-internal.h" +#include "ges-track-object.h" +#include "ges-track-filesource.h" + +G_DEFINE_TYPE (GESTrackFileSource, ges_track_filesource, GES_TYPE_TRACK_SOURCE); + +enum +{ + PROP_0, + PROP_URI +}; + +static void +ges_track_filesource_get_property (GObject * object, guint property_id, + GValue * value, GParamSpec * pspec) +{ + GESTrackFileSource *tfs = GES_TRACK_FILESOURCE (object); + + switch (property_id) { + case PROP_URI: + g_value_set_string (value, tfs->uri); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + } +} + +static void +ges_track_filesource_set_property (GObject * object, guint property_id, + const GValue * value, GParamSpec * pspec) +{ + GESTrackFileSource *tfs = GES_TRACK_FILESOURCE (object); + + switch (property_id) { + case PROP_URI: + tfs->uri = g_value_dup_string (value); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + } +} + +static void +ges_track_filesource_dispose (GObject * object) +{ + G_OBJECT_CLASS (ges_track_filesource_parent_class)->dispose (object); +} + +static void +ges_track_filesource_finalize (GObject * object) +{ + G_OBJECT_CLASS (ges_track_filesource_parent_class)->finalize (object); +} + +static gboolean +ges_track_filesource_create_gnl_object (GESTrackObject * object) +{ + object->gnlobject = gst_element_factory_make ("gnlurisource", NULL); + g_object_set (object->gnlobject, "uri", ((GESTrackFileSource *) object)->uri, + NULL); + + return TRUE; +} + +static void +ges_track_filesource_class_init (GESTrackFileSourceClass * klass) +{ + GObjectClass *object_class = G_OBJECT_CLASS (klass); + GESTrackObjectClass *track_class = GES_TRACK_OBJECT_CLASS (klass); + + object_class->get_property = ges_track_filesource_get_property; + object_class->set_property = ges_track_filesource_set_property; + object_class->dispose = ges_track_filesource_dispose; + object_class->finalize = ges_track_filesource_finalize; + + /** + * GESTrackFileSource:uri + * + * The location of the file/resource to use. + */ + g_object_class_install_property (object_class, PROP_URI, + g_param_spec_string ("uri", "URI", "uri of the resource", + NULL, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); + track_class->create_gnl_object = ges_track_filesource_create_gnl_object; +} + +static void +ges_track_filesource_init (GESTrackFileSource * self) +{ +} + +GESTrackFileSource * +ges_track_filesource_new (gchar * uri) +{ + return g_object_new (GES_TYPE_TRACK_FILESOURCE, "uri", uri, NULL); +} diff --git a/ges/ges-track-filesource.h b/ges/ges-track-filesource.h new file mode 100644 index 0000000000..9761edd1e5 --- /dev/null +++ b/ges/ges-track-filesource.h @@ -0,0 +1,64 @@ +/* GStreamer Editing Services + * Copyright (C) 2009 Edward Hervey + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#ifndef _GES_TRACK_FILESOURCE +#define _GES_TRACK_FILESOURCE + +#include +#include +#include + +G_BEGIN_DECLS + +#define GES_TYPE_TRACK_FILESOURCE ges_track_filesource_get_type() + +#define GES_TRACK_FILESOURCE(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST ((obj), GES_TYPE_TRACK_FILESOURCE, GESTrackFileSource)) + +#define GES_TRACK_FILESOURCE_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_CAST ((klass), GES_TYPE_TRACK_FILESOURCE, GESTrackFileSourceClass)) + +#define GES_IS_TRACK_FILESOURCE(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GES_TYPE_TRACK_FILESOURCE)) + +#define GES_IS_TRACK_FILESOURCE_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_TYPE ((klass), GES_TYPE_TRACK_FILESOURCE)) + +#define GES_TRACK_FILESOURCE_GET_CLASS(obj) \ + (G_TYPE_INSTANCE_GET_CLASS ((obj), GES_TYPE_TRACK_FILESOURCE, GESTrackFileSourceClass)) + +struct _GESTrackFileSource { + GESTrackObject parent; + + /*< public >*/ + gchar *uri; +}; + +struct _GESTrackFileSourceClass { + GESTrackObjectClass parent_class; +}; + +GType ges_track_filesource_get_type (void); + +GESTrackFileSource* ges_track_filesource_new (gchar *uri); + +G_END_DECLS + +#endif /* _GES_TRACK_FILESOURCE */ + diff --git a/ges/ges-types.h b/ges/ges-types.h index 7c4e60eea0..4052b647dd 100644 --- a/ges/ges-types.h +++ b/ges/ges-types.h @@ -41,6 +41,8 @@ typedef struct _GESTimelinePipelineClass GESTimelinePipelineClass; typedef struct _GESTimelineSource GESTimelineSource; typedef struct _GESTimelineSourceClass GESTimelineSourceClass; +typedef struct _GESTimelineFileSource GESTimelineFileSource; +typedef struct _GESTimelineFileSourceClass GESTimelineFileSourceClass; typedef struct _GESTimelineTransition GESTimelineTransition; typedef struct _GESTimelineTransitionClass GESTimelineTransitionClass; @@ -53,5 +55,8 @@ typedef struct _GESTrackObjectClass GESTrackObjectClass; typedef struct _GESTrackSource GESTrackSource; typedef struct _GESTrackSourceClass GESTrackSourceClass; +typedef struct _GESTrackFileSource GESTrackFileSource; +typedef struct _GESTrackFileSourceClass GESTrackFileSourceClass; + #endif /* __GES_TYPES_H__ */ diff --git a/ges/ges.h b/ges/ges.h index 995ae4f67a..8cecfe2596 100644 --- a/ges/ges.h +++ b/ges/ges.h @@ -37,6 +37,8 @@ #include #include +#include +#include G_BEGIN_DECLS