Commit 41b1c636 authored by Paolo Bacchilega's avatar Paolo Bacchilega
Browse files

unified duration and dimensions metadata for videos and pictures

parent 5874c2b7
......@@ -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);
......
......@@ -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;
}
......
......@@ -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 },
......
......@@ -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);
......
......@@ -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;
}
......
......@@ -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);
......
......@@ -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);
......
......@@ -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 },
......
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