[totem] bacon-video-widget: let playbin2 to format conversions when taking screenshots
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [totem] bacon-video-widget: let playbin2 to format conversions when taking screenshots
- Date: Mon, 4 Apr 2011 16:27:57 +0000 (UTC)
commit 6065ee564c12a9eed66ac78f815bf518a03543cb
Author: Tim-Philipp Müller <tim centricular net>
Date: Fri Mar 4 14:13:13 2011 +0000
bacon-video-widget: let playbin2 to format conversions when taking screenshots
Remove home-grown format conversion code and use playbin2's "convert-frame"
action signal instead, which will do that for us. Removes a whole bunch of
code that's not needed any longer, and also fixes a warning caused by
fakesrc modifying the caps of a buffer whose metadata is not writable,
when using GStreamer core from git.
https://bugzilla.gnome.org/show_bug.cgi?id=640933
src/backend/Makefile.am | 4 +-
src/backend/bacon-video-widget-gst-0.10.c | 34 ++----
src/backend/gstscreenshot.c | 202 -----------------------------
src/backend/gstscreenshot.h | 32 -----
4 files changed, 10 insertions(+), 262 deletions(-)
---
diff --git a/src/backend/Makefile.am b/src/backend/Makefile.am
index c3a5b70..af4f8eb 100644
--- a/src/backend/Makefile.am
+++ b/src/backend/Makefile.am
@@ -55,9 +55,7 @@ libbaconvideowidget_la_SOURCES = \
video-utils.c video-utils.h \
bacon-video-widget-gst-0.10.c \
bacon-video-widget-gst-missing-plugins.c \
- bacon-video-widget-gst-missing-plugins.h \
- gstscreenshot.c \
- gstscreenshot.h
+ bacon-video-widget-gst-missing-plugins.h
libbaconvideowidget_la_CPPFLAGS = \
-D_REENTRANT \
diff --git a/src/backend/bacon-video-widget-gst-0.10.c b/src/backend/bacon-video-widget-gst-0.10.c
index f8d125e..55f8385 100644
--- a/src/backend/bacon-video-widget-gst-0.10.c
+++ b/src/backend/bacon-video-widget-gst-0.10.c
@@ -84,7 +84,6 @@
#include "baconvideowidget-marshal.h"
#include "bacon-video-widget-enums.h"
#include "video-utils.h"
-#include "gstscreenshot.h"
#define DEFAULT_USER_AGENT "Totem/"VERSION
@@ -6086,22 +6085,7 @@ bacon_video_widget_get_current_frame (BaconVideoWidget * bvw)
return NULL;
}
- /* get frame */
- g_object_get (bvw->priv->play, "frame", &buf, NULL);
-
- if (!buf) {
- GST_DEBUG ("Could not take screenshot: %s", "no last video frame");
- g_warning ("Could not take screenshot: %s", "no last video frame");
- return NULL;
- }
-
- if (GST_BUFFER_CAPS (buf) == NULL) {
- GST_DEBUG ("Could not take screenshot: %s", "no caps on buffer");
- g_warning ("Could not take screenshot: %s", "no caps on buffer");
- return NULL;
- }
-
- /* convert to our desired format (RGB24) */
+ /* our desired output format (RGB24) */
to_caps = gst_caps_new_simple ("video/x-raw-rgb",
"bpp", G_TYPE_INT, 24,
"depth", G_TYPE_INT, 24,
@@ -6118,17 +6102,15 @@ bacon_video_widget_get_current_frame (BaconVideoWidget * bvw)
"blue_mask", G_TYPE_INT, 0x0000ff,
NULL);
- GST_DEBUG ("frame caps: %" GST_PTR_FORMAT, GST_BUFFER_CAPS (buf));
- GST_DEBUG ("pixbuf caps: %" GST_PTR_FORMAT, to_caps);
-
- /* bvw_frame_conv_convert () takes ownership of the buffer passed */
- buf = bvw_frame_conv_convert (buf, to_caps);
-
+ /* get frame */
+ g_signal_emit_by_name (bvw->priv->play, "convert-frame", to_caps, &buf);
gst_caps_unref (to_caps);
if (!buf) {
- GST_DEBUG ("Could not take screenshot: %s", "conversion failed");
- g_warning ("Could not take screenshot: %s", "conversion failed");
+ GST_DEBUG ("Could not take screenshot: %s",
+ "failed to retrieve or convert video frame");
+ g_warning ("Could not take screenshot: %s",
+ "failed to retrieve or convert video frame");
return NULL;
}
@@ -6138,6 +6120,8 @@ bacon_video_widget_get_current_frame (BaconVideoWidget * bvw)
return NULL;
}
+ GST_DEBUG ("frame caps: %" GST_PTR_FORMAT, GST_BUFFER_CAPS (buf));
+
s = gst_caps_get_structure (GST_BUFFER_CAPS (buf), 0);
gst_structure_get_int (s, "width", &outwidth);
gst_structure_get_int (s, "height", &outheight);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]