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

Modified Files:
        __init__.py audio_port.c audio_port.h post.c post.h post_in.h 
        post_out.h stream.c video_port.c video_port.h xine.c 
Log Message:
Add ability to get Post object from audio and video ports, if one exists;
Add ability to get Stream object from PostOut object, and some helper
functions to check the output type; Add beginnings of post plugin chain
traversal (PostIn.prev, and PostOut.next) -- doesn't do anything yet.  This
stuff is not strictly part of xine's api, but kaa-xine will offer it for
convenience.


Index: stream.c
===================================================================
RCS file: /cvsroot/freevo/kaa/xine/src/stream.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** stream.c    19 Jul 2005 16:22:20 -0000      1.6
--- stream.c    19 Jul 2005 18:05:37 -0000      1.7
***************
*** 181,185 ****
      }
  
!     return (PyObject *)pyxine_new_post_out_pyobject(NULL, output, 0);
  }
  
--- 181,185 ----
      }
  
!     return (PyObject *)pyxine_new_post_out_pyobject((Xine_Post_PyObject 
*)self, output, 0);
  }
  

Index: __init__.py
===================================================================
RCS file: /cvsroot/freevo/kaa/xine/src/__init__.py,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** __init__.py 19 Jul 2005 16:22:18 -0000      1.8
--- __init__.py 19 Jul 2005 18:05:37 -0000      1.9
***************
*** 177,180 ****
--- 177,183 ----
          self._vo = vo
  
+     def get_post_plugin(self):
+         return _wrap_xine_object(self._vo.post)
+ 
  
  class AudioPort(object):
***************
*** 182,185 ****
--- 185,190 ----
          self._ao = ao
  
+     def get_post_plugin(self):
+         return _wrap_xine_object(self._ao.post)
  
  class Stream(object):
***************
*** 310,314 ****
  
      def get_post_plugin(self):
!         return _wrap_xine_object(self._post_out.post)
  
  
--- 315,335 ----
  
      def get_post_plugin(self):
!         if type(self._post_out.post) == _xine.Post:
!             return _wrap_xine_object(self._post_out.post)
! 
!     def get_stream(self):
!         if type(self._post_out.post) == _xine.Stream:
!             return _wrap_xine_object(self._post_out.post)
! 
!     def get_output_type(self):
!         if type(self._post_out.post) == _xine.Stream:
!             return Stream
!         elif type(self._post_out.post) == _xine.Post:
!             return Post
!         
!     def get_output(self):
!         if self.get_output_type() == Stream:
!             return self.get_stream()
!         return self.get_post_plugin()
  
  

Index: post_in.h
===================================================================
RCS file: /cvsroot/freevo/kaa/xine/src/post_in.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** post_in.h   18 Jul 2005 19:36:50 -0000      1.1
--- post_in.h   19 Jul 2005 18:05:37 -0000      1.2
***************
*** 17,20 ****
--- 17,21 ----
      PyObject *post_pyobject;
      PyObject *wrapper;
+     PyObject *prev; // pointer to PostOut object.
  } Xine_Post_In_PyObject;
  

Index: post.h
===================================================================
RCS file: /cvsroot/freevo/kaa/xine/src/post.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** post.h      19 Jul 2005 16:22:20 -0000      1.2
--- post.h      19 Jul 2005 18:05:37 -0000      1.3
***************
*** 18,24 ****
      PyObject *xine_pyobject;
      xine_t *xine;
!     PyObject *audio_targets, *video_targets;
  
-     PyObject *prev, *next; // ref to previous and next plugins in the chain
      PyObject *wrapper;
  } Xine_Post_PyObject;
--- 18,23 ----
      PyObject *xine_pyobject;
      xine_t *xine;
!     PyObject *outputs, *inputs;
  
      PyObject *wrapper;
  } Xine_Post_PyObject;
***************
*** 27,31 ****
  
  PyObject *Xine_Post_PyObject__new(PyTypeObject *, PyObject *, PyObject *);
