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
1e8f719b
Commit
1e8f719b
authored
Sep 03, 2009
by
Olivier Aubert
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
python-ctypes: implement comparison operators for enum classes
parent
3a38a0e0
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
25 additions
and
14 deletions
+25
-14
bindings/python-ctypes/TODO
bindings/python-ctypes/TODO
+0
-2
bindings/python-ctypes/generate.py
bindings/python-ctypes/generate.py
+8
-1
bindings/python-ctypes/test.py
bindings/python-ctypes/test.py
+17
-11
No files found.
bindings/python-ctypes/TODO
View file @
1e8f719b
* Investigate memory management
* Write a test suite
* Support multiple VLC versions: define a front-end module which will
load the appropriate versionned module from a subdirectory.
bindings/python-ctypes/generate.py
View file @
1e8f719b
...
...
@@ -478,7 +478,7 @@ class PythonGenerator(object):
conv
[
k
]
=
n
for
k
,
v
in
values
:
self
.
output
(
" %s=
%s
"
%
(
conv
[
k
],
v
))
self
.
output
(
" %s=
ctypes.c_uint(%s)
"
%
(
conv
[
k
],
v
))
self
.
output
(
" _names={"
)
for
k
,
v
in
values
:
...
...
@@ -488,6 +488,13 @@ class PythonGenerator(object):
self
.
output
(
"""
def __repr__(self):
return ".".join((self.__class__.__module__, self.__class__.__name__, self._names[self.value]))
def __eq__(self, other):
return (isinstance(other, ctypes.c_uint) and self.value == other.value)
def __ne__(self, other):
return not self.__eq__(other)
"""
)
def
output_ctypes
(
self
,
rtype
,
method
,
params
,
comment
):
...
...
bindings/python-ctypes/test.py
View file @
1e8f719b
...
...
@@ -37,37 +37,37 @@ class TestVLCAPI(unittest.TestCase):
# failure, check that the reason is not a change in the .h
# definitions.
def
test_enum_event_type
(
self
):
self
.
assertEqual
(
vlc
.
EventType
.
MediaStateChanged
,
5
)
self
.
assertEqual
(
vlc
.
EventType
.
MediaStateChanged
.
value
,
5
)
def
test_enum_meta
(
self
):
self
.
assertEqual
(
vlc
.
Meta
.
Description
,
6
)
self
.
assertEqual
(
vlc
.
Meta
.
Description
.
value
,
6
)
def
test_enum_state
(
self
):
self
.
assertEqual
(
vlc
.
State
.
Playing
,
3
)
self
.
assertEqual
(
vlc
.
State
.
Playing
.
value
,
3
)
def
test_enum_media_option
(
self
):
self
.
assertEqual
(
vlc
.
MediaOption
.
unique
,
256
)
self
.
assertEqual
(
vlc
.
MediaOption
.
unique
.
value
,
256
)
def
test_enum_playback_mode
(
self
):
self
.
assertEqual
(
vlc
.
PlaybackMode
.
repeat
,
2
)
self
.
assertEqual
(
vlc
.
PlaybackMode
.
repeat
.
value
,
2
)
def
test_enum_marquee_int_option
(
self
):
self
.
assertEqual
(
vlc
.
VideoMarqueeIntOption
.
Size
,
5
)
self
.
assertEqual
(
vlc
.
VideoMarqueeIntOption
.
Size
.
value
,
5
)
def
test_enum_output_device_type
(
self
):
self
.
assertEqual
(
vlc
.
AudioOutputDeviceTypes
.
_2F2R
,
4
)
self
.
assertEqual
(
vlc
.
AudioOutputDeviceTypes
.
_2F2R
.
value
,
4
)
def
test_enum_output_channel
(
self
):
self
.
assertEqual
(
vlc
.
AudioOutputChannel
.
Dolbys
,
5
)
self
.
assertEqual
(
vlc
.
AudioOutputChannel
.
Dolbys
.
value
,
5
)
def
test_enum_position_origin
(
self
):
self
.
assertEqual
(
vlc
.
PositionOrigin
.
ModuloPosition
,
2
)
self
.
assertEqual
(
vlc
.
PositionOrigin
.
ModuloPosition
.
value
,
2
)
def
test_enum_position_key
(
self
):
self
.
assertEqual
(
vlc
.
PositionKey
.
MediaTime
,
2
)
self
.
assertEqual
(
vlc
.
PositionKey
.
MediaTime
.
value
,
2
)
def
test_enum_player_status
(
self
):
self
.
assertEqual
(
vlc
.
PlayerStatus
.
StopStatus
,
5
)
self
.
assertEqual
(
vlc
.
PlayerStatus
.
StopStatus
.
value
,
5
)
# Basic MediaControl tests
def
test_mediacontrol_creation
(
self
):
...
...
@@ -101,5 +101,11 @@ class TestVLCAPI(unittest.TestCase):
p
=
i
.
media_player_new
(
mrl
)
self
.
assertEqual
(
p
.
get_media
().
get_mrl
(),
mrl
)
def
test_libvlc_player_state
(
self
):
mrl
=
'/tmp/foo.avi'
i
=
vlc
.
Instance
()
p
=
i
.
media_player_new
(
mrl
)
self
.
assertEqual
(
p
.
get_state
(),
vlc
.
State
.
Ended
)
if
__name__
==
'__main__'
:
unittest
.
main
()
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