Commit 7ba2c22c authored by namanyadav12's avatar namanyadav12 Committed by Thibault Saunier
Browse files

uri-clip-asset: Add file-size metadata



Add file-size metadata to GESUriClipAsset.
Reviewed-by: default avatarThibault Saunier <thibault.saunier@osg.samsung.com>
Reviewed-by: default avatarThibault Saunier <thibault.saunier@collabora.com>
Differential Revision: https://phabricator.freedesktop.org/D1645
parent a563578b
......@@ -342,6 +342,26 @@ ges_uri_clip_asset_set_info (GESUriClipAsset * self, GstDiscovererInfo * info)
priv->info = gst_object_ref (info);
}
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);
}
}
static void
_set_meta_foreach (const GstTagList * tags, const gchar * tag,
GESMetaContainer * container)
......@@ -371,6 +391,8 @@ discoverer_discovered_cb (GstDiscoverer * discoverer,
if (tags)
gst_tag_list_foreach (tags, (GstTagForeachFunc) _set_meta_foreach, mfs);
_set_meta_file_size (uri, mfs);
if (gst_discoverer_info_get_result (info) == GST_DISCOVERER_OK) {
ges_uri_clip_asset_set_info (mfs, info);
} else {
......@@ -546,6 +568,8 @@ ges_uri_clip_asset_request_sync (const gchar * uri, GError ** error)
gst_discoverer_info_get_result (info));
}
_set_meta_file_size (uri, asset);
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);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment