mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 12:11:13 +00:00
uri-clip-asset: Add file-size metadata
Add file-size metadata to GESUriClipAsset. Reviewed-by: Thibault Saunier <thibault.saunier@osg.samsung.com> Reviewed-by: Thibault Saunier <thibault.saunier@collabora.com> Differential Revision: https://phabricator.freedesktop.org/D1645
This commit is contained in:
parent
a563578b0a
commit
7ba2c22ccb
1 changed files with 24 additions and 0 deletions
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue