GNOME Bugzilla – Bug 328380
support single-image files
Last modified: 2006-01-29 22:57:08 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.
Created attachment 57976 [details] [review] see text
Looks alright. Do you have an example use for this functionality though?
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)
Understood, your call.
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.
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.
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); }
*** Bug 172734 has been marked as a duplicate of this bug. ***
applied, with Tim's changes.