2009-09-21 10:51:16 +00:00
|
|
|
/* GStreamer Editing Services
|
2009-11-30 14:14:25 +00:00
|
|
|
* Copyright (C) 2009 Edward Hervey <edward.hervey@collabora.co.uk>
|
|
|
|
* 2009 Nokia Corporation
|
2009-09-21 10:51:16 +00:00
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*/
|
|
|
|
|
2010-05-19 10:24:44 +00:00
|
|
|
/**
|
|
|
|
* SECTION:ges-timeline-filesource
|
2010-05-31 16:59:12 +00:00
|
|
|
* @short_description: An object for manipulating media files in a GESTimeline
|
|
|
|
*
|
2011-06-25 17:42:29 +00:00
|
|
|
* Represents all the output streams from a particular uri. It is assumed that
|
2010-05-31 16:59:12 +00:00
|
|
|
* the URI points to a file of some type.
|
2010-05-19 10:24:44 +00:00
|
|
|
*/
|
|
|
|
|
2009-09-21 10:51:16 +00:00
|
|
|
#include "ges-internal.h"
|
|
|
|
#include "ges-timeline-file-source.h"
|
|
|
|
#include "ges-timeline-source.h"
|
|
|
|
#include "ges-track-filesource.h"
|
2010-08-09 11:26:20 +00:00
|
|
|
#include "ges-track-image-source.h"
|
2010-08-09 16:35:26 +00:00
|
|
|
#include "ges-track-audio-test-source.h"
|
2009-09-21 10:51:16 +00:00
|
|
|
|
2010-12-15 12:27:39 +00:00
|
|
|
G_DEFINE_TYPE (GESTimelineFileSource, ges_timeline_filesource,
|
2009-09-21 10:51:16 +00:00
|
|
|
GES_TYPE_TIMELINE_SOURCE);
|
|
|
|
|
2011-01-08 14:25:22 +00:00
|
|
|
struct _GESTimelineFileSourcePrivate
|
|
|
|
{
|
|
|
|
gchar *uri;
|
|
|
|
|
|
|
|
gboolean mute;
|
|
|
|
gboolean is_image;
|
|
|
|
|
|
|
|
guint64 maxduration;
|
|
|
|
|
|
|
|
/* The formats supported by this filesource
|
|
|
|
* TODO : Could maybe be moved to a parent class */
|
|
|
|
GESTrackType supportedformats;
|
|
|
|
};
|
|
|
|
|
2009-09-21 10:51:16 +00:00
|
|
|
enum
|
|
|
|
{
|
|
|
|
PROP_0,
|
2009-09-30 14:44:12 +00:00
|
|
|
PROP_URI,
|
2010-05-19 10:24:44 +00:00
|
|
|
PROP_MAX_DURATION,
|
|
|
|
PROP_MUTE,
|
2010-08-09 10:01:34 +00:00
|
|
|
PROP_SUPPORTED_FORMATS,
|
|
|
|
PROP_IS_IMAGE,
|
2009-09-21 10:51:16 +00:00
|
|
|
};
|
|
|
|
|
2009-09-30 14:44:12 +00:00
|
|
|
|
2009-09-21 10:51:16 +00:00
|
|
|
static GESTrackObject
|
2010-12-15 12:27:39 +00:00
|
|
|
* ges_timeline_filesource_create_track_object (GESTimelineObject * obj,
|
2009-09-21 10:51:16 +00:00
|
|
|
GESTrack * track);
|
|
|
|
|
|
|
|
static void
|
2010-12-15 12:27:39 +00:00
|
|
|
ges_timeline_filesource_get_property (GObject * object, guint property_id,
|
2009-09-21 10:51:16 +00:00
|
|
|
GValue * value, GParamSpec * pspec)
|
|
|
|
{
|
2011-01-08 14:25:22 +00:00
|
|
|
GESTimelineFileSourcePrivate *priv = GES_TIMELINE_FILE_SOURCE (object)->priv;
|
2009-09-21 10:51:16 +00:00
|
|
|
|
|
|
|
switch (property_id) {
|
|
|
|
case PROP_URI:
|
2011-01-08 14:25:22 +00:00
|
|
|
g_value_set_string (value, priv->uri);
|
2009-09-21 10:51:16 +00:00
|
|
|
break;
|
2009-09-30 14:44:12 +00:00
|
|
|
case PROP_MUTE:
|
2011-01-08 14:25:22 +00:00
|
|
|
g_value_set_boolean (value, priv->mute);
|
2009-09-30 14:44:12 +00:00
|
|
|
break;
|
2010-05-19 10:24:44 +00:00
|
|
|
case PROP_MAX_DURATION:
|
2011-01-08 14:25:22 +00:00
|
|
|
g_value_set_uint64 (value, priv->maxduration);
|
2010-05-19 10:24:44 +00:00
|
|
|
break;
|
|
|
|
case PROP_SUPPORTED_FORMATS:
|
2011-01-08 14:25:22 +00:00
|
|
|
g_value_set_flags (value, priv->supportedformats);
|
2010-05-19 10:24:44 +00:00
|
|
|
break;
|
2010-08-09 10:01:34 +00:00
|
|
|
case PROP_IS_IMAGE:
|
2011-01-08 14:25:22 +00:00
|
|
|
g_value_set_boolean (value, priv->is_image);
|
2010-08-09 10:01:34 +00:00
|
|
|
break;
|
2009-09-21 10:51:16 +00:00
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2010-12-15 12:27:39 +00:00
|
|
|
ges_timeline_filesource_set_property (GObject * object, guint property_id,
|
2009-09-21 10:51:16 +00:00
|
|
|
const GValue * value, GParamSpec * pspec)
|
|
|
|
{
|
|
|
|
GESTimelineFileSource *tfs = GES_TIMELINE_FILE_SOURCE (object);
|
|
|
|
|
|
|
|
switch (property_id) {
|
|
|
|
case PROP_URI:
|
2011-01-08 14:25:22 +00:00
|
|
|
tfs->priv->uri = g_value_dup_string (value);
|
2009-09-21 10:51:16 +00:00
|
|
|
break;
|
2009-09-30 14:44:12 +00:00
|
|
|
case PROP_MUTE:
|
2010-12-15 12:27:39 +00:00
|
|
|
ges_timeline_filesource_set_mute (tfs, g_value_get_boolean (value));
|
2009-09-30 14:44:12 +00:00
|
|
|
break;
|
2010-05-19 10:24:44 +00:00
|
|
|
case PROP_MAX_DURATION:
|
2010-12-15 12:27:39 +00:00
|
|
|
ges_timeline_filesource_set_max_duration (tfs,
|
|
|
|
g_value_get_uint64 (value));
|
2010-05-19 10:24:44 +00:00
|
|
|
break;
|
|
|
|
case PROP_SUPPORTED_FORMATS:
|
2011-01-08 14:25:22 +00:00
|
|
|
ges_timeline_filesource_set_supported_formats (tfs,
|
|
|
|
g_value_get_flags (value));
|
2010-05-19 10:24:44 +00:00
|
|
|
break;
|
2010-08-09 10:01:34 +00:00
|
|
|
case PROP_IS_IMAGE:
|
2011-01-08 14:25:22 +00:00
|
|
|
ges_timeline_filesource_set_is_image (tfs, g_value_get_boolean (value));
|
2010-08-09 10:01:34 +00:00
|
|
|
break;
|
2009-09-21 10:51:16 +00:00
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2010-12-15 12:27:39 +00:00
|
|
|
ges_timeline_filesource_finalize (GObject * object)
|
2009-09-21 10:51:16 +00:00
|
|
|
{
|
2011-01-08 14:25:22 +00:00
|
|
|
GESTimelineFileSourcePrivate *priv = GES_TIMELINE_FILE_SOURCE (object)->priv;
|
2009-11-25 12:13:49 +00:00
|
|
|
|
2011-01-08 14:25:22 +00:00
|
|
|
if (priv->uri)
|
|
|
|
g_free (priv->uri);
|
2010-12-15 12:27:39 +00:00
|
|
|
G_OBJECT_CLASS (ges_timeline_filesource_parent_class)->finalize (object);
|
2009-09-21 10:51:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2010-12-15 12:27:39 +00:00
|
|
|
ges_timeline_filesource_class_init (GESTimelineFileSourceClass * klass)
|
2009-09-21 10:51:16 +00:00
|
|
|
{
|
|
|
|
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
|
|
|
GESTimelineObjectClass *timobj_class = GES_TIMELINE_OBJECT_CLASS (klass);
|
|
|
|
|
2011-01-08 14:25:22 +00:00
|
|
|
g_type_class_add_private (klass, sizeof (GESTimelineFileSourcePrivate));
|
|
|
|
|
2010-12-15 12:27:39 +00:00
|
|
|
object_class->get_property = ges_timeline_filesource_get_property;
|
|
|
|
object_class->set_property = ges_timeline_filesource_set_property;
|
|
|
|
object_class->finalize = ges_timeline_filesource_finalize;
|
2009-09-21 10:51:16 +00:00
|
|
|
|
|
|
|
|
|
|
|
/**
|
2010-05-19 10:24:44 +00:00
|
|
|
* GESTimelineFileSource:uri:
|
2009-09-21 10:51:16 +00:00
|
|
|
*
|
|
|
|
* 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));
|
|
|
|
|
2009-09-30 14:44:12 +00:00
|
|
|
/**
|
2010-05-19 10:24:44 +00:00
|
|
|
* GESTimelineFileSource:max-duration:
|
|
|
|
*
|
|
|
|
* The maximum duration (in nanoseconds) of the file.
|
|
|
|
*
|
|
|
|
* If not set before adding the object to a layer, it will be discovered
|
|
|
|
* asynchronously. Connect to 'notify::max-duration' to be notified of it.
|
|
|
|
*/
|
|
|
|
g_object_class_install_property (object_class, PROP_MAX_DURATION,
|
|
|
|
g_param_spec_uint64 ("max-duration", "Maximum duration",
|
|
|
|
"The duration of the file", 0, G_MAXUINT64, GST_CLOCK_TIME_NONE,
|
|
|
|
G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
|
|
|
|
|
|
|
|
/**
|
|
|
|
* GESTimelineFileSource:mute:
|
2009-09-30 14:44:12 +00:00
|
|
|
*
|
|
|
|
* Whether the sound will be played or not.
|
|
|
|
*/
|
|
|
|
g_object_class_install_property (object_class, PROP_MUTE,
|
|
|
|
g_param_spec_boolean ("mute", "Mute", "Mute audio track",
|
|
|
|
FALSE, G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
|
|
|
|
|
2010-05-19 10:24:44 +00:00
|
|
|
/**
|
|
|
|
* GESTimelineFileSource:supported-formats:
|
|
|
|
*
|
2011-06-25 17:42:29 +00:00
|
|
|
* The formats supported by the filesource.
|
2010-05-19 10:24:44 +00:00
|
|
|
*/
|
|
|
|
g_object_class_install_property (object_class, PROP_SUPPORTED_FORMATS,
|
|
|
|
g_param_spec_flags ("supported-formats", "Supported formats",
|
|
|
|
"Formats supported by the file", GES_TYPE_TRACK_TYPE,
|
|
|
|
GES_TRACK_TYPE_UNKNOWN, G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
|
|
|
|
|
2010-08-09 10:01:34 +00:00
|
|
|
/**
|
|
|
|
* GESTimelineFileSource:is-image:
|
|
|
|
*
|
|
|
|
* Whether this filesource represents a still image or not. This must be set
|
|
|
|
* before create_track_objects is called.
|
|
|
|
*/
|
|
|
|
g_object_class_install_property (object_class, PROP_IS_IMAGE,
|
|
|
|
g_param_spec_boolean ("is-image", "Is still image",
|
|
|
|
"Whether the timeline object represents a still image or not",
|
|
|
|
FALSE, G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
|
|
|
|
|
2010-12-15 12:27:39 +00:00
|
|
|
timobj_class->create_track_object =
|
|
|
|
ges_timeline_filesource_create_track_object;
|
2009-09-21 10:51:16 +00:00
|
|
|
timobj_class->need_fill_track = FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2010-12-15 12:27:39 +00:00
|
|
|
ges_timeline_filesource_init (GESTimelineFileSource * self)
|
2009-09-21 10:51:16 +00:00
|
|
|
{
|
2011-01-08 14:25:22 +00:00
|
|
|
self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self,
|
|
|
|
GES_TYPE_TIMELINE_FILE_SOURCE, GESTimelineFileSourcePrivate);
|
|
|
|
|
2010-05-19 10:24:44 +00:00
|
|
|
/* Setting the duration to -1 by default. */
|
|
|
|
GES_TIMELINE_OBJECT (self)->duration = GST_CLOCK_TIME_NONE;
|
2009-09-21 10:51:16 +00:00
|
|
|
}
|
|
|
|
|
2011-01-08 14:25:22 +00:00
|
|
|
/**
|
|
|
|
* ges_timeline_filesource_set_mute:
|
|
|
|
* @self: the #GESTimelineFileSource on which to mute or unmute the audio track
|
|
|
|
* @mute: %TRUE to mute @self audio track, %FALSE to unmute it
|
|
|
|
*
|
|
|
|
* Sets whether the audio track of this timeline object is muted or not.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
void
|
2010-12-15 12:27:39 +00:00
|
|
|
ges_timeline_filesource_set_mute (GESTimelineFileSource * self, gboolean mute)
|
2009-09-30 14:44:12 +00:00
|
|
|
{
|
2010-11-28 12:24:07 +00:00
|
|
|
GList *tmp, *trackobjects;
|
2009-09-30 14:44:12 +00:00
|
|
|
GESTimelineObject *object = (GESTimelineObject *) self;
|
|
|
|
|
|
|
|
GST_DEBUG ("self:%p, mute:%d", self, mute);
|
|
|
|
|
2011-01-08 14:25:22 +00:00
|
|
|
self->priv->mute = mute;
|
2009-09-30 14:44:12 +00:00
|
|
|
|
|
|
|
/* Go over tracked objects, and update 'active' status on all audio objects */
|
2010-11-28 12:24:07 +00:00
|
|
|
trackobjects = ges_timeline_object_get_track_objects (object);
|
|
|
|
for (tmp = trackobjects; tmp; tmp = tmp->next) {
|
2009-09-30 14:44:12 +00:00
|
|
|
GESTrackObject *trackobject = (GESTrackObject *) tmp->data;
|
|
|
|
|
2010-12-16 14:00:46 +00:00
|
|
|
if (ges_track_object_get_track (trackobject)->type == GES_TRACK_TYPE_AUDIO)
|
2009-12-09 14:03:15 +00:00
|
|
|
ges_track_object_set_active (trackobject, !mute);
|
2010-11-28 12:24:07 +00:00
|
|
|
|
|
|
|
g_object_unref (GES_TRACK_OBJECT (tmp->data));
|
2009-09-30 14:44:12 +00:00
|
|
|
}
|
2010-11-28 12:24:07 +00:00
|
|
|
g_list_free (trackobjects);
|
2009-09-30 14:44:12 +00:00
|
|
|
}
|
|
|
|
|
2011-01-08 14:25:22 +00:00
|
|
|
/**
|
|
|
|
* ges_timeline_filesource_set_max_duration:
|
|
|
|
* @self: the #GESTimelineFileSource to set the maximum duration on
|
|
|
|
* @maxduration: the maximum duration of @self
|
|
|
|
*
|
|
|
|
* Sets the maximum duration (in nanoseconds) of the file.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
void
|
2010-12-15 12:27:39 +00:00
|
|
|
ges_timeline_filesource_set_max_duration (GESTimelineFileSource * self,
|
2010-05-19 10:24:44 +00:00
|
|
|
guint64 maxduration)
|
|
|
|
{
|
|
|
|
GESTimelineObject *object = GES_TIMELINE_OBJECT (self);
|
|
|
|
|
2011-01-08 14:25:22 +00:00
|
|
|
self->priv->maxduration = maxduration;
|
2010-05-19 10:24:44 +00:00
|
|
|
if (object->duration == GST_CLOCK_TIME_NONE || object->duration == 0) {
|
|
|
|
/* If we don't have a valid duration, use the max duration */
|
2011-01-08 14:25:22 +00:00
|
|
|
g_object_set (self, "duration", self->priv->maxduration - object->inpoint,
|
|
|
|
NULL);
|
2010-05-19 10:24:44 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-01-08 14:25:22 +00:00
|
|
|
/**
|
|
|
|
* ges_timeline_filesource_set_supported_formats:
|
|
|
|
* @self: the #GESTimelineFileSource to set supported formats on
|
|
|
|
* @supportedformats: the #GESTrackType defining formats supported by @self
|
|
|
|
*
|
|
|
|
* Sets the formats supported by the file.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
ges_timeline_filesource_set_supported_formats (GESTimelineFileSource * self,
|
|
|
|
GESTrackType supportedformats)
|
|
|
|
{
|
|
|
|
self->priv->supportedformats = supportedformats;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* ges_timeline_filesource_set_is_image:
|
|
|
|
* @self: the #GESTimelineFileSource
|
2011-06-25 17:42:29 +00:00
|
|
|
* @is_image: %TRUE if @self is a still image, %FALSE otherwise
|
2011-01-08 14:25:22 +00:00
|
|
|
*
|
|
|
|
* Sets whether the timeline object is a still image or not.
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
ges_timeline_filesource_set_is_image (GESTimelineFileSource * self,
|
|
|
|
gboolean is_image)
|
|
|
|
{
|
|
|
|
self->priv->is_image = is_image;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* ges_timeline_filesource_is_muted:
|
|
|
|
* @self: the #GESTimelineFileSource
|
|
|
|
*
|
2011-01-10 13:28:35 +00:00
|
|
|
* Lets you know if the audio track of @self is muted or not.
|
2011-01-08 14:25:22 +00:00
|
|
|
*
|
2011-06-25 17:42:29 +00:00
|
|
|
* Returns: %TRUE if the audio track of @self is muted, %FALSE otherwise.
|
2011-01-08 14:25:22 +00:00
|
|
|
*/
|
|
|
|
gboolean
|
|
|
|
ges_timeline_filesource_is_muted (GESTimelineFileSource * self)
|
|
|
|
{
|
|
|
|
return self->priv->mute;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* ges_timeline_filesource_get_max_duration:
|
|
|
|
* @self: the #GESTimelineFileSource
|
|
|
|
*
|
2011-01-10 13:28:35 +00:00
|
|
|
* Get the duration of the object.
|
2011-01-08 14:25:22 +00:00
|
|
|
*
|
2011-01-10 13:28:35 +00:00
|
|
|
* Returns: The duration of @self.
|
2011-01-08 14:25:22 +00:00
|
|
|
*/
|
|
|
|
guint64
|
|
|
|
ges_timeline_filesource_get_max_duration (GESTimelineFileSource * self)
|
|
|
|
{
|
|
|
|
return self->priv->maxduration;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* ges_timeline_filesource_is_image:
|
|
|
|
* @self: the #GESTimelineFileSource
|
|
|
|
*
|
2011-01-10 13:28:35 +00:00
|
|
|
* Lets you know if @self is an image or not.
|
2011-01-08 14:25:22 +00:00
|
|
|
*
|
2011-06-25 17:42:29 +00:00
|
|
|
* Returns: %TRUE if @self is a still image %FALSE otherwise.
|
2011-01-08 14:25:22 +00:00
|
|
|
*/
|
|
|
|
gboolean
|
|
|
|
ges_timeline_filesource_is_image (GESTimelineFileSource * self)
|
|
|
|
{
|
|
|
|
return self->priv->is_image;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* ges_timeline_filesource_get_uri:
|
|
|
|
* @self: the #GESTimelineFileSource
|
|
|
|
*
|
2011-06-25 17:42:29 +00:00
|
|
|
* Get the location of the resource.
|
2011-01-08 14:25:22 +00:00
|
|
|
*
|
2011-06-25 17:42:29 +00:00
|
|
|
* Returns: The location of the resource.
|
2011-01-08 14:25:22 +00:00
|
|
|
*/
|
|
|
|
const gchar *
|
|
|
|
ges_timeline_filesource_get_uri (GESTimelineFileSource * self)
|
|
|
|
{
|
|
|
|
return self->priv->uri;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* ges_timeline_filesource_get_supported_formats:
|
|
|
|
* @self: the #GESTimelineFileSource
|
|
|
|
*
|
2011-01-10 13:28:35 +00:00
|
|
|
* Get the formats supported by @self.
|
2011-01-08 14:25:22 +00:00
|
|
|
*
|
2011-01-10 13:28:35 +00:00
|
|
|
* Returns: The formats supported by @self.
|
2011-01-08 14:25:22 +00:00
|
|
|
*/
|
|
|
|
GESTrackType
|
|
|
|
ges_timeline_filesource_get_supported_formats (GESTimelineFileSource * self)
|
|
|
|
{
|
|
|
|
return self->priv->supportedformats;
|
|
|
|
}
|
|
|
|
|
2009-09-21 10:51:16 +00:00
|
|
|
static GESTrackObject *
|
2010-12-15 12:27:39 +00:00
|
|
|
ges_timeline_filesource_create_track_object (GESTimelineObject * obj,
|
2009-09-21 10:51:16 +00:00
|
|
|
GESTrack * track)
|
|
|
|
{
|
2011-01-08 14:25:22 +00:00
|
|
|
GESTimelineFileSourcePrivate *priv = GES_TIMELINE_FILE_SOURCE (obj)->priv;
|
2009-09-30 14:44:12 +00:00
|
|
|
GESTrackObject *res;
|
|
|
|
|
2011-01-08 14:25:22 +00:00
|
|
|
if (!(priv->supportedformats & track->type)) {
|
2010-05-19 10:24:44 +00:00
|
|
|
GST_DEBUG ("We don't support this track format");
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2011-01-08 14:25:22 +00:00
|
|
|
if (priv->is_image) {
|
2010-08-09 11:26:20 +00:00
|
|
|
if (track->type != GES_TRACK_TYPE_VIDEO) {
|
2010-08-09 16:35:26 +00:00
|
|
|
GST_DEBUG ("Object is still image, creating silent audio source");
|
|
|
|
res = (GESTrackObject *) ges_track_audio_test_source_new ();
|
|
|
|
} else {
|
|
|
|
GST_DEBUG ("Creating a GESTrackImageSource");
|
2011-01-08 14:25:22 +00:00
|
|
|
res = (GESTrackObject *) ges_track_image_source_new (priv->uri);
|
2010-08-09 11:26:20 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
else {
|
|
|
|
GST_DEBUG ("Creating a GESTrackFileSource");
|
2009-09-30 14:44:12 +00:00
|
|
|
|
2010-08-09 11:26:20 +00:00
|
|
|
/* FIXME : Implement properly ! */
|
2011-01-08 14:25:22 +00:00
|
|
|
res = (GESTrackObject *) ges_track_filesource_new (priv->uri);
|
2010-08-09 11:26:20 +00:00
|
|
|
|
|
|
|
/* If mute and track is audio, deactivate the track object */
|
2011-01-08 14:25:22 +00:00
|
|
|
if (track->type == GES_TRACK_TYPE_AUDIO && priv->mute)
|
2010-08-09 11:26:20 +00:00
|
|
|
ges_track_object_set_active (res, FALSE);
|
|
|
|
}
|
2009-09-30 14:44:12 +00:00
|
|
|
|
|
|
|
return res;
|
2009-09-21 10:51:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 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)
|
|
|
|
{
|
2011-06-25 18:12:46 +00:00
|
|
|
GESTimelineFileSource *res = NULL;
|
|
|
|
|
|
|
|
if (gst_uri_is_valid (uri))
|
|
|
|
res = g_object_new (GES_TYPE_TIMELINE_FILE_SOURCE, "uri", uri, NULL);
|
|
|
|
|
|
|
|
return res;
|
2009-09-21 10:51:16 +00:00
|
|
|
}
|