#include "ges-utils.h"
#include "ges-internal.h"
#include "ges-track-element.h"
+#include "ges-uri-source.h"
#include "ges-audio-uri-source.h"
#include "ges-uri-asset.h"
#include "ges-extractable.h"
struct _GESAudioUriSourcePrivate
{
- GstElement *decodebin; /* Reference owned by parent class */
+ GESUriSource parent;
};
enum
PROP_URI
};
-static void
-ges_audio_uri_source_track_set_cb (GESAudioUriSource * self,
- GParamSpec * arg G_GNUC_UNUSED, gpointer nothing)
-{
- GESTrack *track;
- const GstCaps *caps = NULL;
-
- if (!self->priv->decodebin)
- return;
-
- track = ges_track_element_get_track (GES_TRACK_ELEMENT (self));
- if (!track)
- return;
-
- caps = ges_track_get_caps (track);
-
- GST_INFO_OBJECT (self, "Setting caps to: %" GST_PTR_FORMAT, caps);
- g_object_set (self->priv->decodebin, "caps", caps, NULL);
-}
-
/* GESSource VMethod */
static GstElement *
-ges_audio_uri_source_create_source (GESTrackElement * trksrc)
+ges_audio_uri_source_create_source (GESTrackElement * element)
{
- GESAudioUriSource *self;
- GESTrack *track;
- GstElement *decodebin;
- const GstCaps *caps = NULL;
-
- self = (GESAudioUriSource *) trksrc;
-
- track = ges_track_element_get_track (trksrc);
-
- self->priv->decodebin = decodebin =
- gst_element_factory_make ("uridecodebin", NULL);
-
- if (track)
- caps = ges_track_get_caps (track);
-
- g_object_set (decodebin, "caps", caps,
- "expose-all-streams", FALSE, "uri", self->uri, NULL);
-
- return decodebin;
+ return ges_uri_source_create_source (GES_AUDIO_URI_SOURCE (element)->priv);
}
/* Extractable interface implementation */
GST_WARNING_OBJECT (object, "Uri already set to %s", uriclip->uri);
return;
}
- uriclip->uri = g_value_dup_string (value);
+ uriclip->priv->uri = uriclip->uri = g_value_dup_string (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
ges_audio_uri_source_init (GESAudioUriSource * self)
{
self->priv = ges_audio_uri_source_get_instance_private (self);
-
- g_signal_connect (self, "notify::track",
- G_CALLBACK (ges_audio_uri_source_track_set_cb), NULL);
+ ges_uri_source_init (GES_TRACK_ELEMENT (self), self->priv);
}
/**
G_BEGIN_DECLS
+typedef struct _GESUriSource GESUriSource;
#define GES_TYPE_AUDIO_URI_SOURCE ges_audio_uri_source_get_type()
GES_DECLARE_TYPE(AudioUriSource, audio_uri_source, AUDIO_URI_SOURCE);
gchar *uri;
- GESAudioUriSourcePrivate *priv;
+ GESUriSource *priv;
/* Padding for API extension */
gpointer _ges_reserved[GES_PADDING];
--- /dev/null
+/* GStreamer Editing Services
+ * Copyright (C) 2020 Ubicast S.A
+ * Author: Thibault Saunier <tsaunier@igalia.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., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "ges-internal.h"
+#include "ges-uri-source.h"
+
+GST_DEBUG_CATEGORY_STATIC (uri_source_debug);
+#undef GST_CAT_DEFAULT
+#define GST_CAT_DEFAULT uri_source_debug
+
+
+GstElement *
+ges_uri_source_create_source (GESUriSource * self)
+{
+ GESTrack *track;
+ GstElement *decodebin;
+ const GstCaps *caps = NULL;
+
+ track = ges_track_element_get_track (self->element);
+
+ self->decodebin = decodebin = gst_element_factory_make ("uridecodebin", NULL);
+ GST_DEBUG_OBJECT (self->element,
+ "%" GST_PTR_FORMAT " - Track! %" GST_PTR_FORMAT, self->decodebin, track);
+
+ if (track)
+ caps = ges_track_get_caps (track);
+
+ g_object_set (decodebin, "caps", caps,
+ "expose-all-streams", FALSE, "uri", self->uri, NULL);
+
+ return decodebin;
+
+}
+
+static void
+ges_uri_source_track_set_cb (GESTrackElement * element,
+ GParamSpec * arg G_GNUC_UNUSED, GESUriSource * self)
+{
+ GESTrack *track;
+ const GstCaps *caps = NULL;
+
+ if (!self->decodebin)
+ return;
+
+ track = ges_track_element_get_track (GES_TRACK_ELEMENT (element));
+ if (!track)
+ return;
+
+ caps = ges_track_get_caps (track);
+
+ GST_INFO_OBJECT (element,
+ "Setting %" GST_PTR_FORMAT "caps to: %" GST_PTR_FORMAT, self->decodebin,
+ caps);
+ g_object_set (self->decodebin, "caps", caps, NULL);
+}
+
+
+
+void
+ges_uri_source_init (GESTrackElement * element, GESUriSource * self)
+{
+ static gsize once = 0;
+
+ if (g_once_init_enter (&once)) {
+ GST_DEBUG_CATEGORY_INIT (uri_source_debug, "gesurisource", 0,
+ "GES uri source");
+ g_once_init_leave (&once, 1);
+ }
+
+ self->element = element;
+ g_signal_connect (element, "notify::track",
+ G_CALLBACK (ges_uri_source_track_set_cb), self);
+}
--- /dev/null
+/* GStreamer Editing Services
+ * Copyright (C) 2020 Ubicast SAS
+ * Author: Thibault Saunier <tsaunier@igalia.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., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#pragma once
+
+#include <glib-object.h>
+#include <ges/ges.h>
+
+G_BEGIN_DECLS
+
+typedef struct _GESUriSource GESUriSource;
+
+struct _GESUriSource
+{
+ GstElement *decodebin; /* Reference owned by parent class */
+ gchar *uri;
+
+ GESTrackElement *element;
+};
+
+G_GNUC_INTERNAL GstElement * ges_uri_source_create_source (GESUriSource *self);
+G_GNUC_INTERNAL void ges_uri_source_init (GESTrackElement *element, GESUriSource *self);
+
+G_END_DECLS
#include "ges-utils.h"
#include "ges-internal.h"
#include "ges-track-element.h"
+#include "ges-uri-source.h"
#include "ges-video-uri-source.h"
#include "ges-uri-asset.h"
#include "ges-extractable.h"
struct _GESVideoUriSourcePrivate
{
- GstElement *decodebin; /* Reference owned by parent class */
+ GESUriSource parent;
};
enum
PROP_URI
};
-static void
-ges_video_uri_source_track_set_cb (GESVideoUriSource * self,
- GParamSpec * arg G_GNUC_UNUSED, gpointer nothing)
-{
- GESTrack *track;
- const GstCaps *caps = NULL;
-
- if (!self->priv->decodebin)
- return;
-
- track = ges_track_element_get_track (GES_TRACK_ELEMENT (self));
- if (!track)
- return;
-
- caps = ges_track_get_caps (track);
-
- GST_INFO_OBJECT (self, "Setting caps to: %" GST_PTR_FORMAT, caps);
- g_object_set (self->priv->decodebin, "caps", caps, NULL);
-}
-
/* GESSource VMethod */
static GstElement *
-ges_video_uri_source_create_source (GESTrackElement * trksrc)
+ges_video_uri_source_create_source (GESTrackElement * element)
{
- GESVideoUriSource *self;
- GESTrack *track;
- GstElement *decodebin;
- const GstCaps *caps = NULL;
-
- self = (GESVideoUriSource *) trksrc;
-
- track = ges_track_element_get_track (trksrc);
- if (track)
- caps = ges_track_get_caps (track);
-
- decodebin = self->priv->decodebin = gst_element_factory_make ("uridecodebin",
- NULL);
-
- g_object_set (decodebin, "caps", caps,
- "expose-all-streams", FALSE, "uri", self->uri, NULL);
-
- return decodebin;
+ return ges_uri_source_create_source (GES_VIDEO_URI_SOURCE (element)->priv);
}
static gboolean
GST_WARNING_OBJECT (object, "Uri already set to %s", urisource->uri);
return;
}
- urisource->uri = g_value_dup_string (value);
+ urisource->priv->uri = urisource->uri = g_value_dup_string (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
ges_video_uri_source_init (GESVideoUriSource * self)
{
self->priv = ges_video_uri_source_get_instance_private (self);
-
- g_signal_connect (self, "notify::track",
- G_CALLBACK (ges_video_uri_source_track_set_cb), NULL);
+ ges_uri_source_init (GES_TRACK_ELEMENT (self), self->priv);
}
/**
G_BEGIN_DECLS
+/**
+ * GESUriSource: (attributes doc.skip=true):
+ */
+typedef struct _GESUriSource GESUriSource;
#define GES_TYPE_VIDEO_URI_SOURCE ges_video_uri_source_get_type()
GES_DECLARE_TYPE(VideoUriSource, video_uri_source, VIDEO_URI_SOURCE);
gchar *uri;
- GESVideoUriSourcePrivate *priv;
+ GESUriSource *priv;
/* Padding for API extension */
gpointer _ges_reserved[GES_PADDING];
'ges-base-effect-clip.c',
'ges-effect-clip.c',
'ges-uri-clip.c',
+ 'ges-uri-source.c',
'ges-operation-clip.c',
'ges-base-transition-clip.c',
'ges-transition-clip.c',