| 1 |
|
|---|
| 2 |
|
|---|
| 3 |
|
|---|
| 4 |
|
|---|
| 5 |
|
|---|
| 6 |
|
|---|
| 7 |
|
|---|
| 8 |
|
|---|
| 9 |
|
|---|
| 10 |
|
|---|
| 11 |
|
|---|
| 12 |
|
|---|
| 13 |
|
|---|
| 14 |
|
|---|
| 15 |
|
|---|
| 16 |
|
|---|
| 17 |
|
|---|
| 18 |
|
|---|
| 19 |
|
|---|
| 20 |
|
|---|
| 21 |
|
|---|
| 22 |
|
|---|
| 23 |
#include "vlcglue.h" |
|---|
| 24 |
|
|---|
| 25 |
|
|---|
| 26 |
|
|---|
| 27 |
|
|---|
| 28 |
|
|---|
| 29 |
static PyObject * |
|---|
| 30 |
vlcMediaPlayer_get_length( PyObject *self, PyObject *args ) |
|---|
| 31 |
{ |
|---|
| 32 |
libvlc_exception_t ex; |
|---|
| 33 |
int64_t i_ret; |
|---|
| 34 |
LIBVLC_TRY; |
|---|
| 35 |
i_ret = libvlc_media_player_get_length( LIBVLC_MEDIAPLAYER->p_mp, &ex); |
|---|
| 36 |
LIBVLC_EXCEPT; |
|---|
| 37 |
return Py_BuildValue( "L", i_ret ); |
|---|
| 38 |
} |
|---|
| 39 |
|
|---|
| 40 |
static PyObject * |
|---|
| 41 |
vlcMediaPlayer_get_time( PyObject *self, PyObject *args ) |
|---|
| 42 |
{ |
|---|
| 43 |
libvlc_exception_t ex; |
|---|
| 44 |
int64_t i_ret; |
|---|
| 45 |
LIBVLC_TRY; |
|---|
| 46 |
i_ret = libvlc_media_player_get_time( LIBVLC_MEDIAPLAYER->p_mp, &ex); |
|---|
| 47 |
LIBVLC_EXCEPT; |
|---|
| 48 |
return Py_BuildValue( "L", i_ret ); |
|---|
| 49 |
} |
|---|
| 50 |
|
|---|
| 51 |
static PyObject * |
|---|
| 52 |
vlcMediaPlayer_set_time( PyObject *self, PyObject *args ) |
|---|
| 53 |
{ |
|---|
| 54 |
libvlc_exception_t ex; |
|---|
| 55 |
int64_t i_time; |
|---|
| 56 |
|
|---|
| 57 |
if( !PyArg_ParseTuple( args, "L", &i_time ) ) |
|---|
| 58 |
return NULL; |
|---|
| 59 |
|
|---|
| 60 |
LIBVLC_TRY; |
|---|
| 61 |
libvlc_media_player_set_time( LIBVLC_MEDIAPLAYER->p_mp, i_time, &ex); |
|---|
| 62 |
LIBVLC_EXCEPT; |
|---|
| 63 |
Py_INCREF( Py_None ); |
|---|
| 64 |
return Py_None; |
|---|
| 65 |
} |
|---|
| 66 |
|
|---|
| 67 |
static PyObject * |
|---|
| 68 |
vlcMediaPlayer_get_position( PyObject *self, PyObject *args ) |
|---|
| 69 |
{ |
|---|
| 70 |
libvlc_exception_t ex; |
|---|
| 71 |
float f_ret; |
|---|
| 72 |
LIBVLC_TRY; |
|---|
| 73 |
f_ret = libvlc_media_player_get_position( LIBVLC_MEDIAPLAYER->p_mp, &ex); |
|---|
| 74 |
LIBVLC_EXCEPT; |
|---|
| 75 |
return Py_BuildValue( "f", f_ret ); |
|---|
| 76 |
} |
|---|
| 77 |
|
|---|
| 78 |
static PyObject * |
|---|
| 79 |
vlcMediaPlayer_set_position( PyObject *self, PyObject *args ) |
|---|
| 80 |
{ |
|---|
| 81 |
libvlc_exception_t ex; |
|---|
| 82 |
float f_pos; |
|---|
| 83 |
|
|---|
| 84 |
if( !PyArg_ParseTuple( args, "f", &f_pos ) ) |
|---|
| 85 |
return NULL; |
|---|
| 86 |
|
|---|
| 87 |
LIBVLC_TRY; |
|---|
| 88 |
libvlc_media_player_set_position( LIBVLC_MEDIAPLAYER->p_mp, f_pos, &ex); |
|---|
| 89 |
LIBVLC_EXCEPT; |
|---|
| 90 |
Py_INCREF( Py_None ); |
|---|
| 91 |
return Py_None; |
|---|
| 92 |
} |
|---|
| 93 |
|
|---|
| 94 |
static PyObject * |
|---|
| 95 |
vlcMediaPlayer_will_play( PyObject *self, PyObject *args ) |
|---|
| 96 |
{ |
|---|
| 97 |
libvlc_exception_t ex; |
|---|
| 98 |
int i_ret; |
|---|
| 99 |
LIBVLC_TRY; |
|---|
| 100 |
i_ret = libvlc_media_player_will_play( LIBVLC_MEDIAPLAYER->p_mp, &ex); |
|---|
| 101 |
LIBVLC_EXCEPT; |
|---|
| 102 |
return Py_BuildValue( "i", i_ret ); |
|---|
| 103 |
} |
|---|
| 104 |
|
|---|
| 105 |
static PyObject * |
|---|
| 106 |
vlcMediaPlayer_get_rate( PyObject *self, PyObject *args ) |
|---|
| 107 |
{ |
|---|
| 108 |
libvlc_exception_t ex; |
|---|
| 109 |
float f_ret; |
|---|
| 110 |
LIBVLC_TRY; |
|---|
| 111 |
f_ret = libvlc_media_player_get_rate( LIBVLC_MEDIAPLAYER->p_mp, &ex); |
|---|
| 112 |
LIBVLC_EXCEPT; |
|---|
| 113 |
return Py_BuildValue( "f", f_ret ); |
|---|
| 114 |
} |
|---|
| 115 |
|
|---|
| 116 |
static PyObject * |
|---|
| 117 |
vlcMediaPlayer_set_rate( PyObject *self, PyObject *args ) |
|---|
| 118 |
{ |
|---|
| 119 |
libvlc_exception_t ex; |
|---|
| 120 |
float f_rate; |
|---|
| 121 |
|
|---|
| 122 |
if( !PyArg_ParseTuple( args, "f", &f_rate ) ) |
|---|
| 123 |
return NULL; |
|---|
| 124 |
|
|---|
| 125 |
LIBVLC_TRY; |
|---|
| 126 |
libvlc_media_player_set_rate( LIBVLC_MEDIAPLAYER->p_mp, f_rate, &ex); |
|---|
| 127 |
LIBVLC_EXCEPT; |
|---|
| 128 |
Py_INCREF( Py_None ); |
|---|
| 129 |
return Py_None; |
|---|
| 130 |
} |
|---|
| 131 |
|
|---|
| 132 |
static PyObject * |
|---|
| 133 |
vlcMediaPlayer_get_state( PyObject *self, PyObject *args ) |
|---|
| 134 |
{ |
|---|
| 135 |
libvlc_exception_t ex; |
|---|
| 136 |
int i_ret; |
|---|
| 137 |
LIBVLC_TRY; |
|---|
| 138 |
i_ret = libvlc_media_player_get_state( LIBVLC_MEDIAPLAYER->p_mp, &ex); |
|---|
| 139 |
LIBVLC_EXCEPT; |
|---|
| 140 |
return Py_BuildValue( "i", i_ret ); |
|---|
| 141 |
} |
|---|
| 142 |
|
|---|
| 143 |
static PyObject * |
|---|
| 144 |
vlcMediaPlayer_has_vout( PyObject *self, PyObject *args ) |
|---|
| 145 |
{ |
|---|
| 146 |
libvlc_exception_t ex; |
|---|
| 147 |
int i_ret; |
|---|
| 148 |
LIBVLC_TRY; |
|---|
| 149 |
i_ret = libvlc_media_player_has_vout( LIBVLC_MEDIAPLAYER->p_mp, &ex); |
|---|
| 150 |
LIBVLC_EXCEPT; |
|---|
| 151 |
return Py_BuildValue( "i", i_ret ); |
|---|
| 152 |
} |
|---|
| 153 |
|
|---|
| 154 |
static PyObject * |
|---|
| 155 |
vlcMediaPlayer_get_fps( PyObject *self, PyObject *args ) |
|---|
| 156 |
{ |
|---|
| 157 |
libvlc_exception_t ex; |
|---|
| 158 |
float f_ret; |
|---|
| 159 |
LIBVLC_TRY; |
|---|
| 160 |
f_ret = libvlc_media_player_get_fps( LIBVLC_MEDIAPLAYER->p_mp, &ex); |
|---|
| 161 |
LIBVLC_EXCEPT; |
|---|
| 162 |
return Py_BuildValue( "f", f_ret ); |
|---|
| 163 |
} |
|---|
| 164 |
|
|---|
| 165 |
static PyObject * |
|---|
| 166 |
vlcMediaPlayer_audio_get_track( PyObject *self, PyObject *args ) |
|---|
| 167 |
{ |
|---|
| 168 |
libvlc_exception_t ex; |
|---|
| 169 |
int i_ret; |
|---|
| 170 |
|
|---|
| 171 |
LIBVLC_TRY; |
|---|
| 172 |
i_ret = libvlc_audio_get_track( LIBVLC_MEDIAPLAYER->p_mp, &ex ); |
|---|
| 173 |
LIBVLC_EXCEPT; |
|---|
| 174 |
return Py_BuildValue( "i", i_ret ); |
|---|
| 175 |
} |
|---|
| 176 |
|
|---|
| 177 |
static PyObject * |
|---|
| 178 |
vlcMediaPlayer_audio_set_track( PyObject *self, PyObject *args ) |
|---|
| 179 |
{ |
|---|
| 180 |
libvlc_exception_t ex; |
|---|
| 181 |
int i_track; |
|---|
| 182 |
|
|---|
| 183 |
if( !PyArg_ParseTuple( args, "i", &i_track ) ) |
|---|
| 184 |
return NULL; |
|---|
| 185 |
|
|---|
| 186 |
LIBVLC_TRY; |
|---|
| 187 |
libvlc_audio_set_track( LIBVLC_MEDIAPLAYER->p_mp, i_track, &ex ); |
|---|
| 188 |
LIBVLC_EXCEPT; |
|---|
| 189 |
Py_INCREF( Py_None ); |
|---|
| 190 |
return Py_None; |
|---|
| 191 |
} |
|---|
| 192 |
|
|---|
| 193 |
static PyObject * |
|---|
| 194 |
vlcMediaPlayer_get_chapter( PyObject *self, PyObject *args ) |
|---|
| 195 |
{ |
|---|
| 196 |
libvlc_exception_t ex; |
|---|
| 197 |
int i_ret; |
|---|
| 198 |
|
|---|
| 199 |
LIBVLC_TRY; |
|---|
| 200 |
i_ret = libvlc_media_player_get_chapter( LIBVLC_MEDIAPLAYER->p_mp, &ex ); |
|---|
| 201 |
LIBVLC_EXCEPT; |
|---|
| 202 |
return Py_BuildValue( "i", i_ret ); |
|---|
| 203 |
} |
|---|
| 204 |
|
|---|
| 205 |
static PyObject * |
|---|
| 206 |
vlcMediaPlayer_get_chapter_count( PyObject *self, PyObject *args ) |
|---|
| 207 |
{ |
|---|
| 208 |
libvlc_exception_t ex; |
|---|
| 209 |
int i_ret; |
|---|
| 210 |
|
|---|
| 211 |
LIBVLC_TRY; |
|---|
| 212 |
i_ret = libvlc_media_player_get_chapter_count( LIBVLC_MEDIAPLAYER->p_mp, &ex ); |
|---|
| 213 |
LIBVLC_EXCEPT; |
|---|
| 214 |
return Py_BuildValue( "i", i_ret ); |
|---|
| 215 |
} |
|---|
| 216 |
|
|---|
| 217 |
static PyObject * |
|---|
| 218 |
vlcMediaPlayer_set_chapter( PyObject *self, PyObject *args ) |
|---|
| 219 |
{ |
|---|
| 220 |
libvlc_exception_t ex; |
|---|
| 221 |
int i_chapter; |
|---|
| 222 |
|
|---|
| 223 |
if( !PyArg_ParseTuple( args, "i", &i_chapter ) ) |
|---|
| 224 |
return NULL; |
|---|
| 225 |
|
|---|
| 226 |
LIBVLC_TRY; |
|---|
| 227 |
libvlc_media_player_set_chapter( LIBVLC_MEDIAPLAYER->p_mp, i_chapter, &ex ); |
|---|
| 228 |
LIBVLC_EXCEPT; |
|---|
| 229 |
Py_INCREF( Py_None ); |
|---|
| 230 |
return Py_None; |
|---|
| 231 |
} |
|---|
| 232 |
|
|---|
| 233 |
|
|---|
| 234 |
static PyObject * |
|---|
| 235 |
vlcMediaPlayer_toggle_fullscreen( PyObject *self, PyObject *args ) |
|---|
| 236 |
{ |
|---|
| 237 |
libvlc_exception_t ex; |
|---|
| 238 |
|
|---|
| 239 |
LIBVLC_TRY; |
|---|
| 240 |
libvlc_toggle_fullscreen( LIBVLC_MEDIAPLAYER->p_mp, &ex); |
|---|
| 241 |
LIBVLC_EXCEPT; |
|---|
| 242 |
Py_INCREF( Py_None ); |
|---|
| 243 |
return Py_None; |
|---|
| 244 |
} |
|---|
| 245 |
|
|---|
| 246 |
static PyObject * |
|---|
| 247 |
vlcMediaPlayer_set_fullscreen( PyObject *self, PyObject *args ) |
|---|
| 248 |
{ |
|---|
| 249 |
libvlc_exception_t ex; |
|---|
| 250 |
int i_fullscreen; |
|---|
| 251 |
|
|---|
| 252 |
if( !PyArg_ParseTuple( args, "i", &i_fullscreen ) ) |
|---|
| 253 |
return NULL; |
|---|
| 254 |
|
|---|
| 255 |
LIBVLC_TRY; |
|---|
| 256 |
libvlc_set_fullscreen( LIBVLC_MEDIAPLAYER->p_mp, i_fullscreen, &ex); |
|---|
| 257 |
LIBVLC_EXCEPT; |
|---|
| 258 |
Py_INCREF( Py_None ); |
|---|
| 259 |
return Py_None; |
|---|
| 260 |
} |
|---|
| 261 |
|
|---|
| 262 |
static PyObject * |
|---|
| 263 |
vlcMediaPlayer_get_fullscreen( PyObject *self, PyObject *args ) |
|---|
| 264 |
{ |
|---|
| 265 |
libvlc_exception_t ex; |
|---|
| 266 |
int i_ret; |
|---|
| 267 |
|
|---|
| 268 |
LIBVLC_TRY; |
|---|
| 269 |
i_ret = libvlc_get_fullscreen( LIBVLC_MEDIAPLAYER->p_mp, &ex); |
|---|
| 270 |
LIBVLC_EXCEPT; |
|---|
| 271 |
return Py_BuildValue( "i", i_ret ); |
|---|
| 272 |
} |
|---|
| 273 |
|
|---|
| 274 |
static PyObject * |
|---|
| 275 |
vlcMediaPlayer_get_height( PyObject *self, PyObject *args ) |
|---|
| 276 |
{ |
|---|
| 277 |
libvlc_exception_t ex; |
|---|
| 278 |
int i_ret; |
|---|
| 279 |
|
|---|
| 280 |
LIBVLC_TRY; |
|---|
| 281 |
i_ret = libvlc_video_get_height( LIBVLC_MEDIAPLAYER->p_mp, &ex); |
|---|
| 282 |
LIBVLC_EXCEPT; |
|---|
| 283 |
return Py_BuildValue( "i", i_ret ); |
|---|
| 284 |
} |
|---|
| 285 |
|
|---|
| 286 |
static PyObject * |
|---|
| 287 |
vlcMediaPlayer_get_width( PyObject *self, PyObject *args ) |
|---|
| 288 |
{ |
|---|
| 289 |
libvlc_exception_t ex; |
|---|
| 290 |
int i_ret; |
|---|
| 291 |
|
|---|
| 292 |
LIBVLC_TRY; |
|---|
| 293 |
i_ret = libvlc_video_get_width( LIBVLC_MEDIAPLAYER->p_mp, &ex); |
|---|
| 294 |
LIBVLC_EXCEPT; |
|---|
| 295 |
return Py_BuildValue( "i", i_ret ); |
|---|
| 296 |
} |
|---|
| 297 |
|
|---|
| 298 |
static PyObject * |
|---|
| 299 |
vlcMediaPlayer_get_aspect_ratio( PyObject *self, PyObject *args ) |
|---|
| 300 |
{ |
|---|
| 301 |
libvlc_exception_t ex; |
|---|
| 302 |
char* psz_ret; |
|---|
| 303 |
PyObject* o_ret; |
|---|
| 304 |
|
|---|
| 305 |
LIBVLC_TRY; |
|---|
| 306 |
psz_ret = libvlc_video_get_aspect_ratio( LIBVLC_MEDIAPLAYER->p_mp, &ex); |
|---|
| 307 |
LIBVLC_EXCEPT; |
|---|
| 308 |
o_ret=Py_BuildValue( "s", psz_ret ); |
|---|
| 309 |
free( psz_ret ); |
|---|
| 310 |
return o_ret; |
|---|
| 311 |
} |
|---|
| 312 |
|
|---|
| 313 |
static PyObject * |
|---|
| 314 |
vlcMediaPlayer_set_aspect_ratio( PyObject *self, PyObject *args ) |
|---|
| 315 |
{ |
|---|
| 316 |
libvlc_exception_t ex; |
|---|
| 317 |
char* psz_ratio; |
|---|
| 318 |
|
|---|
| 319 |
if( !PyArg_ParseTuple( args, "s", &psz_ratio ) ) |
|---|
| 320 |
return NULL; |
|---|
| 321 |
|
|---|
| 322 |
LIBVLC_TRY; |
|---|
| 323 |
libvlc_video_set_aspect_ratio( LIBVLC_MEDIAPLAYER->p_mp, psz_ratio, &ex); |
|---|
| 324 |
LIBVLC_EXCEPT; |
|---|
| 325 |
free( psz_ratio ); |
|---|
| 326 |
Py_INCREF( Py_None ); |
|---|
| 327 |
return Py_None; |
|---|
| 328 |
} |
|---|
| 329 |
|
|---|
| 330 |
static PyObject * |
|---|
| 331 |
vlcMediaPlayer_video_take_snapshot( PyObject *self, PyObject *args ) |
|---|
| 332 |
{ |
|---|
| 333 |
libvlc_exception_t ex; |
|---|
| 334 |
char* psz_filename; |
|---|
| 335 |
|
|---|
| 336 |
if( !PyArg_ParseTuple( args, "s", &psz_filename ) ) |
|---|
| 337 |
return NULL; |
|---|
| 338 |
|
|---|
| 339 |
LIBVLC_TRY; |
|---|
| 340 |
libvlc_video_take_snapshot( LIBVLC_MEDIAPLAYER->p_mp, psz_filename, 0, 0, &ex); |
|---|
| 341 |
LIBVLC_EXCEPT; |
|---|
| 342 |
Py_INCREF( Py_None ); |
|---|
| 343 |
return Py_None; |
|---|
| 344 |
} |
|---|
| 345 |
|
|---|
| 346 |
static PyObject * |
|---|
| 347 |
vlcMediaPlayer_video_resize( PyObject *self, PyObject *args ) |
|---|
| 348 |
{ |
|---|
| 349 |
libvlc_exception_t ex; |
|---|
| 350 |
int i_width; |
|---|
| 351 |
int i_height; |
|---|
| 352 |
|
|---|
| 353 |
if( !PyArg_ParseTuple( args, "ii", &i_width, &i_height ) ) |
|---|
| 354 |
return NULL; |
|---|
| 355 |
|
|---|
| 356 |
LIBVLC_TRY; |
|---|
| 357 |
libvlc_video_resize( LIBVLC_MEDIAPLAYER->p_mp, i_width, i_height, &ex); |
|---|
| 358 |
LIBVLC_EXCEPT; |
|---|
| 359 |
Py_INCREF( Py_None ); |
|---|
| 360 |
return Py_None; |
|---|
| 361 |
} |
|---|
| 362 |
|
|---|
| 363 |
static PyObject * |
|---|
| 364 |
vlcMediaPlayer_video_reparent( PyObject *self, PyObject *args ) |
|---|
| 365 |
{ |
|---|
| 366 |
libvlc_exception_t ex; |
|---|
| 367 |
WINDOWHANDLE i_visual; |
|---|
| 368 |
int i_ret; |
|---|
| 369 |
|
|---|
| 370 |
if( !PyArg_ParseTuple( args, "i", &i_visual ) ) |
|---|
| 371 |
return NULL; |
|---|
| 372 |
|
|---|
| 373 |
LIBVLC_TRY; |
|---|
| 374 |
i_ret = libvlc_video_reparent( LIBVLC_MEDIAPLAYER->p_mp, i_visual, &ex); |
|---|
| 375 |
LIBVLC_EXCEPT; |
|---|
| 376 |
return Py_BuildValue( "i", i_ret ); |
|---|
| 377 |
} |
|---|
| 378 |
|
|---|
| 379 |
static PyObject * |
|---|
| 380 |
vlcMediaPlayer_is_seekable( PyObject *self, PyObject *args ) |
|---|
| 381 |
{ |
|---|
| 382 |
libvlc_exception_t ex; |
|---|
| 383 |
int i_ret; |
|---|
| 384 |
LIBVLC_TRY; |
|---|
| 385 |
i_ret = libvlc_media_player_is_seekable( LIBVLC_MEDIAPLAYER->p_mp, &ex); |
|---|
| 386 |
LIBVLC_EXCEPT; |
|---|
| 387 |
return Py_BuildValue( "i", i_ret ); |
|---|
| 388 |
} |
|---|
| 389 |
|
|---|
| 390 |
static PyObject * |
|---|
| 391 |
vlcMediaPlayer_can_pause( PyObject *self, PyObject *args ) |
|---|
| 392 |
{ |
|---|
| 393 |
libvlc_exception_t ex; |
|---|
| 394 |
int i_ret; |
|---|
| 395 |
LIBVLC_TRY; |
|---|
| 396 |
i_ret = libvlc_media_player_can_pause( LIBVLC_MEDIAPLAYER->p_mp, &ex); |
|---|
| 397 |
LIBVLC_EXCEPT; |
|---|
| 398 |
return Py_BuildValue( "i", i_ret ); |
|---|
| 399 |
} |
|---|
| 400 |
|
|---|
| 401 |
static PyObject * |
|---|
| 402 |
vlcMediaPlayer_play( PyObject *self, PyObject *args ) |
|---|
| 403 |
{ |
|---|
| 404 |
libvlc_exception_t ex; |
|---|
| 405 |
|
|---|
| 406 |
LIBVLC_TRY; |
|---|
| 407 |
libvlc_media_player_play( LIBVLC_MEDIAPLAYER->p_mp, &ex); |
|---|
| 408 |
LIBVLC_EXCEPT; |
|---|
| 409 |
Py_INCREF( Py_None ); |
|---|
| 410 |
return Py_None; |
|---|
| 411 |
} |
|---|
| 412 |
|
|---|
| 413 |
static PyObject * |
|---|
| 414 |
vlcMediaPlayer_pause( PyObject *self, PyObject *args ) |
|---|
| 415 |
{ |
|---|
| 416 |
libvlc_exception_t ex; |
|---|
| 417 |
|
|---|
| 418 |
LIBVLC_TRY; |
|---|
| 419 |
libvlc_media_player_pause( LIBVLC_MEDIAPLAYER->p_mp, &ex); |
|---|
| 420 |
LIBVLC_EXCEPT; |
|---|
| 421 |
Py_INCREF( Py_None ); |
|---|
| 422 |
return Py_None; |
|---|
| 423 |
} |
|---|
| 424 |
|
|---|
| 425 |
static PyObject * |
|---|
| 426 |
vlcMediaPlayer_stop( PyObject *self, PyObject *args ) |
|---|
| 427 |
{ |
|---|
| 428 |
libvlc_exception_t ex; |
|---|
| 429 |
|
|---|
| 430 |
LIBVLC_TRY; |
|---|
| 431 |
libvlc_media_player_stop( LIBVLC_MEDIAPLAYER->p_mp, &ex); |
|---|
| 432 |
LIBVLC_EXCEPT; |
|---|
| 433 |
Py_INCREF( Py_None ); |
|---|
| 434 |
return Py_None; |
|---|
| 435 |
} |
|---|
| 436 |
|
|---|
| 437 |
static PyObject * |
|---|
| 438 |
vlcMediaPlayer_set_drawable( PyObject *self, PyObject *args ) |
|---|
| 439 |
{ |
|---|
| 440 |
libvlc_exception_t ex; |
|---|
| 441 |
int i_drawable; |
|---|
| 442 |
|
|---|
| 443 |
if( !PyArg_ParseTuple( args, "i", &i_drawable ) ) |
|---|
| 444 |
return NULL; |
|---|
| 445 |
|
|---|
| 446 |
LIBVLC_TRY; |
|---|
| 447 |
libvlc_media_player_set_drawable( LIBVLC_MEDIAPLAYER->p_mp, (libvlc_drawable_t) i_drawable, &ex ); |
|---|
| 448 |
LIBVLC_EXCEPT; |
|---|
| 449 |
|
|---|
| 450 |
Py_INCREF( Py_None ); |
|---|
| 451 |
return Py_None; |
|---|
| 452 |
} |
|---|
| 453 |
|
|---|
| 454 |
static PyObject * |
|---|
| 455 |
vlcMediaPlayer_set_media( PyObject *self, PyObject *args ) |
|---|
| 456 |
{ |
|---|
| 457 |
libvlc_exception_t ex; |
|---|
| 458 |
PyObject* py_param = NULL; |
|---|
| 459 |
|
|---|
| 460 |
if( !PyArg_ParseTuple( args, "O", &py_param ) ) |
|---|
| 461 |
return NULL; |
|---|
| 462 |
if( PyObject_TypeCheck( py_param, &vlcMedia_Type ) == 1 ) |
|---|
| 463 |
{ |
|---|
| 464 |
LIBVLC_TRY; |
|---|
| 465 |
libvlc_media_player_set_media( LIBVLC_MEDIAPLAYER->p_mp, ((vlcMedia*)py_param)->p_media, &ex ); |
|---|
| 466 |
LIBVLC_EXCEPT; |
|---|
| 467 |
} |
|---|
| 468 |
else |
|---|
| 469 |
{ |
|---|
| 470 |
PyObject *py_exc = vlc_Exception; |
|---|
| 471 |
PyErr_SetString( py_exc, "vlc.Media parameter needed" ); |
|---|
| 472 |
return NULL; |
|---|
| 473 |
} |
|---|
| 474 |
return NULL; |
|---|
| 475 |
} |
|---|
| 476 |
|
|---|
| 477 |
static PyObject * |
|---|
| 478 |
vlcMediaPlayer_get_media( PyObject *self, PyObject *args ) |
|---|
| 479 |
{ |
|---|
| 480 |
libvlc_exception_t ex; |
|---|
| 481 |
libvlc_media_t *p_media; |
|---|
| 482 |
vlcMedia *p_ret; |
|---|
| 483 |
|
|---|
| 484 |
LIBVLC_TRY; |
|---|
| 485 |
p_media = libvlc_media_player_get_media( LIBVLC_MEDIAPLAYER->p_mp, &ex ); |
|---|
| 486 |
LIBVLC_EXCEPT; |
|---|
| 487 |
|
|---|
| 488 |
if( !p_media ) |
|---|
| 489 |
{ |
|---|
| 490 |
Py_INCREF( Py_None ); |
|---|
| 491 |
return Py_None; |
|---|
| 492 |
} |
|---|
| 493 |
else |
|---|
| 494 |
{ |
|---|
| 495 |
p_ret = PyObject_New( vlcMedia, &vlcMedia_Type ); |
|---|
| 496 |
p_ret->p_media = p_media; |
|---|
| 497 |
Py_INCREF( p_ret ); |
|---|
| 498 |
return ( PyObject * )p_ret; |
|---|
| 499 |
} |
|---|
| 500 |
} |
|---|
| 501 |
|
|---|
| 502 |
static PyObject * |
|---|
| 503 |
vlcMediaPlayer_get_spu( PyObject *self, PyObject *args ) |
|---|
| 504 |
{ |
|---|
| 505 |
libvlc_exception_t ex; |
|---|
| 506 |
int i_ret; |
|---|
| 507 |
LIBVLC_TRY; |
|---|
| 508 |
i_ret = libvlc_video_get_spu( LIBVLC_MEDIAPLAYER->p_mp, &ex); |
|---|
| 509 |
LIBVLC_EXCEPT; |
|---|
| 510 |
return Py_BuildValue( "i", i_ret ); |
|---|
| 511 |
} |
|---|
| 512 |
|
|---|
| 513 |
static PyObject * |
|---|
| 514 |
vlcMediaPlayer_set_spu( PyObject *self, PyObject *args ) |
|---|
| 515 |
{ |
|---|
| 516 |
libvlc_exception_t ex; |
|---|
| 517 |
int i_spu; |
|---|
| 518 |
|
|---|
| 519 |
if( !PyArg_ParseTuple( args, "i", &i_spu ) ) |
|---|
| 520 |
return NULL; |
|---|
| 521 |
|
|---|
| 522 |
LIBVLC_TRY; |
|---|
| 523 |
libvlc_video_set_spu( LIBVLC_MEDIAPLAYER->p_mp, i_spu, &ex); |
|---|
| 524 |
LIBVLC_EXCEPT; |
|---|
| 525 |
Py_INCREF( Py_None ); |
|---|
| 526 |
return Py_None; |
|---|
| 527 |
} |
|---|
| 528 |
|
|---|
| 529 |
|
|---|
| 530 |
static PyMethodDef vlcMediaPlayer_methods[] = |
|---|
| 531 |
{ |
|---|
| 532 |
{ "get_length", vlcMediaPlayer_get_length, METH_VARARGS, |
|---|
| 533 |
"get_length() -> long " }, |
|---|
| 534 |
{ "get_time", vlcMediaPlayer_get_time, METH_VARARGS, |
|---|
| 535 |
"get_time() -> long" }, |
|---|
| 536 |
{ "set_time", vlcMediaPlayer_set_time, METH_VARARGS, |
|---|
| 537 |
"set_time(long)" }, |
|---|
| 538 |
{ "get_position", vlcMediaPlayer_get_position, METH_VARARGS, |
|---|
| 539 |
"get_position() -> float" }, |
|---|
| 540 |
{ "set_position", vlcMediaPlayer_set_position, METH_VARARGS, |
|---|
| 541 |
"set_position(float)" }, |
|---|
| 542 |
{ "will_play", vlcMediaPlayer_will_play, METH_VARARGS, |
|---|
| 543 |
"will_play() -> int" }, |
|---|
| 544 |
{ "is_seekable", vlcMediaPlayer_is_seekable, METH_VARARGS, |
|---|
| 545 |
"is_seekable() -> int" }, |
|---|
| 546 |
{ "can_pause", vlcMediaPlayer_can_pause, METH_VARARGS, |
|---|
| 547 |
"can_pause() -> int" }, |
|---|
| 548 |
{ "get_rate", vlcMediaPlayer_get_rate, METH_VARARGS, |
|---|
| 549 |
"get_rate() -> float" }, |
|---|
| 550 |
{ "set_rate", vlcMediaPlayer_set_rate, METH_VARARGS, |
|---|
| 551 |
"set_rate(float)" }, |
|---|
| 552 |
{ "get_state", vlcMediaPlayer_get_state, METH_VARARGS, |
|---|
| 553 |
"get_state() -> int" }, |
|---|
| 554 |
{ "has_vout", vlcMediaPlayer_has_vout, METH_VARARGS, |
|---|
| 555 |
"has_vout() -> int" }, |
|---|
| 556 |
{ "get_fps", vlcMediaPlayer_get_fps, METH_VARARGS, |
|---|
| 557 |
"get_fps() -> float" }, |
|---|
| 558 |
{ "audio_get_track", vlcMediaPlayer_audio_get_track, METH_VARARGS, |
|---|
| 559 |
"audio_get_track() -> int Get current audio track" }, |
|---|
| 560 |
{ "audio_set_track", vlcMediaPlayer_audio_set_track, METH_VARARGS, |
|---|
| 561 |
"audio_set_track(int) Set current audio track" }, |
|---|
| 562 |
{ "toggle_fullscreen", vlcMediaPlayer_toggle_fullscreen, METH_VARARGS, |
|---|
| 563 |
"toggle_fullscreen() Toggle fullscreen status on video output" }, |
|---|
| 564 |
{ "set_fullscreen", vlcMediaPlayer_set_fullscreen, METH_VARARGS, |
|---|
| 565 |
"set_fullscreen(bool) Enable or disable fullscreen on a video output" }, |
|---|
| 566 |
{ "get_fullscreen", vlcMediaPlayer_get_fullscreen, METH_VARARGS, |
|---|
| 567 |
"get_fullscreen() -> bool Get current fullscreen status" }, |
|---|
| 568 |
{ "get_height", vlcMediaPlayer_get_height, METH_VARARGS, |
|---|
| 569 |
"get_height() -> int Get current video height" }, |
|---|
| 570 |
{ "get_width", vlcMediaPlayer_get_width, METH_VARARGS, |
|---|
| 571 |
"get_width() -> int Get current video width" }, |
|---|
| 572 |
{ "get_aspect_ratio", vlcMediaPlayer_get_aspect_ratio, METH_VARARGS, |
|---|
| 573 |
"get_aspect_ratio() -> str Get current video aspect ratio" }, |
|---|
| 574 |
{ "set_aspect_ratio", vlcMediaPlayer_set_aspect_ratio, METH_VARARGS, |
|---|
| 575 |
"set_aspect_ratio(str) Set new video aspect ratio" }, |
|---|
| 576 |
{ "video_take_snapshot", vlcMediaPlayer_video_take_snapshot, METH_VARARGS, |
|---|
| 577 |
"video_take_snapshot(filename=str) Take a snapshot of the current video window" }, |
|---|
| 578 |
{ "video_resize", vlcMediaPlayer_video_resize, METH_VARARGS, |
|---|
| 579 |
"video_resize(width=int, height=int) Resize the current video output window" }, |
|---|
| 580 |
{ "video_reparent", vlcMediaPlayer_video_reparent, METH_VARARGS, |
|---|
| 581 |
"video_reparent(visual=int) change the parent for the current video output" }, |
|---|
| 582 |
|
|---|
| 583 |
{ "play", vlcMediaPlayer_play, METH_VARARGS, |
|---|
| 584 |
"play() Play the media instance" }, |
|---|
| 585 |
{ "pause", vlcMediaPlayer_pause, METH_VARARGS, |
|---|
| 586 |
"pause() Pause the media instance" }, |
|---|
| 587 |
{ "stop", vlcMediaPlayer_stop, METH_VARARGS, |
|---|
| 588 |
"stop() Stop the media instance" }, |
|---|
| 589 |
{ "set_drawable", vlcMediaPlayer_set_drawable, METH_VARARGS, |
|---|
| 590 |
"set_drawable() Set the drawable id" }, |
|---|
| 591 |
|
|---|
| 592 |
{ "get_chapter", vlcMediaPlayer_get_chapter, METH_VARARGS, |
|---|
| 593 |
"get_chapter() -> int Get current chapter" }, |
|---|
| 594 |
{ "set_chapter", vlcMediaPlayer_set_chapter, METH_VARARGS, |
|---|
| 595 |
"set_chapter(int) Set current chapter" }, |
|---|
| 596 |
{ "get_chapter_count", vlcMediaPlayer_get_chapter_count, METH_VARARGS, |
|---|
| 597 |
"get_chapter_count() -> int Get current chapter count" }, |
|---|
| 598 |
|
|---|
| 599 |
{ "set_media", vlcMediaPlayer_set_media, METH_VARARGS, |
|---|
| 600 |
"set_media(vlc.Media) Set the media that will be used by the media_player" }, |
|---|
| 601 |
{ "get_media", vlcMediaPlayer_get_media, METH_VARARGS, |
|---|
| 602 |
"get_media() -> vlc.Media Get the media used by the media_player (if any)." }, |
|---|
| 603 |
|
|---|
| 604 |
{ "get_spu", vlcMediaPlayer_get_spu, METH_VARARGS, |
|---|
| 605 |
"get_spu() -> int Get current video subtitle" }, |
|---|
| 606 |
{ "set_spu", vlcMediaPlayer_set_spu, METH_VARARGS, |
|---|
| 607 |
"set_spu(int) Set new video subtitle" }, |
|---|
| 608 |
|
|---|
| 609 |
{ NULL } |
|---|
| 610 |
}; |
|---|
| 611 |
|
|---|
| 612 |
static PyTypeObject vlcMediaPlayer_Type = |
|---|
| 613 |
{ |
|---|
| 614 |
PyObject_HEAD_INIT( NULL ) |
|---|
| 615 |
0, |
|---|
| 616 |
"vlc.MediaPlayer", |
|---|
| 617 |
sizeof( vlcMediaPlayer_Type ), |
|---|
| 618 |
0, |
|---|
| 619 |
0, |
|---|
| 620 |
0, |
|---|
| 621 |
0, |
|---|
| 622 |
0, |
|---|
| 623 |
0, |
|---|
| 624 |
0, |
|---|
| 625 |
0, |
|---|
| 626 |
0, |
|---|
| 627 |
0, |
|---|
| 628 |
0, |
|---|
| 629 |
0, |
|---|
| 630 |
0, |
|---|
| 631 |
0, |
|---|
| 632 |
0, |
|---|
| 633 |
0, |
|---|
| 634 |
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, |
|---|
| 635 |
"vlc.MediaPlayer object\n\nIt cannot be instanciated standalone, it must be obtained from an existing vlc.Instance object", |
|---|
| 636 |
0, |
|---|
| 637 |
0, |
|---|
| 638 |
0, |
|---|
| 639 |
0, |
|---|
| 640 |
0, |
|---|
| 641 |
0, |
|---|
| 642 |
vlcMediaPlayer_methods, |
|---|
| 643 |
0, |
|---|
| 644 |
0, |
|---|
| 645 |
0, |
|---|
| 646 |
0, |
|---|
| 647 |
0, |
|---|
| 648 |
0, |
|---|
| 649 |
0, |
|---|
| 650 |
0, |
|---|
| 651 |
0, |
|---|
| 652 |
0, |
|---|
| 653 |
}; |
|---|
| 654 |
|
|---|