Update of /cvsroot/freevo/kaa/xine/src/drivers
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15153/drivers
Modified Files:
x11.c
Log Message:
Implement more of the API; add some default values in frame_output_callback
in case the python function fails; check for return value of False from
callback (assumes it's a WeakCallback whose referance is no longer
available)
Index: x11.c
===================================================================
RCS file: /cvsroot/freevo/kaa/xine/src/drivers/x11.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** x11.c 19 Jul 2005 02:07:25 -0000 1.2
--- x11.c 19 Jul 2005 05:51:59 -0000 1.3
***************
*** 23,26 ****
--- 23,27 ----
PyObject *args, *result;
PyGILState_STATE gstate;
+ int success = 0;
if (!user_data->frame_output_callback) {
***************
*** 30,33 ****
--- 31,35 ----
}
+
gstate = PyGILState_Ensure();
args = Py_BuildValue("(iid)", video_width, video_height,
video_pixel_aspect);
***************
*** 35,44 ****
Py_DECREF(args);
if (result) {
! if (!PyArg_ParseTuple(result, "(ii)(ii)(ii)d", dest_x, dest_y, win_x,
win_y,
dest_width, dest_height, dest_pixel_aspect)) {
// FIXME: find a way to propagate this back to the main thread.
printf("EXCEPTION: frame_output_cb returned bad arguments.\n");
PyErr_Print();
! }
Py_DECREF(result);
--- 37,50 ----
Py_DECREF(args);
if (result) {
! if (PyBool_Check(result)) {
! // Probably WeakCallback returning False because we're on
shutdown.
! success = 0;
! } else if (!PyArg_ParseTuple(result, "(ii)(ii)(ii)d", dest_x, dest_y,
win_x, win_y,
dest_width, dest_height, dest_pixel_aspect)) {
// FIXME: find a way to propagate this back to the main thread.
printf("EXCEPTION: frame_output_cb returned bad arguments.\n");
PyErr_Print();
! } else
! success = 1;
Py_DECREF(result);
***************
*** 48,52 ****
--- 54,67 ----
PyErr_Print();
}
+
PyGILState_Release(gstate);
+
+ if (!success) {
+ // Call to python space failed, but we need to set some sane defaults
+ // here, or else xine does ugly things.
+ *dest_x = *dest_y = *win_x = *win_y = 0;
+ *dest_width = *dest_height = 50;
+ *dest_pixel_aspect = 1;
+ }
}
-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
Freevo-cvslog mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freevo-cvslog