2012-09-10 00:15:17 +00:00
|
|
|
/* GStreamer Editing Services
|
|
|
|
*
|
|
|
|
* Copyright (C) 2012 Thibault Saunier <thibault.saunier@collabora.com>
|
|
|
|
* Copyright (C) 2012 Volodymyr Rudyi <vladimir.rudoy@gmail.com>
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Library General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Library General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Library General Public
|
|
|
|
* License along with this library; if not, write to the
|
|
|
|
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
|
|
* Boston, MA 02111-1307, USA.
|
|
|
|
*/
|
|
|
|
/**
|
2014-04-07 19:02:48 +00:00
|
|
|
* SECTION: gesuriclipasset
|
2017-03-08 21:13:48 +00:00
|
|
|
* @title: GESUriClipAsset
|
2013-01-20 15:44:57 +00:00
|
|
|
* @short_description: A GESAsset subclass specialized in GESUriClip extraction
|
2012-09-10 00:15:17 +00:00
|
|
|
*
|
2013-01-20 15:44:57 +00:00
|
|
|
* The #GESUriClipAsset is a special #GESAsset that lets you handle
|
2012-09-10 00:15:17 +00:00
|
|
|
* the media file to use inside the GStreamer Editing Services. It has APIs that
|
|
|
|
* let you get information about the medias. Also, the tags found in the media file are
|
|
|
|
* set as Metadatas of the Asser.
|
|
|
|
*/
|
2015-06-09 18:58:00 +00:00
|
|
|
#include <errno.h>
|
2012-09-10 00:15:17 +00:00
|
|
|
#include <gst/pbutils/pbutils.h>
|
|
|
|
#include "ges.h"
|
|
|
|
#include "ges-internal.h"
|
2013-01-26 17:14:57 +00:00
|
|
|
#include "ges-track-element-asset.h"
|
2012-09-10 00:15:17 +00:00
|
|
|
|
2016-11-20 14:34:46 +00:00
|
|
|
#define DEFAULT_DISCOVERY_TIMEOUT (60 * GST_SECOND)
|
|
|
|
|
2012-09-10 00:15:17 +00:00
|
|
|
static GHashTable *parent_newparent_table = NULL;
|
2014-11-03 10:55:29 +00:00
|
|
|
|
2017-02-06 11:07:26 +00:00
|
|
|
static GstDiscoverer *discoverer = NULL;
|
|
|
|
static GstDiscoverer *sync_discoverer = NULL;
|
|
|
|
|
2012-09-10 00:15:17 +00:00
|
|
|
static void
|
|
|
|
initable_iface_init (GInitableIface * initable_iface)
|
|
|
|
{
|
|
|
|
/* We can not iniate synchronously */
|
|
|
|
initable_iface->init = NULL;
|
|
|
|
}
|
|
|
|
|
2013-01-20 15:44:57 +00:00
|
|
|
G_DEFINE_TYPE_WITH_CODE (GESUriClipAsset, ges_uri_clip_asset,
|
2013-01-27 15:51:52 +00:00
|
|
|
GES_TYPE_CLIP_ASSET,
|
2012-09-10 00:15:17 +00:00
|
|
|
G_IMPLEMENT_INTERFACE (G_TYPE_INITABLE, initable_iface_init));
|
|
|
|
|
|
|
|
/* TODO: We should monitor files here, and add some way of reporting changes
|
|
|
|
* to user
|
|
|
|
*/
|
|
|
|
enum
|
|
|
|
{
|
|
|
|
PROP_0,
|
|
|
|
PROP_DURATION,
|
|
|
|
PROP_LAST
|
|
|
|
};
|
|
|
|
static GParamSpec *properties[PROP_LAST];
|
|
|
|
|
|
|
|
static void discoverer_discovered_cb (GstDiscoverer * discoverer,
|
|
|
|
GstDiscovererInfo * info, GError * err, gpointer user_data);
|
|
|
|
|
2013-01-20 15:44:57 +00:00
|
|
|
struct _GESUriClipAssetPrivate
|
2012-09-10 00:15:17 +00:00
|
|
|
{
|
|
|
|
GstDiscovererInfo *info;
|
|
|
|
GstClockTime duration;
|
|
|
|
gboolean is_image;
|
2012-12-21 17:28:16 +00:00
|
|
|
|
|
|
|
GList *asset_trackfilesources;
|
|
|
|
};
|
|
|
|
|
2013-01-26 17:07:01 +00:00
|
|
|
struct _GESUriSourceAssetPrivate
|
2012-12-21 17:28:16 +00:00
|
|
|
{
|
|
|
|
GstDiscovererStreamInfo *sinfo;
|
2013-01-20 15:44:57 +00:00
|
|
|
GESUriClipAsset *parent_asset;
|
2012-12-21 17:28:16 +00:00
|
|
|
|
|
|
|
const gchar *uri;
|
2012-09-10 00:15:17 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
static void
|
2013-01-20 15:44:57 +00:00
|
|
|
ges_uri_clip_asset_get_property (GObject * object, guint property_id,
|
2012-09-10 00:15:17 +00:00
|
|
|
GValue * value, GParamSpec * pspec)
|
|
|
|
{
|
2013-01-20 15:44:57 +00:00
|
|
|
GESUriClipAssetPrivate *priv = GES_URI_CLIP_ASSET (object)->priv;
|
2012-09-10 00:15:17 +00:00
|
|
|
|
|
|
|
switch (property_id) {
|
|
|
|
case PROP_DURATION:
|
|
|
|
g_value_set_uint64 (value, priv->duration);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2013-01-20 15:44:57 +00:00
|
|
|
ges_uri_clip_asset_set_property (GObject * object, guint property_id,
|
2012-09-10 00:15:17 +00:00
|
|
|
const GValue * value, GParamSpec * pspec)
|
|
|
|
{
|
2013-01-20 15:44:57 +00:00
|
|
|
GESUriClipAssetPrivate *priv = GES_URI_CLIP_ASSET (object)->priv;
|
2012-09-10 00:15:17 +00:00
|
|
|
|
|
|
|
switch (property_id) {
|
|
|
|
case PROP_DURATION:
|
|
|
|
priv->duration = g_value_get_uint64 (value);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static GESAssetLoadingReturn
|
|
|
|
_start_loading (GESAsset * asset, GError ** error)
|
|
|
|
{
|
|
|
|
gboolean ret;
|
|
|
|
const gchar *uri;
|
2013-01-20 15:44:57 +00:00
|
|
|
GESUriClipAssetClass *class = GES_URI_CLIP_ASSET_GET_CLASS (asset);
|
2012-09-10 00:15:17 +00:00
|
|
|
|
|
|
|
GST_DEBUG ("Started loading %p", asset);
|
|
|
|
|
|
|
|
uri = ges_asset_get_id (asset);
|
|
|
|
|
|
|
|
ret = gst_discoverer_discover_uri_async (class->discoverer, uri);
|
|
|
|
if (ret)
|
|
|
|
return GES_ASSET_LOADING_ASYNC;
|
|
|
|
|
|
|
|
return GES_ASSET_LOADING_ERROR;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
_request_id_update (GESAsset * self, gchar ** proposed_new_id, GError * error)
|
|
|
|
{
|
|
|
|
if (error->domain == GST_RESOURCE_ERROR &&
|
2014-01-16 14:25:06 +00:00
|
|
|
(error->code == GST_RESOURCE_ERROR_NOT_FOUND ||
|
|
|
|
error->code == GST_RESOURCE_ERROR_OPEN_READ)) {
|
2012-09-10 00:15:17 +00:00
|
|
|
const gchar *uri = ges_asset_get_id (self);
|
|
|
|
GFile *parent, *file = g_file_new_for_uri (uri);
|
|
|
|
|
|
|
|
/* Check if we have the new parent in cache */
|
|
|
|
parent = g_file_get_parent (file);
|
|
|
|
if (parent) {
|
|
|
|
GFile *new_parent = g_hash_table_lookup (parent_newparent_table, parent);
|
|
|
|
|
|
|
|
if (new_parent) {
|
|
|
|
gchar *basename = g_file_get_basename (file);
|
|
|
|
GFile *new_file = g_file_get_child (new_parent, basename);
|
|
|
|
|
2013-10-11 20:00:22 +00:00
|
|
|
/* FIXME Handle the GCancellable */
|
2014-12-12 11:02:41 +00:00
|
|
|
if (g_file_query_exists (new_file, NULL)) {
|
2013-10-11 20:00:22 +00:00
|
|
|
*proposed_new_id = g_file_get_uri (new_file);
|
|
|
|
GST_DEBUG_OBJECT (self, "Proposing path: %s as proxy",
|
|
|
|
*proposed_new_id);
|
|
|
|
}
|
2012-09-10 00:15:17 +00:00
|
|
|
|
2013-03-16 22:05:04 +00:00
|
|
|
gst_object_unref (new_file);
|
2012-09-10 00:15:17 +00:00
|
|
|
g_free (basename);
|
|
|
|
}
|
2013-03-16 22:05:04 +00:00
|
|
|
gst_object_unref (parent);
|
2012-09-10 00:15:17 +00:00
|
|
|
}
|
|
|
|
|
2013-03-16 22:05:04 +00:00
|
|
|
gst_object_unref (file);
|
2012-09-10 00:15:17 +00:00
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_asset_proxied (GESAsset * self, const gchar * new_uri)
|
|
|
|
{
|
|
|
|
const gchar *uri = ges_asset_get_id (self);
|
|
|
|
GFile *parent, *new_parent, *new_file = g_file_new_for_uri (new_uri),
|
|
|
|
*file = g_file_new_for_uri (uri);
|
|
|
|
|
|
|
|
parent = g_file_get_parent (file);
|
|
|
|
new_parent = g_file_get_parent (new_file);
|
|
|
|
g_hash_table_insert (parent_newparent_table, parent, new_parent);
|
2013-03-16 22:05:04 +00:00
|
|
|
gst_object_unref (file);
|
|
|
|
gst_object_unref (new_file);
|
2012-09-10 00:15:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2013-01-20 15:44:57 +00:00
|
|
|
ges_uri_clip_asset_class_init (GESUriClipAssetClass * klass)
|
2012-09-10 00:15:17 +00:00
|
|
|
{
|
2016-11-15 18:09:10 +00:00
|
|
|
GError *err;
|
2015-06-09 18:58:00 +00:00
|
|
|
GstClockTime timeout;
|
|
|
|
const gchar *timeout_str;
|
2012-09-10 00:15:17 +00:00
|
|
|
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
2013-01-20 15:44:57 +00:00
|
|
|
g_type_class_add_private (klass, sizeof (GESUriClipAssetPrivate));
|
2012-09-10 00:15:17 +00:00
|
|
|
|
2013-01-20 15:44:57 +00:00
|
|
|
object_class->get_property = ges_uri_clip_asset_get_property;
|
|
|
|
object_class->set_property = ges_uri_clip_asset_set_property;
|
2012-09-10 00:15:17 +00:00
|
|
|
|
|
|
|
GES_ASSET_CLASS (klass)->start_loading = _start_loading;
|
|
|
|
GES_ASSET_CLASS (klass)->request_id_update = _request_id_update;
|
|
|
|
GES_ASSET_CLASS (klass)->inform_proxy = _asset_proxied;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
2013-01-20 15:44:57 +00:00
|
|
|
* GESUriClipAsset:duration:
|
2012-09-10 00:15:17 +00:00
|
|
|
*
|
|
|
|
* The duration (in nanoseconds) of the media file
|
|
|
|
*/
|
|
|
|
properties[PROP_DURATION] =
|
|
|
|
g_param_spec_uint64 ("duration", "Duration", "The duration to use", 0,
|
|
|
|
G_MAXUINT64, GST_CLOCK_TIME_NONE, G_PARAM_READWRITE);
|
|
|
|
g_object_class_install_property (object_class, PROP_DURATION,
|
|
|
|
properties[PROP_DURATION]);
|
|
|
|
|
2016-11-20 14:34:46 +00:00
|
|
|
timeout = DEFAULT_DISCOVERY_TIMEOUT;
|
2015-06-09 18:58:00 +00:00
|
|
|
errno = 0;
|
|
|
|
timeout_str = g_getenv ("GES_DISCOVERY_TIMEOUT");
|
|
|
|
if (timeout_str)
|
|
|
|
timeout = g_ascii_strtod (timeout_str, NULL) * GST_SECOND;
|
|
|
|
else
|
|
|
|
errno = 10;
|
|
|
|
|
|
|
|
if (errno)
|
2016-11-20 14:34:46 +00:00
|
|
|
timeout = DEFAULT_DISCOVERY_TIMEOUT;
|
2015-06-09 18:58:00 +00:00
|
|
|
|
2017-02-06 11:07:26 +00:00
|
|
|
if (!discoverer) {
|
|
|
|
discoverer = gst_discoverer_new (timeout, &err);
|
|
|
|
if (!discoverer) {
|
|
|
|
GST_ERROR ("Could not create discoverer: %s", err->message);
|
|
|
|
g_error_free (err);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* The class structure keeps weak pointers on the discoverers so they
|
|
|
|
* can be properly cleaned up in _ges_uri_asset_cleanup(). */
|
2016-11-15 18:09:10 +00:00
|
|
|
if (!klass->discoverer) {
|
2017-02-06 11:07:26 +00:00
|
|
|
klass->discoverer = discoverer;
|
|
|
|
g_object_add_weak_pointer (G_OBJECT (discoverer),
|
|
|
|
(gpointer *) & klass->discoverer);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!sync_discoverer) {
|
|
|
|
sync_discoverer = gst_discoverer_new (timeout, &err);
|
|
|
|
|
|
|
|
if (!sync_discoverer) {
|
|
|
|
GST_ERROR ("Could not create discoverer: %s", err->message);
|
|
|
|
g_error_free (err);
|
|
|
|
return;
|
|
|
|
}
|
2016-11-15 18:09:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (!klass->sync_discoverer) {
|
2017-02-06 11:07:26 +00:00
|
|
|
klass->sync_discoverer = sync_discoverer;
|
|
|
|
g_object_add_weak_pointer (G_OBJECT (sync_discoverer),
|
|
|
|
(gpointer *) & klass->sync_discoverer);
|
2016-11-15 18:09:10 +00:00
|
|
|
}
|
|
|
|
|
2012-09-10 00:15:17 +00:00
|
|
|
g_signal_connect (klass->discoverer, "discovered",
|
|
|
|
G_CALLBACK (discoverer_discovered_cb), NULL);
|
|
|
|
|
|
|
|
/* We just start the discoverer and let it live */
|
|
|
|
gst_discoverer_start (klass->discoverer);
|
|
|
|
if (parent_newparent_table == NULL) {
|
|
|
|
parent_newparent_table = g_hash_table_new_full (g_file_hash,
|
2013-03-16 22:05:04 +00:00
|
|
|
(GEqualFunc) g_file_equal, gst_object_unref, gst_object_unref);
|
2012-09-10 00:15:17 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2013-01-20 15:44:57 +00:00
|
|
|
ges_uri_clip_asset_init (GESUriClipAsset * self)
|
2012-09-10 00:15:17 +00:00
|
|
|
{
|
2013-01-20 15:44:57 +00:00
|
|
|
GESUriClipAssetPrivate *priv;
|
2012-09-10 00:15:17 +00:00
|
|
|
|
|
|
|
priv = self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self,
|
2013-01-20 15:44:57 +00:00
|
|
|
GES_TYPE_URI_CLIP_ASSET, GESUriClipAssetPrivate);
|
2012-09-10 00:15:17 +00:00
|
|
|
|
|
|
|
priv->info = NULL;
|
|
|
|
priv->duration = GST_CLOCK_TIME_NONE;
|
|
|
|
priv->is_image = FALSE;
|
|
|
|
}
|
|
|
|
|
2012-12-21 17:28:16 +00:00
|
|
|
static void
|
2013-01-26 17:07:01 +00:00
|
|
|
_create_uri_source_asset (GESUriClipAsset * asset,
|
2012-12-21 17:28:16 +00:00
|
|
|
GstDiscovererStreamInfo * sinfo, GESTrackType type)
|
|
|
|
{
|
|
|
|
GESAsset *tck_filesource_asset;
|
2013-01-26 17:07:01 +00:00
|
|
|
GESUriSourceAssetPrivate *priv_tckasset;
|
2013-01-20 15:44:57 +00:00
|
|
|
GESUriClipAssetPrivate *priv = asset->priv;
|
2012-12-21 17:28:16 +00:00
|
|
|
gchar *stream_id =
|
|
|
|
g_strdup (gst_discoverer_stream_info_get_stream_id (sinfo));
|
|
|
|
|
|
|
|
if (stream_id == NULL) {
|
|
|
|
GST_WARNING ("No stream ID found, using the pointer instead");
|
|
|
|
|
|
|
|
stream_id = g_strdup_printf ("%i", GPOINTER_TO_INT (sinfo));
|
|
|
|
}
|
|
|
|
|
2013-07-09 13:31:15 +00:00
|
|
|
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);
|
2012-12-21 17:28:16 +00:00
|
|
|
g_free (stream_id);
|
|
|
|
|
2013-05-23 17:16:22 +00:00
|
|
|
priv_tckasset = GES_URI_SOURCE_ASSET (tck_filesource_asset)->priv;
|
2012-12-21 17:28:16 +00:00
|
|
|
priv_tckasset->uri = ges_asset_get_id (GES_ASSET (asset));
|
2013-03-16 22:05:04 +00:00
|
|
|
priv_tckasset->sinfo = gst_object_ref (sinfo);
|
2012-12-21 17:28:16 +00:00
|
|
|
priv_tckasset->parent_asset = asset;
|
2013-01-26 17:14:57 +00:00
|
|
|
ges_track_element_asset_set_track_type (GES_TRACK_ELEMENT_ASSET
|
2012-12-21 23:48:03 +00:00
|
|
|
(tck_filesource_asset), type);
|
2012-12-21 17:28:16 +00:00
|
|
|
|
|
|
|
priv->asset_trackfilesources = g_list_append (priv->asset_trackfilesources,
|
|
|
|
gst_object_ref (tck_filesource_asset));
|
|
|
|
}
|
|
|
|
|
2012-09-10 00:15:17 +00:00
|
|
|
static void
|
2013-01-20 15:44:57 +00:00
|
|
|
ges_uri_clip_asset_set_info (GESUriClipAsset * self, GstDiscovererInfo * info)
|
2012-09-10 00:15:17 +00:00
|
|
|
{
|
|
|
|
GList *tmp, *stream_list;
|
|
|
|
|
|
|
|
GESTrackType supportedformats = GES_TRACK_TYPE_UNKNOWN;
|
2013-01-20 15:44:57 +00:00
|
|
|
GESUriClipAssetPrivate *priv = GES_URI_CLIP_ASSET (self)->priv;
|
2012-09-10 00:15:17 +00:00
|
|
|
|
|
|
|
/* Extract infos from the GstDiscovererInfo */
|
|
|
|
stream_list = gst_discoverer_info_get_stream_list (info);
|
|
|
|
for (tmp = stream_list; tmp; tmp = tmp->next) {
|
2012-12-21 17:28:16 +00:00
|
|
|
GESTrackType type = GES_TRACK_TYPE_UNKNOWN;
|
2012-09-10 00:15:17 +00:00
|
|
|
GstDiscovererStreamInfo *sinf = (GstDiscovererStreamInfo *) tmp->data;
|
|
|
|
|
|
|
|
if (GST_IS_DISCOVERER_AUDIO_INFO (sinf)) {
|
|
|
|
if (supportedformats == GES_TRACK_TYPE_UNKNOWN)
|
|
|
|
supportedformats = GES_TRACK_TYPE_AUDIO;
|
|
|
|
else
|
|
|
|
supportedformats |= GES_TRACK_TYPE_AUDIO;
|
|
|
|
|
2012-12-21 17:28:16 +00:00
|
|
|
type = GES_TRACK_TYPE_AUDIO;
|
2012-09-10 00:15:17 +00:00
|
|
|
} else if (GST_IS_DISCOVERER_VIDEO_INFO (sinf)) {
|
|
|
|
if (supportedformats == GES_TRACK_TYPE_UNKNOWN)
|
|
|
|
supportedformats = GES_TRACK_TYPE_VIDEO;
|
|
|
|
else
|
|
|
|
supportedformats |= GES_TRACK_TYPE_VIDEO;
|
|
|
|
if (gst_discoverer_video_info_is_image ((GstDiscovererVideoInfo *)
|
2012-12-21 17:28:16 +00:00
|
|
|
sinf))
|
2012-09-10 00:15:17 +00:00
|
|
|
priv->is_image = TRUE;
|
2012-12-21 17:28:16 +00:00
|
|
|
type = GES_TRACK_TYPE_VIDEO;
|
|
|
|
}
|
|
|
|
|
2013-01-26 17:07:01 +00:00
|
|
|
GST_DEBUG_OBJECT (self, "Creating GESUriSourceAsset for stream: %s",
|
2012-12-21 17:28:16 +00:00
|
|
|
gst_discoverer_stream_info_get_stream_id (sinf));
|
2013-01-26 17:07:01 +00:00
|
|
|
_create_uri_source_asset (self, sinf, type);
|
2012-09-10 00:15:17 +00:00
|
|
|
}
|
2013-01-27 15:51:52 +00:00
|
|
|
ges_clip_asset_set_supported_formats (GES_CLIP_ASSET
|
2012-12-21 21:51:26 +00:00
|
|
|
(self), supportedformats);
|
2012-09-10 00:15:17 +00:00
|
|
|
|
|
|
|
if (stream_list)
|
|
|
|
gst_discoverer_stream_info_list_free (stream_list);
|
|
|
|
|
|
|
|
if (priv->is_image == FALSE)
|
|
|
|
priv->duration = gst_discoverer_info_get_duration (info);
|
|
|
|
/* else we keep #GST_CLOCK_TIME_NONE */
|
|
|
|
|
2013-03-16 22:05:04 +00:00
|
|
|
priv->info = gst_object_ref (info);
|
2012-09-10 00:15:17 +00:00
|
|
|
}
|
|
|
|
|
2017-02-04 20:15:55 +00:00
|
|
|
static void
|
|
|
|
_set_meta_file_size (const gchar * uri, GESUriClipAsset * asset)
|
|
|
|
{
|
|
|
|
GError *error = NULL;
|
|
|
|
GFileInfo *file_info;
|
|
|
|
guint64 file_size;
|
|
|
|
|
|
|
|
GESMetaContainer *container = GES_META_CONTAINER (asset);
|
|
|
|
|
|
|
|
file_info = g_file_query_info (g_file_new_for_uri (uri), "standard::size",
|
|
|
|
G_FILE_QUERY_INFO_NONE, NULL, &error);
|
|
|
|
if (!error) {
|
|
|
|
file_size = g_file_info_get_attribute_uint64 (file_info, "standard::size");
|
|
|
|
ges_meta_container_register_meta_uint64 (container, GES_META_READ_WRITE,
|
|
|
|
"file-size", file_size);
|
|
|
|
} else {
|
|
|
|
g_error_free (error);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-09-10 00:15:17 +00:00
|
|
|
static void
|
|
|
|
_set_meta_foreach (const GstTagList * tags, const gchar * tag,
|
|
|
|
GESMetaContainer * container)
|
|
|
|
{
|
|
|
|
GValue value = { 0 };
|
|
|
|
|
2014-04-17 11:04:26 +00:00
|
|
|
if (gst_tag_list_copy_value (&value, tags, tag)) {
|
|
|
|
ges_meta_container_set_meta (container, tag, &value);
|
|
|
|
g_value_unset (&value);
|
|
|
|
} else {
|
|
|
|
GST_INFO ("Could not set metadata: %s", tag);
|
|
|
|
}
|
2012-09-10 00:15:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
discoverer_discovered_cb (GstDiscoverer * discoverer,
|
|
|
|
GstDiscovererInfo * info, GError * err, gpointer user_data)
|
|
|
|
{
|
2015-10-02 14:08:03 +00:00
|
|
|
GError *error = NULL;
|
2012-09-10 00:15:17 +00:00
|
|
|
const GstTagList *tags;
|
|
|
|
|
|
|
|
const gchar *uri = gst_discoverer_info_get_uri (info);
|
2013-01-20 15:44:57 +00:00
|
|
|
GESUriClipAsset *mfs =
|
|
|
|
GES_URI_CLIP_ASSET (ges_asset_cache_lookup (GES_TYPE_URI_CLIP, uri));
|
2012-09-10 00:15:17 +00:00
|
|
|
|
|
|
|
tags = gst_discoverer_info_get_tags (info);
|
|
|
|
if (tags)
|
|
|
|
gst_tag_list_foreach (tags, (GstTagForeachFunc) _set_meta_foreach, mfs);
|
|
|
|
|
2017-02-04 20:15:55 +00:00
|
|
|
_set_meta_file_size (uri, mfs);
|
|
|
|
|
2015-06-09 19:00:44 +00:00
|
|
|
if (gst_discoverer_info_get_result (info) == GST_DISCOVERER_OK) {
|
2013-01-20 15:44:57 +00:00
|
|
|
ges_uri_clip_asset_set_info (mfs, info);
|
2015-10-02 14:08:03 +00:00
|
|
|
} else {
|
|
|
|
if (err) {
|
|
|
|
error = g_error_copy (err);
|
|
|
|
} else {
|
|
|
|
error = g_error_new (GST_RESOURCE_ERROR, GST_RESOURCE_ERROR_FAILED,
|
|
|
|
"Stream %s discovering failed (error code: %d)",
|
|
|
|
uri, gst_discoverer_info_get_result (info));
|
|
|
|
}
|
2015-06-09 19:00:44 +00:00
|
|
|
}
|
|
|
|
|
2015-10-02 14:08:03 +00:00
|
|
|
ges_asset_cache_set_loaded (GES_TYPE_URI_CLIP, uri, error);
|
|
|
|
|
|
|
|
if (error)
|
|
|
|
g_error_free (error);
|
2012-09-10 00:15:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* API implementation */
|
|
|
|
/**
|
2013-01-20 15:44:57 +00:00
|
|
|
* ges_uri_clip_asset_get_info:
|
2012-09-10 00:15:17 +00:00
|
|
|
* @self: Target asset
|
|
|
|
*
|
|
|
|
* Gets #GstDiscovererInfo about the file
|
|
|
|
*
|
|
|
|
* Returns: (transfer none): #GstDiscovererInfo of specified asset
|
|
|
|
*/
|
|
|
|
GstDiscovererInfo *
|
2013-01-20 15:44:57 +00:00
|
|
|
ges_uri_clip_asset_get_info (const GESUriClipAsset * self)
|
2012-09-10 00:15:17 +00:00
|
|
|
{
|
2013-07-18 00:54:20 +00:00
|
|
|
g_return_val_if_fail (GES_IS_URI_CLIP_ASSET (self), NULL);
|
|
|
|
|
2012-09-10 00:15:17 +00:00
|
|
|
return self->priv->info;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2013-01-20 15:44:57 +00:00
|
|
|
* ges_uri_clip_asset_get_duration:
|
|
|
|
* @self: a #GESUriClipAsset
|
2012-09-10 00:15:17 +00:00
|
|
|
*
|
|
|
|
* Gets duration of the file represented by @self
|
|
|
|
*
|
|
|
|
* Returns: The duration of @self
|
|
|
|
*/
|
|
|
|
GstClockTime
|
2013-01-20 15:44:57 +00:00
|
|
|
ges_uri_clip_asset_get_duration (GESUriClipAsset * self)
|
2012-09-10 00:15:17 +00:00
|
|
|
{
|
2013-01-20 15:44:57 +00:00
|
|
|
g_return_val_if_fail (GES_IS_URI_CLIP_ASSET (self), GST_CLOCK_TIME_NONE);
|
2012-09-10 00:15:17 +00:00
|
|
|
|
|
|
|
return self->priv->duration;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2013-01-20 15:44:57 +00:00
|
|
|
* ges_uri_clip_asset_is_image:
|
2012-09-10 00:15:17 +00:00
|
|
|
* @self: a #indent: Standard input:311: Error:Unexpected end of file
|
2013-01-20 15:44:57 +00:00
|
|
|
GESUriClipAsset
|
2012-09-10 00:15:17 +00:00
|
|
|
*
|
|
|
|
* Gets Whether the file represented by @self is an image or not
|
|
|
|
*
|
|
|
|
* Returns: Whether the file represented by @self is an image or not
|
|
|
|
*/
|
|
|
|
gboolean
|
2013-01-20 15:44:57 +00:00
|
|
|
ges_uri_clip_asset_is_image (GESUriClipAsset * self)
|
2012-09-10 00:15:17 +00:00
|
|
|
{
|
2013-01-20 15:44:57 +00:00
|
|
|
g_return_val_if_fail (GES_IS_URI_CLIP_ASSET (self), FALSE);
|
2012-09-10 00:15:17 +00:00
|
|
|
|
|
|
|
return self->priv->is_image;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2013-01-20 15:44:57 +00:00
|
|
|
* ges_uri_clip_asset_new:
|
|
|
|
* @uri: The URI of the file for which to create a #GESUriClipAsset
|
2012-09-10 00:15:17 +00:00
|
|
|
* @cancellable: optional %GCancellable object, %NULL to ignore.
|
|
|
|
* @callback: (scope async): a #GAsyncReadyCallback to call when the initialization is finished
|
|
|
|
* @user_data: The user data to pass when @callback is called
|
|
|
|
*
|
2013-01-20 15:44:57 +00:00
|
|
|
* Creates a #GESUriClipAsset for @uri
|
2012-09-10 00:15:17 +00:00
|
|
|
*
|
2013-01-20 15:44:57 +00:00
|
|
|
* Example of request of a GESUriClipAsset:
|
2012-09-10 00:15:17 +00:00
|
|
|
* |[
|
|
|
|
* // The request callback
|
|
|
|
* static void
|
|
|
|
* filesource_asset_loaded_cb (GESAsset * source, GAsyncResult * res, gpointer user_data)
|
|
|
|
* {
|
|
|
|
* GError *error = NULL;
|
2013-01-20 15:44:57 +00:00
|
|
|
* GESUriClipAsset *filesource_asset;
|
2012-09-10 00:15:17 +00:00
|
|
|
*
|
2013-01-20 15:44:57 +00:00
|
|
|
* filesource_asset = GES_URI_CLIP_ASSET (ges_asset_request_finish (res, &error));
|
2012-09-10 00:15:17 +00:00
|
|
|
* if (filesource_asset) {
|
|
|
|
* g_print ("The file: %s is usable as a FileSource, it is%s an image and lasts %" GST_TIME_FORMAT,
|
|
|
|
* ges_asset_get_id (GES_ASSET (filesource_asset))
|
2013-01-20 15:44:57 +00:00
|
|
|
* ges_uri_clip_asset_is_image (filesource_asset) ? "" : " not",
|
|
|
|
* GST_TIME_ARGS (ges_uri_clip_asset_get_duration (filesource_asset));
|
2012-09-10 00:15:17 +00:00
|
|
|
* } else {
|
|
|
|
* g_print ("The file: %s is *not* usable as a FileSource because: %s",
|
|
|
|
* ges_asset_get_id (source), error->message);
|
|
|
|
* }
|
|
|
|
*
|
2013-03-16 22:05:04 +00:00
|
|
|
* gst_object_unref (mfs);
|
2012-09-10 00:15:17 +00:00
|
|
|
* }
|
|
|
|
*
|
|
|
|
* // The request:
|
2013-01-20 15:44:57 +00:00
|
|
|
* ges_uri_clip_asset_new (uri, (GAsyncReadyCallback) filesource_asset_loaded_cb, user_data);
|
2012-09-10 00:15:17 +00:00
|
|
|
* ]|
|
|
|
|
*/
|
|
|
|
void
|
2013-01-20 15:44:57 +00:00
|
|
|
ges_uri_clip_asset_new (const gchar * uri, GCancellable * cancellable,
|
2012-09-10 00:15:17 +00:00
|
|
|
GAsyncReadyCallback callback, gpointer user_data)
|
|
|
|
{
|
2013-01-20 15:44:57 +00:00
|
|
|
ges_asset_request_async (GES_TYPE_URI_CLIP, uri, cancellable,
|
2012-09-10 00:15:17 +00:00
|
|
|
callback, user_data);
|
|
|
|
}
|
|
|
|
|
2013-03-19 22:49:09 +00:00
|
|
|
/**
|
2013-04-30 17:16:10 +00:00
|
|
|
* ges_uri_clip_asset_request_sync:
|
2013-11-12 11:13:31 +00:00
|
|
|
* @uri: The URI of the file for which to create a #GESUriClipAsset.
|
|
|
|
* You can also use multi file uris for #GESMultiFileSource.
|
2013-03-19 22:49:09 +00:00
|
|
|
* @error: (allow-none): An error to be set in case something wrong happens or %NULL
|
|
|
|
*
|
|
|
|
* Creates a #GESUriClipAsset for @uri syncronously. You should avoid
|
|
|
|
* to use it in application, and rather create #GESUriClipAsset asynchronously
|
|
|
|
*
|
2016-05-14 23:04:17 +00:00
|
|
|
* Returns: (transfer none) (nullable): A reference to the requested asset or
|
|
|
|
* %NULL if an error happened
|
2013-03-19 22:49:09 +00:00
|
|
|
*/
|
|
|
|
GESUriClipAsset *
|
|
|
|
ges_uri_clip_asset_request_sync (const gchar * uri, GError ** error)
|
|
|
|
{
|
|
|
|
GError *lerror = NULL;
|
|
|
|
GstDiscovererInfo *info;
|
|
|
|
GstDiscoverer *discoverer;
|
|
|
|
GESUriClipAsset *asset;
|
2013-11-12 11:13:31 +00:00
|
|
|
gchar *first_file, *first_file_uri;
|
2013-03-19 22:49:09 +00:00
|
|
|
|
|
|
|
asset = GES_URI_CLIP_ASSET (ges_asset_request (GES_TYPE_URI_CLIP, uri,
|
|
|
|
&lerror));
|
|
|
|
|
|
|
|
if (asset)
|
|
|
|
return asset;
|
|
|
|
|
2013-03-22 20:39:04 +00:00
|
|
|
if (lerror && lerror->domain == GES_ERROR &&
|
|
|
|
lerror->code == GES_ERROR_ASSET_WRONG_ID) {
|
2013-03-19 22:49:09 +00:00
|
|
|
g_propagate_error (error, lerror);
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
asset = g_object_new (GES_TYPE_URI_CLIP_ASSET, "id", uri,
|
|
|
|
"extractable-type", GES_TYPE_URI_CLIP, NULL);
|
|
|
|
discoverer = GES_URI_CLIP_ASSET_GET_CLASS (asset)->sync_discoverer;
|
2013-11-12 11:13:31 +00:00
|
|
|
|
|
|
|
if (g_str_has_prefix (uri, GES_MULTI_FILE_URI_PREFIX)) {
|
|
|
|
GESMultiFileURI *uri_data;
|
|
|
|
|
|
|
|
uri_data = ges_multi_file_uri_new (uri);
|
|
|
|
first_file = g_strdup_printf (uri_data->location, uri_data->start);
|
|
|
|
first_file_uri = gst_filename_to_uri (first_file, &lerror);
|
|
|
|
info = gst_discoverer_discover_uri (discoverer, first_file_uri, &lerror);
|
|
|
|
GST_DEBUG ("Got multifile uri. Discovering first file %s", first_file_uri);
|
|
|
|
g_free (uri_data);
|
|
|
|
g_free (first_file_uri);
|
|
|
|
g_free (first_file);
|
|
|
|
} else {
|
|
|
|
info = gst_discoverer_discover_uri (discoverer, uri, &lerror);
|
|
|
|
}
|
|
|
|
|
2016-06-06 14:44:15 +00:00
|
|
|
/* We might get a discoverer info but it might have a non-OK result. We
|
|
|
|
* should consider that an error */
|
|
|
|
if (!lerror && info
|
|
|
|
&& gst_discoverer_info_get_result (info) != GST_DISCOVERER_OK) {
|
|
|
|
lerror =
|
|
|
|
g_error_new (GST_RESOURCE_ERROR, GST_RESOURCE_ERROR_FAILED,
|
|
|
|
"Stream %s discovering failed (error code: %d)", uri,
|
|
|
|
gst_discoverer_info_get_result (info));
|
|
|
|
}
|
|
|
|
|
2017-02-04 20:15:55 +00:00
|
|
|
_set_meta_file_size (uri, asset);
|
|
|
|
|
2014-11-03 10:55:29 +00:00
|
|
|
ges_asset_cache_put (gst_object_ref (asset), NULL);
|
|
|
|
ges_uri_clip_asset_set_info (asset, info);
|
|
|
|
ges_asset_cache_set_loaded (GES_TYPE_URI_CLIP, uri, lerror);
|
|
|
|
|
2013-03-19 22:49:09 +00:00
|
|
|
if (info == NULL || lerror != NULL) {
|
|
|
|
gst_object_unref (asset);
|
2016-06-06 14:44:15 +00:00
|
|
|
if (info)
|
|
|
|
gst_discoverer_info_unref (info);
|
2013-03-19 22:49:09 +00:00
|
|
|
if (lerror)
|
|
|
|
g_propagate_error (error, lerror);
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
return asset;
|
|
|
|
}
|
|
|
|
|
2012-09-10 00:15:17 +00:00
|
|
|
/**
|
2013-04-22 00:13:00 +00:00
|
|
|
* ges_uri_clip_asset_class_set_timeout:
|
2013-11-13 12:18:00 +00:00
|
|
|
* @klass: The #GESUriClipAssetClass on which to set the discoverer timeout
|
2012-09-10 00:15:17 +00:00
|
|
|
* @timeout: The timeout to set
|
|
|
|
*
|
2013-01-20 15:44:57 +00:00
|
|
|
* Sets the timeout of #GESUriClipAsset loading
|
2012-09-10 00:15:17 +00:00
|
|
|
*/
|
|
|
|
void
|
2013-11-13 12:18:00 +00:00
|
|
|
ges_uri_clip_asset_class_set_timeout (GESUriClipAssetClass * klass,
|
2012-09-10 00:15:17 +00:00
|
|
|
GstClockTime timeout)
|
|
|
|
{
|
2013-11-13 12:18:00 +00:00
|
|
|
g_return_if_fail (GES_IS_URI_CLIP_ASSET_CLASS (klass));
|
2012-09-10 00:15:17 +00:00
|
|
|
|
2013-11-13 12:18:00 +00:00
|
|
|
g_object_set (klass->discoverer, "timeout", timeout, NULL);
|
|
|
|
g_object_set (klass->sync_discoverer, "timeout", timeout, NULL);
|
2012-09-10 00:15:17 +00:00
|
|
|
}
|
2012-12-21 17:28:16 +00:00
|
|
|
|
|
|
|
/**
|
2013-01-20 15:44:57 +00:00
|
|
|
* ges_uri_clip_asset_get_stream_assets:
|
|
|
|
* @self: A #GESUriClipAsset
|
2012-12-21 17:28:16 +00:00
|
|
|
*
|
2013-01-26 17:07:01 +00:00
|
|
|
* Get the GESUriSourceAsset @self containes
|
2012-12-21 17:28:16 +00:00
|
|
|
*
|
2013-01-26 17:07:01 +00:00
|
|
|
* Returns: (transfer none) (element-type GESUriSourceAsset): a
|
|
|
|
* #GList of #GESUriSourceAsset
|
2012-12-21 17:28:16 +00:00
|
|
|
*/
|
|
|
|
const GList *
|
2013-01-20 15:44:57 +00:00
|
|
|
ges_uri_clip_asset_get_stream_assets (GESUriClipAsset * self)
|
2012-12-21 17:28:16 +00:00
|
|
|
{
|
2013-01-20 15:44:57 +00:00
|
|
|
g_return_val_if_fail (GES_IS_URI_CLIP_ASSET (self), FALSE);
|
2012-12-21 17:28:16 +00:00
|
|
|
|
|
|
|
return self->priv->asset_trackfilesources;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*****************************************************************
|
2013-01-26 17:07:01 +00:00
|
|
|
* GESUriSourceAsset implementation *
|
2012-12-21 17:28:16 +00:00
|
|
|
*****************************************************************/
|
|
|
|
/**
|
2014-04-07 19:02:48 +00:00
|
|
|
* SECTION: gesurisourceasset
|
2017-03-08 21:13:48 +00:00
|
|
|
* @title: GESUriClipAsset
|
2013-01-26 17:07:01 +00:00
|
|
|
* @short_description: A GESAsset subclass specialized in GESUriSource extraction
|
2012-12-21 17:28:16 +00:00
|
|
|
*
|
|
|
|
* NOTE: You should never request such a #GESAsset as they will be created automatically
|
2013-01-20 15:44:57 +00:00
|
|
|
* by #GESUriClipAsset-s.
|
2012-12-21 17:28:16 +00:00
|
|
|
*/
|
|
|
|
|
2013-01-26 17:07:01 +00:00
|
|
|
G_DEFINE_TYPE (GESUriSourceAsset, ges_uri_source_asset,
|
2013-01-26 17:14:57 +00:00
|
|
|
GES_TYPE_TRACK_ELEMENT_ASSET);
|
2012-12-21 17:28:16 +00:00
|
|
|
|
|
|
|
static GESExtractable *
|
|
|
|
_extract (GESAsset * asset, GError ** error)
|
|
|
|
{
|
2015-09-24 04:41:30 +00:00
|
|
|
gchar *uri = NULL;
|
2013-01-26 15:31:33 +00:00
|
|
|
GESTrackElement *trackelement;
|
2013-05-23 17:16:22 +00:00
|
|
|
GESUriSourceAssetPrivate *priv = GES_URI_SOURCE_ASSET (asset)->priv;
|
2012-12-21 17:28:16 +00:00
|
|
|
|
|
|
|
if (GST_IS_DISCOVERER_STREAM_INFO (priv->sinfo) == FALSE) {
|
|
|
|
GST_WARNING_OBJECT (asset, "Can not extract as no strean info set");
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (priv->uri == NULL) {
|
|
|
|
GST_WARNING_OBJECT (asset, "Can not extract as no uri set");
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2015-09-24 04:41:30 +00:00
|
|
|
uri = g_strdup (priv->uri);
|
|
|
|
|
2013-11-12 11:13:31 +00:00
|
|
|
if (g_str_has_prefix (priv->uri, GES_MULTI_FILE_URI_PREFIX)) {
|
2015-09-24 04:41:30 +00:00
|
|
|
trackelement = GES_TRACK_ELEMENT (ges_multi_file_source_new (uri));
|
2013-11-12 11:13:31 +00:00
|
|
|
} else if (GST_IS_DISCOVERER_VIDEO_INFO (priv->sinfo)
|
|
|
|
&& gst_discoverer_video_info_is_image ((GstDiscovererVideoInfo *)
|
2013-03-20 00:07:58 +00:00
|
|
|
priv->sinfo))
|
2015-09-24 04:41:30 +00:00
|
|
|
trackelement = GES_TRACK_ELEMENT (ges_image_source_new (uri));
|
2013-07-09 13:31:15 +00:00
|
|
|
else if (GST_IS_DISCOVERER_VIDEO_INFO (priv->sinfo))
|
2015-09-24 04:41:30 +00:00
|
|
|
trackelement = GES_TRACK_ELEMENT (ges_video_uri_source_new (uri));
|
2013-03-20 00:07:58 +00:00
|
|
|
else
|
2015-09-24 04:41:30 +00:00
|
|
|
trackelement = GES_TRACK_ELEMENT (ges_audio_uri_source_new (uri));
|
2013-07-09 13:31:15 +00:00
|
|
|
|
2013-03-20 00:07:58 +00:00
|
|
|
ges_track_element_set_track_type (trackelement,
|
|
|
|
ges_track_element_asset_get_track_type (GES_TRACK_ELEMENT_ASSET (asset)));
|
2012-12-21 17:28:16 +00:00
|
|
|
|
2015-09-24 04:41:30 +00:00
|
|
|
g_free (uri);
|
|
|
|
|
2013-01-26 15:31:33 +00:00
|
|
|
return GES_EXTRACTABLE (trackelement);
|
2012-12-21 17:28:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2013-01-26 17:07:01 +00:00
|
|
|
ges_uri_source_asset_class_init (GESUriSourceAssetClass * klass)
|
2012-12-21 17:28:16 +00:00
|
|
|
{
|
2013-01-26 17:07:01 +00:00
|
|
|
g_type_class_add_private (klass, sizeof (GESUriSourceAssetPrivate));
|
2012-12-21 17:28:16 +00:00
|
|
|
|
|
|
|
GES_ASSET_CLASS (klass)->extract = _extract;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2013-01-26 17:07:01 +00:00
|
|
|
ges_uri_source_asset_init (GESUriSourceAsset * self)
|
2012-12-21 17:28:16 +00:00
|
|
|
{
|
2013-01-26 17:07:01 +00:00
|
|
|
GESUriSourceAssetPrivate *priv;
|
2012-12-21 17:28:16 +00:00
|
|
|
|
|
|
|
priv = self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self,
|
2013-05-23 17:16:22 +00:00
|
|
|
GES_TYPE_URI_SOURCE_ASSET, GESUriSourceAssetPrivate);
|
2012-12-21 17:28:16 +00:00
|
|
|
|
|
|
|
priv->sinfo = NULL;
|
|
|
|
priv->parent_asset = NULL;
|
|
|
|
priv->uri = NULL;
|
|
|
|
}
|
|
|
|
|
2012-12-21 23:17:41 +00:00
|
|
|
/**
|
2013-01-26 17:07:01 +00:00
|
|
|
* ges_uri_source_asset_get_stream_info:
|
2013-01-20 15:44:57 +00:00
|
|
|
* @asset: A #GESUriClipAsset
|
2012-12-21 23:17:41 +00:00
|
|
|
*
|
|
|
|
* Get the #GstDiscovererStreamInfo user by @asset
|
|
|
|
*
|
2013-01-20 15:44:57 +00:00
|
|
|
* Returns: (transfer none): a #GESUriClipAsset
|
2012-12-21 23:17:41 +00:00
|
|
|
*/
|
2012-12-21 17:28:16 +00:00
|
|
|
GstDiscovererStreamInfo *
|
2013-01-26 17:07:01 +00:00
|
|
|
ges_uri_source_asset_get_stream_info (GESUriSourceAsset * asset)
|
2012-12-21 17:28:16 +00:00
|
|
|
{
|
2013-05-23 17:16:22 +00:00
|
|
|
g_return_val_if_fail (GES_IS_URI_SOURCE_ASSET (asset), NULL);
|
2012-12-21 17:28:16 +00:00
|
|
|
|
|
|
|
return asset->priv->sinfo;
|
|
|
|
}
|
|
|
|
|
|
|
|
const gchar *
|
2013-01-26 17:07:01 +00:00
|
|
|
ges_uri_source_asset_get_stream_uri (GESUriSourceAsset * asset)
|
2012-12-21 17:28:16 +00:00
|
|
|
{
|
2013-05-23 17:16:22 +00:00
|
|
|
g_return_val_if_fail (GES_IS_URI_SOURCE_ASSET (asset), NULL);
|
2012-12-21 17:28:16 +00:00
|
|
|
|
|
|
|
return asset->priv->uri;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2013-01-26 17:07:01 +00:00
|
|
|
* ges_uri_source_asset_get_filesource_asset:
|
2013-01-20 15:44:57 +00:00
|
|
|
* @asset: A #GESUriClipAsset
|
2012-12-21 17:28:16 +00:00
|
|
|
*
|
2013-01-20 15:44:57 +00:00
|
|
|
* Get the #GESUriClipAsset @self is contained in
|
2012-12-21 17:28:16 +00:00
|
|
|
*
|
2013-01-20 15:44:57 +00:00
|
|
|
* Returns: a #GESUriClipAsset
|
2012-12-21 17:28:16 +00:00
|
|
|
*/
|
2013-01-20 15:44:57 +00:00
|
|
|
const GESUriClipAsset *
|
2013-01-26 17:07:01 +00:00
|
|
|
ges_uri_source_asset_get_filesource_asset (GESUriSourceAsset * asset)
|
2012-12-21 17:28:16 +00:00
|
|
|
{
|
2013-05-23 17:16:22 +00:00
|
|
|
g_return_val_if_fail (GES_IS_URI_SOURCE_ASSET (asset), NULL);
|
2012-12-21 17:28:16 +00:00
|
|
|
|
|
|
|
return asset->priv->parent_asset;
|
|
|
|
}
|
2017-02-06 11:07:26 +00:00
|
|
|
|
|
|
|
void
|
|
|
|
_ges_uri_asset_cleanup (void)
|
|
|
|
{
|
|
|
|
g_clear_object (&discoverer);
|
|
|
|
g_clear_object (&sync_discoverer);
|
|
|
|
}
|