Changeset 18959e10b702b913c0e9461518d34c4bb160e77b
- Timestamp:
- 05/20/07 17:08:53
(1 year ago)
- Author:
- Olivier Aubert <olivier.aubert@liris.cnrs.fr>
- git-committer:
- Olivier Aubert <olivier.aubert@liris.cnrs.fr> 1179673733 +0000
- git-parent:
[f376fdb9df8064ab9904c4a50f9ee44210804423]
- git-author:
- Olivier Aubert <olivier.aubert@liris.cnrs.fr> 1179673733 +0000
- Message:
python bindings: allow to pass values in the vlc.Position constructor:
p = vlc.Position(value=16, origin=vlc.RelativePosition?)
Defaults to value=0, origin=AbsolutePosition?, key=MediaTime?
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| r7b89d13 |
r18959e1 |
|
| 47 | 47 | { |
|---|
| 48 | 48 | PyObject* p_module; |
|---|
| 49 | | |
|---|
| 50 | | PyPosition_Type.tp_new = PyType_GenericNew; |
|---|
| 51 | | PyPosition_Type.tp_alloc = PyType_GenericAlloc; |
|---|
| 52 | 49 | |
|---|
| 53 | 50 | vlcInput_Type.tp_new = PyType_GenericNew; |
|---|
| rc9958ed |
r18959e1 |
|
| 27 | 27 | ***********************************************************************/ |
|---|
| 28 | 28 | |
|---|
| 29 | | static int |
|---|
| 30 | | PyPosition_init( PyPosition *self, PyObject *args, PyObject *kwds ) |
|---|
| 31 | | { |
|---|
| 32 | | self->origin = mediacontrol_AbsolutePosition; |
|---|
| 33 | | self->key = mediacontrol_MediaTime; |
|---|
| 34 | | self->value = 0; |
|---|
| 35 | | return 0; |
|---|
| | 29 | static PyObject * |
|---|
| | 30 | PyPosition_new( PyTypeObject *type, PyObject *args, PyObject *kwds ) |
|---|
| | 31 | { |
|---|
| | 32 | PyPosition *self; |
|---|
| | 33 | static char *kwlist[] = { "value", "origin", "key", NULL}; |
|---|
| | 34 | |
|---|
| | 35 | self = PyObject_New( PyPosition, &PyPosition_Type ); |
|---|
| | 36 | |
|---|
| | 37 | self->value=0; |
|---|
| | 38 | self->origin=mediacontrol_AbsolutePosition; |
|---|
| | 39 | self->key=mediacontrol_MediaTime; |
|---|
| | 40 | |
|---|
| | 41 | /* We do not care about the return value, since it will leave the fields |
|---|
| | 42 | with their default value. */ |
|---|
| | 43 | if(! PyArg_ParseTupleAndKeywords( args, kwds, "|lii", kwlist, |
|---|
| | 44 | &(self->value), |
|---|
| | 45 | &(self->origin), |
|---|
| | 46 | &(self->key) ) ) |
|---|
| | 47 | { |
|---|
| | 48 | return NULL; |
|---|
| | 49 | } |
|---|
| | 50 | |
|---|
| | 51 | Py_INCREF( self ); |
|---|
| | 52 | return ( PyObject * )self; |
|---|
| 36 | 53 | } |
|---|
| 37 | 54 | |
|---|
| … | … | |
| 168 | 185 | 0, /*tp_as_buffer*/ |
|---|
| 169 | 186 | Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/ |
|---|
| 170 | | "Represent a Position with origin, key and value", /* tp_doc */ |
|---|
| | 187 | "Represent a Position with value, origin and key", /* tp_doc */ |
|---|
| 171 | 188 | 0, /* tp_traverse */ |
|---|
| 172 | 189 | 0, /* tp_clear */ |
|---|
| … | … | |
| 183 | 200 | 0, /* tp_descr_set */ |
|---|
| 184 | 201 | 0, /* tp_dictoffset */ |
|---|
| 185 | | ( initproc )PyPosition_init, /* tp_init */ |
|---|
| | 202 | 0, /* tp_init */ |
|---|
| 186 | 203 | 0, /* tp_alloc */ |
|---|
| 187 | | 0, /* tp_new */ |
|---|
| | 204 | PyPosition_new, /* tp_new */ |
|---|
| 188 | 205 | }; |
|---|