[totem] properties: Show the container format



commit ef9ab89bc818084ff6548a4c0b354fdee1d616b6
Author: Bastien Nocera <hadess hadess net>
Date:   Mon Apr 4 00:36:54 2011 +0100

    properties: Show the container format
    
    When available, in both the properties tab, and Totem.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=611169

 data/properties.ui                              |   36 ++++++++++++++++++++++-
 src/backend/bacon-video-widget-gst-0.10.c       |    7 ++++
 src/backend/bacon-video-widget.h                |    1 +
 src/plugins/properties/totem-movie-properties.c |    1 +
 src/properties/bacon-video-widget-properties.c  |    4 ++-
 src/totem-properties-view.c                     |   18 +++++++++++
 6 files changed, 65 insertions(+), 2 deletions(-)
---
diff --git a/data/properties.ui b/data/properties.ui
index 184c358..8c89498 100644
--- a/data/properties.ui
+++ b/data/properties.ui
@@ -37,7 +37,7 @@
               <object class="GtkTable" id="general">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
-                <property name="n_rows">6</property>
+                <property name="n_rows">7</property>
                 <property name="n_columns">2</property>
                 <property name="column_spacing">12</property>
                 <property name="row_spacing">6</property>
@@ -293,6 +293,40 @@
                     <property name="y_options"></property>
                   </packing>
                 </child>
+                <child>
+                  <object class="GtkLabel" id="container_label">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="xalign">0</property>
+                    <property name="label" translatable="yes">Container:</property>
+                    <attributes>
+                      <attribute name="style" value="italic"/>
+                    </attributes>
+                  </object>
+                  <packing>
+                    <property name="top_attach">6</property>
+                    <property name="bottom_attach">7</property>
+                    <property name="x_options">GTK_FILL</property>
+                    <property name="y_options"></property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkLabel" id="container">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="xalign">0</property>
+                    <property name="label" translatable="yes">Unknown</property>
+                    <property name="selectable">True</property>
+                  </object>
+                  <packing>
+                    <property name="left_attach">1</property>
+                    <property name="right_attach">2</property>
+                    <property name="top_attach">6</property>
+                    <property name="bottom_attach">7</property>
+                    <property name="x_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
+                    <property name="y_options"></property>
+                  </packing>
+                </child>
               </object>
             </child>
           </object>
diff --git a/src/backend/bacon-video-widget-gst-0.10.c b/src/backend/bacon-video-widget-gst-0.10.c
index 1939e07..71cade2 100644
--- a/src/backend/bacon-video-widget-gst-0.10.c
+++ b/src/backend/bacon-video-widget-gst-0.10.c
@@ -5562,6 +5562,12 @@ bacon_video_widget_get_metadata_string (BaconVideoWidget * bvw,
                                              GST_TAG_ALBUM, 0, &string);
       }
       break;
