mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-26 19:51:11 +00:00
GES: Add GESVideoSource and GESAudioSource base classes
+ Update documentation. + Implements subclasses audio-uri-source and video-uri-source
This commit is contained in:
parent
7fcc6e4b08
commit
a635e48d77
27 changed files with 863 additions and 229 deletions
|
@ -47,6 +47,8 @@ platform as well as Windows. It is released under the GNU Library General Public
|
||||||
<xi:include href="xml/ges-track.xml"/>
|
<xi:include href="xml/ges-track.xml"/>
|
||||||
<xi:include href="xml/ges-track-element.xml"/>
|
<xi:include href="xml/ges-track-element.xml"/>
|
||||||
<xi:include href="xml/ges-source.xml"/>
|
<xi:include href="xml/ges-source.xml"/>
|
||||||
|
<xi:include href="xml/ges-video-source.xml"/>
|
||||||
|
<xi:include href="xml/ges-audio-source.xml"/>
|
||||||
<xi:include href="xml/ges-base-effect.xml"/>
|
<xi:include href="xml/ges-base-effect.xml"/>
|
||||||
<xi:include href="xml/ges-operation.xml"/>
|
<xi:include href="xml/ges-operation.xml"/>
|
||||||
<xi:include href="xml/ges-base-transition-clip.xml"/>
|
<xi:include href="xml/ges-base-transition-clip.xml"/>
|
||||||
|
@ -66,7 +68,8 @@ platform as well as Windows. It is released under the GNU Library General Public
|
||||||
|
|
||||||
<chapter>
|
<chapter>
|
||||||
<title>Track objects</title>
|
<title>Track objects</title>
|
||||||
<xi:include href="xml/ges-uri-source.xml"/>
|
<xi:include href="xml/ges-audio-uri-source.xml"/>
|
||||||
|
<xi:include href="xml/ges-video-uri-source.xml"/>
|
||||||
<xi:include href="xml/ges-title-source.xml"/>
|
<xi:include href="xml/ges-title-source.xml"/>
|
||||||
<xi:include href="xml/ges-audio-test-source.xml"/>
|
<xi:include href="xml/ges-audio-test-source.xml"/>
|
||||||
<xi:include href="xml/ges-video-test-source.xml"/>
|
<xi:include href="xml/ges-video-test-source.xml"/>
|
||||||
|
|
|
@ -192,20 +192,69 @@ GES_TYPE_OPERATION
|
||||||
</SECTION>
|
</SECTION>
|
||||||
|
|
||||||
<SECTION>
|
<SECTION>
|
||||||
<FILE>ges-uri-source</FILE>
|
<FILE>ges-video-source</FILE>
|
||||||
<TITLE>GESUriSource</TITLE>
|
<TITLE>GESVideoSource</TITLE>
|
||||||
GESUriSource
|
GESVideoSource
|
||||||
ges_track_filesource_new
|
|
||||||
<SUBSECTION Standard>
|
<SUBSECTION Standard>
|
||||||
GESUriSourceClass
|
GESVideoSourceClass
|
||||||
GESUriSourcePrivate
|
GESVideoSourcePrivate
|
||||||
GES_URI_SOURCE
|
GES_VIDEO_SOURCE
|
||||||
GES_URI_SOURCE_CLASS
|
GES_VIDEO_SOURCE_CLASS
|
||||||
GES_URI_SOURCE_GET_CLASS
|
GES_VIDEO_SOURCE_GET_CLASS
|
||||||
GES_TYPE_URI_SOURCE
|
GES_TYPE_VIDEO_SOURCE
|
||||||
GES_IS_URI_SOURCE
|
GES_IS_VIDEO_SOURCE
|
||||||
GES_IS_URI_SOURCE_CLASS
|
GES_IS_VIDEO_SOURCE_CLASS
|
||||||
ges_track_filesource_get_type
|
ges_video_source_get_type
|
||||||
|
</SECTION>
|
||||||
|
|
||||||
|
<SECTION>
|
||||||
|
<FILE>ges-audio-source</FILE>
|
||||||
|
<TITLE>GESAudioSource</TITLE>
|
||||||
|
GESAudioSource
|
||||||
|
<SUBSECTION Standard>
|
||||||
|
GESAudioSourceClass
|
||||||
|
GESAudioSourcePrivate
|
||||||
|
GES_AUDIO_SOURCE
|
||||||
|
GES_AUDIO_SOURCE_CLASS
|
||||||
|
GES_AUDIO_SOURCE_GET_CLASS
|
||||||
|
GES_TYPE_AUDIO_SOURCE
|
||||||
|
GES_IS_AUDIO_SOURCE
|
||||||
|
GES_IS_AUDIO_SOURCE_CLASS
|
||||||
|
ges_audio_source_get_type
|
||||||
|
</SECTION>
|
||||||
|
|
||||||
|
<SECTION>
|
||||||
|
<FILE>ges-video-uri-source</FILE>
|
||||||
|
<TITLE>GESVideoUriSource</TITLE>
|
||||||
|
GESVideoUriSource
|
||||||
|
ges_video_uri_source_new
|
||||||
|
<SUBSECTION Standard>
|
||||||
|
GESVideoUriSourceClass
|
||||||
|
GESVideoUriSourcePrivate
|
||||||
|
GES_VIDEO_URI_SOURCE
|
||||||
|
GES_VIDEO_URI_SOURCE_CLASS
|
||||||
|
GES_VIDEO_URI_SOURCE_GET_CLASS
|
||||||
|
GES_TYPE_VIDEO_URI_SOURCE
|
||||||
|
GES_IS_VIDEO_URI_SOURCE
|
||||||
|
GES_IS_VIDEO_URI_SOURCE_CLASS
|
||||||
|
ges_video_uri_source_get_type
|
||||||
|
</SECTION>
|
||||||
|
|
||||||
|
<SECTION>
|
||||||
|
<FILE>ges-audio-uri-source</FILE>
|
||||||
|
<TITLE>GESAudioUriSource</TITLE>
|
||||||
|
GESAudioUriSource
|
||||||
|
ges_audio_uri_source_new
|
||||||
|
<SUBSECTION Standard>
|
||||||
|
GESAudioUriSourceClass
|
||||||
|
GESAudioUriSourcePrivate
|
||||||
|
GES_AUDIO_URI_SOURCE
|
||||||
|
GES_AUDIO_URI_SOURCE_CLASS
|
||||||
|
GES_AUDIO_URI_SOURCE_GET_CLASS
|
||||||
|
GES_TYPE_AUDIO_URI_SOURCE
|
||||||
|
GES_IS_AUDIO_URI_SOURCE
|
||||||
|
GES_IS_AUDIO_URI_SOURCE_CLASS
|
||||||
|
ges_audio_uri_source_get_type
|
||||||
</SECTION>
|
</SECTION>
|
||||||
|
|
||||||
<SECTION>
|
<SECTION>
|
||||||
|
|
|
@ -22,7 +22,8 @@ ges_text_overlay_clip_get_type
|
||||||
ges_title_clip_get_type
|
ges_title_clip_get_type
|
||||||
ges_audio_test_source_get_type
|
ges_audio_test_source_get_type
|
||||||
ges_audio_transition_get_type
|
ges_audio_transition_get_type
|
||||||
ges_track_filesource_get_type
|
ges_video_uri_source_get_type
|
||||||
|
ges_audio_uri_source_get_type
|
||||||
ges_track_get_type
|
ges_track_get_type
|
||||||
ges_image_source_get_type
|
ges_image_source_get_type
|
||||||
ges_track_element_get_type
|
ges_track_element_get_type
|
||||||
|
|
|
@ -34,7 +34,10 @@ libges_@GST_API_VERSION@_la_SOURCES = \
|
||||||
ges-track-element.c \
|
ges-track-element.c \
|
||||||
ges-source.c \
|
ges-source.c \
|
||||||
ges-operation.c \
|
ges-operation.c \
|
||||||
ges-uri-source.c \
|
ges-video-source.c \
|
||||||
|
ges-audio-source.c \
|
||||||
|
ges-video-uri-source.c \
|
||||||
|
ges-audio-uri-source.c \
|
||||||
ges-image-source.c \
|
ges-image-source.c \
|
||||||
ges-transition.c \
|
ges-transition.c \
|
||||||
ges-audio-transition.c \
|
ges-audio-transition.c \
|
||||||
|
@ -100,7 +103,10 @@ libges_@GST_API_VERSION@include_HEADERS = \
|
||||||
ges-track-element.h \
|
ges-track-element.h \
|
||||||
ges-source.h \
|
ges-source.h \
|
||||||
ges-operation.h \
|
ges-operation.h \
|
||||||
ges-uri-source.h \
|
ges-video-source.h \
|
||||||
|
ges-audio-source.h \
|
||||||
|
ges-video-uri-source.h \
|
||||||
|
ges-audio-uri-source.h \
|
||||||
ges-image-source.h \
|
ges-image-source.h \
|
||||||
ges-transition.h \
|
ges-transition.h \
|
||||||
ges-audio-transition.h \
|
ges-audio-transition.h \
|
||||||
|
|
109
ges/ges-audio-source.c
Normal file
109
ges/ges-audio-source.c
Normal file
|
@ -0,0 +1,109 @@
|
||||||
|
/* GStreamer Editing Services
|
||||||
|
* Copyright (C) 2009 Edward Hervey <edward.hervey@collabora.co.uk>
|
||||||
|
* 2009 Nokia Corporation
|
||||||
|
*
|
||||||
|
* 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., 51 Franklin St, Fifth Floor,
|
||||||
|
* Boston, MA 02110-1301, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* SECTION:ges-audio-source
|
||||||
|
* @short_description: Base Class for audio sources
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "ges-internal.h"
|
||||||
|
#include "ges/ges-meta-container.h"
|
||||||
|
#include "ges-track-element.h"
|
||||||
|
#include "ges-audio-source.h"
|
||||||
|
#include "ges-layer.h"
|
||||||
|
|
||||||
|
G_DEFINE_TYPE (GESAudioSource, ges_audio_source, GES_TYPE_SOURCE);
|
||||||
|
|
||||||
|
struct _GESAudioSourcePrivate
|
||||||
|
{
|
||||||
|
/* Dummy variable */
|
||||||
|
void *nothing;
|
||||||
|
};
|
||||||
|
|
||||||
|
static void
|
||||||
|
_sync_element_to_layer_property_float (GESTrackElement * trksrc,
|
||||||
|
GstElement * element, const gchar * meta, const gchar * propname)
|
||||||
|
{
|
||||||
|
GESTimelineElement *parent;
|
||||||
|
GESLayer *layer;
|
||||||
|
gfloat value;
|
||||||
|
|
||||||
|
parent = ges_timeline_element_get_parent (GES_TIMELINE_ELEMENT (trksrc));
|
||||||
|
layer = ges_clip_get_layer (GES_CLIP (parent));
|
||||||
|
|
||||||
|
gst_object_unref (parent);
|
||||||
|
|
||||||
|
if (layer != NULL) {
|
||||||
|
|
||||||
|
ges_meta_container_get_float (GES_META_CONTAINER (layer), meta, &value);
|
||||||
|
g_object_set (element, propname, value, NULL);
|
||||||
|
GST_DEBUG_OBJECT (trksrc, "Setting %s to %f", propname, value);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
GST_DEBUG_OBJECT (trksrc, "NOT setting the %s", propname);
|
||||||
|
}
|
||||||
|
|
||||||
|
gst_object_unref (layer);
|
||||||
|
}
|
||||||
|
|
||||||
|
static GstElement *
|
||||||
|
ges_audio_source_create_element (GESTrackElement * trksrc)
|
||||||
|
{
|
||||||
|
GstElement *topbin;
|
||||||
|
GstElement *sub_element;
|
||||||
|
GESAudioSourceClass *source_class = GES_AUDIO_SOURCE_GET_CLASS (trksrc);
|
||||||
|
const gchar *props[] = { "volume", "mute", NULL };
|
||||||
|
GstElement *volume;
|
||||||
|
|
||||||
|
if (!source_class->create_source)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
sub_element = source_class->create_source (trksrc);
|
||||||
|
|
||||||
|
GST_DEBUG_OBJECT (trksrc, "Creating a bin sub_element ! volume");
|
||||||
|
volume = gst_element_factory_make ("volume", NULL);
|
||||||
|
topbin = ges_source_create_topbin ("audiosrcbin", sub_element, volume, NULL);
|
||||||
|
_sync_element_to_layer_property_float (trksrc, volume, GES_META_VOLUME,
|
||||||
|
"volume");
|
||||||
|
ges_track_element_add_children_props (trksrc, volume, NULL, NULL, props);
|
||||||
|
|
||||||
|
return topbin;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
ges_audio_source_class_init (GESAudioSourceClass * klass)
|
||||||
|
{
|
||||||
|
GESTrackElementClass *track_class = GES_TRACK_ELEMENT_CLASS (klass);
|
||||||
|
GESAudioSourceClass *audio_source_class = GES_AUDIO_SOURCE_CLASS (klass);
|
||||||
|
|
||||||
|
g_type_class_add_private (klass, sizeof (GESAudioSourcePrivate));
|
||||||
|
|
||||||
|
track_class->gnlobject_factorytype = "gnlsource";
|
||||||
|
track_class->create_element = ges_audio_source_create_element;
|
||||||
|
audio_source_class->create_source = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
ges_audio_source_init (GESAudioSource * self)
|
||||||
|
{
|
||||||
|
self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self,
|
||||||
|
GES_TYPE_AUDIO_SOURCE, GESAudioSourcePrivate);
|
||||||
|
}
|
90
ges/ges-audio-source.h
Normal file
90
ges/ges-audio-source.h
Normal file
|
@ -0,0 +1,90 @@
|
||||||
|
/* GStreamer Editing Services
|
||||||
|
* Copyright (C) 2009 Edward Hervey <edward.hervey@collabora.co.uk>
|
||||||
|
* 2009 Nokia Corporation
|
||||||
|
*
|
||||||
|
* 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., 51 Franklin St, Fifth Floor,
|
||||||
|
* Boston, MA 02110-1301, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _GES_AUDIO_SOURCE
|
||||||
|
#define _GES_AUDIO_SOURCE
|
||||||
|
|
||||||
|
#include <glib-object.h>
|
||||||
|
#include <gst/gst.h>
|
||||||
|
#include <ges/ges-types.h>
|
||||||
|
#include <ges/ges-track-element.h>
|
||||||
|
#include <ges/ges-source.h>
|
||||||
|
|
||||||
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
|
#define GES_TYPE_AUDIO_SOURCE ges_audio_source_get_type()
|
||||||
|
|
||||||
|
#define GES_AUDIO_SOURCE(obj) \
|
||||||
|
(G_TYPE_CHECK_INSTANCE_CAST ((obj), GES_TYPE_AUDIO_SOURCE, GESAudioSource))
|
||||||
|
|
||||||
|
#define GES_AUDIO_SOURCE_CLASS(klass) \
|
||||||
|
(G_TYPE_CHECK_CLASS_CAST ((klass), GES_TYPE_AUDIO_SOURCE, GESAudioSourceClass))
|
||||||
|
|
||||||
|
#define GES_IS_AUDIO_SOURCE(obj) \
|
||||||
|
(G_TYPE_CHECK_INSTANCE_TYPE ((obj), GES_TYPE_AUDIO_SOURCE))
|
||||||
|
|
||||||
|
#define GES_IS_AUDIO_SOURCE_CLASS(klass) \
|
||||||
|
(G_TYPE_CHECK_CLASS_TYPE ((klass), GES_TYPE_AUDIO_SOURCE))
|
||||||
|
|
||||||
|
#define GES_AUDIO_SOURCE_GET_CLASS(obj) \
|
||||||
|
(G_TYPE_INSTANCE_GET_CLASS ((obj), GES_TYPE_AUDIO_SOURCE, GESAudioSourceClass))
|
||||||
|
|
||||||
|
typedef struct _GESAudioSourcePrivate GESAudioSourcePrivate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GESAudioSource:
|
||||||
|
*
|
||||||
|
* Base class for audio sources
|
||||||
|
*/
|
||||||
|
|
||||||
|
struct _GESAudioSource {
|
||||||
|
/*< private >*/
|
||||||
|
GESSource parent;
|
||||||
|
|
||||||
|
GESAudioSourcePrivate *priv;
|
||||||
|
|
||||||
|
/* Padding for API extension */
|
||||||
|
gpointer _ges_reserved[GES_PADDING];
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GESAudioSourceClass:
|
||||||
|
* @create_source: method to return the GstElement to put in the source topbin.
|
||||||
|
* Other elements will be queued, like a volume.
|
||||||
|
* In the case of a AudioUriSource, for example, the subclass will return a decodebin,
|
||||||
|
* and we will append a volume.
|
||||||
|
*/
|
||||||
|
struct _GESAudioSourceClass {
|
||||||
|
/*< private >*/
|
||||||
|
GESSourceClass parent_class;
|
||||||
|
|
||||||
|
/*< public >*/
|
||||||
|
GstElement* (*create_source) (GESTrackElement * object);
|
||||||
|
|
||||||
|
/*< private >*/
|
||||||
|
/* Padding for API extension */
|
||||||
|
gpointer _ges_reserved[GES_PADDING];
|
||||||
|
};
|
||||||
|
|
||||||
|
GType ges_audio_source_get_type (void);
|
||||||
|
|
||||||
|
G_END_DECLS
|
||||||
|
|
||||||
|
#endif /* _GES_AUDIO_SOURCE */
|
|
@ -31,7 +31,8 @@
|
||||||
#include "ges-track-element.h"
|
#include "ges-track-element.h"
|
||||||
#include "ges-audio-test-source.h"
|
#include "ges-audio-test-source.h"
|
||||||
|
|
||||||
G_DEFINE_TYPE (GESAudioTestSource, ges_audio_test_source, GES_TYPE_SOURCE);
|
G_DEFINE_TYPE (GESAudioTestSource, ges_audio_test_source,
|
||||||
|
GES_TYPE_AUDIO_SOURCE);
|
||||||
#define DEFAULT_VOLUME 1.0
|
#define DEFAULT_VOLUME 1.0
|
||||||
|
|
||||||
struct _GESAudioTestSourcePrivate
|
struct _GESAudioTestSourcePrivate
|
||||||
|
@ -57,7 +58,7 @@ static void
|
||||||
ges_audio_test_source_class_init (GESAudioTestSourceClass * klass)
|
ges_audio_test_source_class_init (GESAudioTestSourceClass * klass)
|
||||||
{
|
{
|
||||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||||
GESSourceClass *source_class = GES_SOURCE_CLASS (klass);
|
GESAudioSourceClass *source_class = GES_AUDIO_SOURCE_CLASS (klass);
|
||||||
|
|
||||||
g_type_class_add_private (klass, sizeof (GESAudioTestSourcePrivate));
|
g_type_class_add_private (klass, sizeof (GESAudioTestSourcePrivate));
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
|
|
||||||
#include <glib-object.h>
|
#include <glib-object.h>
|
||||||
#include <ges/ges-types.h>
|
#include <ges/ges-types.h>
|
||||||
#include <ges/ges-source.h>
|
#include <ges/ges-audio-source.h>
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
|
@ -53,7 +53,7 @@ typedef struct _GESAudioTestSourcePrivate GESAudioTestSourcePrivate;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
struct _GESAudioTestSource {
|
struct _GESAudioTestSource {
|
||||||
GESSource parent;
|
GESAudioSource parent;
|
||||||
|
|
||||||
/*< private >*/
|
/*< private >*/
|
||||||
GESAudioTestSourcePrivate *priv;
|
GESAudioTestSourcePrivate *priv;
|
||||||
|
@ -64,7 +64,7 @@ struct _GESAudioTestSource {
|
||||||
|
|
||||||
struct _GESAudioTestSourceClass {
|
struct _GESAudioTestSourceClass {
|
||||||
/*< private >*/
|
/*< private >*/
|
||||||
GESSourceClass parent_class;
|
GESAudioSourceClass parent_class;
|
||||||
|
|
||||||
/* Padding for API extension */
|
/* Padding for API extension */
|
||||||
gpointer _ges_reserved[GES_PADDING];
|
gpointer _ges_reserved[GES_PADDING];
|
||||||
|
|
|
@ -19,21 +19,18 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* SECTION:ges-uri-source
|
* SECTION:ges-audio-uri-source
|
||||||
* @short_description: outputs a single media stream from a given file
|
* @short_description: outputs a single audio 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.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "ges-utils.h"
|
#include "ges-utils.h"
|
||||||
#include "ges-internal.h"
|
#include "ges-internal.h"
|
||||||
#include "ges-track-element.h"
|
#include "ges-track-element.h"
|
||||||
#include "ges-uri-source.h"
|
#include "ges-audio-uri-source.h"
|
||||||
#include "ges-uri-asset.h"
|
#include "ges-uri-asset.h"
|
||||||
#include "ges-extractable.h"
|
#include "ges-extractable.h"
|
||||||
|
|
||||||
struct _GESUriSourcePrivate
|
struct _GESAudioUriSourcePrivate
|
||||||
{
|
{
|
||||||
void *nothing;
|
void *nothing;
|
||||||
};
|
};
|
||||||
|
@ -46,13 +43,13 @@ enum
|
||||||
|
|
||||||
/* GESSource VMethod */
|
/* GESSource VMethod */
|
||||||
static GstElement *
|
static GstElement *
|
||||||
ges_uri_source_create_source (GESTrackElement * trksrc)
|
ges_audio_uri_source_create_source (GESTrackElement * trksrc)
|
||||||
{
|
{
|
||||||
GESUriSource *self;
|
GESAudioUriSource *self;
|
||||||
GESTrack *track;
|
GESTrack *track;
|
||||||
GstElement *decodebin;
|
GstElement *decodebin;
|
||||||
|
|
||||||
self = (GESUriSource *) trksrc;
|
self = (GESAudioUriSource *) trksrc;
|
||||||
|
|
||||||
track = ges_track_element_get_track (trksrc);
|
track = ges_track_element_get_track (trksrc);
|
||||||
|
|
||||||
|
@ -94,8 +91,8 @@ ges_extractable_interface_init (GESExtractableInterface * iface)
|
||||||
iface->set_asset = extractable_set_asset;
|
iface->set_asset = extractable_set_asset;
|
||||||
}
|
}
|
||||||
|
|
||||||
G_DEFINE_TYPE_WITH_CODE (GESUriSource, ges_track_filesource,
|
G_DEFINE_TYPE_WITH_CODE (GESAudioUriSource, ges_audio_uri_source,
|
||||||
GES_TYPE_SOURCE,
|
GES_TYPE_AUDIO_SOURCE,
|
||||||
G_IMPLEMENT_INTERFACE (GES_TYPE_EXTRACTABLE,
|
G_IMPLEMENT_INTERFACE (GES_TYPE_EXTRACTABLE,
|
||||||
ges_extractable_interface_init));
|
ges_extractable_interface_init));
|
||||||
|
|
||||||
|
@ -103,10 +100,10 @@ G_DEFINE_TYPE_WITH_CODE (GESUriSource, ges_track_filesource,
|
||||||
/* GObject VMethods */
|
/* GObject VMethods */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
ges_track_filesource_get_property (GObject * object, guint property_id,
|
ges_audio_uri_source_get_property (GObject * object, guint property_id,
|
||||||
GValue * value, GParamSpec * pspec)
|
GValue * value, GParamSpec * pspec)
|
||||||
{
|
{
|
||||||
GESUriSource *uriclip = GES_URI_SOURCE (object);
|
GESAudioUriSource *uriclip = GES_AUDIO_URI_SOURCE (object);
|
||||||
|
|
||||||
switch (property_id) {
|
switch (property_id) {
|
||||||
case PROP_URI:
|
case PROP_URI:
|
||||||
|
@ -118,10 +115,10 @@ ges_track_filesource_get_property (GObject * object, guint property_id,
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
ges_track_filesource_set_property (GObject * object, guint property_id,
|
ges_audio_uri_source_set_property (GObject * object, guint property_id,
|
||||||
const GValue * value, GParamSpec * pspec)
|
const GValue * value, GParamSpec * pspec)
|
||||||
{
|
{
|
||||||
GESUriSource *uriclip = GES_URI_SOURCE (object);
|
GESAudioUriSource *uriclip = GES_AUDIO_URI_SOURCE (object);
|
||||||
|
|
||||||
switch (property_id) {
|
switch (property_id) {
|
||||||
case PROP_URI:
|
case PROP_URI:
|
||||||
|
@ -137,30 +134,30 @@ ges_track_filesource_set_property (GObject * object, guint property_id,
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
ges_track_filesource_dispose (GObject * object)
|
ges_audio_uri_source_dispose (GObject * object)
|
||||||
{
|
{
|
||||||
GESUriSource *uriclip = GES_URI_SOURCE (object);
|
GESAudioUriSource *uriclip = GES_AUDIO_URI_SOURCE (object);
|
||||||
|
|
||||||
if (uriclip->uri)
|
if (uriclip->uri)
|
||||||
g_free (uriclip->uri);
|
g_free (uriclip->uri);
|
||||||
|
|
||||||
G_OBJECT_CLASS (ges_track_filesource_parent_class)->dispose (object);
|
G_OBJECT_CLASS (ges_audio_uri_source_parent_class)->dispose (object);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
ges_track_filesource_class_init (GESUriSourceClass * klass)
|
ges_audio_uri_source_class_init (GESAudioUriSourceClass * klass)
|
||||||
{
|
{
|
||||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||||
GESSourceClass *source_class = GES_SOURCE_CLASS (klass);
|
GESAudioSourceClass *source_class = GES_AUDIO_SOURCE_CLASS (klass);
|
||||||
|
|
||||||
g_type_class_add_private (klass, sizeof (GESUriSourcePrivate));
|
g_type_class_add_private (klass, sizeof (GESAudioUriSourcePrivate));
|
||||||
|
|
||||||
object_class->get_property = ges_track_filesource_get_property;
|
object_class->get_property = ges_audio_uri_source_get_property;
|
||||||
object_class->set_property = ges_track_filesource_set_property;
|
object_class->set_property = ges_audio_uri_source_set_property;
|
||||||
object_class->dispose = ges_track_filesource_dispose;
|
object_class->dispose = ges_audio_uri_source_dispose;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* GESUriSource:uri:
|
* GESAudioUriSource:uri:
|
||||||
*
|
*
|
||||||
* The location of the file/resource to use.
|
* The location of the file/resource to use.
|
||||||
*/
|
*/
|
||||||
|
@ -168,27 +165,27 @@ ges_track_filesource_class_init (GESUriSourceClass * klass)
|
||||||
g_param_spec_string ("uri", "URI", "uri of the resource",
|
g_param_spec_string ("uri", "URI", "uri of the resource",
|
||||||
NULL, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
|
NULL, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
|
||||||
|
|
||||||
source_class->create_source = ges_uri_source_create_source;
|
source_class->create_source = ges_audio_uri_source_create_source;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
ges_track_filesource_init (GESUriSource * self)
|
ges_audio_uri_source_init (GESAudioUriSource * self)
|
||||||
{
|
{
|
||||||
self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self,
|
self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self,
|
||||||
GES_TYPE_URI_SOURCE, GESUriSourcePrivate);
|
GES_TYPE_AUDIO_URI_SOURCE, GESAudioUriSourcePrivate);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ges_track_filesource_new:
|
* ges_audio_uri_source_new:
|
||||||
* @uri: the URI the source should control
|
* @uri: the URI the source should control
|
||||||
*
|
*
|
||||||
* Creates a new #GESUriSource for the provided @uri.
|
* Creates a new #GESAudioUriSource for the provided @uri.
|
||||||
*
|
*
|
||||||
* Returns: The newly created #GESUriSource, or %NULL if there was an
|
* Returns: The newly created #GESAudioUriSource, or %NULL if there was an
|
||||||
* error.
|
* error.
|
||||||
*/
|
*/
|
||||||
GESUriSource *
|
GESAudioUriSource *
|
||||||
ges_track_filesource_new (gchar * uri)
|
ges_audio_uri_source_new (gchar * uri)
|
||||||
{
|
{
|
||||||
return g_object_new (GES_TYPE_URI_SOURCE, "uri", uri, NULL);
|
return g_object_new (GES_TYPE_AUDIO_URI_SOURCE, "uri", uri, NULL);
|
||||||
}
|
}
|
|
@ -18,62 +18,62 @@
|
||||||
* Boston, MA 02110-1301, USA.
|
* Boston, MA 02110-1301, USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _GES_URI_SOURCE
|
#ifndef _GES_AUDIO_URI_SOURCE
|
||||||
#define _GES_URI_SOURCE
|
#define _GES_AUDIO_URI_SOURCE
|
||||||
|
|
||||||
#include <glib-object.h>
|
#include <glib-object.h>
|
||||||
#include <ges/ges-types.h>
|
#include <ges/ges-types.h>
|
||||||
#include <ges/ges-source.h>
|
#include <ges/ges-audio-source.h>
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
#define GES_TYPE_URI_SOURCE ges_track_filesource_get_type()
|
#define GES_TYPE_AUDIO_URI_SOURCE ges_audio_uri_source_get_type()
|
||||||
|
|
||||||
#define GES_URI_SOURCE(obj) \
|
#define GES_AUDIO_URI_SOURCE(obj) \
|
||||||
(G_TYPE_CHECK_INSTANCE_CAST ((obj), GES_TYPE_URI_SOURCE, GESUriSource))
|
(G_TYPE_CHECK_INSTANCE_CAST ((obj), GES_TYPE_AUDIO_URI_SOURCE, GESAudioUriSource))
|
||||||
|
|
||||||
#define GES_URI_SOURCE_CLASS(klass) \
|
#define GES_AUDIO_URI_SOURCE_CLASS(klass) \
|
||||||
(G_TYPE_CHECK_CLASS_CAST ((klass), GES_TYPE_URI_SOURCE, GESUriSourceClass))
|
(G_TYPE_CHECK_CLASS_CAST ((klass), GES_TYPE_AUDIO_URI_SOURCE, GESAudioUriSourceClass))
|
||||||
|
|
||||||
#define GES_IS_URI_SOURCE(obj) \
|
#define GES_IS_AUDIO_URI_SOURCE(obj) \
|
||||||
(G_TYPE_CHECK_INSTANCE_TYPE ((obj), GES_TYPE_URI_SOURCE))
|
(G_TYPE_CHECK_INSTANCE_TYPE ((obj), GES_TYPE_AUDIO_URI_SOURCE))
|
||||||
|
|
||||||
#define GES_IS_URI_SOURCE_CLASS(klass) \
|
#define GES_IS_AUDIO_URI_SOURCE_CLASS(klass) \
|
||||||
(G_TYPE_CHECK_CLASS_TYPE ((klass), GES_TYPE_URI_SOURCE))
|
(G_TYPE_CHECK_CLASS_TYPE ((klass), GES_TYPE_AUDIO_URI_SOURCE))
|
||||||
|
|
||||||
#define GES_URI_SOURCE_GET_CLASS(obj) \
|
#define GES_AUDIO_URI_SOURCE_GET_CLASS(obj) \
|
||||||
(G_TYPE_INSTANCE_GET_CLASS ((obj), GES_TYPE_URI_SOURCE, GESUriSourceClass))
|
(G_TYPE_INSTANCE_GET_CLASS ((obj), GES_TYPE_AUDIO_URI_SOURCE, GESAudioUriSourceClass))
|
||||||
|
|
||||||
typedef struct _GESUriSourcePrivate GESUriSourcePrivate;
|
typedef struct _GESAudioUriSourcePrivate GESAudioUriSourcePrivate;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* GESUriSource:
|
* GESAudioUriSource:
|
||||||
*/
|
*/
|
||||||
struct _GESUriSource {
|
struct _GESAudioUriSource {
|
||||||
/*< private >*/
|
/*< private >*/
|
||||||
GESSource parent;
|
GESAudioSource parent;
|
||||||
|
|
||||||
gchar *uri;
|
gchar *uri;
|
||||||
|
|
||||||
GESUriSourcePrivate *priv;
|
GESAudioUriSourcePrivate *priv;
|
||||||
|
|
||||||
/* Padding for API extension */
|
/* Padding for API extension */
|
||||||
gpointer _ges_reserved[GES_PADDING];
|
gpointer _ges_reserved[GES_PADDING];
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _GESUriSourceClass {
|
struct _GESAudioUriSourceClass {
|
||||||
/*< private >*/
|
/*< private >*/
|
||||||
GESSourceClass parent_class;
|
GESAudioSourceClass parent_class;
|
||||||
|
|
||||||
/* Padding for API extension */
|
/* Padding for API extension */
|
||||||
gpointer _ges_reserved[GES_PADDING];
|
gpointer _ges_reserved[GES_PADDING];
|
||||||
};
|
};
|
||||||
|
|
||||||
GType ges_track_filesource_get_type (void);
|
GType ges_audio_uri_source_get_type (void);
|
||||||
|
|
||||||
GESUriSource* ges_track_filesource_new (gchar *uri);
|
GESAudioUriSource* ges_audio_uri_source_new (gchar *uri);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
#endif /* _GES_URI_SOURCE */
|
#endif /* _GES_AUDIO_URI_SOURCE */
|
||||||
|
|
|
@ -32,7 +32,7 @@
|
||||||
#include "ges-track-element.h"
|
#include "ges-track-element.h"
|
||||||
#include "ges-image-source.h"
|
#include "ges-image-source.h"
|
||||||
|
|
||||||
G_DEFINE_TYPE (GESImageSource, ges_image_source, GES_TYPE_SOURCE);
|
G_DEFINE_TYPE (GESImageSource, ges_image_source, GES_TYPE_VIDEO_SOURCE);
|
||||||
|
|
||||||
struct _GESImageSourcePrivate
|
struct _GESImageSourcePrivate
|
||||||
{
|
{
|
||||||
|
@ -150,7 +150,7 @@ static void
|
||||||
ges_image_source_class_init (GESImageSourceClass * klass)
|
ges_image_source_class_init (GESImageSourceClass * klass)
|
||||||
{
|
{
|
||||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||||
GESSourceClass *source_class = GES_SOURCE_CLASS (klass);
|
GESVideoSourceClass *source_class = GES_VIDEO_SOURCE_CLASS (klass);
|
||||||
|
|
||||||
g_type_class_add_private (klass, sizeof (GESImageSourcePrivate));
|
g_type_class_add_private (klass, sizeof (GESImageSourcePrivate));
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
|
|
||||||
#include <glib-object.h>
|
#include <glib-object.h>
|
||||||
#include <ges/ges-types.h>
|
#include <ges/ges-types.h>
|
||||||
#include <ges/ges-source.h>
|
#include <ges/ges-video-source.h>
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
|
@ -51,7 +51,7 @@ typedef struct _GESImageSourcePrivate GESImageSourcePrivate;
|
||||||
*/
|
*/
|
||||||
struct _GESImageSource {
|
struct _GESImageSource {
|
||||||
/*< private >*/
|
/*< private >*/
|
||||||
GESSource parent;
|
GESVideoSource parent;
|
||||||
|
|
||||||
gchar *uri;
|
gchar *uri;
|
||||||
|
|
||||||
|
@ -62,7 +62,7 @@ struct _GESImageSource {
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _GESImageSourceClass {
|
struct _GESImageSourceClass {
|
||||||
GESSourceClass parent_class;
|
GESVideoSourceClass parent_class;
|
||||||
|
|
||||||
/* Padding for API extension */
|
/* Padding for API extension */
|
||||||
gpointer _ges_reserved[GES_PADDING];
|
gpointer _ges_reserved[GES_PADDING];
|
||||||
|
|
122
ges/ges-source.c
122
ges/ges-source.c
|
@ -119,134 +119,15 @@ ges_source_create_topbin (const gchar * bin_name, GstElement * sub_element, ...)
|
||||||
return bin;
|
return bin;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
_sync_element_to_layer_property_float (GESTrackElement * trksrc,
|
|
||||||
GstElement * element, const gchar * meta, const gchar * propname)
|
|
||||||
{
|
|
||||||
GESTimelineElement *parent;
|
|
||||||
GESLayer *layer;
|
|
||||||
gfloat value;
|
|
||||||
|
|
||||||
parent = ges_timeline_element_get_parent (GES_TIMELINE_ELEMENT (trksrc));
|
|
||||||
layer = ges_clip_get_layer (GES_CLIP (parent));
|
|
||||||
|
|
||||||
gst_object_unref (parent);
|
|
||||||
|
|
||||||
if (layer != NULL) {
|
|
||||||
|
|
||||||
ges_meta_container_get_float (GES_META_CONTAINER (layer), meta, &value);
|
|
||||||
g_object_set (element, propname, value, NULL);
|
|
||||||
GST_DEBUG_OBJECT (trksrc, "Setting %s to %f", propname, value);
|
|
||||||
|
|
||||||
} else {
|
|
||||||
|
|
||||||
GST_DEBUG_OBJECT (trksrc, "NOT setting the %s", propname);
|
|
||||||
}
|
|
||||||
|
|
||||||
gst_object_unref (layer);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
update_z_order_cb (GESClip * clip, GParamSpec * arg G_GNUC_UNUSED,
|
|
||||||
GESSource * self)
|
|
||||||
{
|
|
||||||
GESLayer *layer = ges_clip_get_layer (clip);
|
|
||||||
|
|
||||||
if (layer == NULL)
|
|
||||||
return;
|
|
||||||
|
|
||||||
/* 10000 is the max value of zorder on videomixerpad, hardcoded */
|
|
||||||
|
|
||||||
g_object_set (self->priv->positionner, "zorder",
|
|
||||||
10000 - ges_layer_get_priority (layer), NULL);
|
|
||||||
|
|
||||||
gst_object_unref (layer);
|
|
||||||
}
|
|
||||||
|
|
||||||
static GstElement *
|
|
||||||
ges_source_create_element (GESTrackElement * trksrc)
|
|
||||||
{
|
|
||||||
GstElement *topbin;
|
|
||||||
GstElement *sub_element;
|
|
||||||
GESSourceClass *source_class = GES_SOURCE_GET_CLASS (trksrc);
|
|
||||||
GESTrack *track;
|
|
||||||
GESSource *self;
|
|
||||||
|
|
||||||
if (!source_class->create_source)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
sub_element = source_class->create_source (trksrc);
|
|
||||||
|
|
||||||
track = ges_track_element_get_track (trksrc);
|
|
||||||
|
|
||||||
self = (GESSource *) trksrc;
|
|
||||||
|
|
||||||
switch (track->type) {
|
|
||||||
case GES_TRACK_TYPE_AUDIO:
|
|
||||||
{
|
|
||||||
const gchar *props[] = { "volume", "mute", NULL };
|
|
||||||
GstElement *volume;
|
|
||||||
|
|
||||||
GST_DEBUG_OBJECT (trksrc, "Creating a bin sub_element ! volume");
|
|
||||||
|
|
||||||
volume = gst_element_factory_make ("volume", NULL);
|
|
||||||
|
|
||||||
topbin =
|
|
||||||
ges_source_create_topbin ("audiosrcbin", sub_element, volume, NULL);
|
|
||||||
|
|
||||||
_sync_element_to_layer_property_float (trksrc, volume, GES_META_VOLUME,
|
|
||||||
"volume");
|
|
||||||
ges_track_element_add_children_props (trksrc, volume, NULL, NULL, props);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case GES_TRACK_TYPE_VIDEO:
|
|
||||||
{
|
|
||||||
GstElement *positionner;
|
|
||||||
const gchar *props[] = { "alpha", "posx", "posy", NULL };
|
|
||||||
GESTimelineElement *parent;
|
|
||||||
|
|
||||||
/* That positionner will add metadata to buffers according to its
|
|
||||||
properties, acting like a proxy for our smart-mixer dynamic pads. */
|
|
||||||
positionner =
|
|
||||||
gst_element_factory_make ("framepositionner", "frame_tagger");
|
|
||||||
|
|
||||||
ges_track_element_add_children_props (trksrc, positionner, NULL, NULL,
|
|
||||||
props);
|
|
||||||
topbin =
|
|
||||||
ges_source_create_topbin ("videosrcbin", sub_element, positionner,
|
|
||||||
NULL);
|
|
||||||
parent = ges_timeline_element_get_parent (GES_TIMELINE_ELEMENT (trksrc));
|
|
||||||
if (parent) {
|
|
||||||
self->priv->positionner = GST_FRAME_POSITIONNER (positionner);
|
|
||||||
g_signal_connect (parent, "notify::layer",
|
|
||||||
(GCallback) update_z_order_cb, trksrc);
|
|
||||||
update_z_order_cb (GES_CLIP (parent), NULL, self);
|
|
||||||
gst_object_unref (parent);
|
|
||||||
} else {
|
|
||||||
GST_WARNING ("No parent timeline element, SHOULD NOT HAPPEN");
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
default:
|
|
||||||
topbin =
|
|
||||||
ges_source_create_topbin ("a-questionable-name", sub_element, NULL);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
return topbin;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
ges_source_class_init (GESSourceClass * klass)
|
ges_source_class_init (GESSourceClass * klass)
|
||||||
{
|
{
|
||||||
GESTrackElementClass *track_class = GES_TRACK_ELEMENT_CLASS (klass);
|
GESTrackElementClass *track_class = GES_TRACK_ELEMENT_CLASS (klass);
|
||||||
GESSourceClass *source_class = GES_SOURCE_CLASS (klass);
|
|
||||||
|
|
||||||
g_type_class_add_private (klass, sizeof (GESSourcePrivate));
|
g_type_class_add_private (klass, sizeof (GESSourcePrivate));
|
||||||
|
|
||||||
track_class->gnlobject_factorytype = "gnlsource";
|
track_class->gnlobject_factorytype = "gnlsource";
|
||||||
track_class->create_element = ges_source_create_element;
|
track_class->create_element = NULL;
|
||||||
source_class->create_source = NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -254,5 +135,4 @@ ges_source_init (GESSource * self)
|
||||||
{
|
{
|
||||||
self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self,
|
self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self,
|
||||||
GES_TYPE_SOURCE, GESSourcePrivate);
|
GES_TYPE_SOURCE, GESSourcePrivate);
|
||||||
self->priv->positionner = NULL;
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -74,7 +74,6 @@ struct _GESSourceClass {
|
||||||
|
|
||||||
/*< private >*/
|
/*< private >*/
|
||||||
/* Padding for API extension */
|
/* Padding for API extension */
|
||||||
GstElement* (*create_source) (GESTrackElement * object);
|
|
||||||
gpointer _ges_reserved[GES_PADDING];
|
gpointer _ges_reserved[GES_PADDING];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
#include "ges-title-source.h"
|
#include "ges-title-source.h"
|
||||||
#include "ges-video-test-source.h"
|
#include "ges-video-test-source.h"
|
||||||
|
|
||||||
G_DEFINE_TYPE (GESTitleSource, ges_title_source, GES_TYPE_SOURCE);
|
G_DEFINE_TYPE (GESTitleSource, ges_title_source, GES_TYPE_VIDEO_SOURCE);
|
||||||
|
|
||||||
struct _GESTitleSourcePrivate
|
struct _GESTitleSourcePrivate
|
||||||
{
|
{
|
||||||
|
@ -64,7 +64,7 @@ static void
|
||||||
ges_title_source_class_init (GESTitleSourceClass * klass)
|
ges_title_source_class_init (GESTitleSourceClass * klass)
|
||||||
{
|
{
|
||||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||||
GESSourceClass *source_class = GES_SOURCE_CLASS (klass);
|
GESVideoSourceClass *source_class = GES_VIDEO_SOURCE_CLASS (klass);
|
||||||
|
|
||||||
g_type_class_add_private (klass, sizeof (GESTitleSourcePrivate));
|
g_type_class_add_private (klass, sizeof (GESTitleSourcePrivate));
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
|
|
||||||
#include <glib-object.h>
|
#include <glib-object.h>
|
||||||
#include <ges/ges-types.h>
|
#include <ges/ges-types.h>
|
||||||
#include <ges/ges-source.h>
|
#include <ges/ges-video-source.h>
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
|
@ -51,7 +51,7 @@ typedef struct _GESTitleSourcePrivate GESTitleSourcePrivate;
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
struct _GESTitleSource {
|
struct _GESTitleSource {
|
||||||
GESSource parent;
|
GESVideoSource parent;
|
||||||
|
|
||||||
/*< private >*/
|
/*< private >*/
|
||||||
GESTitleSourcePrivate *priv;
|
GESTitleSourcePrivate *priv;
|
||||||
|
@ -66,7 +66,7 @@ struct _GESTitleSource {
|
||||||
*/
|
*/
|
||||||
|
|
||||||
struct _GESTitleSourceClass {
|
struct _GESTitleSourceClass {
|
||||||
GESSourceClass parent_class;
|
GESVideoSourceClass parent_class;
|
||||||
|
|
||||||
/*< private >*/
|
/*< private >*/
|
||||||
|
|
||||||
|
|
|
@ -104,8 +104,17 @@ typedef struct _GESBaseEffectClass GESBaseEffectClass;
|
||||||
typedef struct _GESEffect GESEffect;
|
typedef struct _GESEffect GESEffect;
|
||||||
typedef struct _GESEffectClass GESEffectClass;
|
typedef struct _GESEffectClass GESEffectClass;
|
||||||
|
|
||||||
typedef struct _GESUriSource GESUriSource;
|
typedef struct _GESVideoSource GESVideoSource;
|
||||||
typedef struct _GESUriSourceClass GESUriSourceClass;
|
typedef struct _GESVideoSourceClass GESVideoSourceClass;
|
||||||
|
|
||||||
|
typedef struct _GESAudioSource GESAudioSource;
|
||||||
|
typedef struct _GESAudioSourceClass GESAudioSourceClass;
|
||||||
|
|
||||||
|
typedef struct _GESVideoUriSource GESVideoUriSource;
|
||||||
|
typedef struct _GESVideoUriSourceClass GESVideoUriSourceClass;
|
||||||
|
|
||||||
|
typedef struct _GESAudioUriSource GESAudioUriSource;
|
||||||
|
typedef struct _GESAudioUriSourceClass GESAudioUriSourceClass;
|
||||||
|
|
||||||
typedef struct _GESImageSource GESImageSource;
|
typedef struct _GESImageSource GESImageSource;
|
||||||
typedef struct _GESImageSourceClass GESImageSourceClass;
|
typedef struct _GESImageSourceClass GESImageSourceClass;
|
||||||
|
|
|
@ -238,7 +238,11 @@ _create_uri_source_asset (GESUriClipAsset * asset,
|
||||||
stream_id = g_strdup_printf ("%i", GPOINTER_TO_INT (sinfo));
|
stream_id = g_strdup_printf ("%i", GPOINTER_TO_INT (sinfo));
|
||||||
}
|
}
|
||||||
|
|
||||||
tck_filesource_asset = ges_asset_request (GES_TYPE_URI_SOURCE,
|
if (type == GES_TRACK_TYPE_VIDEO)
|
||||||
|
tck_filesource_asset = ges_asset_request (GES_TYPE_VIDEO_URI_SOURCE,
|
||||||
|
stream_id, NULL);
|
||||||
|
else
|
||||||
|
tck_filesource_asset = ges_asset_request (GES_TYPE_AUDIO_URI_SOURCE,
|
||||||
stream_id, NULL);
|
stream_id, NULL);
|
||||||
g_free (stream_id);
|
g_free (stream_id);
|
||||||
|
|
||||||
|
@ -547,9 +551,13 @@ _extract (GESAsset * asset, GError ** error)
|
||||||
priv->sinfo))
|
priv->sinfo))
|
||||||
trackelement =
|
trackelement =
|
||||||
GES_TRACK_ELEMENT (ges_image_source_new (g_strdup (priv->uri)));
|
GES_TRACK_ELEMENT (ges_image_source_new (g_strdup (priv->uri)));
|
||||||
|
else if (GST_IS_DISCOVERER_VIDEO_INFO (priv->sinfo))
|
||||||
|
trackelement =
|
||||||
|
GES_TRACK_ELEMENT (ges_video_uri_source_new (g_strdup (priv->uri)));
|
||||||
else
|
else
|
||||||
trackelement =
|
trackelement =
|
||||||
GES_TRACK_ELEMENT (ges_track_filesource_new (g_strdup (priv->uri)));
|
GES_TRACK_ELEMENT (ges_audio_uri_source_new (g_strdup (priv->uri)));
|
||||||
|
|
||||||
ges_track_element_set_track_type (trackelement,
|
ges_track_element_set_track_type (trackelement,
|
||||||
ges_track_element_asset_get_track_type (GES_TRACK_ELEMENT_ASSET (asset)));
|
ges_track_element_asset_get_track_type (GES_TRACK_ELEMENT_ASSET (asset)));
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,8 @@
|
||||||
#include "ges-internal.h"
|
#include "ges-internal.h"
|
||||||
#include "ges-uri-clip.h"
|
#include "ges-uri-clip.h"
|
||||||
#include "ges-source-clip.h"
|
#include "ges-source-clip.h"
|
||||||
#include "ges-uri-source.h"
|
#include "ges-video-uri-source.h"
|
||||||
|
#include "ges-audio-uri-source.h"
|
||||||
#include "ges-uri-asset.h"
|
#include "ges-uri-asset.h"
|
||||||
#include "ges-track-element-asset.h"
|
#include "ges-track-element-asset.h"
|
||||||
#include "ges-extractable.h"
|
#include "ges-extractable.h"
|
||||||
|
@ -424,7 +425,7 @@ static GESTrackElement *
|
||||||
ges_uri_clip_create_track_element (GESClip * clip, GESTrackType type)
|
ges_uri_clip_create_track_element (GESClip * clip, GESTrackType type)
|
||||||
{
|
{
|
||||||
GESUriClipPrivate *priv = GES_URI_CLIP (clip)->priv;
|
GESUriClipPrivate *priv = GES_URI_CLIP (clip)->priv;
|
||||||
GESTrackElement *res;
|
GESTrackElement *res = NULL;
|
||||||
|
|
||||||
if (priv->is_image) {
|
if (priv->is_image) {
|
||||||
if (type != GES_TRACK_TYPE_VIDEO) {
|
if (type != GES_TRACK_TYPE_VIDEO) {
|
||||||
|
@ -439,7 +440,10 @@ ges_uri_clip_create_track_element (GESClip * clip, GESTrackType type)
|
||||||
GST_DEBUG ("Creating a GESUriSource");
|
GST_DEBUG ("Creating a GESUriSource");
|
||||||
|
|
||||||
/* FIXME : Implement properly ! */
|
/* FIXME : Implement properly ! */
|
||||||
res = (GESTrackElement *) ges_track_filesource_new (priv->uri);
|
if (type == GES_TRACK_TYPE_VIDEO)
|
||||||
|
res = (GESTrackElement *) ges_video_uri_source_new (priv->uri);
|
||||||
|
else if (type == GES_TRACK_TYPE_AUDIO)
|
||||||
|
res = (GESTrackElement *) ges_audio_uri_source_new (priv->uri);
|
||||||
|
|
||||||
/* If mute and track is audio, deactivate the track element */
|
/* If mute and track is audio, deactivate the track element */
|
||||||
if (type == GES_TRACK_TYPE_AUDIO && priv->mute)
|
if (type == GES_TRACK_TYPE_AUDIO && priv->mute)
|
||||||
|
|
115
ges/ges-video-source.c
Normal file
115
ges/ges-video-source.c
Normal file
|
@ -0,0 +1,115 @@
|
||||||
|
/* GStreamer Editing Services
|
||||||
|
* Copyright (C) 2009 Edward Hervey <edward.hervey@collabora.co.uk>
|
||||||
|
* 2009 Nokia Corporation
|
||||||
|
*
|
||||||
|
* 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., 51 Franklin St, Fifth Floor,
|
||||||
|
* Boston, MA 02110-1301, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* SECTION:ges-video-source
|
||||||
|
* @short_description: Base Class for video sources
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "ges-internal.h"
|
||||||
|
#include "ges/ges-meta-container.h"
|
||||||
|
#include "ges-track-element.h"
|
||||||
|
#include "ges-video-source.h"
|
||||||
|
#include "ges-layer.h"
|
||||||
|
#include "gstframepositionner.h"
|
||||||
|
|
||||||
|
G_DEFINE_TYPE (GESVideoSource, ges_video_source, GES_TYPE_SOURCE);
|
||||||
|
|
||||||
|
struct _GESVideoSourcePrivate
|
||||||
|
{
|
||||||
|
GstFramePositionner *positionner;
|
||||||
|
};
|
||||||
|
|
||||||
|
static void
|
||||||
|
update_z_order_cb (GESClip * clip, GParamSpec * arg G_GNUC_UNUSED,
|
||||||
|
GESVideoSource * self)
|
||||||
|
{
|
||||||
|
GESLayer *layer = ges_clip_get_layer (clip);
|
||||||
|
|
||||||
|
if (layer == NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
|
/* 10000 is the max value of zorder on videomixerpad, hardcoded */
|
||||||
|
|
||||||
|
g_object_set (self->priv->positionner, "zorder",
|
||||||
|
10000 - ges_layer_get_priority (layer), NULL);
|
||||||
|
|
||||||
|
gst_object_unref (layer);
|
||||||
|
}
|
||||||
|
|
||||||
|
static GstElement *
|
||||||
|
ges_video_source_create_element (GESTrackElement * trksrc)
|
||||||
|
{
|
||||||
|
GstElement *topbin;
|
||||||
|
GstElement *sub_element;
|
||||||
|
GESVideoSourceClass *source_class = GES_VIDEO_SOURCE_GET_CLASS (trksrc);
|
||||||
|
GESVideoSource *self;
|
||||||
|
GstElement *positionner;
|
||||||
|
const gchar *props[] = { "alpha", "posx", "posy", NULL };
|
||||||
|
GESTimelineElement *parent;
|
||||||
|
|
||||||
|
if (!source_class->create_source)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
sub_element = source_class->create_source (trksrc);
|
||||||
|
|
||||||
|
self = (GESVideoSource *) trksrc;
|
||||||
|
|
||||||
|
/* That positionner will add metadata to buffers according to its
|
||||||
|
properties, acting like a proxy for our smart-mixer dynamic pads. */
|
||||||
|
positionner = gst_element_factory_make ("framepositionner", "frame_tagger");
|
||||||
|
|
||||||
|
ges_track_element_add_children_props (trksrc, positionner, NULL, NULL, props);
|
||||||
|
topbin =
|
||||||
|
ges_source_create_topbin ("videosrcbin", sub_element, positionner, NULL);
|
||||||
|
parent = ges_timeline_element_get_parent (GES_TIMELINE_ELEMENT (trksrc));
|
||||||
|
if (parent) {
|
||||||
|
self->priv->positionner = GST_FRAME_POSITIONNER (positionner);
|
||||||
|
g_signal_connect (parent, "notify::layer",
|
||||||
|
(GCallback) update_z_order_cb, trksrc);
|
||||||
|
update_z_order_cb (GES_CLIP (parent), NULL, self);
|
||||||
|
gst_object_unref (parent);
|
||||||
|
} else {
|
||||||
|
GST_ERROR ("No parent timeline element, SHOULD NOT HAPPEN");
|
||||||
|
}
|
||||||
|
|
||||||
|
return topbin;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
ges_video_source_class_init (GESVideoSourceClass * klass)
|
||||||
|
{
|
||||||
|
GESTrackElementClass *track_class = GES_TRACK_ELEMENT_CLASS (klass);
|
||||||
|
GESVideoSourceClass *video_source_class = GES_VIDEO_SOURCE_CLASS (klass);
|
||||||
|
|
||||||
|
g_type_class_add_private (klass, sizeof (GESVideoSourcePrivate));
|
||||||
|
|
||||||
|
track_class->gnlobject_factorytype = "gnlsource";
|
||||||
|
track_class->create_element = ges_video_source_create_element;
|
||||||
|
video_source_class->create_source = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
ges_video_source_init (GESVideoSource * self)
|
||||||
|
{
|
||||||
|
self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self,
|
||||||
|
GES_TYPE_VIDEO_SOURCE, GESVideoSourcePrivate);
|
||||||
|
self->priv->positionner = NULL;
|
||||||
|
}
|
90
ges/ges-video-source.h
Normal file
90
ges/ges-video-source.h
Normal file
|
@ -0,0 +1,90 @@
|
||||||
|
/* GStreamer Editing Services
|
||||||
|
* Copyright (C) 2009 Edward Hervey <edward.hervey@collabora.co.uk>
|
||||||
|
* 2009 Nokia Corporation
|
||||||
|
*
|
||||||
|
* 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., 51 Franklin St, Fifth Floor,
|
||||||
|
* Boston, MA 02110-1301, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _GES_VIDEO_SOURCE
|
||||||
|
#define _GES_VIDEO_SOURCE
|
||||||
|
|
||||||
|
#include <glib-object.h>
|
||||||
|
#include <gst/gst.h>
|
||||||
|
#include <ges/ges-types.h>
|
||||||
|
#include <ges/ges-track-element.h>
|
||||||
|
#include <ges/ges-source.h>
|
||||||
|
|
||||||
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
|
#define GES_TYPE_VIDEO_SOURCE ges_video_source_get_type()
|
||||||
|
|
||||||
|
#define GES_VIDEO_SOURCE(obj) \
|
||||||
|
(G_TYPE_CHECK_INSTANCE_CAST ((obj), GES_TYPE_VIDEO_SOURCE, GESVideoSource))
|
||||||
|
|
||||||
|
#define GES_VIDEO_SOURCE_CLASS(klass) \
|
||||||
|
(G_TYPE_CHECK_CLASS_CAST ((klass), GES_TYPE_VIDEO_SOURCE, GESVideoSourceClass))
|
||||||
|
|
||||||
|
#define GES_IS_VIDEO_SOURCE(obj) \
|
||||||
|
(G_TYPE_CHECK_INSTANCE_TYPE ((obj), GES_TYPE_VIDEO_SOURCE))
|
||||||
|
|
||||||
|
#define GES_IS_VIDEO_SOURCE_CLASS(klass) \
|
||||||
|
(G_TYPE_CHECK_CLASS_TYPE ((klass), GES_TYPE_VIDEO_SOURCE))
|
||||||
|
|
||||||
|
#define GES_VIDEO_SOURCE_GET_CLASS(obj) \
|
||||||
|
(G_TYPE_INSTANCE_GET_CLASS ((obj), GES_TYPE_VIDEO_SOURCE, GESVideoSourceClass))
|
||||||
|
|
||||||
|
typedef struct _GESVideoSourcePrivate GESVideoSourcePrivate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GESVideoSource:
|
||||||
|
*
|
||||||
|
* Base class for video sources
|
||||||
|
*/
|
||||||
|
|
||||||
|
struct _GESVideoSource {
|
||||||
|
/*< private >*/
|
||||||
|
GESSource parent;
|
||||||
|
|
||||||
|
GESVideoSourcePrivate *priv;
|
||||||
|
|
||||||
|
/* Padding for API extension */
|
||||||
|
gpointer _ges_reserved[GES_PADDING];
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GESVideoSourceClass:
|
||||||
|
* @create_source: method to return the GstElement to put in the source topbin.
|
||||||
|
* Other elements will be queued, like a videoscale.
|
||||||
|
* In the case of a VideoUriSource, for example, the subclass will return a decodebin,
|
||||||
|
* and we will append a videoscale.
|
||||||
|
*/
|
||||||
|
struct _GESVideoSourceClass {
|
||||||
|
/*< private >*/
|
||||||
|
GESSourceClass parent_class;
|
||||||
|
|
||||||
|
/*< public >*/
|
||||||
|
GstElement* (*create_source) (GESTrackElement * object);
|
||||||
|
|
||||||
|
/*< private >*/
|
||||||
|
/* Padding for API extension */
|
||||||
|
gpointer _ges_reserved[GES_PADDING];
|
||||||
|
};
|
||||||
|
|
||||||
|
GType ges_video_source_get_type (void);
|
||||||
|
|
||||||
|
G_END_DECLS
|
||||||
|
|
||||||
|
#endif /* _GES_VIDEO_SOURCE */
|
|
@ -27,7 +27,8 @@
|
||||||
#include "ges-track-element.h"
|
#include "ges-track-element.h"
|
||||||
#include "ges-video-test-source.h"
|
#include "ges-video-test-source.h"
|
||||||
|
|
||||||
G_DEFINE_TYPE (GESVideoTestSource, ges_video_test_source, GES_TYPE_SOURCE);
|
G_DEFINE_TYPE (GESVideoTestSource, ges_video_test_source,
|
||||||
|
GES_TYPE_VIDEO_SOURCE);
|
||||||
|
|
||||||
#define DEFAULT_VPATTERN GES_VIDEO_TEST_PATTERN_SMPTE
|
#define DEFAULT_VPATTERN GES_VIDEO_TEST_PATTERN_SMPTE
|
||||||
|
|
||||||
|
@ -41,7 +42,7 @@ static GstElement *ges_video_test_source_create_source (GESTrackElement * self);
|
||||||
static void
|
static void
|
||||||
ges_video_test_source_class_init (GESVideoTestSourceClass * klass)
|
ges_video_test_source_class_init (GESVideoTestSourceClass * klass)
|
||||||
{
|
{
|
||||||
GESSourceClass *source_class = GES_SOURCE_CLASS (klass);
|
GESVideoSourceClass *source_class = GES_VIDEO_SOURCE_CLASS (klass);
|
||||||
|
|
||||||
g_type_class_add_private (klass, sizeof (GESVideoTestSourcePrivate));
|
g_type_class_add_private (klass, sizeof (GESVideoTestSourcePrivate));
|
||||||
|
|
||||||
|
@ -74,7 +75,7 @@ ges_video_test_source_create_source (GESTrackElement * self)
|
||||||
|
|
||||||
ges_track_element_add_children_props (self, testsrc, NULL, NULL, props);
|
ges_track_element_add_children_props (self, testsrc, NULL, NULL, props);
|
||||||
|
|
||||||
return create_bin ("videotestsrc", testsrc, capsfilter, NULL);
|
return ges_source_create_topbin ("videotestsrc", testsrc, capsfilter, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
#include <glib-object.h>
|
#include <glib-object.h>
|
||||||
#include <ges/ges-enums.h>
|
#include <ges/ges-enums.h>
|
||||||
#include <ges/ges-types.h>
|
#include <ges/ges-types.h>
|
||||||
#include <ges/ges-source.h>
|
#include <ges/ges-video-source.h>
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
|
@ -52,7 +52,7 @@ typedef struct _GESVideoTestSourcePrivate GESVideoTestSourcePrivate;
|
||||||
*/
|
*/
|
||||||
struct _GESVideoTestSource {
|
struct _GESVideoTestSource {
|
||||||
/*< private >*/
|
/*< private >*/
|
||||||
GESSource parent;
|
GESVideoSource parent;
|
||||||
|
|
||||||
GESVideoTestSourcePrivate *priv;
|
GESVideoTestSourcePrivate *priv;
|
||||||
|
|
||||||
|
@ -61,7 +61,7 @@ struct _GESVideoTestSource {
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _GESVideoTestSourceClass {
|
struct _GESVideoTestSourceClass {
|
||||||
GESSourceClass parent_class;
|
GESVideoSourceClass parent_class;
|
||||||
|
|
||||||
/* Padding for API extension */
|
/* Padding for API extension */
|
||||||
gpointer _ges_reserved[GES_PADDING];
|
gpointer _ges_reserved[GES_PADDING];
|
||||||
|
|
191
ges/ges-video-uri-source.c
Normal file
191
ges/ges-video-uri-source.c
Normal file
|
@ -0,0 +1,191 @@
|
||||||
|
/* GStreamer Editing Services
|
||||||
|
* Copyright (C) 2009 Edward Hervey <edward.hervey@collabora.co.uk>
|
||||||
|
* 2009 Nokia Corporation
|
||||||
|
*
|
||||||
|
* 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., 51 Franklin St, Fifth Floor,
|
||||||
|
* Boston, MA 02110-1301, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* SECTION:ges-video-uri-source
|
||||||
|
* @short_description: outputs a single video stream from a given file
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "ges-utils.h"
|
||||||
|
#include "ges-internal.h"
|
||||||
|
#include "ges-track-element.h"
|
||||||
|
#include "ges-video-uri-source.h"
|
||||||
|
#include "ges-uri-asset.h"
|
||||||
|
#include "ges-extractable.h"
|
||||||
|
|
||||||
|
struct _GESVideoUriSourcePrivate
|
||||||
|
{
|
||||||
|
void *nothing;
|
||||||
|
};
|
||||||
|
|
||||||
|
enum
|
||||||
|
{
|
||||||
|
PROP_0,
|
||||||
|
PROP_URI
|
||||||
|
};
|
||||||
|
|
||||||
|
/* GESSource VMethod */
|
||||||
|
static GstElement *
|
||||||
|
ges_video_uri_source_create_source (GESTrackElement * trksrc)
|
||||||
|
{
|
||||||
|
GESVideoUriSource *self;
|
||||||
|
GESTrack *track;
|
||||||
|
GstElement *decodebin;
|
||||||
|
|
||||||
|
self = (GESVideoUriSource *) trksrc;
|
||||||
|
|
||||||
|
track = ges_track_element_get_track (trksrc);
|
||||||
|
|
||||||
|
decodebin = gst_element_factory_make ("uridecodebin", NULL);
|
||||||
|
|
||||||
|
g_object_set (decodebin, "caps", ges_track_get_caps (track),
|
||||||
|
"expose-all-streams", FALSE, "uri", self->uri, NULL);
|
||||||
|
|
||||||
|
return decodebin;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Extractable interface implementation */
|
||||||
|
|
||||||
|
static gchar *
|
||||||
|
ges_extractable_check_id (GType type, const gchar * id, GError ** error)
|
||||||
|
{
|
||||||
|
return g_strdup (id);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
extractable_set_asset (GESExtractable * self, GESAsset * asset)
|
||||||
|
{
|
||||||
|
/* FIXME That should go into #GESTrackElement, but
|
||||||
|
* some work is needed to make sure it works properly */
|
||||||
|
|
||||||
|
if (ges_track_element_get_track_type (GES_TRACK_ELEMENT (self)) ==
|
||||||
|
GES_TRACK_TYPE_UNKNOWN) {
|
||||||
|
ges_track_element_set_track_type (GES_TRACK_ELEMENT (self),
|
||||||
|
ges_track_element_asset_get_track_type (GES_TRACK_ELEMENT_ASSET
|
||||||
|
(asset)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
ges_extractable_interface_init (GESExtractableInterface * iface)
|
||||||
|
{
|
||||||
|
iface->asset_type = GES_TYPE_URI_SOURCE_ASSET;
|
||||||
|
iface->check_id = ges_extractable_check_id;
|
||||||
|
iface->set_asset = extractable_set_asset;
|
||||||
|
}
|
||||||
|
|
||||||
|
G_DEFINE_TYPE_WITH_CODE (GESVideoUriSource, ges_video_uri_source,
|
||||||
|
GES_TYPE_VIDEO_SOURCE,
|
||||||
|
G_IMPLEMENT_INTERFACE (GES_TYPE_EXTRACTABLE,
|
||||||
|
ges_extractable_interface_init));
|
||||||
|
|
||||||
|
|
||||||
|
/* GObject VMethods */
|
||||||
|
|
||||||
|
static void
|
||||||
|
ges_video_uri_source_get_property (GObject * object, guint property_id,
|
||||||
|
GValue * value, GParamSpec * pspec)
|
||||||
|
{
|
||||||
|
GESVideoUriSource *uriclip = GES_VIDEO_URI_SOURCE (object);
|
||||||
|
|
||||||
|
switch (property_id) {
|
||||||
|
case PROP_URI:
|
||||||
|
g_value_set_string (value, uriclip->uri);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
ges_video_uri_source_set_property (GObject * object, guint property_id,
|
||||||
|
const GValue * value, GParamSpec * pspec)
|
||||||
|
{
|
||||||
|
GESVideoUriSource *uriclip = GES_VIDEO_URI_SOURCE (object);
|
||||||
|
|
||||||
|
switch (property_id) {
|
||||||
|
case PROP_URI:
|
||||||
|
if (uriclip->uri) {
|
||||||
|
GST_WARNING_OBJECT (object, "Uri already set to %s", uriclip->uri);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
uriclip->uri = g_value_dup_string (value);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
ges_video_uri_source_dispose (GObject * object)
|
||||||
|
{
|
||||||
|
GESVideoUriSource *uriclip = GES_VIDEO_URI_SOURCE (object);
|
||||||
|
|
||||||
|
if (uriclip->uri)
|
||||||
|
g_free (uriclip->uri);
|
||||||
|
|
||||||
|
G_OBJECT_CLASS (ges_video_uri_source_parent_class)->dispose (object);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
ges_video_uri_source_class_init (GESVideoUriSourceClass * klass)
|
||||||
|
{
|
||||||
|
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||||
|
GESVideoSourceClass *source_class = GES_VIDEO_SOURCE_CLASS (klass);
|
||||||
|
|
||||||
|
g_type_class_add_private (klass, sizeof (GESVideoUriSourcePrivate));
|
||||||
|
|
||||||
|
object_class->get_property = ges_video_uri_source_get_property;
|
||||||
|
object_class->set_property = ges_video_uri_source_set_property;
|
||||||
|
object_class->dispose = ges_video_uri_source_dispose;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GESVideoUriSource: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));
|
||||||
|
|
||||||
|
source_class->create_source = ges_video_uri_source_create_source;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
ges_video_uri_source_init (GESVideoUriSource * self)
|
||||||
|
{
|
||||||
|
self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self,
|
||||||
|
GES_TYPE_VIDEO_URI_SOURCE, GESVideoUriSourcePrivate);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ges_video_uri_source_new:
|
||||||
|
* @uri: the URI the source should control
|
||||||
|
*
|
||||||
|
* Creates a new #GESVideoUriSource for the provided @uri.
|
||||||
|
*
|
||||||
|
* Returns: The newly created #GESVideoUriSource, or %NULL if there was an
|
||||||
|
* error.
|
||||||
|
*/
|
||||||
|
GESVideoUriSource *
|
||||||
|
ges_video_uri_source_new (gchar * uri)
|
||||||
|
{
|
||||||
|
return g_object_new (GES_TYPE_VIDEO_URI_SOURCE, "uri", uri, NULL);
|
||||||
|
}
|
79
ges/ges-video-uri-source.h
Normal file
79
ges/ges-video-uri-source.h
Normal file
|
@ -0,0 +1,79 @@
|
||||||
|
/* GStreamer Editing Services
|
||||||
|
* Copyright (C) 2009 Edward Hervey <edward.hervey@collabora.co.uk>
|
||||||
|
* 2009 Nokia Corporation
|
||||||
|
*
|
||||||
|
* 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., 51 Franklin St, Fifth Floor,
|
||||||
|
* Boston, MA 02110-1301, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _GES_VIDEO_URI_SOURCE
|
||||||
|
#define _GES_VIDEO_URI_SOURCE
|
||||||
|
|
||||||
|
#include <glib-object.h>
|
||||||
|
#include <ges/ges-types.h>
|
||||||
|
#include <ges/ges-video-source.h>
|
||||||
|
|
||||||
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
|
#define GES_TYPE_VIDEO_URI_SOURCE ges_video_uri_source_get_type()
|
||||||
|
|
||||||
|
#define GES_VIDEO_URI_SOURCE(obj) \
|
||||||
|
(G_TYPE_CHECK_INSTANCE_CAST ((obj), GES_TYPE_VIDEO_URI_SOURCE, GESVideoUriSource))
|
||||||
|
|
||||||
|
#define GES_VIDEO_URI_SOURCE_CLASS(klass) \
|
||||||
|
(G_TYPE_CHECK_CLASS_CAST ((klass), GES_TYPE_VIDEO_URI_SOURCE, GESVideoUriSourceClass))
|
||||||
|
|
||||||
|
#define GES_IS_VIDEO_URI_SOURCE(obj) \
|
||||||
|
(G_TYPE_CHECK_INSTANCE_TYPE ((obj), GES_TYPE_VIDEO_URI_SOURCE))
|
||||||
|
|
||||||
|
#define GES_IS_VIDEO_URI_SOURCE_CLASS(klass) \
|
||||||
|
(G_TYPE_CHECK_CLASS_TYPE ((klass), GES_TYPE_VIDEO_URI_SOURCE))
|
||||||
|
|
||||||
|
#define GES_VIDEO_URI_SOURCE_GET_CLASS(obj) \
|
||||||
|
(G_TYPE_INSTANCE_GET_CLASS ((obj), GES_TYPE_VIDEO_URI_SOURCE, GESVideoUriSourceClass))
|
||||||
|
|
||||||
|
typedef struct _GESVideoUriSourcePrivate GESVideoUriSourcePrivate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GESVideoUriSource:
|
||||||
|
*/
|
||||||
|
struct _GESVideoUriSource {
|
||||||
|
/*< private >*/
|
||||||
|
GESVideoSource parent;
|
||||||
|
|
||||||
|
gchar *uri;
|
||||||
|
|
||||||
|
GESVideoUriSourcePrivate *priv;
|
||||||
|
|
||||||
|
/* Padding for API extension */
|
||||||
|
gpointer _ges_reserved[GES_PADDING];
|
||||||
|
};
|
||||||
|
|
||||||
|
struct _GESVideoUriSourceClass {
|
||||||
|
/*< private >*/
|
||||||
|
GESVideoSourceClass parent_class;
|
||||||
|
|
||||||
|
/* Padding for API extension */
|
||||||
|
gpointer _ges_reserved[GES_PADDING];
|
||||||
|
};
|
||||||
|
|
||||||
|
GType ges_video_uri_source_get_type (void);
|
||||||
|
|
||||||
|
GESVideoUriSource* ges_video_uri_source_new (gchar *uri);
|
||||||
|
|
||||||
|
G_END_DECLS
|
||||||
|
|
||||||
|
#endif /* _GES_VIDEO_URI_SOURCE */
|
||||||
|
|
|
@ -60,7 +60,8 @@
|
||||||
#include <ges/ges-source.h>
|
#include <ges/ges-source.h>
|
||||||
#include <ges/ges-operation.h>
|
#include <ges/ges-operation.h>
|
||||||
|
|
||||||
#include <ges/ges-uri-source.h>
|
#include <ges/ges-video-uri-source.h>
|
||||||
|
#include <ges/ges-audio-uri-source.h>
|
||||||
#include <ges/ges-image-source.h>
|
#include <ges/ges-image-source.h>
|
||||||
#include <ges/ges-video-test-source.h>
|
#include <ges/ges-video-test-source.h>
|
||||||
#include <ges/ges-audio-test-source.h>
|
#include <ges/ges-audio-test-source.h>
|
||||||
|
|
|
@ -68,7 +68,8 @@ asset_created_cb (GObject * source, GAsyncResult * res, gpointer udata)
|
||||||
GList *trackelements = ges_track_get_elements (GES_TRACK (tmp->data));
|
GList *trackelements = ges_track_get_elements (GES_TRACK (tmp->data));
|
||||||
|
|
||||||
assert_equals_int (g_list_length (trackelements), 1);
|
assert_equals_int (g_list_length (trackelements), 1);
|
||||||
fail_unless (GES_IS_URI_SOURCE (trackelements->data));
|
fail_unless (GES_IS_VIDEO_URI_SOURCE (trackelements->data)
|
||||||
|
|| GES_IS_AUDIO_URI_SOURCE (trackelements->data));
|
||||||
g_list_free_full (trackelements, gst_object_unref);
|
g_list_free_full (trackelements, gst_object_unref);
|
||||||
}
|
}
|
||||||
g_list_free_full (tracks, gst_object_unref);
|
g_list_free_full (tracks, gst_object_unref);
|
||||||
|
|
Loading…
Reference in a new issue