! Xine_Post_PyObject *pyxine_new_post_pyobject(Xine_PyObject *, xine_post_t *, 
PyObject *, PyObject *, int);
  
  
--- 26,32 ----
  
  PyObject *Xine_Post_PyObject__new(PyTypeObject *, PyObject *, PyObject *);
! //Xine_Post_PyObject *pyxine_new_post_pyobject(Xine_PyObject *, xine_post_t 
*, PyObject *, PyObject *, int);
! Xine_Post_PyObject *pyxine_new_post_pyobject(Xine_PyObject *, xine_post_t *, 
!                                              xine_audio_port_t **, 
xine_video_port_t **, int);
  
  

Index: audio_port.h
===================================================================
RCS file: /cvsroot/freevo/kaa/xine/src/audio_port.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** audio_port.h        18 Jul 2005 03:40:21 -0000      1.2
--- audio_port.h        19 Jul 2005 18:05:37 -0000      1.3
***************
*** 16,19 ****
--- 16,20 ----
      xine_t *xine;
  
+     PyObject *post; // post plugin for this port or None otherwise
      PyObject *wrapper;
  } Xine_Audio_Port_PyObject;
***************
*** 22,26 ****
  
  PyObject *Xine_Audio_Port_PyObject__new(PyTypeObject *, PyObject *, PyObject 
*);
! Xine_Audio_Port_PyObject *pyxine_new_audio_port_pyobject(Xine_PyObject *, 
xine_audio_port_t *, int);
  
  
--- 23,27 ----
  
  PyObject *Xine_Audio_Port_PyObject__new(PyTypeObject *, PyObject *, PyObject 
*);
! Xine_Audio_Port_PyObject *pyxine_new_audio_port_pyobject(Xine_PyObject *, 
xine_audio_port_t *, PyObject *post, int);
  
  

Index: video_port.h
===================================================================
RCS file: /cvsroot/freevo/kaa/xine/src/video_port.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** video_port.h        19 Jul 2005 02:07:24 -0000      1.3
--- video_port.h        19 Jul 2005 18:05:37 -0000      1.4
***************
*** 5,8 ****
--- 5,9 ----
  #include <Python.h>
  #include <xine.h>
+ #include <xine/video_out.h>
  
  #define Xine_Video_Port_PyObject_Check(v) ((v)->ob_type == 
&Xine_Video_Port_PyObject_Type)
***************
*** 16,19 ****
--- 17,21 ----
      xine_video_port_t *vo;
  
+     PyObject *post; // post plugin for this port or None otherwise
      PyObject *wrapper;
  
***************
*** 25,29 ****
  
  PyObject *Xine_Video_Port_PyObject__new(PyTypeObject *, PyObject *, PyObject 
*);
! Xine_Video_Port_PyObject *pyxine_new_video_port_pyobject(Xine_PyObject *, 
xine_video_port_t *, int);
  
  
--- 27,31 ----
  
  PyObject *Xine_Video_Port_PyObject__new(PyTypeObject *, PyObject *, PyObject 
*);
! Xine_Video_Port_PyObject *pyxine_new_video_port_pyobject(Xine_PyObject *, 
xine_video_port_t *, PyObject *post, int);
  
  

Index: xine.c
===================================================================
RCS file: /cvsroot/freevo/kaa/xine/src/xine.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** xine.c      19 Jul 2005 16:22:22 -0000      1.8
--- xine.c      19 Jul 2005 18:05:37 -0000      1.9
***************
*** 241,245 ****
      }
  
!     vo = pyxine_new_video_port_pyobject(self, vo_port, 1);
  
      if (!strcmp(driver, "xv") || !strcmp(driver, "auto")) {
--- 241,245 ----
      }
  
!     vo = pyxine_new_video_port_pyobject(self, vo_port, NULL, 1);
  
      if (!strcmp(driver, "xv") || !strcmp(driver, "auto")) {
***************
*** 267,271 ****
      }
  