+    case BVW_INFO_CONTAINER:
+      if (bvw->priv->tagcache != NULL) {
+        res = gst_tag_list_get_string_index (bvw->priv->tagcache,
+                                             GST_TAG_CONTAINER_FORMAT, 0, &string);
+      }
+      break;
     case BVW_INFO_VIDEO_CODEC: {
       GstTagList *tags;
 
@@ -5843,6 +5849,7 @@ bacon_video_widget_get_metadata (BaconVideoWidget * bvw,
     case BVW_INFO_YEAR:
     case BVW_INFO_COMMENT:
     case BVW_INFO_ALBUM:
+    case BVW_INFO_CONTAINER:
     case BVW_INFO_VIDEO_CODEC:
     case BVW_INFO_AUDIO_CODEC:
     case BVW_INFO_AUDIO_CHANNELS:
diff --git a/src/backend/bacon-video-widget.h b/src/backend/bacon-video-widget.h
index a27099a..b2d50fa 100644
--- a/src/backend/bacon-video-widget.h
+++ b/src/backend/bacon-video-widget.h
@@ -301,6 +301,7 @@ typedef enum {
 	BVW_INFO_DURATION,
 	BVW_INFO_TRACK_NUMBER,
 	BVW_INFO_COVER,
+	BVW_INFO_CONTAINER,
 	/* Video */
 	BVW_INFO_HAS_VIDEO,
 	BVW_INFO_DIMENSION_X,
diff --git a/src/plugins/properties/totem-movie-properties.c b/src/plugins/properties/totem-movie-properties.c
index 8479e45..b185082 100644
--- a/src/plugins/properties/totem-movie-properties.c
+++ b/src/plugins/properties/totem-movie-properties.c
@@ -121,6 +121,7 @@ update_properties_from_bvw (BaconVideoWidgetProperties *props,
 	UPDATE_FROM_STRING (BVW_INFO_ALBUM, "album");
 	UPDATE_FROM_STRING (BVW_INFO_YEAR, "year");
 	UPDATE_FROM_STRING (BVW_INFO_COMMENT, "comment");
+	UPDATE_FROM_STRING (BVW_INFO_CONTAINER, "container");
 
 	bacon_video_widget_get_metadata (BACON_VIDEO_WIDGET (bvw),
 					 BVW_INFO_DURATION, &value);
diff --git a/src/properties/bacon-video-widget-properties.c b/src/properties/bacon-video-widget-properties.c
index 22acfd5..5822f9c 100644
--- a/src/properties/bacon-video-widget-properties.c
+++ b/src/properties/bacon-video-widget-properties.c
@@ -113,6 +113,8 @@ bacon_video_widget_properties_reset (BaconVideoWidgetProperties *props)
 	bacon_video_widget_properties_set_duration (props, 0);
 	/* Comment */
 	bacon_video_widget_properties_set_label (props, "comment", "");
+	/* Container */
+	bacon_video_widget_properties_set_label (props, "container", _("Unknown"));
 
 	/* Dimensions */
 	bacon_video_widget_properties_set_label (props, "dimensions", C_("Dimensions", "N/A"));
@@ -204,7 +206,7 @@ bacon_video_widget_properties_new (void)
 	GtkWidget *vbox;
 	GtkSizeGroup *group;
 	const char *labels[] = { "title_label", "artist_label", "album_label",
-			"year_label", "duration_label", "comment_label",
+			"year_label", "duration_label", "comment_label", "container_label",
 			"dimensions_label", "vcodec_label", "framerate_label",
 			"vbitrate_label", "abitrate_label", "acodec_label",
 			"samplerate_label", "channels_label" };
diff --git a/src/totem-properties-view.c b/src/totem-properties-view.c
index c1907e0..369866c 100644
--- a/src/totem-properties-view.c
+++ b/src/totem-properties-view.c
@@ -106,6 +106,17 @@ set_codec (TotemPropertiesView     *props,
 	   const char              *widget)
 {
 	GstCaps *caps;
+	const char *nick;
+
+	nick = gst_discoverer_stream_info_get_stream_type_nick (info);
+	if (g_str_equal (nick, "audio") == FALSE &&
+	    g_str_equal (nick, "video") == FALSE &&
+	    g_str_equal (nick, "container") == FALSE) {
+		bacon_video_widget_properties_set_label (props->priv->props,
+							 widget,
+							 _("N/A"));
+		return;
+	}
 
 	caps = gst_discoverer_stream_info_get_caps (info);
 	if (caps) {
@@ -223,6 +234,7 @@ discovered_cb (GstDiscoverer       *discoverer,
 	gboolean has_audio, has_video;
 	const char *label;
         GstClockTime duration;
+        GstDiscovererStreamInfo *sinfo;
 
 	if (error) {
 		g_warning ("Couldn't get information about '%s': %s",
@@ -254,6 +266,12 @@ discovered_cb (GstDiscoverer       *discoverer,
         duration = gst_discoverer_info_get_duration (info);
         bacon_video_widget_properties_set_duration (props->priv->props, duration / GST_SECOND * 1000);
 
+        sinfo = gst_discoverer_info_get_stream_info (info);
+        if (sinfo) {
+		set_codec (props, sinfo, "container");
+		gst_discoverer_stream_info_unref (sinfo);
+	}
+
 	taglist = gst_discoverer_info_get_tags (info);
 	update_general (props, taglist);
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]