rpms/totem/F-8 totem-2.20.1-ignore-0-duration-pl-entries.patch, NONE, 1.1 totem.spec, 1.122, 1.123

Hans de Goede (jwrdegoede) fedora-extras-commits at redhat.com
Wed Dec 12 19:17:34 UTC 2007


Author: jwrdegoede

Update of /cvs/extras/rpms/totem/F-8
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv23502

Modified Files:
	totem.spec 
Added Files:
	totem-2.20.1-ignore-0-duration-pl-entries.patch 
Log Message:
* Wed Dec 12 2007 - Hans de Goede <j.w.r.degoede at hhs.nl> - 2.20.1-2
- Backport patch from trunk: skip 0 duration playlist entries (bz 419561)


totem-2.20.1-ignore-0-duration-pl-entries.patch:

--- NEW FILE totem-2.20.1-ignore-0-duration-pl-entries.patch ---
diff -ur totem-2.20.1/browser-plugin/totem-plugin-viewer.c new/browser-plugin/totem-plugin-viewer.c
--- totem-2.20.1/browser-plugin/totem-plugin-viewer.c	2007-10-17 15:07:53.000000000 +0200
+++ new/browser-plugin/totem-plugin-viewer.c	2007-12-12 17:09:02.000000000 +0100
@@ -1990,6 +1990,7 @@
 {
 	TotemEmbedded *emb = (TotemEmbedded *) data;
 	TotemPlItem *item;
+	int duration;
 
 	if (g_str_has_prefix (uri, "file://") != FALSE
 	    && g_str_has_prefix (emb->base_uri, "file://") == FALSE) {
@@ -2000,9 +2001,14 @@
 	g_print ("added URI '%s'\n", uri);
 	g_hash_table_foreach (metadata, (GHFunc) entry_metadata_foreach, NULL);
 
+	/* Skip short advert streams */
+	duration = totem_embedded_parse_duration (g_hash_table_lookup (metadata, "duration"));
+	if (duration == 0)
+		return;
+
 	item = g_new0 (TotemPlItem, 1);
 	item->uri = g_strdup (uri);
-	item->duration = totem_embedded_parse_duration (g_hash_table_lookup (metadata, "duration"));
+	item->duration = duration;
 	item->starttime = totem_embedded_parse_duration (g_hash_table_lookup (metadata, "starttime"));
 
 	emb->playlist = g_list_prepend (emb->playlist, item);
diff -ur totem-2.20.1/src/totem-playlist.c new/src/totem-playlist.c
--- totem-2.20.1/src/totem-playlist.c	2007-10-05 16:17:22.000000000 +0200
+++ new/src/totem-playlist.c	2007-12-12 17:09:23.000000000 +0100
@@ -1436,6 +1436,39 @@
 			GCONF_PREFIX"/shuffle", NULL) != FALSE;
 }
 
+/* FIXME this should live in the playlist parser */
+static int
+totem_embedded_parse_duration (const char *duration)
+{
+	int hours, minutes, seconds, fractions;
+
+	if (!duration)
+		return -1;
+
+	/* Formats used by both ASX and RAM files */
+	if (sscanf (duration, "%d:%d:%d.%d", &hours, &minutes, &seconds, &fractions) == 4) {
+		int ret = hours * 3600 + minutes * 60 + seconds;
+		if (ret == 0 && fractions > 0)
+			ret = 1;
+		return ret;
+	}
+	if (sscanf (duration, "%d:%d:%d", &hours, &minutes, &seconds) == 3)
+		return hours * 3600 + minutes * 60 + seconds;
+	if (sscanf (duration, "%d:%d.%d", &minutes, &seconds, &fractions) == 3) {
+		int ret = minutes * 60 + seconds;
+		if (ret == 0 && fractions > 0)
+			ret = 1;
+		return ret;
+	}
+	if (sscanf (duration, "%d:%d", &minutes, &seconds) == 2)
+		return minutes * 60 + seconds;
+	/* PLS files format */
+	if (sscanf (duration, "%d", &seconds) == 1)
+		return seconds;
+
+	return -1;
+}
+
 static void
 totem_playlist_entry_parsed (TotemPlParser *parser,
 			     const char *uri,
@@ -1443,7 +1476,13 @@
 			     TotemPlaylist *playlist)
 {
 	const char *title;
+	gint64 duration;
 
+	/* We ignore 0-length items in playlists, they're usually just banners */
+	duration = totem_embedded_parse_duration
+		(g_hash_table_lookup (metadata, TOTEM_PL_PARSER_FIELD_DURATION));
+	if (duration == 0)
+		return;
 	title = g_hash_table_lookup (metadata, TOTEM_PL_PARSER_FIELD_TITLE);
 	totem_playlist_add_one_mrl (playlist, uri, title);
 }


Index: totem.spec
===================================================================
RCS file: /cvs/extras/rpms/totem/F-8/totem.spec,v
retrieving revision 1.122
retrieving revision 1.123
diff -u -r1.122 -r1.123
--- totem.spec	17 Oct 2007 13:38:42 -0000	1.122
+++ totem.spec	12 Dec 2007 19:16:44 -0000	1.123
@@ -6,11 +6,12 @@
 Summary: Movie player for GNOME 2
 Name: totem
 Version: 2.20.1
-Release: 1%{?dist} 
+Release: 2%{?dist} 
 License: GPLv2 with exception
 Group: Applications/Multimedia
 URL: http://www.gnome.org/projects/totem/
 Source0: http://ftp.gnome.org/pub/GNOME/sources/totem/2.20/totem-%{version}.tar.bz2
+Patch0: totem-2.20.1-ignore-0-duration-pl-entries.patch
 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) 
 
 Requires(pre): GConf2 >= 2.14
@@ -114,6 +115,7 @@
 
 %prep
 %setup -q
+%patch0 -p1
 
 %build
 # try to work around a problem where gst-inspect does 
@@ -235,6 +237,9 @@
 %{_libdir}/*so
 
 %changelog
+* Wed Dec 12 2007 - Hans de Goede <j.w.r.degoede at hhs.nl> - 2.20.1-2
+- Backport patch from trunk: skip 0 duration playlist entries (bz 419561)
+
 * Wed Oct 17 2007 - Bastien Nocera <bnocera at redhat.com> - 2.20.1-1
 - Update to 2.20.1
 - Require GTK+ 2.12.1




More information about the fedora-extras-commits mailing list