<chapter>
<title>Assets</title>
<xi:include href="xml/ges-asset-timeline-object.xml"/>
+ <xi:include href="xml/ges-asset-track-object.xml"/>
<xi:include href="xml/ges-asset-file-source.xml"/>
<xi:include href="xml/ges-asset-track-file-source.xml"/>
<xi:include href="xml/ges-project.xml"/>
</SECTION>
<SECTION>
+<FILE>ges-asset-track-object</FILE>
+<TITLE>GESAssetTrackObject</TITLE>
+GESAssetObject
+ges_asset_track_object_get_type
+ges_asset_track_object_get_track_type
+ges_asset_track_object_set_track_type
+<SUBSECTION Standard>
+GESAssetTrackObjectPrivate
+GES_ASSET_TRACK_OBJECT
+GES_TYPE_ASSET_TRACK_OBJECT
+GES_ASSET_TRACK_OBJECT_CLASS
+GES_IS_ASSET_TRACK_OBJECT
+GES_IS_ASSET_TRACK_OBJECT_CLASS
+GES_ASSET_TRACK_OBJECT_GET_CLASS
+</SECTION>
+
+<SECTION>
<FILE>ges-asset-file-source</FILE>
<TITLE>GESAssetFileSource</TITLE>
GESAssetFileSource
ges-asset.c \
ges-asset-file-source.c \
ges-asset-timeline-object.c \
+ ges-asset-track-object.c \
ges-extractable.c \
ges-project.c \
ges-base-xml-formatter.c \
ges-asset.h \
ges-asset-file-source.h \
ges-asset-timeline-object.h \
+ ges-asset-track-object.h \
ges-extractable.h \
ges-project.h \
ges-base-xml-formatter.h \
#include <gst/pbutils/pbutils.h>
#include "ges.h"
#include "ges-internal.h"
+#include "ges-asset-track-object.h"
static GHashTable *parent_newparent_table = NULL;
static void
priv_tckasset->uri = ges_asset_get_id (GES_ASSET (asset));
priv_tckasset->sinfo = g_object_ref (sinfo);
priv_tckasset->parent_asset = asset;
- priv_tckasset->type = type;
+ ges_asset_track_object_set_track_type (GES_ASSET_TRACK_OBJECT
+ (tck_filesource_asset), type);
priv->asset_trackfilesources = g_list_append (priv->asset_trackfilesources,
gst_object_ref (tck_filesource_asset));
*/
G_DEFINE_TYPE (GESAssetTrackFileSource, ges_asset_track_filesource,
- GES_TYPE_ASSET);
+ GES_TYPE_ASSET_TRACK_OBJECT);
static GESExtractable *
_extract (GESAsset * asset, GError ** error)
}
/**
- * ges_asset_track_filesource_get_track_type:
- * @self: A #GESAssetFileSource
- *
- * Get the GESAssetTrackType the #GESTrackObject extracted from @self
- * should get into
- *
- * Returns: a #GESTrackType
- */
-const GESTrackType
-ges_asset_track_filesource_get_track_type (GESAssetTrackFileSource * asset)
-{
- g_return_val_if_fail (GES_IS_ASSET_TRACK_FILESOURCE (asset),
- GES_TRACK_TYPE_UNKNOWN);
-
- return asset->priv->type;
-}
-
-/**
* ges_asset_track_filesource_get_filesource_asset:
* @self: A #GESAssetFileSource
*
#include <ges/ges-types.h>
#include <ges/ges-asset.h>
#include <ges/ges-asset-timeline-object.h>
+#include <ges/ges-asset-track-object.h>
G_BEGIN_DECLS
#define GES_TYPE_ASSET_FILESOURCE ges_asset_filesource_get_type()
struct _GESAssetTrackFileSource
{
- GESAsset parent;
+ GESAssetTrackObject parent;
/* <private> */
GESAssetTrackFileSourcePrivate *priv;
struct _GESAssetTrackFileSourceClass
{
- GESAssetClass parent_class;
+ GESAssetTrackObjectClass parent_class;
gpointer _ges_reserved[GES_PADDING];
};
GstDiscovererStreamInfo * ges_asset_track_filesource_get_stream_info (GESAssetTrackFileSource *asset);
const gchar * ges_asset_track_filesource_get_stream_uri (GESAssetTrackFileSource *asset);
-const GESTrackType ges_asset_track_filesource_get_track_type (GESAssetTrackFileSource *asset);
const GESAssetFileSource *ges_asset_track_filesource_get_filesource_asset (GESAssetTrackFileSource *asset);
G_END_DECLS
--- /dev/null
+/**
+ * Gstreamer
+ *
+ * Copyright (C) <2012> Thibault Saunier <thibault.saunier@collabora.com>
+ *
+ * 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-asset-track-object
+ * @short_description: A GESAsset subclass specialized in GESTrackObject extraction
+ */
+
+#include "ges-asset-track-object.h"
+
+enum
+{
+ PROP_0,
+ PROP_TRACK_TYPE,
+ PROP_LAST
+};
+
+static GParamSpec *properties[PROP_LAST];
+
+G_DEFINE_TYPE (GESAssetTrackObject, ges_asset_track_object, GES_TYPE_ASSET);
+
+struct _GESAssetTrackObjectPrivate
+{
+ GESTrackType type;
+};
+
+static void
+_get_property (GObject * object, guint property_id,
+ GValue * value, GParamSpec * pspec)
+{
+ GESAssetTrackObject *asset = GES_ASSET_TRACK_OBJECT (object);
+
+ switch (property_id) {
+ case PROP_TRACK_TYPE:
+ g_value_set_flags (value, asset->priv->type);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+ }
+}
+
+static void
+_set_property (GObject * object, guint property_id,
+ const GValue * value, GParamSpec * pspec)
+{
+ GESAssetTrackObject *asset = GES_ASSET_TRACK_OBJECT (object);
+
+ switch (property_id) {
+ case PROP_TRACK_TYPE:
+ asset->priv->type = g_value_get_flags (value);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+ }
+}
+
+static void
+ges_asset_track_object_class_init (GESAssetTrackObjectClass * klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+ g_type_class_add_private (klass, sizeof (GESAssetTrackObjectPrivate));
+
+ object_class->get_property = _get_property;
+ object_class->set_property = _set_property;
+
+ /**
+ * GESTimelineObject:supported-formats:
+ *
+ * The formats supported by the object.
+ *
+ * Since: 0.10.XX
+ */
+ properties[PROP_TRACK_TYPE] = g_param_spec_flags ("track-type",
+ "Track type", "The GESTrackType in which the object is",
+ GES_TYPE_TRACK_TYPE, GES_TRACK_TYPE_UNKNOWN,
+ G_PARAM_READWRITE | G_PARAM_CONSTRUCT);
+
+ g_object_class_install_property (object_class, PROP_TRACK_TYPE,
+ properties[PROP_TRACK_TYPE]);
+}
+
+static void
+ges_asset_track_object_init (GESAssetTrackObject * self)
+{
+ GESAssetTrackObjectPrivate *priv;
+
+ priv = self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self,
+ GES_TYPE_ASSET_TRACK_OBJECT, GESAssetTrackObjectPrivate);
+
+ priv->type = GES_TRACK_TYPE_UNKNOWN;
+
+}
+
+/**
+ * ges_asset_track_object_set_track_type:
+ * @self: A #GESAssetObject
+ * @type: A #GESTrackType
+ *
+ * Set the #GESAssetTrackType the #GESTrackObject extracted from @self
+ * should get into
+ */
+void
+ges_asset_track_object_set_track_type (GESAssetTrackObject * asset,
+ GESTrackType type)
+{
+ g_return_if_fail (GES_IS_ASSET_TRACK_OBJECT (asset));
+
+ asset->priv->type = type;
+}
+
+/**
+ * ges_asset_track_object_get_track_type:
+ * @self: A #GESAssetObject
+ *
+ * Get the GESAssetTrackType the #GESTrackObject extracted from @self
+ * should get into
+ *
+ * Returns: a #GESTrackType
+ */
+const GESTrackType
+ges_asset_track_object_get_track_type (GESAssetTrackObject * asset)
+{
+ g_return_val_if_fail (GES_IS_ASSET_TRACK_OBJECT (asset),
+ GES_TRACK_TYPE_UNKNOWN);
+
+ return asset->priv->type;
+}
--- /dev/null
+/* GStreamer Editing Services
+ *
+ * Copyright (C) 2012 Thibault Saunier <thibault.saunier@collabora.com>
+ *
+ * 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_ASSET_TRACK_OBJECT_
+#define _GES_ASSET_TRACK_OBJECT_
+
+#include <glib-object.h>
+#include <gio/gio.h>
+#include <ges/ges-types.h>
+#include <ges/ges-asset.h>
+
+G_BEGIN_DECLS
+
+#define GES_TYPE_ASSET_TRACK_OBJECT ges_asset_track_object_get_type()
+#define GES_ASSET_TRACK_OBJECT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GES_TYPE_ASSET_TRACK_OBJECT, GESAssetTrackObject))
+#define GES_ASSET_TRACK_OBJECT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GES_TYPE_ASSET_TRACK_OBJECT, GESAssetTrackObjectClass))
+#define GES_IS_ASSET_TRACK_OBJECT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GES_TYPE_ASSET_TRACK_OBJECT))
+#define GES_IS_ASSET_TRACK_OBJECT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GES_TYPE_ASSET_TRACK_OBJECT))
+#define GES_ASSET_TRACK_OBJECT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GES_TYPE_ASSET_TRACK_OBJECT, GESAssetTrackObjectClass))
+
+typedef struct _GESAssetTrackObjectPrivate GESAssetTrackObjectPrivate;
+
+GType ges_asset_track_object_get_type (void);
+
+struct _GESAssetTrackObject
+{
+ GESAsset parent;
+
+ /* <private> */
+ GESAssetTrackObjectPrivate *priv;
+
+ /* Padding for API extension */
+ gpointer __ges_reserved[GES_PADDING];
+};
+
+struct _GESAssetTrackObjectClass
+{
+ GESAssetClass parent_class;
+
+ gpointer _ges_reserved[GES_PADDING];
+};
+
+const GESTrackType ges_asset_track_object_get_track_type (GESAssetTrackObject *asset);
+void ges_asset_track_object_set_track_type (GESAssetTrackObject * asset, GESTrackType type);
+
+G_END_DECLS
+#endif /* _GES_ASSET_TRACK_OBJECT */
+
#include "ges-timeline-source.h"
#include "ges-track-filesource.h"
#include "ges-asset-file-source.h"
+#include "ges-asset-track-object.h"
#include "ges-extractable.h"
#include "ges-track-image-source.h"
#include "ges-track-audio-test-source.h"
ges_asset_filesource_get_stream_assets (GES_ASSET_FILESOURCE
(obj->asset));
for (tmp = stream_assets; tmp; tmp = tmp->next) {
- GESAssetTrackFileSource *asset = GES_ASSET_TRACK_FILESOURCE (tmp->data);
+ GESAssetTrackObject *asset = GES_ASSET_TRACK_OBJECT (tmp->data);
- if (ges_asset_track_filesource_get_track_type (asset) == type)
+ if (ges_asset_track_object_get_track_type (asset) == type)
res = g_list_prepend (res, ges_asset_extract (GES_ASSET (asset), NULL));
}
track_object, &tracks);
if (!tracks || tracks->len == 0) {
- GST_DEBUG_OBJECT (timeline, "Got no Track to add %p into", object);
+ GST_DEBUG_OBJECT (timeline, "Got no Track to add %p (type %s)",
+ track_object,
+ ges_track_type_name (ges_track_object_get_track_type
+ (track_object)));
goto next_track_object;
}
/**
* SECTION:ges-track-filesource
* @short_description: outputs a single media stream from a given file
- *
+ *
* Outputs a single media stream from a given file. The stream chosen depends on
* the type of the track which contains the object.
*/
}
static void
+extractable_set_asset (GESExtractable * self, GESAsset * asset)
+{
+ /* FIXME That should go into #GESTrackObject, but
+ * some work is needed to make sure it works properly */
+
+ if (ges_track_object_get_track_type (GES_TRACK_OBJECT (self)) ==
+ GES_TRACK_TYPE_UNKNOWN) {
+ ges_track_object_set_track_type (GES_TRACK_OBJECT (self),
+ ges_asset_track_object_get_track_type (GES_ASSET_TRACK_OBJECT (asset)));
+ }
+}
+
+static void
ges_extractable_interface_init (GESExtractableInterface * iface)
{
iface->asset_type = GES_TYPE_ASSET_TRACK_FILESOURCE;
iface->check_id = ges_extractable_check_id;
+ iface->set_asset = extractable_set_asset;
}
G_DEFINE_TYPE_WITH_CODE (GESTrackFileSource, ges_track_filesource,
typedef struct _GESAssetFileSource GESAssetFileSource;
typedef struct _GESAssetFileSourceClass GESAssetFileSourceClass;
+typedef struct _GESAssetTrackObject GESAssetTrackObject;
+typedef struct _GESAssetTrackObjectClass GESAssetTrackObjectClass;
+
typedef struct _GESAssetTrackFileSource GESAssetTrackFileSource;
typedef struct _GESAssetTrackFileSourceClass GESAssetTrackFileSourceClass;
#include <ges/ges-screenshot.h>
#include <ges/ges-asset.h>
#include <ges/ges-asset-timeline-object.h>
+#include <ges/ges-asset-track-object.h>
#include <ges/ges-asset-file-source.h>
#include <ges/ges-project.h>
#include <ges/ges-extractable.h>