Update of /cvsroot/freevo/kaa/xine/src/drivers
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25244/src/drivers

Modified Files:
        x11.c 
Log Message:
More API calls.  Keep track of the plugin chain, a process which is
obfuscated by the fact that stream PostOuts don't have ports, and that
PostOut.wire(PostIn) is the same as PostOut.wire_video_port(PostIn.port).
So we keep track of the post chain using a wire_object member in Video/
Audio Ports (inputs have a list, outputs have a single target), and PostOut
for streams are treated as a special case (PostOut has its own wire_object
which is used exclusively for the Stream case).

Added _debug_show_chain() to test the chain traversal stuff.

Also added support for xshm.


Index: x11.c
===================================================================
RCS file: /cvsroot/freevo/kaa/xine/src/drivers/x11.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** x11.c       19 Jul 2005 05:51:59 -0000      1.3
--- x11.c       21 Jul 2005 18:32:12 -0000      1.4
***************
*** 37,41 ****
      Py_DECREF(args);
      if (result) {
!         if (PyBool_Check(result)) {
              // Probably WeakCallback returning False because we're on 
shutdown.
              success = 0;
--- 37,41 ----
      Py_DECREF(args);
      if (result) {
!         if (PyBool_Check(result) || result == Py_None) {
              // Probably WeakCallback returning False because we're on 
shutdown.
              success = 0;
***************
*** 43,47 ****
                                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
--- 43,47 ----
                                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 
(%s).\n", result->ob_type->tp_name);
              PyErr_Print();
          } else
***************
*** 67,70 ****
--- 67,119 ----
  
  
+ 
+ static void x11_dest_size_cb(void *data, int video_width, int video_height,
+                 double video_pixel_aspect, int *dest_width, int *dest_height,
+                 double *dest_pixel_aspect) 
+ {
+     x11_callback_user_data *user_data = (x11_callback_user_data *)data;
+     PyObject *args, *result;
+     PyGILState_STATE gstate;
+     int success = 0;
+ 
+     if (!user_data->dest_size_callback) {
+         // This should never happen because it's checked in 
x11_open_video_driver()
+         printf("OOPS!  No frame output callback specified.\n");
+         return;
+     }
+ 
+     gstate = PyGILState_Ensure();
+     args = Py_BuildValue("(iid)", video_width, video_height, 
video_pixel_aspect);
+     result = PyEval_CallObject(user_data->dest_size_callback, args);
+     Py_DECREF(args);
+     if (result) {
+         if (PyBool_Check(result) || result == Py_None) {
+             // Probably WeakCallback returning False because we're on 
shutdown.
+             success = 0;
+         } else if (!PyArg_ParseTuple(result, "(ii)d", dest_width, 
dest_height, dest_pixel_aspect)) {
+             // FIXME: find a way to propagate this back to the main thread.
+             printf("EXCEPTION: dest_size_cb returned bad arguments (%s).\n", 
result->ob_type->tp_name);
+             PyErr_Print();
+         } else
+             success = 1;
+ 
+         Py_DECREF(result);
+     } else {
+         // FIXME: find a way to propagate this back to the main thread.
+         printf("EXCEPTION in dest_size_cb!\n");
+         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_width = *dest_height = 50;
+         *dest_pixel_aspect = 1;
+     }
+ }
+ 
+ 
  xine_video_port_t *
  x11_open_video_driver(Xine_PyObject *xine, char *driver, PyObject *kwargs, 
***************
*** 78,81 ****
--- 127,131 ----
  
      window = PyDict_GetItemString(kwargs, "window");
+     printf("Driver: %s, window: %x\n", driver, window);
      if (!x11window_object_decompose(window, &vis.d, (Display 
**)&vis.display)) {
          PyErr_Format(xine_error, "Error in window parameter.");
***************
*** 105,109 ****
      vis.user_data = user_data;
      vis.frame_output_cb = x11_frame_output_cb;
! //   vis.dest_size_cb = x11_dest_size_cb;
  
      vo = xine_open_video_driver(xine->xine, driver, XINE_VISUAL_TYPE_X11, 
(void *)&vis);
--- 155,159 ----
      vis.user_data = user_data;
      vis.frame_output_cb = x11_frame_output_cb;
!     vis.dest_size_cb = x11_dest_size_cb;
  
      vo = xine_open_video_driver(xine->xine, driver, XINE_VISUAL_TYPE_X11, 
(void *)&vis);



-------------------------------------------------------
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

Reply via email to