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

Modified Files:
        __init__.py audio_port.c post.c stream.c video_port.c xine.c 
Added Files:
        post_in.c post_in.h post_out.c post_out.h 
Log Message:
Added types for xine_post_in_t and xine_post_out_t; fleshed out the post
API a bit more; added post wiring support (via PostOut.wire())


Index: stream.c
===================================================================
RCS file: /cvsroot/freevo/kaa/xine/src/stream.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** stream.c    18 Jul 2005 03:40:21 -0000      1.2
--- stream.c    18 Jul 2005 19:36:50 -0000      1.3
***************
*** 2,5 ****
--- 2,6 ----
  #include "stream.h"
  #include "structmember.h"
+ #include "post_out.h"
  
  Xine_Stream_PyObject *
***************
*** 112,116 ****
  Xine_Stream_PyObject__dealloc(Xine_Stream_PyObject *self)
  {
!     printf("DEalloc Stream: %x\n", self->xine);
      if (self->stream && self->xine_object_owner) {
          xine_close(self->stream);
--- 113,117 ----
  Xine_Stream_PyObject__dealloc(Xine_Stream_PyObject *self)
  {
!     printf("DEalloc Stream: %x\n", self->stream);
      if (self->stream && self->xine_object_owner) {
          xine_close(self->stream);
***************
*** 158,165 ****
--- 159,192 ----
  }
  
+ 
+ PyObject *
+ Xine_Stream_PyObject_get_source(Xine_Stream_PyObject *self, PyObject *args, 
PyObject *kwargs)
+ {
+     char *source;
+     xine_post_out_t *output = NULL;
+ 
+     if (!PyArg_ParseTuple(args, "s", &source))
+         return NULL;
+ 
+     if (!strcmp(source, "video"))
+         output = xine_get_video_source(self->stream);
+     else if (!strcmp(source, "audio"))
+         output = xine_get_audio_source(self->stream);
+ 
+     if (!output) {
+         PyErr_Format(xine_error, "Failed to get output source for %s stream", 
source);
+         return NULL;
+     }
+ 
+     return (PyObject *)pyxine_new_post_out_pyobject(NULL, output, 0);
+ }
+ 
+ 
+ 
  // *INDENT-OFF*
  PyMethodDef Xine_Stream_PyObject_methods[] = {
      {"open", (PyCFunction) Xine_Stream_PyObject_open, METH_VARARGS | 
METH_KEYWORDS},
      {"play", (PyCFunction) Xine_Stream_PyObject_play, METH_VARARGS | 
METH_KEYWORDS},
+     {"get_source", (PyCFunction) Xine_Stream_PyObject_get_source, 
METH_VARARGS | METH_KEYWORDS},
      {NULL, NULL}
  };

--- NEW FILE: post_out.c ---
#include "xine.h"
#include "post_out.h"
#include "post.h"
#include "video_port.h"
#include "audio_port.h"
#include "post_in.h"
#include "structmember.h"

Xine_Post_Out_PyObject *
pyxine_new_post_out_pyobject(Xine_Post_PyObject *post, xine_post_out_t 
*post_out, 
                         int owner)
{
    Xine_Post_Out_PyObject *o = (Xine_Post_Out_PyObject 
*)xine_object_to_pyobject_find(post_out);
    if (o) {
        Py_INCREF(o);
        return o;
    }
    o = (Xine_Post_Out_PyObject 
*)Xine_Post_Out_PyObject__new(&Xine_Post_Out_PyObject_Type, NULL, NULL);
    if (!o)
        return NULL;
    o->post_out = post_out;

    if (!post)
        post = (Xine_Post_PyObject *)Py_None;
    o->post_pyobject = (PyObject *)post;
    Py_INCREF(post);
    o->xine_object_owner = owner;
    xine_object_to_pyobject_register(post_out, (PyObject *)o);
    return o;
}


static int
Xine_Post_Out_PyObject__clear(Xine_Post_Out_PyObject *self)
{
    PyObject *tmp;
    if (self->post_pyobject) {
        tmp = self->post_pyobject;
        self->post_pyobject = 0;
        Py_DECREF(tmp);
    }
    return 0;
}

static int
Xine_Post_Out_PyObject__traverse(Xine_Post_Out_PyObject *self, visitproc visit, 
void *arg)
{
    int ret;
    if (self->post_pyobject) {
        ret = visit((PyObject *)self->post_pyobject, arg);
        if (ret != 0)
            return ret;
    }
}

PyObject *
Xine_Post_Out_PyObject__new(PyTypeObject *type, PyObject * args, PyObject * 
kwargs)
{
    Xine_Post_Out_PyObject *self;

    if (args) {
        PyErr_SetString(xine_error, "Don't call me directly");
        return NULL;
    }

    self = (Xine_Post_Out_PyObject *)type->tp_alloc(type, 0);
    self->post_out = NULL;
    self->post_pyobject = NULL;
    self->wrapper = Py_None;
    Py_INCREF(Py_None);
    return (PyObject *)self;
}

static int
Xine_Post_Out_PyObject__init(Xine_Post_Out_PyObject *self, PyObject *args, 
PyObject *kwds)
{
    return 0;
}

static PyMemberDef Xine_Post_Out_PyObject_members[] = {
    {"post", T_OBJECT_EX, offsetof(Xine_Post_Out_PyObject, post_pyobject), 0, 
"Post object"},
    {"wrapper", T_OBJECT_EX, offsetof(Xine_Post_Out_PyObject, wrapper), 0, 
"Wrapper object"},
    {NULL}
};


void
Xine_Post_Out_PyObject__dealloc(Xine_Post_Out_PyObject *self)
{
    printf("DEalloc Post Out: %x\n", self->post_out);
    if (self->post_out && self->xine_object_owner) {
    }
    Py_DECREF(self->wrapper);
    Xine_Post_Out_PyObject__clear(self);
    xine_object_to_pyobject_unregister(self->post_out);
    self->ob_type->tp_free((PyObject*)self);
}


PyObject *
Xine_Post_Out_PyObject_wire(Xine_Post_Out_PyObject *self, PyObject *args, 
PyObject *kwargs)
{
    Xine_Post_In_PyObject *input;
    int result;

    if (!PyArg_ParseTuple(args, "O!", &Xine_Post_In_PyObject_Type, &input))
        return NULL;

    result = xine_post_wire(self->post_out, input->post_in);
    return PyBool_FromLong(result);
}

PyObject *
Xine_Post_Out_PyObject_wire_video_port(Xine_Post_Out_PyObject *self, PyObject 
*args, PyObject *kwargs)
{
    Xine_Video_Port_PyObject *port;
    int result;

    if (!PyArg_ParseTuple(args, "O!", &Xine_Video_Port_PyObject_Type, &port))
        return NULL;

    result = xine_post_wire_video_port(self->post_out, port->vo);
    return PyBool_FromLong(result);
}

PyObject *
Xine_Post_Out_PyObject_wire_audio_port(Xine_Post_Out_PyObject *self, PyObject 
*args, PyObject *kwargs)
{
    Xine_Audio_Port_PyObject *port;
    int result;

    if (!PyArg_ParseTuple(args, "O!", &Xine_Audio_Port_PyObject_Type, &port))
        return NULL;

    result = xine_post_wire_audio_port(self->post_out, port->ao);
    return PyBool_FromLong(result);
}


PyMethodDef Xine_Post_Out_PyObject_methods[] = {
    {"wire", (PyCFunction) Xine_Post_Out_PyObject_wire, METH_VARARGS},
    {"wire_video_port", (PyCFunction) Xine_Post_Out_PyObject_wire_video_port, 
METH_VARARGS},
    {"wire_audio_port", (PyCFunction) Xine_Post_Out_PyObject_wire_audio_port, 
METH_VARARGS},
    {NULL, NULL}
};

PyTypeObject Xine_Post_Out_PyObject_Type = {
    PyObject_HEAD_INIT(NULL) 
    0,                          /* ob_size */
    "_xine.PostOut",               /* tp_name */
    sizeof(Xine_Post_Out_PyObject),      /* tp_basicsize */
    0,                          /* tp_itemsize */
    (destructor) Xine_Post_Out_PyObject__dealloc,        /* tp_dealloc */
    0,                          /* tp_print */
    0,                          /* tp_getattr */
    0,                          /* tp_setattr */
    0,                          /* tp_compare */
    0,                          /* tp_repr */
    0,                          /* tp_as_number */
    0,                          /* tp_as_sequence */
    0,                          /* tp_as_mapping */
    0,                          /* tp_hash */
    0,                          /* tp_call */
    0,                          /* tp_str */
    PyObject_GenericGetAttr,    /* tp_getattro */
    PyObject_GenericSetAttr,    /* tp_setattro */
    0,                          /* tp_as_buffer */
    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC, /* tp_flags 
*/
    "Xine Post Output Object",               /* tp_doc */
    (traverseproc)Xine_Post_Out_PyObject__traverse,   /* tp_traverse */
    (inquiry)Xine_Post_Out_PyObject__clear,           /* tp_clear */
    0,                         /* tp_richcompare */
    0,                         /* tp_weaklistoffset */
    0,                         /* tp_iter */
    0,                         /* tp_iternext */
    Xine_Post_Out_PyObject_methods,     /* tp_methods */
    Xine_Post_Out_PyObject_members,     /* tp_members */
    0,                         /* tp_getset */
    0,                         /* tp_base */
    0,                         /* tp_dict */
    0,                         /* tp_descr_get */
    0,                         /* tp_descr_set */
    0,                         /* tp_dictoffset */
    (initproc)Xine_Post_Out_PyObject__init, /* tp_init */
    0,                         /* tp_alloc */
    Xine_Post_Out_PyObject__new,        /* tp_new */
};



Index: post.c
===================================================================
RCS file: /cvsroot/freevo/kaa/xine/src/post.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** post.c      18 Jul 2005 03:40:21 -0000      1.1
--- post.c      18 Jul 2005 19:36:49 -0000      1.2
***************
*** 3,6 ****
--- 3,8 ----
  #include "audio_port.h"
  #include "post.h"
+ #include "post_in.h"
+ #include "post_out.h"
  #include "structmember.h"
  
***************
*** 111,117 ****
  Xine_Post_PyObject__dealloc(Xine_Post_PyObject *self)
  {
!     printf("DEalloc Post: %x\n", self->xine);
      if (self->post && self->xine_object_owner) {
!         // bug in xine?
          //xine_post_dispose(self->xine, self->post);
      }
--- 113,119 ----
  Xine_Post_PyObject__dealloc(Xine_Post_PyObject *self)
  {
!     printf("DEalloc Post: %x\n", self->post);
      if (self->post && self->xine_object_owner) {
!         // bug in xine: 
http://sourceforge.net/mailarchive/forum.php?thread_id=7753300&forum_id=7131
          //xine_post_dispose(self->xine, self->post);
      }
***************
*** 370,374 ****
  }
  
! // *INDENT-OFF*
  PyMethodDef Xine_Post_PyObject_methods[] = {
      {"get_audio_inputs", (PyCFunction) Xine_Post_PyObject_get_audio_inputs, 
METH_VARARGS},
--- 372,467 ----
  }
  
! PyObject *
! Xine_Post_PyObject_get_help(Xine_Post_PyObject *self, PyObject *args, 
PyObject *kwargs)
! {
!     xine_post_in_t *input_api;
!     xine_post_api_t *api;
!     char *help;
! 
!     input_api = (xine_post_in_t *)xine_post_input(self->post, "parameters");
!     if (!input_api) {
!         Py_INCREF(Py_None);
!         return Py_None;
!     }
! 
!     api = (xine_post_api_t *)input_api->data;
!     help = api->get_help();
!     if (!help) 
!         help = "";
!     return PyString_FromString(help);
! }
! 
! 
! PyObject *
! Xine_Post_PyObject_list_inputs(Xine_Post_PyObject *self, PyObject *args, 
PyObject *kwargs)
! {
!     const char *const *list;
!     PyObject *pylist = PyList_New(0);
!     int i;
! 
!     list = xine_post_list_inputs(self->post);
!     for (i = 0; list[i]; i++) {
!         PyObject *o = PyString_FromString(list[i]);
!         PyList_Append(pylist, o);
!         Py_DECREF(o);
!     }
! 
!     return pylist;
! }
! 
! PyObject *
! Xine_Post_PyObject_list_outputs(Xine_Post_PyObject *self, PyObject *args, 
PyObject *kwargs)
! {
!     const char *const *list;
!     PyObject *pylist = PyList_New(0);
!     int i;
! 
!     list = xine_post_list_outputs(self->post);
!     for (i = 0; list[i]; i++) {
!         PyObject *o = PyString_FromString(list[i]);
!         PyList_Append(pylist, o);
!         Py_DECREF(o);
!     }
! 
!     return pylist;
! }
! 
! PyObject *
! Xine_Post_PyObject_post_output(Xine_Post_PyObject *self, PyObject *args, 
PyObject *kwargs)
! {
!     char *name;
!     xine_post_out_t *output;
! 
!     if (!PyArg_ParseTuple(args, "s", &name))
!         return NULL;
! 
!     output = xine_post_output(self->post, name);
!     if (!output) {
!         PyErr_Format(xine_error, "Failed to get post output: %s", name);
!         return NULL;
!     }
! 
!     return (PyObject *)pyxine_new_post_out_pyobject(self, output, 1);
! }
! 
! PyObject *
! Xine_Post_PyObject_post_input(Xine_Post_PyObject *self, PyObject *args, 
PyObject *kwargs)
! {
!     char *name;
!     xine_post_in_t *input;
! 
!     if (!PyArg_ParseTuple(args, "s", &name))
!         return NULL;
! 
!     input = xine_post_input(self->post, name);
!     if (!input) {
!         PyErr_Format(xine_error, "Failed to get post input: %s", name);
!         return NULL;
!     }
! 
!     return (PyObject *)pyxine_new_post_in_pyobject(self, input, 1);
! }
! 
! 
  PyMethodDef Xine_Post_PyObject_methods[] = {
      {"get_audio_inputs", (PyCFunction) Xine_Post_PyObject_get_audio_inputs, 
METH_VARARGS},
***************
*** 377,380 ****
--- 470,482 ----
      {"get_parameters", (PyCFunction) Xine_Post_PyObject_get_parameters, 
METH_VARARGS},
      {"set_parameters", (PyCFunction) Xine_Post_PyObject_set_parameters, 
METH_VARARGS},
+     {"get_help", (PyCFunction) Xine_Post_PyObject_get_help, METH_VARARGS},
+     {"list_inputs", (PyCFunction) Xine_Post_PyObject_list_inputs, 
METH_VARARGS},
+     {"list_outputs", (PyCFunction) Xine_Post_PyObject_list_outputs, 
METH_VARARGS},
+     {"post_output", (PyCFunction) Xine_Post_PyObject_post_output, 
METH_VARARGS},
+     {"post_input", (PyCFunction) Xine_Post_PyObject_post_input, METH_VARARGS},
+ 
+ // XXX: how?
+ //    {"get_description", (PyCFunction) Xine_Post_PyObject_get_description, 
METH_VARARGS},
+ //    {"get_identifier", (PyCFunction) Xine_Post_PyObject_get_identifer, 
METH_VARARGS},
  
      {NULL, NULL}

Index: audio_port.c
===================================================================
RCS file: /cvsroot/freevo/kaa/xine/src/audio_port.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** audio_port.c        18 Jul 2005 03:40:21 -0000      1.2
--- audio_port.c        18 Jul 2005 19:36:49 -0000      1.3
***************
*** 83,87 ****
  Xine_Audio_Port_PyObject__dealloc(Xine_Audio_Port_PyObject *self)
  {
!     printf("DEalloc Audio Port: %x\n", self->xine);
      if (self->ao && self->xine_object_owner) {
          xine_close_audio_driver(self->xine, self->ao);
--- 83,87 ----
  Xine_Audio_Port_PyObject__dealloc(Xine_Audio_Port_PyObject *self)
  {
!     printf("DEalloc Audio Port: %x\n", self->ao);
      if (self->ao && self->xine_object_owner) {
          xine_close_audio_driver(self->xine, self->ao);

--- NEW FILE: post_in.c ---
#include "xine.h"
#include "post.h"
#include "post_in.h"
#include "structmember.h"

Xine_Post_In_PyObject *
pyxine_new_post_in_pyobject(Xine_Post_PyObject *post, xine_post_in_t *post_in, 
                         int owner)
{
    Xine_Post_In_PyObject *o = (Xine_Post_In_PyObject 
*)xine_object_to_pyobject_find(post_in);
    if (o) {
        Py_INCREF(o);
        return o;
    }
    o = (Xine_Post_In_PyObject 
*)Xine_Post_In_PyObject__new(&Xine_Post_In_PyObject_Type, NULL, NULL);
    if (!o)
        return NULL;
    o->post_in = post_in;
    o->post_pyobject = (PyObject *)post;
    Py_INCREF(post);
    o->xine_object_owner = owner;
    xine_object_to_pyobject_register(post_in, (PyObject *)o);
    return o;
}


static int
Xine_Post_In_PyObject__clear(Xine_Post_In_PyObject *self)
{
    PyObject *tmp;
    if (self->post_pyobject) {
        tmp = self->post_pyobject;
        self->post_pyobject = 0;
        Py_DECREF(tmp);
    }
    return 0;
}

static int
Xine_Post_In_PyObject__traverse(Xine_Post_In_PyObject *self, visitproc visit, 
void *arg)
{
    int ret;
    if (self->post_pyobject) {
        ret = visit((PyObject *)self->post_pyobject, arg);
        if (ret != 0)
            return ret;
    }
}

PyObject *
Xine_Post_In_PyObject__new(PyTypeObject *type, PyObject * args, PyObject * 
kwargs)
{
    Xine_Post_In_PyObject *self;

    if (args) {
        PyErr_SetString(xine_error, "Don't call me directly");
        return NULL;
    }

    self = (Xine_Post_In_PyObject *)type->tp_alloc(type, 0);
    self->post_in = NULL;
    self->post_pyobject = NULL;
    self->wrapper = Py_None;
    Py_INCREF(Py_None);
    return (PyObject *)self;
}

static int
Xine_Post_In_PyObject__init(Xine_Post_In_PyObject *self, PyObject *args, 
PyObject *kwds)
{
    return 0;
}

static PyMemberDef Xine_Post_In_PyObject_members[] = {
    {"post", T_OBJECT_EX, offsetof(Xine_Post_In_PyObject, post_pyobject), 0, 
"Post object"},
    {"wrapper", T_OBJECT_EX, offsetof(Xine_Post_In_PyObject, wrapper), 0, 
"Wrapper object"},
    {NULL}
};


void
Xine_Post_In_PyObject__dealloc(Xine_Post_In_PyObject *self)
{
    printf("DEalloc Post In: %x\n", self->post_in);
    if (self->post_in && self->xine_object_owner) {
    }
    Py_DECREF(self->wrapper);
    Xine_Post_In_PyObject__clear(self);
    xine_object_to_pyobject_unregister(self->post_in);
    self->ob_type->tp_free((PyObject*)self);
}


// *INDENT-OFF*
PyMethodDef Xine_Post_In_PyObject_methods[] = {
//    {"get_identifier", (PyCFunction) Xine_Post_In_PyObject_get_identifer, 
METH_VARARGS},

    {NULL, NULL}
};

PyTypeObject Xine_Post_In_PyObject_Type = {
    PyObject_HEAD_INIT(NULL) 
    0,                          /* ob_size */
    "_xine.PostIn",               /* tp_name */
    sizeof(Xine_Post_In_PyObject),      /* tp_basicsize */
    0,                          /* tp_itemsize */
    (destructor) Xine_Post_In_PyObject__dealloc,        /* tp_dealloc */
    0,                          /* tp_print */
    0,                          /* tp_getattr */
    0,                          /* tp_setattr */
    0,                          /* tp_compare */
    0,                          /* tp_repr */
    0,                          /* tp_as_number */
    0,                          /* tp_as_sequence */
    0,                          /* tp_as_mapping */
    0,                          /* tp_hash */
    0,                          /* tp_call */
    0,                          /* tp_str */
    PyObject_GenericGetAttr,    /* tp_getattro */
    PyObject_GenericSetAttr,    /* tp_setattro */
    0,                          /* tp_as_buffer */
    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC, /* tp_flags 
*/
    "Xine Post Input Object",               /* tp_doc */
    (traverseproc)Xine_Post_In_PyObject__traverse,   /* tp_traverse */
    (inquiry)Xine_Post_In_PyObject__clear,           /* tp_clear */
    0,                         /* tp_richcompare */
    0,                         /* tp_weaklistoffset */
    0,                         /* tp_iter */
    0,                         /* tp_iternext */
    Xine_Post_In_PyObject_methods,     /* tp_methods */
    Xine_Post_In_PyObject_members,     /* tp_members */
    0,                         /* tp_getset */
    0,                         /* tp_base */
    0,                         /* tp_dict */
    0,                         /* tp_descr_get */
    0,                         /* tp_descr_set */
    0,                         /* tp_dictoffset */
    (initproc)Xine_Post_In_PyObject__init, /* tp_init */
    0,                         /* tp_alloc */
    Xine_Post_In_PyObject__new,        /* tp_new */
};



--- NEW FILE: post_out.h ---
#ifndef __POST_OUT_H_
#define __POST_OUT_H_
#include "config.h"

#include <Python.h>
#include <xine.h>
#include "post.h"

#define Xine_Post_Out_PyObject_Check(v) ((v)->ob_type == 
&Xine_Post_Out_PyObject_Type)

typedef struct {
    PyObject_HEAD

    xine_post_out_t *post_out;
    int xine_object_owner;

    PyObject *post_pyobject;
    PyObject *wrapper;
} Xine_Post_Out_PyObject;

extern PyTypeObject Xine_Post_Out_PyObject_Type;

PyObject *Xine_Post_Out_PyObject__new(PyTypeObject *, PyObject *, PyObject *);
Xine_Post_Out_PyObject *pyxine_new_post_out_pyobject(Xine_Post_PyObject *, 
xine_post_out_t *, int);


#endif

Index: video_port.c
===================================================================
RCS file: /cvsroot/freevo/kaa/xine/src/video_port.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** video_port.c        18 Jul 2005 03:40:21 -0000      1.2
--- video_port.c        18 Jul 2005 19:36:50 -0000      1.3
***************
*** 93,97 ****
  Xine_Video_Port_PyObject__dealloc(Xine_Video_Port_PyObject * self)
  {
!     printf("DEalloc Video Port: %x\n", self->xine);
      if (self->vo && self->xine_object_owner) {
          xine_close_video_driver(self->xine, self->vo);
--- 93,97 ----
  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) {
          xine_close_video_driver(self->xine, self->vo);

Index: xine.c
===================================================================
RCS file: /cvsroot/freevo/kaa/xine/src/xine.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** xine.c      18 Jul 2005 03:40:21 -0000      1.2
--- xine.c      18 Jul 2005 19:36:50 -0000      1.3
***************
*** 6,9 ****
--- 6,11 ----
  #include "stream.h"
  #include "post.h"
+ #include "post_out.h"
+ #include "post_in.h"
  #include "post/buffer.h"
  
***************
*** 157,161 ****
      pylist = PyList_New(0);
      for (i = 0; list[i] != 0; i++) {
!         PyList_Append(pylist, PyString_FromString(list[i]));
      }
      return pylist;
--- 159,165 ----
      pylist = PyList_New(0);
      for (i = 0; list[i] != 0; i++) {
!         PyObject *str = PyString_FromString(list[i]);
!         PyList_Append(pylist, str);
!         Py_DECREF(str);
      }
      return pylist;
***************
*** 418,421 ****
--- 422,435 ----
      PyModule_AddObject(m, "Post", (PyObject *)&Xine_Post_PyObject_Type);
  
+     if (PyType_Ready(&Xine_Post_Out_PyObject_Type) < 0)
+         return;
+     Py_INCREF(&Xine_Post_Out_PyObject_Type);
+     PyModule_AddObject(m, "PostOut", (PyObject 
*)&Xine_Post_Out_PyObject_Type);
+ 
+     if (PyType_Ready(&Xine_Post_In_PyObject_Type) < 0)
+         return;
+     Py_INCREF(&Xine_Post_In_PyObject_Type);
+     PyModule_AddObject(m, "PostIn", (PyObject *)&Xine_Post_In_PyObject_Type);
+ 
      if (xine_object_to_pyobject_dict == NULL)
          xine_object_to_pyobject_dict = PyDict_New();

Index: __init__.py
===================================================================
RCS file: /cvsroot/freevo/kaa/xine/src/__init__.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** __init__.py 18 Jul 2005 03:40:21 -0000      1.2
--- __init__.py 18 Jul 2005 19:36:49 -0000      1.3
***************
*** 17,20 ****
--- 17,24 ----
      elif type(obj) == _xine.Post:
          o = Post(obj)
+     elif type(obj) == _xine.PostOut:
+         o = PostOut(obj)
+     elif type(obj) == _xine.PostIn:
+         o = PostIn(obj)
  
      obj.wrapper = weakref.ref(o)
***************
*** 94,97 ****
--- 98,108 ----
          return self._stream.play(pos, time)
  
+     def get_video_source(self):
+         return _wrap_xine_object(self._stream.get_source("video"))
+ 
+     def get_audio_source(self):
+         return _wrap_xine_object(self._stream.get_source("audio"))
+ 
+ 
  
  class Post(object):
***************
*** 105,108 ****
--- 116,125 ----
          return l
  
+     def get_audio_inputs(self):
+         l = []
+         for item in self._post.get_audio_inputs():
+             l.append(_wrap_xine_object(item))
+         return l
+ 
      def get_parameters_desc(self):
          return self._post.get_parameters_desc()
***************
*** 111,123 ****
          return self._post.get_parameters()
  
!     def set_parameters(self, values):
!         assert(type(values) == dict)
          parms = self.get_parameters_desc()
!         for key, value in values.items():
              assert(key in parms)
              assert(type(value) == parms[key]["type"])
  
!         return self._post.set_parameters(values)
  
!     def set_parameter(self, param, value):
!         return self.set_parameters({param: value})
--- 128,177 ----
          return self._post.get_parameters()
  
!     def set_parameters(self, **kwargs):
          parms = self.get_parameters_desc()
!         for key, value in kwargs.items():
              assert(key in parms)
              assert(type(value) == parms[key]["type"])
  
!         return self._post.set_parameters(kwargs)
  
!     def get_identifier(self):
!         return self._post.get_identifier()
! 
!     def get_description(self):
!         return self._post.get_description()
! 
!     def get_help(self):
!         return self._post.get_help()
! 
!     def list_inputs(self):
!         return self._post.list_inputs()
! 
!     def list_outputs(self):
!         return self._post.list_outputs()
! 
!     def get_output(self, name):
!         return _wrap_xine_object(self._post.post_output(name))
! 
!     def get_input(self, name):
!         return _wrap_xine_object(self._post.post_input(name))
! 
! 
! class PostOut(object):
!     def __init__(self, post_out):
!         self._post_out = post_out
! 
!     def wire(self, input):
!         if type(input) == PostIn:
!             return self._post_out.wire(input._post_in)
!         elif type(input) == VideoPort:
!             return self._post_out.wire_video_port(input._vo)
!         elif type(input) == AudioPort:
!             return self._post_out.wire_audio_port(input._ao)
!         else:
!             raise XineError, "Unsupported input type: " + str(type(input))
! 
! 
! class PostIn(object):
!     def __init__(self, post_in):
!         self._post_in = post_in

--- NEW FILE: post_in.h ---
#ifndef __POST_IN_H_
#define __POST_IN_H_
#include "config.h"

#include <Python.h>
#include <xine.h>


#define Xine_Post_In_PyObject_Check(v) ((v)->ob_type == 
&Xine_Post_In_PyObject_Type)

typedef struct {
    PyObject_HEAD

    xine_post_in_t *post_in;
    int xine_object_owner;

    PyObject *post_pyobject;
    PyObject *wrapper;
} Xine_Post_In_PyObject;

extern PyTypeObject Xine_Post_In_PyObject_Type;

PyObject *Xine_Post_In_PyObject__new(PyTypeObject *, PyObject *, PyObject *);
Xine_Post_In_PyObject *pyxine_new_post_in_pyobject(Xine_Post_PyObject *, 
xine_post_in_t *, int);


#endif



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