!     return (PyObject *)pyxine_new_audio_port_pyobject(self, ao_port, 1);
  }
  
--- 267,271 ----
      }
  
!     return (PyObject *)pyxine_new_audio_port_pyobject(self, ao_port, NULL, 1);
  }
  
***************
*** 296,300 ****
      char *name;
      int inputs, i;
!     PyObject *audio_targets, *video_targets;
      xine_video_port_t **vo;
      xine_audio_port_t **ao;
--- 296,300 ----
      char *name;
      int inputs, i;
!     PyObject *audio_targets, *video_targets, *post_pyobject;
      xine_video_port_t **vo;
      xine_audio_port_t **ao;
***************
*** 317,320 ****
--- 317,323 ----
      post = xine_post_init(self->xine, name, inputs, ao, vo);
  
+     if (post)
+         post_pyobject = (PyObject *)pyxine_new_post_pyobject(self, post, ao, 
vo, 1);
+ 
      free(ao);
      free(vo);
***************
*** 324,329 ****
          return NULL;
      }
  
-     return (PyObject *)pyxine_new_post_pyobject(self, post, audio_targets, 
video_targets, 1);
  
  }
--- 327,332 ----
          return NULL;
      }
+     return post_pyobject;
  
  
  }

Index: post.c
===================================================================
RCS file: /cvsroot/freevo/kaa/xine/src/post.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** post.c      19 Jul 2005 16:22:20 -0000      1.3
--- post.c      19 Jul 2005 18:05:37 -0000      1.4
***************
*** 9,15 ****
  Xine_Post_PyObject *
  pyxine_new_post_pyobject(Xine_PyObject *xine, xine_post_t *post, 
!                          PyObject *audio_targets, PyObject *video_targets, 
                           int owner)
  {
      Xine_Post_PyObject *o = (Xine_Post_PyObject 
*)xine_object_to_pyobject_find(post);
      if (o) {
--- 9,18 ----
  Xine_Post_PyObject *
  pyxine_new_post_pyobject(Xine_PyObject *xine, xine_post_t *post, 
!                          xine_audio_port_t **ao, xine_video_port_t **vo,
! //                         PyObject *audio_targets, PyObject *video_targets, 
                           int owner)
  {
+     int i;
+     const char *const *list;
      Xine_Post_PyObject *o = (Xine_Post_PyObject 
*)xine_object_to_pyobject_find(post);
      if (o) {
***************
*** 25,33 ****
--- 28,50 ----
      o->xine_object_owner = owner;
      Py_INCREF(xine);
+     /*
      o->audio_targets = audio_targets;
      Py_INCREF(audio_targets);
      o->video_targets = video_targets;
      Py_INCREF(video_targets);
+     */
      xine_object_to_pyobject_register(post, (PyObject *)o);
+ 
+     printf("CONNECTED POST PLUGIN\n");
+     list = xine_post_list_outputs(post);
+     for (i = 0; list[i]; i++) {
+         xine_post_out_t *out = xine_post_output(post, list[i]);
+         if (out->type == XINE_POST_DATA_VIDEO) {
+             xine_video_port_t *vop = *(xine_video_port_t **)out->data;
+             printf("Output: %s out=%x outtype=%d video port: %x==%x\n", 
list[i], out, out->type, vo[i], vop);
+         }
+     }
+ 
+ 
      return o;
  }
***************
*** 38,43 ****
  Xine_Post_PyObject__clear(Xine_Post_PyObject *self)
  {
!     PyObject **list[] = {&self->xine_pyobject, &self->audio_targets, 
!                          &self->video_targets, &self->prev, &self->next, 
NULL};
      return pyxine_gc_helper_clear(list);
  }
--- 55,59 ----
  Xine_Post_PyObject__clear(Xine_Post_PyObject *self)
  {
!     PyObject **list[] = {&self->xine_pyobject, NULL };
      return pyxine_gc_helper_clear(list);
  }
***************
*** 46,51 ****
  Xine_Post_PyObject__traverse(Xine_Post_PyObject *self, visitproc visit, void 
*arg)
  {
!     PyObject **list[] = {&self->xine_pyobject, &self->audio_targets, 
!                          &self->video_targets, &self->prev, &self->next, 
NULL};
      return pyxine_gc_helper_traverse(list, visit, arg);
  }
--- 62,66 ----
  Xine_Post_PyObject__traverse(Xine_Post_PyObject *self, visitproc visit, void 
*arg)
  {
!     PyObject **list[] = {&self->xine_pyobject, NULL };
      return pyxine_gc_helper_traverse(list, visit, arg);
  }
***************
*** 65,71 ****
      self->xine = NULL;
      self->xine_pyobject = NULL;
!     self->wrapper = self->prev = self->next = Py_None;
!     Py_INCREF(Py_None);
!     Py_INCREF(Py_None);
      Py_INCREF(Py_None);
      return (PyObject *)self;
--- 80,84 ----
      self->xine = NULL;
      self->xine_pyobject = NULL;
!     self->wrapper = Py_None;
      Py_INCREF(Py_None);
      return (PyObject *)self;
***************
*** 79,84 ****
  
  static PyMemberDef Xine_Post_PyObject_members[] = {
-     {"prev", T_OBJECT_EX, offsetof(Xine_Post_PyObject, prev), 0, "Previous 
plugin in chain"},
-     {"next", T_OBJECT_EX, offsetof(Xine_Post_PyObject, next), 0, "Next plugin 
in chain"},
      {"wrapper", T_OBJECT_EX, offsetof(Xine_Post_PyObject, wrapper), 0, 
"Wrapper object"},
      {NULL}
--- 92,95 ----
***************
*** 110,114 ****
      for (i = 0; self->post->audio_input[i]; i++) {
          ao = self->post->audio_input[i];
!         o = (PyObject *)pyxine_new_audio_port_pyobject(xine, ao, 0);
          PyList_Append(list, o);
          Py_DECREF(o);
--- 121,125 ----
      for (i = 0; self->post->audio_input[i]; i++) {
          ao = self->post->audio_input[i];
!         o = (PyObject *)pyxine_new_audio_port_pyobject(xine, ao, (PyObject 
*)self, 0);
          PyList_Append(list, o);
          Py_DECREF(o);
***************
*** 128,132 ****
      for (i = 0; self->post->video_input[i]; i++) {
          vo = self->post->video_input[i];
!         o = (PyObject *)pyxine_new_video_port_pyobject(xine, vo, 0);
          PyList_Append(list, o);
          Py_DECREF(o);
--- 139,143 ----
      for (i = 0; self->post->video_input[i]; i++) {
          vo = self->post->video_input[i];
!         o = (PyObject *)pyxine_new_video_port_pyobject(xine, vo, (PyObject 
*)self, 0);
          PyList_Append(list, o);
          Py_DECREF(o);
***************
*** 418,421 ****
--- 429,433 ----
      }
  
+     //printf("POST OUTPUT DATA %s %x\n", name, *(void **)output->data);
      return (PyObject *)pyxine_new_post_out_pyobject(self, output, 1);
  }

Index: post_out.h
===================================================================
RCS file: /cvsroot/freevo/kaa/xine/src/post_out.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** post_out.h  18 Jul 2005 19:36:50 -0000      1.1
--- post_out.h  19 Jul 2005 18:05:37 -0000      1.2
***************
*** 17,20 ****
--- 17,21 ----
      PyObject *post_pyobject;
      PyObject *wrapper;
+     PyObject *next; // pointer to PostIn object
  } Xine_Post_Out_PyObject;
  

Index: video_port.c
===================================================================
RCS file: /cvsroot/freevo/kaa/xine/src/video_port.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** video_port.c        19 Jul 2005 16:22:21 -0000      1.5
--- video_port.c        19 Jul 2005 18:05:37 -0000      1.6
***************
*** 4,8 ****
  
  Xine_Video_Port_PyObject *
! pyxine_new_video_port_pyobject(Xine_PyObject * xine, xine_video_port_t * vo, 
int owner)
  {
      Xine_Video_Port_PyObject *o = (Xine_Video_Port_PyObject 
*)xine_object_to_pyobject_find(vo);
--- 4,8 ----
  
  Xine_Video_Port_PyObject *
! pyxine_new_video_port_pyobject(Xine_PyObject * xine, xine_video_port_t * vo, 
PyObject *post, int owner)
  {
      Xine_Video_Port_PyObject *o = (Xine_Video_Port_PyObject 
*)xine_object_to_pyobject_find(vo);
***************
*** 21,27 ****
      o->vo = vo;
      o->xine_pyobject = (PyObject *)xine;
      o->xine = xine->xine;
      o->xine_object_owner = owner;
!     Py_INCREF(xine);
      xine_object_to_pyobject_register(vo, (PyObject *)o);
      return o;
--- 21,33 ----
      o->vo = vo;
      o->xine_pyobject = (PyObject *)xine;
+     Py_INCREF(xine);
      o->xine = xine->xine;
      o->xine_object_owner = owner;
!     if (post && post != o->post) {
!         Py_DECREF(o->post);
!         o->post = post;
!         Py_INCREF(post);
!     }
! 
      xine_object_to_pyobject_register(vo, (PyObject *)o);
      return o;
***************
*** 33,37 ****
  Xine_Video_Port_PyObject__clear(Xine_Video_Port_PyObject * self)
  {
!     PyObject **list[] = {&self->xine_pyobject, NULL};
      return pyxine_gc_helper_clear(list);
  }
--- 39,43 ----
  Xine_Video_Port_PyObject__clear(Xine_Video_Port_PyObject * self)
  {
!     PyObject **list[] = {&self->xine_pyobject, &self->post, NULL};
      return pyxine_gc_helper_clear(list);
  }
***************
*** 41,45 ****
                                     visitproc visit, void *arg)
  {
!     PyObject **list[] = {&self->xine_pyobject, NULL};
      return pyxine_gc_helper_traverse(list, visit, arg);
  }
--- 47,51 ----
                                     visitproc visit, void *arg)
  {
!     PyObject **list[] = {&self->xine_pyobject, &self->post, NULL};
      return pyxine_gc_helper_traverse(list, visit, arg);
  }
***************
*** 60,64 ****
      self->xine = NULL;
      self->xine_pyobject = NULL;
!     self->wrapper = Py_None;
      Py_INCREF(Py_None);
      return (PyObject *) self;
--- 66,71 ----
      self->xine = NULL;
      self->xine_pyobject = NULL;
!     self->post = self->wrapper = Py_None;
!     Py_INCREF(Py_None);
      Py_INCREF(Py_None);
      return (PyObject *) self;
***************
*** 73,76 ****
--- 80,84 ----
  
  static PyMemberDef Xine_Video_Port_PyObject_members[] = {
+     {"post", T_OBJECT_EX, offsetof(Xine_Video_Port_PyObject, post), 0, "Post 
object"},
      {"wrapper", T_OBJECT_EX, offsetof(Xine_Video_Port_PyObject, wrapper), 0, 
"Wrapper object"},
      {NULL}
***************
*** 81,85 ****
  Xine_Video_Port_PyObject__dealloc(Xine_Video_Port_PyObject * self)
  {
!     printf("DEalloc Video Port: %x\n", self->vo);
      if (self->vo && self->xine_object_owner) {
          Py_BEGIN_ALLOW_THREADS
--- 89,93 ----
  Xine_Video_Port_PyObject__dealloc(Xine_Video_Port_PyObject * self)
  {
!     printf("DEalloc Video Port: %x, driver=%x\n", self->vo, 
((xine_video_port_t *)self->vo)->driver);
      if (self->vo && self->xine_object_owner) {
          Py_BEGIN_ALLOW_THREADS

Index: audio_port.c
===================================================================
RCS file: /cvsroot/freevo/kaa/xine/src/audio_port.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** audio_port.c        19 Jul 2005 16:22:20 -0000      1.5
--- audio_port.c        19 Jul 2005 18:05:37 -0000      1.6
***************
*** 5,9 ****
  
  Xine_Audio_Port_PyObject *
! pyxine_new_audio_port_pyobject(Xine_PyObject *xine, xine_audio_port_t *ao, 
int owner)
  {
      Xine_Audio_Port_PyObject *o = (Xine_Audio_Port_PyObject 
*)xine_object_to_pyobject_find(ao);
--- 5,9 ----
  
  Xine_Audio_Port_PyObject *
! pyxine_new_audio_port_pyobject(Xine_PyObject *xine, xine_audio_port_t *ao, 
PyObject *post, int owner)
  {
      Xine_Audio_Port_PyObject *o = (Xine_Audio_Port_PyObject 
*)xine_object_to_pyobject_find(ao);
***************
*** 18,24 ****
      o->ao = ao;
      o->xine_pyobject = (PyObject *)xine;
      o->xine = xine->xine;
      o->xine_object_owner = owner;
!     Py_INCREF(xine);
      xine_object_to_pyobject_register(ao, (PyObject *)o);
      return o;
--- 18,29 ----
      o->ao = ao;
      o->xine_pyobject = (PyObject *)xine;
+     Py_INCREF(xine);
      o->xine = xine->xine;
      o->xine_object_owner = owner;
!     if (post && post != o->post) {
!         Py_DECREF(o->post);
!         o->post = post;
!         Py_INCREF(post);
!     }
      xine_object_to_pyobject_register(ao, (PyObject *)o);
      return o;
***************
*** 29,33 ****
  Xine_Audio_Port_PyObject__clear(Xine_Audio_Port_PyObject *self)
  {
!     PyObject **list[] = {&self->xine_pyobject, NULL};
      return pyxine_gc_helper_clear(list);
  }
--- 34,38 ----
  Xine_Audio_Port_PyObject__clear(Xine_Audio_Port_PyObject *self)
  {
!     PyObject **list[] = {&self->xine_pyobject, &self->post, NULL};
      return pyxine_gc_helper_clear(list);
  }
***************
*** 36,40 ****
  Xine_Audio_Port_PyObject__traverse(Xine_Audio_Port_PyObject *self, visitproc 
visit, void *arg)
  {
!     PyObject **list[] = {&self->xine_pyobject, NULL};
      return pyxine_gc_helper_traverse(list, visit, arg);
  }
--- 41,45 ----
  Xine_Audio_Port_PyObject__traverse(Xine_Audio_Port_PyObject *self, visitproc 
visit, void *arg)
  {
!     PyObject **list[] = {&self->xine_pyobject, &self->post, NULL};
      return pyxine_gc_helper_traverse(list, visit, arg);
  }
***************
*** 53,57 ****
      self->ao = NULL;
      self->xine = NULL;
!     self->wrapper = Py_None;
      Py_INCREF(Py_None);
      return (PyObject *)self;
--- 58,63 ----
      self->ao = NULL;
      self->xine = NULL;
!     self->post = self->wrapper = Py_None;
!     Py_INCREF(Py_None);
      Py_INCREF(Py_None);
      return (PyObject *)self;
***************
*** 65,68 ****
--- 71,75 ----
  
  static PyMemberDef Xine_Audio_Port_PyObject_members[] = {
+     {"post", T_OBJECT_EX, offsetof(Xine_Audio_Port_PyObject, post), 0, "Post 
object"},
      {"wrapper", T_OBJECT_EX, offsetof(Xine_Audio_Port_PyObject, wrapper), 0, 
"Wrapper object"},
      {NULL}



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