Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-gpu
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc-gpu
Commits
365408f9
Commit
365408f9
authored
Aug 28, 2009
by
Olivier Aubert
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
python-ctypes: check at load time the availability of symbols before trying to wrap them
parent
4b8fd642
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
23 deletions
+27
-23
bindings/python-ctypes/generate.py
bindings/python-ctypes/generate.py
+27
-23
No files found.
bindings/python-ctypes/generate.py
View file @
365408f9
...
...
@@ -65,14 +65,16 @@ blacklist=[
"libvlc_media_list_view_remove_at_index"
,
"libvlc_media_list_view_add_item"
,
# In svn but not in current 1.0.0
"libvlc_media_add_option_flag"
,
'libvlc_video_set_deinterlace'
,
'libvlc_video_get_marquee_option_as_int'
,
'libvlc_video_get_marquee_option_as_string'
,
'libvlc_video_set_marquee_option_as_int'
,
'libvlc_video_set_marquee_option_as_string'
,
'libvlc_vlm_get_event_manager'
,
# In svn but not in current 1.0.0.
#"libvlc_media_add_option_flag",
#'libvlc_video_set_deinterlace',
#'libvlc_video_get_marquee_option_as_int',
#'libvlc_video_get_marquee_option_as_string',
#'libvlc_video_set_marquee_option_as_int',
#'libvlc_video_set_marquee_option_as_string',
#'libvlc_vlm_get_event_manager',
#"libvlc_media_list_player_event_manager",
#'libvlc_media_player_next_frame',
'mediacontrol_PlaylistSeq__free'
,
]
...
...
@@ -478,25 +480,26 @@ class PythonGenerator(object):
# FIXME
return
self
.
output
(
"""if hasattr(dll, '%s'):"""
%
method
)
if
params
:
self
.
output
(
"prototype=ctypes.CFUNCTYPE(%s, %s)"
%
(
self
.
type2class
.
get
(
rtype
,
'FIXME_%s'
%
rtype
),
self
.
output
(
"
prototype=ctypes.CFUNCTYPE(%s, %s)"
%
(
self
.
type2class
.
get
(
rtype
,
'FIXME_%s'
%
rtype
),
","
.
join
(
self
.
type2class
[
p
[
0
]]
for
p
in
params
)))
else
:
self
.
output
(
"prototype=ctypes.CFUNCTYPE(%s)"
%
self
.
type2class
.
get
(
rtype
,
'FIXME_%s'
%
rtype
))
self
.
output
(
"
prototype=ctypes.CFUNCTYPE(%s)"
%
self
.
type2class
.
get
(
rtype
,
'FIXME_%s'
%
rtype
))
if
not
params
:
flags
=
'paramflags= tuple()'
flags
=
'
paramflags= tuple()'
elif
len
(
params
)
==
1
:
flags
=
"paramflags=( (%d, ), )"
%
parameter_passing
[
params
[
0
][
0
]]
flags
=
"
paramflags=( (%d, ), )"
%
parameter_passing
[
params
[
0
][
0
]]
else
:
flags
=
"paramflags=%s"
%
","
.
join
(
'(%d,)'
%
parameter_passing
[
p
[
0
]]
for
p
in
params
)
flags
=
"
paramflags=%s"
%
","
.
join
(
'(%d,)'
%
parameter_passing
[
p
[
0
]]
for
p
in
params
)
self
.
output
(
flags
)
self
.
output
(
'%s = prototype( ("%s", dll), paramflags )'
%
(
method
,
method
))
self
.
output
(
'
%s = prototype( ("%s", dll), paramflags )'
%
(
method
,
method
))
if
'3'
in
flags
:
# A VLCException is present. Process it.
self
.
output
(
"%s.errcheck = check_vlc_exception"
%
method
)
self
.
output
(
'%s.__doc__ = """%s"""'
%
(
method
,
comment
))
self
.
output
(
"
%s.errcheck = check_vlc_exception"
%
method
)
self
.
output
(
'
%s.__doc__ = """%s"""'
%
(
method
,
comment
))
self
.
output
()
def
parse_override
(
self
,
name
):
...
...
@@ -613,18 +616,19 @@ class PythonGenerator(object):
else:
args=", ".join( p[1] for p in params )
self.output(" def %s(%s):" % (name, args))
self.output('
"""%s
\
n
"""' % self.fix_python_comment(comment))
self.output(" if hasattr(dll, '
%
s
'):" % method)
self.output(" def %s(%s):" % (name, args))
self.output('
"""%s
\
n
"""' % self.fix_python_comment(comment))
if params and params[-1][0] == '
libvlc_exception_t
*
':
# Exception handling
self.output(" e=VLCException()")
self.output(" return %s(%s, e)" % (method, args))
self.output("
e=VLCException()")
self.output("
return %s(%s, e)" % (method, args))
elif params and params[-1][0] == '
mediacontrol_Exception
*
':
# Exception handling
self.output(" e=MediaControlException()")
self.output(" return %s(%s, e)" % (method, args))
self.output("
e=MediaControlException()")
self.output("
return %s(%s, e)" % (method, args))
else:
self.output(" return %s(%s)" % (method, args))
self.output("
return %s(%s)" % (method, args))
self.output()
# Check for standard methods
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment