Merge lp:~ahmed-a-ammar/pigment-python/pigment-python-0.3-expose-set_from_system_buffer into lp:pigment-python/0.3

Proposed by Ahmed Ammar
Status: Needs review
Proposed branch: lp:~ahmed-a-ammar/pigment-python/pigment-python-0.3-expose-set_from_system_buffer
Merge into: lp:pigment-python/0.3
Diff against target: 85 lines (+64/-0)
2 files modified
pgm/pgm.defs (+13/-0)
pgm/pgmimage.override (+51/-0)
To merge this branch: bzr merge lp:~ahmed-a-ammar/pigment-python/pigment-python-0.3-expose-set_from_system_buffer
Reviewer Review Type Date Requested Status
Loïc Molinari Pending
Review via email: mp+28972@code.launchpad.net
To post a comment you must log in.
154. By Ahmed Ammar

Fixed CPU consumption problem. This really doesn't belong in .override
anyway. TODO.

Unmerged revisions

154. By Ahmed Ammar

Fixed CPU consumption problem. This really doesn't belong in .override
anyway. TODO.

153. By Ahmed Ammar

Expose pgm_image_set_from_system_buffer to python as
PgmImage.set_from_system_buffer. Using g_timeout_add to keep image
updated.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'pgm/pgm.defs'
--- pgm/pgm.defs 2009-04-27 14:50:38 +0000
+++ pgm/pgm.defs 2010-07-09 21:41:41 +0000
@@ -1705,6 +1705,19 @@
1705 )1705 )
1706)1706)
17071707
1708(define-method set_from_system_buffer
1709 (unblock-threads #t)
1710 (of-object "PgmImage")
1711 (c-name "pgm_image_set_from_system_buffer")
1712 (return-type "PgmError")
1713 (parameters
1714 '("PgmImagePixelFormat" "format")
1715 '("guint" "width")
1716 '("guint" "height")
1717 '("gconstpointer" "system_buffer")
1718 )
1719)
1720
1708(define-method set_from_image1721(define-method set_from_image
1709 (unblock-threads #t)1722 (unblock-threads #t)
1710 (of-object "PgmImage")1723 (of-object "PgmImage")
17111724
=== modified file 'pgm/pgmimage.override'
--- pgm/pgmimage.override 2008-09-17 16:25:11 +0000
+++ pgm/pgmimage.override 2010-07-09 21:41:41 +0000
@@ -1128,6 +1128,57 @@
1128}1128}
11291129
1130%%1130%%
1131override pgm_image_set_from_system_buffer kwargs
1132static gboolean
1133update_image (gpointer data)
1134{
1135 PgmDrawable *img;
1136
1137 img = (PgmDrawable*) data;
1138
1139 pgm_image_system_buffer_lock (PGM_IMAGE (img));
1140 pgm_image_system_buffer_unlock (PGM_IMAGE (img));
1141
1142 return TRUE;
1143}
1144
1145static PyObject *
1146_wrap_pgm_image_set_from_system_buffer (PyGObject *self,
1147 PyObject *args,
1148 PyObject *kwargs)
1149{
1150 static char *kwlist[] =
1151 { "format", "width", "height", "system_buffer", NULL };
1152 unsigned int py_format, py_width, py_height;
1153 unsigned long long py_system_buffer;
1154 gint ret;
1155 gconstpointer system_buffer;
1156
1157 system_buffer = g_slice_new(unsigned long);
1158
1159 if (!PyArg_ParseTupleAndKeywords (args, kwargs,
1160 "IIIK:PgmImage.set_image_from_system_buffer",
1161 kwlist, &py_format, &py_width,
1162 &py_height, &py_system_buffer))
1163 return NULL;
1164
1165 pyg_begin_allow_threads;
1166
1167 *(unsigned long*)system_buffer = py_system_buffer;
1168
1169 ret = pgm_image_set_from_system_buffer (PGM_IMAGE (self->obj),
1170 py_format, py_width, py_height,
1171 system_buffer);
1172
1173 g_timeout_add (100, update_image, PGM_IMAGE (self->obj));
1174
1175 pyg_end_allow_threads;
1176
1177 return pyg_enum_from_gtype (PGM_TYPE_ERROR, ret);
1178}
1179
1180
1181%%
1131override pgm_image_set_from_gst_buffer kwargs1182override pgm_image_set_from_gst_buffer kwargs
1132static PyObject *1183static PyObject *
1133_wrap_pgm_image_set_from_gst_buffer (PyGObject *self,1184_wrap_pgm_image_set_from_gst_buffer (PyGObject *self,

Subscribers

People subscribed via source and target branches

to all changes: