Bug#1107654: marked as done (unblock: totem/43.2-3) (2/2)
From
Debian Bug Tracking System@21:1/5 to
All on Fri Jun 13 16:00:02 2025
[continued from previous message]
- gst_object_unref (csp);
- gst_object_unref (vscale);
- g_clear_pointer (&dl, gst_object_unref);
- gst_object_unref (sink);
-
- GST_ERROR ("Could not convert video frame: no pipeline (unknown error)"); - if (err)
- *err = g_error_new (GST_CORE_ERROR, GST_CORE_ERROR_FAILED,
- "Could not convert video frame: no pipeline (unknown error)");
- return NULL;
- }
-link_failed:
- {
- gst_object_unref (pipeline);
-
- GST_ERROR ("Could not convert video frame: failed to link elements");
- if (err)
- *err = g_error_new (GST_CORE_ERROR, GST_CORE_ERROR_NEGOTIATION,
- "Could not convert video frame: failed to link elements");
- return NULL;
- }
-}
-
-/**
- * totem_gst_video_convert_sample:
- * @capture_type: capture type
- * @sample: a #GstSample
- * @to_caps: the #GstCaps to convert to
- * @timeout: the maximum amount of time allowed for the processing.
- * @error: pointer to a #GError. Can be %NULL.
- *
- * Converts a raw video buffer into the specified output caps.
- *
- * The output caps can be any raw video formats or any image formats (jpeg, png, ...).
- *
- * The width, height and pixel-aspect-ratio can also be specified in the output caps.
- *
- * Returns: The converted #GstSample, or %NULL if an error happened (in which case @err
- * will point to the #GError).
- */
-static GstSample *
-totem_gst_video_convert_sample (FrameCaptureType capture_type,
- GstSample * sample, const GstCaps * to_caps,
- GstClockTime timeout, GError ** error)
-{
- GstMessage *msg;
- GstBuffer *buf;
- GstSample *result = NULL;
- GError *err = NULL;
- GstBus *bus;
- GstCaps *from_caps, *to_caps_copy = NULL;
- GstFlowReturn ret;
- GstElement *pipeline, *src, *sink;
- guint i, n;
-
- g_return_val_if_fail (sample != NULL, NULL);
- g_return_val_if_fail (to_caps != NULL, NULL);
-
- buf = gst_sample_get_buffer (sample);
- g_return_val_if_fail (buf != NULL, NULL);
-
- from_caps = gst_sample_get_caps (sample);
- g_return_val_if_fail (from_caps != NULL, NULL);
-
- to_caps_copy = gst_caps_new_empty ();
- n = gst_caps_get_size (to_caps);
- for (i = 0; i < n; i++) {
- GstStructure *s = gst_caps_get_structure (to_caps, i);
-
- s = gst_structure_copy (s);
- gst_structure_remove_field (s, "framerate");
- gst_caps_append_structure (to_caps_copy, s);
- }
-
- pipeline =
- build_convert_frame_pipeline (capture_type, &src, &sink, from_caps,
- to_caps_copy, &err);
- if (!pipeline)
- goto no_pipeline;
-
- /* now set the pipeline to the paused state, after we push the buffer into
- * appsrc, this should preroll the converted buffer in appsink */
- GST_DEBUG ("running conversion pipeline to caps %" GST_PTR_FORMAT,
- to_caps_copy);
- if (gst_element_set_state (pipeline,
- GST_STATE_PAUSED) == GST_STATE_CHANGE_FAILURE)
- goto state_change_failed;
-
- /* feed buffer in appsrc */
- GST_DEBUG ("feeding buffer %p, size %" G_GSIZE_FORMAT ", caps %"
- GST_PTR_FORMAT, buf, gst_buffer_get_size (buf), from_caps);
- g_signal_emit_by_name (src, "push-buffer", buf, &ret);
-
- /* now see what happens. We either got an error somewhere or the pipeline
- * prerolled */
- bus = gst_element_get_bus (pipeline);
- msg = gst_bus_timed_pop_filtered (bus,
- timeout, GST_MESSAGE_ERROR | GST_MESSAGE_ASYNC_DONE);
-
- if (msg) {
- switch (GST_MESSAGE_TYPE (msg)) {
- case GST_MESSAGE_ASYNC_DONE:
- {
- /* we're prerolled, get the frame from appsink */
- g_signal_emit_by_name (sink, "pull-preroll", &result);
-
- if (result) {
- GST_DEBUG ("conversion successful: result = %p", result);
- } else {
- GST_ERROR ("prerolled but no result frame?!");
- }
- break;
- }
- case GST_MESSAGE_ERROR:{
- gchar *dbg = NULL;
-
- gst_message_parse_error (msg, &err, &dbg);
- if (err) {
- GST_ERROR ("Could not convert video frame: %s", err->message);
- GST_DEBUG ("%s [debug: %s]", err->message, GST_STR_NULL (dbg));
- if (error)
- *error = err;
- else
- g_error_free (err);
- }
- g_free (dbg);
- break;
- }
- default:{
- g_return_val_if_reached (NULL);
- }
- }
- gst_message_unref (msg);
- } else {
- GST_ERROR ("Could not convert video frame: timeout during conversion");
- if (error)
- *error = g_error_new (GST_CORE_ERROR, GST_CORE_ERROR_FAILED,
- "Could not convert video frame: timeout during conversion");
- }
-
- gst_element_set_state (pipeline, GST_STATE_NULL);
- gst_object_unref (bus);
- gst_object_unref (pipeline);
- gst_caps_unref (to_caps_copy);
-
- return result;
-
- /* ERRORS */
-no_pipeline:
-state_change_failed:
- {
- gst_caps_unref (to_caps_copy);
-
- if (error)
- *error = err;
- else
- g_error_free (err);
-
- return NULL;
- }
-}
-
GdkPixbuf *
totem_gst_playbin_get_frame (GstElement *play, GError **error)
{
FrameCaptureType capture_type;
GstStructure *s;
GstSample *sample = NULL;
- GstSample *last_sample = NULL;
guint bpp;
GdkPixbuf *pixbuf = NULL;
GstCaps *to_caps, *sample_caps;
@@ -359,19 +81,12 @@
NULL);
/* get frame */
- g_object_get (G_OBJECT (play), "sample", &last_sample, NULL);
- if (!last_sample) {
- g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_FAILED,
- "Failed to retrieve video frame");
- return NULL;
- }
- sample = totem_gst_video_convert_sample (capture_type, last_sample, to_caps, 25 * GST_SECOND, error);
- gst_sample_unref (last_sample);
+ g_signal_emit_by_name (play, "convert-sample", to_caps, &sample);
gst_caps_unref (to_caps);
if (!sample) {
g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_FAILED,
- "Failed to convert video frame");
+ "Failed to retrieve or convert video frame");
return NULL;
}
diff -Nru totem-43.1/src/icon-helpers.c totem-43.2/src/icon-helpers.c
--- totem-43.1/src/icon-helpers.c 2024-10-22 17:04:07.000000000 +0100
+++ totem-43.2/src/icon-helpers.c 2025-05-21 14:08:29.000000000 +0100
@@ -30,7 +30,7 @@
#define GNOME_DESKTOP_USE_UNSTABLE_API 1
#include <libgnome-desktop/gnome-desktop-thumbnail.h>
-#define DEFAULT_MAX_THREADS 1
+#define DEFAULT_MAX_THREADS g_get_num_processors ()
#define THUMB_SEARCH_SIZE 256
#define THUMB_SEARCH_HEIGHT THUMB_SEARCH_SIZE
#define SOURCES_MAX_HEIGHT 64
diff -Nru totem-43.1/src/plugins/open-directory/totem-open-directory.c totem-43.2/src/plugins/open-directory/totem-open-directory.c
--- totem-43.1/src/plugins/open-directory/totem-open-directory.c 2024-10-22 17:04:07.000000000 +0100
+++ totem-43.2/src/plugins/open-directory/totem-open-directory.c 2025-05-21 14:08:29.000000000 +0100
@@ -135,11 +135,17 @@
GMenu *menu;
GMenuItem *item;
char *mrl;
+ g_autoptr(GError) error = NULL;
pi->totem = g_object_get_data (G_OBJECT (plugin), "object");
- pi->portal = xdp_portal_new ();
+ pi-