1 /*****************************************************************************
2 * vlc_input.c: vlc.Input binding
3 *****************************************************************************
4 * Copyright (C) 2006 the VideoLAN team
7 * Authors: Olivier Aubert <oaubert at bat710.univ-lyon1.fr>
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
22 *****************************************************************************/
25 /***********************************************************************
27 ***********************************************************************/
30 vlcInput_get_length( PyObject *self, PyObject *args )
32 libvlc_exception_t ex;
35 i_ret = libvlc_input_get_length( LIBVLC_INPUT->p_input, &ex);
37 return Py_BuildValue( "L", i_ret );
41 vlcInput_get_time( PyObject *self, PyObject *args )
43 libvlc_exception_t ex;
46 i_ret = libvlc_input_get_time( LIBVLC_INPUT->p_input, &ex);
48 return Py_BuildValue( "L", i_ret );
52 vlcInput_set_time( PyObject *self, PyObject *args )
54 libvlc_exception_t ex;
57 if( !PyArg_ParseTuple( args, "L", &i_time ) )
61 libvlc_input_set_time( LIBVLC_INPUT->p_input, i_time, &ex);
68 vlcInput_get_position( PyObject *self, PyObject *args )
70 libvlc_exception_t ex;
73 f_ret = libvlc_input_get_position( LIBVLC_INPUT->p_input, &ex);
75 return Py_BuildValue( "f", f_ret );
79 vlcInput_set_position( PyObject *self, PyObject *args )
81 libvlc_exception_t ex;
84 if( !PyArg_ParseTuple( args, "f", &f_pos ) )
88 libvlc_input_set_position( LIBVLC_INPUT->p_input, f_pos, &ex);
95 vlcInput_will_play( PyObject *self, PyObject *args )
97 libvlc_exception_t ex;
100 i_ret = libvlc_input_will_play( LIBVLC_INPUT->p_input, &ex);
102 return Py_BuildValue( "i", i_ret );
106 vlcInput_get_rate( PyObject *self, PyObject *args )
108 libvlc_exception_t ex;
111 f_ret = libvlc_input_get_rate( LIBVLC_INPUT->p_input, &ex);
113 return Py_BuildValue( "f", f_ret );
117 vlcInput_set_rate( PyObject *self, PyObject *args )
119 libvlc_exception_t ex;
122 if( !PyArg_ParseTuple( args, "f", &f_rate ) )
126 libvlc_input_set_rate( LIBVLC_INPUT->p_input, f_rate, &ex);
128 Py_INCREF( Py_None );
133 vlcInput_get_state( PyObject *self, PyObject *args )
135 libvlc_exception_t ex;
138 i_ret = libvlc_input_get_state( LIBVLC_INPUT->p_input, &ex);
140 return Py_BuildValue( "i", i_ret );
144 vlcInput_has_vout( PyObject *self, PyObject *args )
146 libvlc_exception_t ex;
149 i_ret = libvlc_input_has_vout( LIBVLC_INPUT->p_input, &ex);
151 return Py_BuildValue( "i", i_ret );
155 vlcInput_get_fps( PyObject *self, PyObject *args )
157 libvlc_exception_t ex;
160 f_ret = libvlc_input_get_fps( LIBVLC_INPUT->p_input, &ex);
162 return Py_BuildValue( "f", f_ret );
165 static PyMethodDef vlcInput_methods[] =
167 { "get_length", vlcInput_get_length, METH_VARARGS,
168 "get_length() -> long" },
169 { "get_time", vlcInput_get_time, METH_VARARGS,
170 "get_time() -> long" },
171 { "set_time", vlcInput_set_time, METH_VARARGS,
173 { "get_position", vlcInput_get_position, METH_VARARGS,
174 "get_position() -> float" },
175 { "set_position", vlcInput_set_position, METH_VARARGS,
176 "set_position(float)" },
177 { "will_play", vlcInput_will_play, METH_VARARGS,
178 "will_play() -> int" },
179 { "get_rate", vlcInput_get_rate, METH_VARARGS,
180 "get_rate() -> float" },
181 { "set_rate", vlcInput_set_rate, METH_VARARGS,
183 { "get_state", vlcInput_get_state, METH_VARARGS,
184 "get_state() -> int" },
185 { "has_vout", vlcInput_has_vout, METH_VARARGS,
186 "has_vout() -> int" },
187 { "get_fps", vlcInput_get_fps, METH_VARARGS,
188 "get_fps() -> float" },
189 { NULL } /* Sentinel */
192 static PyTypeObject vlcInput_Type =
194 PyObject_HEAD_INIT( NULL )
196 "vlc.Input", /*tp_name*/
197 sizeof( vlcInput_Type ), /*tp_basicsize*/
206 0, /*tp_as_sequence*/
214 Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/
215 "vlc.Input object", /* tp_doc */
218 0, /* tp_richcompare */
219 0, /* tp_weaklistoffset */
222 vlcInput_methods, /* tp_methods */
227 0, /* tp_descr_get */
228 0, /* tp_descr_set */
229 0, /* tp_dictoffset */