[gnac/devel] Added video thumbnail in metadata
- From: Benoît Dupasquier <bdupasqu src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnac/devel] Added video thumbnail in metadata
- Date: Sat, 17 Jul 2010 11:30:27 +0000 (UTC)
commit e5e0edbf0bc9750a5ee78dc9b092d58b2e89be37
Author: Benoît Dupasquier <bdupasqu src gnome org>
Date: Sat Jul 17 12:29:54 2010 +0100
Added video thumbnail in metadata
libgnac/libgnac-metadata.c | 33 +++++++++++++++++++++++++--------
libgnac/libgnac-output.c | 4 ++--
src/gnac-main.c | 10 ++++++----
src/gnac-utils.c | 4 ++--
4 files changed, 35 insertions(+), 16 deletions(-)
---
diff --git a/libgnac/libgnac-metadata.c b/libgnac/libgnac-metadata.c
index 2ccf30e..09da337 100644
--- a/libgnac/libgnac-metadata.c
+++ b/libgnac/libgnac-metadata.c
@@ -558,16 +558,20 @@ libgnac_metadata_autoplug_continue_cb(GstElement *decodebin,
static void
libgnac_metadata_get_file_info(GFile *uri, LibgnacMetadata *md)
{
- gchar *path;
- GError *error = NULL;
- GFileInfo *info;
- GValue *file_size_value;
- GValue *filename_value;
- GValue *location_value;
+ gchar *path;
+ GError *error = NULL;
+ GFileInfo *info;
+ GValue *file_size_value;
+ GValue *filename_value;
+ GValue *location_value;
+ const gchar *thumbnail_path;
info = g_file_query_info(uri,
- "standard::display-name,standard::size", G_FILE_QUERY_INFO_NONE,
- NULL, &error);
+ G_FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME ","
+ G_FILE_ATTRIBUTE_STANDARD_ICON ","
+ G_FILE_ATTRIBUTE_STANDARD_SIZE ","
+ G_FILE_ATTRIBUTE_THUMBNAIL_PATH,
+ G_FILE_QUERY_INFO_NONE, NULL, &error);
if (error) {
g_clear_error(&error);
@@ -593,6 +597,19 @@ libgnac_metadata_get_file_info(GFile *uri, LibgnacMetadata *md)
g_value_set_string(filename_value, g_file_info_get_display_name(info));
g_hash_table_insert(md->priv->metadata, GNAC_TAG_FILENAME, filename_value);
+ /* image */
+ thumbnail_path = g_file_info_get_attribute_byte_string(info,
+ G_FILE_ATTRIBUTE_THUMBNAIL_PATH);
+ if (thumbnail_path) {
+ GdkPixbuf *pixbuf;
+ GValue *value;
+ pixbuf = gdk_pixbuf_new_from_file(thumbnail_path, NULL);
+ value = g_new0(GValue, 1);
+ g_value_init(value, G_TYPE_OBJECT);
+ g_value_set_object(value, pixbuf);
+ g_hash_table_insert(md->priv->metadata, GST_TAG_IMAGE, value);
+ }
+
/* cleanup */
g_free(path);
g_object_unref(info);
diff --git a/libgnac/libgnac-output.c b/libgnac/libgnac-output.c
index d6ee92a..a38b4f8 100644
--- a/libgnac/libgnac-output.c
+++ b/libgnac/libgnac-output.c
@@ -104,8 +104,8 @@ libgnac_output_remove_extension_from_file(GFile *source_uri,
g_return_val_if_fail(source_uri, NULL);
info = g_file_query_info(source_uri,
- G_FILE_ATTRIBUTE_STANDARD_NAME, G_FILE_QUERY_INFO_NONE,
- NULL, &err);
+ G_FILE_ATTRIBUTE_STANDARD_NAME,
+ G_FILE_QUERY_INFO_NONE, NULL, &err);
if (err) {
libgnac_debug("Unable to query GFile information");
diff --git a/src/gnac-main.c b/src/gnac-main.c
index 5adfadb..320c06c 100644
--- a/src/gnac-main.c
+++ b/src/gnac-main.c
@@ -351,8 +351,9 @@ gnac_add_file(GFile *file)
GtkFileFilterInfo filter_info;
libgnac_debug("Trying to add file %s", g_file_get_uri(file));
- info = g_file_query_info(file, G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE,
- G_FILE_QUERY_INFO_NONE, NULL, &error);
+ info = g_file_query_info(file,
+ G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE,
+ G_FILE_QUERY_INFO_NONE, NULL, &error);
if (error) {
/* Error adding file */
libgnac_debug("Unable to query file info");
@@ -481,8 +482,9 @@ gnac_on_converter_overwrite_cb(LibgnacConverter *converter,
GError *error = NULL;
uri = (GFile*) file;
- info = g_file_query_info(uri, G_FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME,
- G_FILE_QUERY_INFO_NONE, NULL, &error);
+ info = g_file_query_info(uri,
+ G_FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME,
+ G_FILE_QUERY_INFO_NONE, NULL, &error);
if (!remember_overwrite)
{
diff --git a/src/gnac-utils.c b/src/gnac-utils.c
index daf617b..5eb80c4 100644
--- a/src/gnac-utils.c
+++ b/src/gnac-utils.c
@@ -52,8 +52,8 @@ gnac_utils_get_display_name(const gchar *uri,
file = g_file_new_for_uri(uri);
info = g_file_query_info(file,
- G_FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME, G_FILE_QUERY_INFO_NONE,
- NULL, &err);
+ G_FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME,
+ G_FILE_QUERY_INFO_NONE, NULL, &err);
if (err) {
g_propagate_error(error, err);
return NULL;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]