mirror of
https://code.videolan.org/videolan/vlc
synced 2024-09-04 09:11:33 +02:00
Merge fixes to the python binding from my branch
This commit is contained in:
parent
c58f4c10dc
commit
42088654d6
@ -34,7 +34,8 @@ def get_ldflags():
|
||||
|
||||
# To compile in a local vlc tree
|
||||
vlclocal = Extension('vlc',
|
||||
sources = ['vlcglue.c', '../../src/control/init.c'],
|
||||
sources = ['vlcglue.c',
|
||||
'../../src/control/init.c'],
|
||||
include_dirs = ['../../include', '../../', '/usr/win32/include' ],
|
||||
extra_objects = [ '../../lib/libvlc.a' ],
|
||||
extra_compile_args = get_cflags(),
|
||||
|
File diff suppressed because it is too large
Load Diff
123
bindings/python/vlcglue.h
Normal file
123
bindings/python/vlcglue.h
Normal file
@ -0,0 +1,123 @@
|
||||
/*****************************************************************************
|
||||
* vlcglue.h: Main header for the Python binding
|
||||
*****************************************************************************
|
||||
* Copyright (C) 1998-2004 the VideoLAN team
|
||||
* $Id: vlc.c 12667 2005-09-25 10:19:26Z zorglub $
|
||||
*
|
||||
* Authors: Olivier Aubert <oaubert at bat710.univ-lyon1.fr>
|
||||
* Clément Stenac <zorglub@videolan.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
|
||||
*****************************************************************************/
|
||||
|
||||
#include <Python.h>
|
||||
#include "structmember.h"
|
||||
|
||||
/* Undefine the following define to disable low-level vlc Object support */
|
||||
#define VLCOBJECT_SUPPORT 0
|
||||
|
||||
#define __VLC__
|
||||
|
||||
#include <stdio.h>
|
||||
#include <vlc/control.h>
|
||||
|
||||
#define SELF ((MediaControl*)self)
|
||||
|
||||
/**********************************************************************
|
||||
* Exceptions handling
|
||||
**********************************************************************/
|
||||
|
||||
#define MC_TRY exception=mediacontrol_exception_init(exception)
|
||||
|
||||
#define MC_EXCEPT \
|
||||
if (exception->code) { \
|
||||
PyObject *py_exc = MediaControl_InternalException; \
|
||||
switch (exception->code) { \
|
||||
case mediacontrol_InternalException: \
|
||||
py_exc = MediaControl_InternalException; \
|
||||
break; \
|
||||
case mediacontrol_PlaylistException: \
|
||||
py_exc = MediaControl_PlaylistException; \
|
||||
break; \
|
||||
case mediacontrol_InvalidPosition: \
|
||||
py_exc = MediaControl_InvalidPosition; \
|
||||
break; \
|
||||
case mediacontrol_PositionKeyNotSupported: \
|
||||
py_exc = MediaControl_PositionKeyNotSupported; \
|
||||
break; \
|
||||
case mediacontrol_PositionOriginNotSupported: \
|
||||
py_exc = MediaControl_PositionOriginNotSupported; \
|
||||
break; \
|
||||
} \
|
||||
PyErr_SetString(py_exc, exception->message); \
|
||||
mediacontrol_exception_free(exception); \
|
||||
return NULL; \
|
||||
} else { mediacontrol_exception_free(exception); }
|
||||
|
||||
PyObject *MediaControl_InternalException;
|
||||
PyObject *MediaControl_PositionKeyNotSupported;
|
||||
PyObject *MediaControl_PositionOriginNotSupported;
|
||||
PyObject *MediaControl_InvalidPosition;
|
||||
PyObject *MediaControl_PlaylistException;
|
||||
|
||||
/**********************************************************************
|
||||
* VLC Object
|
||||
**********************************************************************/
|
||||
#ifdef VLCOBJECT_SUPPORT
|
||||
|
||||
#define VLCSELF ((vlcObject*)self)
|
||||
|
||||
/**********************************************************************
|
||||
* VLCObject Object
|
||||
**********************************************************************/
|
||||
typedef struct
|
||||
{
|
||||
PyObject_HEAD
|
||||
vlc_object_t* p_object;
|
||||
int b_released;
|
||||
} vlcObject;
|
||||
|
||||
staticforward PyTypeObject vlcObject_Type;
|
||||
|
||||
#endif
|
||||
|
||||
/**********************************************************************
|
||||
* MediaControl Object
|
||||
**********************************************************************/
|
||||
typedef struct
|
||||
{
|
||||
PyObject_HEAD
|
||||
mediacontrol_Instance* mc;
|
||||
}MediaControl;
|
||||
|
||||
staticforward PyTypeObject MediaControl_Type;
|
||||
|
||||
/**********************************************************************
|
||||
* Position Object
|
||||
**********************************************************************/
|
||||
typedef struct
|
||||
{
|
||||
PyObject_HEAD
|
||||
int origin;
|
||||
int key;
|
||||
long long value;
|
||||
} PyPosition;
|
||||
|
||||
staticforward PyTypeObject PyPosition_Type;
|
||||
|
||||
mediacontrol_PositionKey positionKey_py_to_c( PyObject * py_key );
|
||||
mediacontrol_PositionOrigin positionOrigin_py_to_c( PyObject * py_origin );
|
||||
mediacontrol_Position* position_py_to_c( PyObject * py_position );
|
||||
PyPosition* position_c_to_py(mediacontrol_Position *position);
|
@ -186,7 +186,7 @@ int aout_OutputNew( aout_instance_t * p_aout,
|
||||
p_aout->mixer.mixer.i_format = p_format->i_format;
|
||||
}
|
||||
|
||||
aout_FormatPrint( p_aout, "mixer", &p_aout->output.output );
|
||||
aout_FormatPrint( p_aout, "mixer", &p_aout->mixer.mixer );
|
||||
|
||||
/* Create filters. */
|
||||
p_aout->output.i_nb_filters = 0;
|
||||
|
@ -74,7 +74,8 @@ mediacontrol_Instance* mediacontrol_new_from_object( vlc_object_t* p_object,
|
||||
retval->vlc_object_id = p_vlc->i_object_id;
|
||||
|
||||
/* We can keep references on these, which should not change. Is it true ? */
|
||||
retval->p_playlist = vlc_object_find( p_vlc, VLC_OBJECT_PLAYLIST, FIND_ANYWHERE );
|
||||
retval->p_playlist = vlc_object_find( p_vlc,
|
||||
VLC_OBJECT_PLAYLIST, FIND_ANYWHERE );
|
||||
retval->p_intf = vlc_object_find( p_vlc, VLC_OBJECT_INTF, FIND_ANYWHERE );
|
||||
|
||||
if( ! retval->p_playlist || ! retval->p_intf )
|
||||
@ -272,7 +273,8 @@ mediacontrol_playlist_add_item( mediacontrol_Instance *self,
|
||||
return;
|
||||
}
|
||||
|
||||
playlist_Add( self->p_playlist, psz_file, psz_file , PLAYLIST_REPLACE, 0 );
|
||||
playlist_Add( self->p_playlist, psz_file, psz_file , PLAYLIST_INSERT,
|
||||
PLAYLIST_END );
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -62,7 +62,8 @@ mediacontrol_Instance* mediacontrol_new( char** args, mediacontrol_Exception *ex
|
||||
retval->vlc_object_id = p_vlc_id;
|
||||
|
||||
/* We can keep references on these, which should not change. Is it true ? */
|
||||
retval->p_playlist = vlc_object_find( p_vlc, VLC_OBJECT_PLAYLIST, FIND_ANYWHERE );
|
||||
retval->p_playlist = vlc_object_find( p_vlc,
|
||||
VLC_OBJECT_PLAYLIST, FIND_ANYWHERE );
|
||||
retval->p_intf = vlc_object_find( p_vlc, VLC_OBJECT_INTF, FIND_ANYWHERE );
|
||||
|
||||
if( ! retval->p_playlist || ! retval->p_intf )
|
||||
@ -71,16 +72,19 @@ mediacontrol_Instance* mediacontrol_new( char** args, mediacontrol_Exception *ex
|
||||
exception->message = strdup( "No available interface" );
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
return retval;
|
||||
};
|
||||
|
||||
void
|
||||
mediacontrol_exit( mediacontrol_Instance *self )
|
||||
{
|
||||
/*
|
||||
|
||||
vlc_object_release( (vlc_object_t* )self->p_playlist );
|
||||
vlc_object_release( (vlc_object_t* )self->p_intf );
|
||||
*/
|
||||
vlc_object_release( (vlc_object_t*)self->p_vlc );
|
||||
|
||||
VLC_CleanUp( self->vlc_object_id );
|
||||
VLC_Destroy( self->vlc_object_id );
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user