[gthumb/ext: 3/18] unified duration and dimensions metadata for videos and pictures
- From: Paolo Bacchilega <paobac src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gthumb/ext: 3/18] unified duration and dimensions metadata for videos and pictures
- Date: Fri, 6 Nov 2009 00:15:50 +0000 (UTC)
commit 41b1c636fc922411a9a73fae55c3c39804449c0a
Author: Paolo Bacchilega <paobac src gnome org>
Date: Sun Nov 1 22:28:25 2009 +0100
unified duration and dimensions metadata for videos and pictures
extensions/gstreamer/gstreamer-utils.c | 14 +++++++++-----
.../gstreamer/gth-metadata-provider-gstreamer.c | 2 +-
extensions/gstreamer/main.c | 18 +++++++-----------
extensions/image_viewer/gth-image-viewer-page.c | 2 +-
.../image_viewer/gth-metadata-provider-image.c | 6 +++---
extensions/image_viewer/main.c | 15 ---------------
gthumb/gth-browser.c | 2 +-
gthumb/gth-main-default-metadata.c | 5 +++++
8 files changed, 27 insertions(+), 37 deletions(-)
---
diff --git a/extensions/gstreamer/gstreamer-utils.c b/extensions/gstreamer/gstreamer-utils.c
index f2f393d..540b764 100644
--- a/extensions/gstreamer/gstreamer-utils.c
+++ b/extensions/gstreamer/gstreamer-utils.c
@@ -150,7 +150,11 @@ add_metadata (GFileInfo *info,
if (raw == NULL)
return;
- if (strcmp (key, "audio-video::general::duration") == 0) {
+ if (strcmp (key, "general::size") == 0) {
+ g_file_info_set_attribute_string (info, key, raw);
+ return;
+ }
+ else if (strcmp (key, "general::duration") == 0) {
int secs;
g_free (formatted);
@@ -297,7 +301,7 @@ tag_iterate (const GstTagList *list,
tag_key = NULL;
if (strcmp (tag, "container-format") == 0) {
- tag_key = "audio-video::general::container-format";
+ tag_key = "general::format";
}
else if (strcmp (tag, "bitrate") == 0) {
tag_key = "audio-video::general::bitrate";
@@ -402,7 +406,7 @@ extract_metadata (MetadataExtractor *extractor,
if ((extractor->video_height >= 0) && (extractor->video_width >= 0))
add_metadata (info,
- "audio-video::video::size",
+ "general::size",
g_strdup_printf ("%d x %d", (guint) extractor->video_width, (guint) extractor->video_height),
NULL);
@@ -421,7 +425,7 @@ extract_metadata (MetadataExtractor *extractor,
duration = get_media_duration (extractor);
if (duration >= 0)
add_metadata (info,
- "audio-video::general::duration",
+ "general::duration",
g_strdup_printf ("%" G_GINT64_FORMAT, duration),
g_strdup_printf ("%" G_GINT64_FORMAT " sec", duration));
@@ -630,7 +634,7 @@ message_loop_to_state_change (MetadataExtractor *extractor,
gst_message_parse_error (message, &gsterror, &debug);
- g_warning ("Error: %s (%s)", gsterror->message, debug);
+ /*g_warning ("Error: %s (%s)", gsterror->message, debug);*/
g_error_free (gsterror);
gst_message_unref (message);
diff --git a/extensions/gstreamer/gth-metadata-provider-gstreamer.c b/extensions/gstreamer/gth-metadata-provider-gstreamer.c
index f5e003d..351603d 100644
--- a/extensions/gstreamer/gth-metadata-provider-gstreamer.c
+++ b/extensions/gstreamer/gth-metadata-provider-gstreamer.c
@@ -82,7 +82,7 @@ gth_metadata_provider_constructor (GType type,
obj = parent_class->constructor (type, n_construct_properties, construct_properties);
self = GTH_METADATA_PROVIDER (obj);
- g_object_set (self, "readable-attributes", "audio-video::*", NULL);
+ g_object_set (self, "readable-attributes", "general::format,general::size,audio-video::*", NULL);
return obj;
}
diff --git a/extensions/gstreamer/main.c b/extensions/gstreamer/main.c
index 340c021..3ef81b8 100644
--- a/extensions/gstreamer/main.c
+++ b/extensions/gstreamer/main.c
@@ -28,7 +28,6 @@
GthMetadataCategory gstreamer_metadata_category[] = {
- { "audio-video::general", N_("General"), 30 },
{ "audio-video::video", N_("Video"), 40 },
{ "audio-video::audio", N_("Audio"), 50 },
{ "audio-video::other", N_("Other"), 60 },
@@ -37,16 +36,13 @@ GthMetadataCategory gstreamer_metadata_category[] = {
GthMetadataInfo gstreamer_metadata_info[] = {
- { "audio-video::general::title", N_("Title"), "audio-video::general", 1, GTH_METADATA_ALLOW_EVERYWHERE },
- { "audio-video::general::artist", N_("Artist"), "audio-video::general", 2, GTH_METADATA_ALLOW_EVERYWHERE },
- { "audio-video::general::album", N_("Album"), "audio-video::general", 3, GTH_METADATA_ALLOW_EVERYWHERE },
- { "audio-video::general::duration", N_("Duration"), "audio-video::general", 4, GTH_METADATA_ALLOW_EVERYWHERE },
- { "audio-video::general::bitrate", N_("Bitrate"), "audio-video::general", 5, GTH_METADATA_ALLOW_IN_PROPERTIES_VIEW },
- { "audio-video::general::container-format", N_("Container Format"), "audio-video::general", 6, GTH_METADATA_ALLOW_IN_PROPERTIES_VIEW },
- { "audio-video::general::encoder", N_("Encoder"), "audio-video::general", 7, GTH_METADATA_ALLOW_IN_PROPERTIES_VIEW },
-
- { "audio-video::video::size", N_("Dimensions"), "audio-video::video", 1, GTH_METADATA_ALLOW_EVERYWHERE },
- { "audio-video::video::codec", N_("Codec"), "audio-video::video", 2, GTH_METADATA_ALLOW_EVERYWHERE },
+ { "audio-video::general::title", N_("Title"), "general", 1, GTH_METADATA_ALLOW_EVERYWHERE },
+ { "audio-video::general::artist", N_("Artist"), "general", 2, GTH_METADATA_ALLOW_EVERYWHERE },
+ { "audio-video::general::album", N_("Album"), "general", 3, GTH_METADATA_ALLOW_EVERYWHERE },
+ { "audio-video::general::bitrate", N_("Bitrate"), "general", 20, GTH_METADATA_ALLOW_IN_PROPERTIES_VIEW },
+ { "audio-video::general::encoder", N_("Encoder"), "general", 21, GTH_METADATA_ALLOW_IN_PROPERTIES_VIEW },
+
+ { "audio-video::video::codec", N_("Codec"), "audio-video::video", 2, GTH_METADATA_ALLOW_IN_PROPERTIES_VIEW },
{ "audio-video::video::framerate", N_("Framerate"), "audio-video::video", 3, GTH_METADATA_ALLOW_IN_PROPERTIES_VIEW },
{ "audio-video::video::width", N_("Width"), "audio-video::video", 0, GTH_METADATA_ALLOW_NOWHERE },
{ "audio-video::video::height", N_("Height"), "audio-video::video", 0, GTH_METADATA_ALLOW_NOWHERE },
diff --git a/extensions/image_viewer/gth-image-viewer-page.c b/extensions/image_viewer/gth-image-viewer-page.c
index 6286449..5664657 100644
--- a/extensions/image_viewer/gth-image-viewer-page.c
+++ b/extensions/image_viewer/gth-image-viewer-page.c
@@ -1032,7 +1032,7 @@ _gth_image_viewer_page_set_pixbuf (GthImageViewerPage *self,
g_file_info_set_attribute_int32 (file_data->info, "image::height", height);
size = g_strdup_printf ("%d x %d", width, height);
- g_file_info_set_attribute_string (file_data->info, "image::size", size);
+ g_file_info_set_attribute_string (file_data->info, "general::size", size);
gth_monitor_metadata_changed (gth_main_get_default_monitor (), file_data);
diff --git a/extensions/image_viewer/gth-metadata-provider-image.c b/extensions/image_viewer/gth-metadata-provider-image.c
index 6358567..b30d6f0 100644
--- a/extensions/image_viewer/gth-metadata-provider-image.c
+++ b/extensions/image_viewer/gth-metadata-provider-image.c
@@ -57,13 +57,13 @@ gth_metadata_provider_image_read (GthMetadataProvider *self,
if (format != NULL) {
char *size;
- g_file_info_set_attribute_string (file_data->info, "image::format", gdk_pixbuf_format_get_description (format));
+ g_file_info_set_attribute_string (file_data->info, "general::format", gdk_pixbuf_format_get_description (format));
g_file_info_set_attribute_int32 (file_data->info, "image::width", width);
g_file_info_set_attribute_int32 (file_data->info, "image::height", height);
size = g_strdup_printf ("%d x %d", width, height);
- g_file_info_set_attribute_string (file_data->info, "image::size", size);
+ g_file_info_set_attribute_string (file_data->info, "general::size", size);
g_free (size);
}
@@ -96,7 +96,7 @@ gth_metadata_provider_constructor (GType type,
obj = parent_class->constructor (type, n_construct_properties, construct_properties);
self = GTH_METADATA_PROVIDER (obj);
- g_object_set (self, "readable-attributes", "image::format,image::size,image::width,image::height", NULL);
+ g_object_set (self, "readable-attributes", "general::format,general::size,image::width,image::height", NULL);
return obj;
}
diff --git a/extensions/image_viewer/main.c b/extensions/image_viewer/main.c
index 2536443..7c5a5f4 100644
--- a/extensions/image_viewer/main.c
+++ b/extensions/image_viewer/main.c
@@ -29,24 +29,9 @@
#include "preferences.h"
-GthMetadataCategory image_metadata_category[] = {
- { "image", N_("Image"), 5 },
- { NULL, NULL, 0 }
-};
-
-
-GthMetadataInfo image_metadata_info[] = {
- { "image::size", N_("Dimensions"), "image", 1, GTH_METADATA_ALLOW_IN_PROPERTIES_VIEW | GTH_METADATA_ALLOW_IN_FILE_LIST },
- { "image::format", N_("Format"), "image", 2, GTH_METADATA_ALLOW_IN_PROPERTIES_VIEW },
- { NULL, NULL, NULL, 0, 0 }
-};
-
-
G_MODULE_EXPORT void
gthumb_extension_activate (void)
{
- gth_main_register_metadata_category (image_metadata_category);
- gth_main_register_metadata_info_v (image_metadata_info);
gth_main_register_metadata_provider (GTH_TYPE_METADATA_PROVIDER_IMAGE);
gth_main_register_object (GTH_TYPE_VIEWER_PAGE, NULL, GTH_TYPE_IMAGE_VIEWER_PAGE, NULL);
gth_hook_add_callback ("dlg-preferences-construct", 10, G_CALLBACK (image_viewer__dlg_preferences_construct_cb), NULL);
diff --git a/gthumb/gth-browser.c b/gthumb/gth-browser.c
index d60b7db..f189916 100644
--- a/gthumb/gth-browser.c
+++ b/gthumb/gth-browser.c
@@ -2618,7 +2618,7 @@ _gth_browser_update_statusbar_file_info (GthBrowser *browser)
return;
}
- image_size = g_file_info_get_attribute_string (browser->priv->current_file->info, "image::size");
+ image_size = g_file_info_get_attribute_string (browser->priv->current_file->info, "general::size");
metadata = (GthMetadata *) g_file_info_get_attribute_object (browser->priv->current_file->info, "Embedded::Image::DateTime");
if (metadata != NULL)
file_date = gth_metadata_get_formatted (metadata);
diff --git a/gthumb/gth-main-default-metadata.c b/gthumb/gth-main-default-metadata.c
index 811fe78..4475293 100644
--- a/gthumb/gth-main-default-metadata.c
+++ b/gthumb/gth-main-default-metadata.c
@@ -31,6 +31,7 @@
GthMetadataCategory file_metadata_category[] = {
{ "file", N_("File"), 1 },
+ { "general", N_("General"), 2 },
{ NULL, NULL, 0 }
};
@@ -42,6 +43,10 @@ GthMetadataInfo file_metadata_info[] = {
{ "standard::fast-content-type", N_("Type"), "file", 4, GTH_METADATA_ALLOW_EVERYWHERE },
{ "gth::file::is-modified", NULL, "file", 5, GTH_METADATA_ALLOW_NOWHERE },
+ { "general::size", N_("Dimensions"), "general", 10, GTH_METADATA_ALLOW_EVERYWHERE },
+ { "general::duration", N_("Duration"), "general", 11, GTH_METADATA_ALLOW_EVERYWHERE },
+ { "general::format", N_("Format"), "general", 12, GTH_METADATA_ALLOW_IN_PROPERTIES_VIEW },
+
{ "Embedded::Image::DateTime", "", "", 0, GTH_METADATA_ALLOW_NOWHERE },
{ "Embedded::Image::Comment", "", "", 0, GTH_METADATA_ALLOW_NOWHERE },
{ "Embedded::Image::Location", "", "", 0, GTH_METADATA_ALLOW_NOWHERE },
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]