Commit 329c7473 authored by Zaheer Abbas Merali's avatar Zaheer Abbas Merali
Browse files

sys/ximagesrc/ximagesrc.c: Fix typo, C++ style comments and other small cleanups

Original commit message from CVS:
2006-04-07  Zaheer Abbas Merali  <zaheerabbas at merali dot org>

* sys/ximagesrc/ximagesrc.c: (gst_ximagesrc_recalc),
(composite_pixel), (gst_ximagesrc_ximage_get),
(gst_ximagesrc_create), (gst_ximagesrc_set_property):
Fix typo, C++ style comments and other small cleanups
parent 200bb9a5
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
* This element captures your X Display and creates raw RGB video. It uses * This element captures your X Display and creates raw RGB video. It uses
* the XDamage extension if available to only capture areas of the screen that * the XDamage extension if available to only capture areas of the screen that
* have changed since the last frame. It uses the XFixes extension if * have changed since the last frame. It uses the XFixes extension if
* available to also cpature your mouse pointer * available to also capture your mouse pointer
* </para> * </para>
* <title>Example pipelines</title> * <title>Example pipelines</title>
* <para> * <para>
...@@ -52,6 +52,9 @@ ...@@ -52,6 +52,9 @@
#include <X11/Xlib.h> #include <X11/Xlib.h>
#include <X11/Xutil.h> #include <X11/Xutil.h>
#include <gst/gst.h>
#include <gst/gst-i18n-plugin.h>
GST_DEBUG_CATEGORY_STATIC (gst_debug_ximagesrc); GST_DEBUG_CATEGORY_STATIC (gst_debug_ximagesrc);
#define GST_CAT_DEFAULT gst_debug_ximagesrc #define GST_CAT_DEFAULT gst_debug_ximagesrc
...@@ -233,7 +236,7 @@ gst_ximagesrc_recalc (GstXImageSrc * src) ...@@ -233,7 +236,7 @@ gst_ximagesrc_recalc (GstXImageSrc * src)
if (!src->xcontext) if (!src->xcontext)
return FALSE; return FALSE;
/* FIXME: Check the display hasn't changed size or something */ /* Mayble later we can check the display hasn't changed size */
/* We could use XQueryPointer to get only the current window. */ /* We could use XQueryPointer to get only the current window. */
return TRUE; return TRUE;
} }
...@@ -264,12 +267,13 @@ composite_pixel (GstXContext * xcontext, guchar * dest, guchar * src) ...@@ -264,12 +267,13 @@ composite_pixel (GstXContext * xcontext, guchar * dest, guchar * src)
color = GUINT32_FROM_LE (*(guint32 *) (dest)); color = GUINT32_FROM_LE (*(guint32 *) (dest));
break; break;
default: default:
g_warning ("bpp %d not supported\n", xcontext->bpp); /* Should not reach here */
color = 0; g_assert_not_reached ();
} }
/* FIXME: move the code that finds shift and max in the _link function */ /* possible optimisation:
* move the code that finds shift and max in the _link function */
for (r_shift = 0; !(xcontext->visual->red_mask & (1 << r_shift)); r_shift++); for (r_shift = 0; !(xcontext->visual->red_mask & (1 << r_shift)); r_shift++);
for (g_shift = 0; !(xcontext->visual->green_mask & (1 << g_shift)); for (g_shift = 0; !(xcontext->visual->green_mask & (1 << g_shift));
g_shift++); g_shift++);
...@@ -478,7 +482,6 @@ gst_ximagesrc_ximage_get (GstXImageSrc * ximagesrc) ...@@ -478,7 +482,6 @@ gst_ximagesrc_ximage_get (GstXImageSrc * ximagesrc)
cx = ximagesrc->cursor_image->x - ximagesrc->cursor_image->xhot; cx = ximagesrc->cursor_image->x - ximagesrc->cursor_image->xhot;
cy = ximagesrc->cursor_image->y - ximagesrc->cursor_image->yhot; cy = ximagesrc->cursor_image->y - ximagesrc->cursor_image->yhot;
//count = image->width * image->height;
count = ximagesrc->cursor_image->width * ximagesrc->cursor_image->height; count = ximagesrc->cursor_image->width * ximagesrc->cursor_image->height;
for (i = 0; i < count; i++) for (i = 0; i < count; i++)
ximagesrc->cursor_image->pixels[i] = ximagesrc->cursor_image->pixels[i] =
...@@ -522,7 +525,9 @@ gst_ximagesrc_create (GstPushSrc * bs, GstBuffer ** buf) ...@@ -522,7 +525,9 @@ gst_ximagesrc_create (GstPushSrc * bs, GstBuffer ** buf)
gint64 next_frame_no; gint64 next_frame_no;
if (!gst_ximagesrc_recalc (s)) { if (!gst_ximagesrc_recalc (s)) {
/* FIXME: Post error on the bus */ GST_ELEMENT_ERROR (s, RESOURCE, FAILED,
(_("X11 Display changed resolution, we do not support this yet.")),
(NULL));
return GST_FLOW_ERROR; return GST_FLOW_ERROR;
} }
...@@ -610,11 +615,11 @@ gst_ximagesrc_set_property (GObject * object, guint prop_id, ...@@ -610,11 +615,11 @@ gst_ximagesrc_set_property (GObject * object, guint prop_id,
g_free (src->display_name); g_free (src->display_name);
src->display_name = g_strdup (g_value_get_string (value)); src->display_name = g_strdup (g_value_get_string (value));
// src->screen_num = MIN (src->screen_num, ScreenCount (src->display) - 1); /* src->screen_num = MIN (src->screen_num, ScreenCount (src->display) - 1); */
break; break;
case PROP_SCREEN_NUM: case PROP_SCREEN_NUM:
src->screen_num = g_value_get_uint (value); src->screen_num = g_value_get_uint (value);
// src->screen_num = MIN (src->screen_num, ScreenCount (src->display) - 1); /* src->screen_num = MIN (src->screen_num, ScreenCount (src->display) - 1); */
break; break;
case PROP_SHOW_POINTER: case PROP_SHOW_POINTER:
src->show_pointer = g_value_get_boolean (value); src->show_pointer = g_value_get_boolean (value);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment