After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 328380 - support single-image files
support single-image files
Status: RESOLVED FIXED
Product: totem
Classification: Core
Component: GStreamer backend
unspecified
Other Linux
: Normal normal
: ---
Assigned To: Maintainer alias for GStreamer component of Totem
Maintainer alias for GStreamer component of Totem
: 172734 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2006-01-24 04:47 UTC by Ronald Bultje
Modified: 2006-01-29 22:57 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
see text (8.00 KB, patch)
2006-01-24 04:48 UTC, Ronald Bultje
none Details | Review

Description Ronald Bultje 2006-01-24 04:47:53 UTC
Attached patch adds some code to -gst to support single-image quicktime files. Since GStreamer is not at all good at that itself, I use some hacks to get the images as tags and display those as a GdkPixbuf.
Comment 1 Ronald Bultje 2006-01-24 04:48:10 UTC
Created attachment 57976 [details] [review]
see text
Comment 2 Bastien Nocera 2006-01-24 08:50:32 UTC
Looks alright. Do you have an example use for this functionality though?
Comment 3 Ronald Bultje 2006-01-24 13:21:31 UTC
Many of the apple trailers HD movies have a single-image quicktime/jpeg stream, and show several of those on the trailer selection website (see my blogpost, also). I used the da-vinci website as an example. Showing it as video is unwanted for several reasons:

1) this image-stuff requires less resources (or so I hope), since we don't use an actual (heavy) pipeline, but only a GdkPixbuf
2) keeps xv device busy, so actual movie needs to fallback to x
3) it really isn't a movie, it's an image (semantics)
Comment 4 Bastien Nocera 2006-01-24 13:55:33 UTC
Understood, your call.
Comment 5 Tim-Philipp Müller 2006-01-24 14:04:51 UTC
Btw, instead of writing the image to a temp file and reading it with gdk_pixbuf_new_from_file() you could use GdkPixbufLoader and feed it the data directly. Probably doesn't make much difference in practice, but might just be worth doing anyway given that it's not really more lines of code than the current solution.

Comment 6 Ronald Bultje 2006-01-24 14:43:45 UTC
Tim: I completely agree. I was looking for a gdk_pixbuf_new_from_data() that reads a memory area like as if it were a mmap()'ed file, but couldn't find one. I'll have a better look there. If you have sample code, that'd be great.
Comment 7 Tim-Philipp Müller 2006-01-24 14:54:15 UTC
Maybe something like this (completely untested):

+  } else if (bvw->priv->tagcache &&
+             (v = gst_tag_list_get_value_index (bvw->priv->tagcache,
+						GST_TAG_IMAGE, 0))) {
+    GdkPixbufLoader *loader;
+    GstBuffer *b = g_value_get_boxed (v);
+    gint w, h;
+
+    if (bvw->priv->media_pixbuf) {
+      g_object_unref (bvw->priv->media_pixbuf);
+      bvw->priv->media_pixbuf = NULL;
+    }
+
+    loader = gdk_pixbuf_loader_new ();
+    if (gdk_pixbuf_loader_write (loader, GST_BUFFER_DATA (b),
+                                 GST_BUFFER_SIZE (b), NULL)) {
+      bvw->priv->media_pixbuf = gdk_pixbuf_loader_get_pixbuf (loader);
+      if (bvw->priv->media_pixbuf)
+        g_object_ref (bvw->priv->media_pixbuf);
+    }
+    g_object_unref (loader);
+
+    shrink_toplevel (bvw);
+    get_media_size (bvw, &w, &h);
+    totem_widget_set_preferred_size (GTK_WIDGET (bvw), w, h);
   }
Comment 8 Ronald Bultje 2006-01-25 05:29:14 UTC
*** Bug 172734 has been marked as a duplicate of this bug. ***
Comment 9 Ronald Bultje 2006-01-29 22:57:08 UTC
applied, with Tim's changes.