Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
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
Commits
612953e0
Commit
612953e0
authored
Aug 09, 2009
by
Olivier Aubert
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
python-cytpes: fix MediaControl API support
parent
e863f5c9
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
89 additions
and
20 deletions
+89
-20
bindings/python-ctypes/TODO
bindings/python-ctypes/TODO
+11
-0
bindings/python-ctypes/generate.py
bindings/python-ctypes/generate.py
+3
-3
bindings/python-ctypes/header.py
bindings/python-ctypes/header.py
+32
-16
bindings/python-ctypes/override.py
bindings/python-ctypes/override.py
+43
-1
No files found.
bindings/python-ctypes/TODO
View file @
612953e0
...
@@ -4,3 +4,14 @@
...
@@ -4,3 +4,14 @@
* Support multiple VLC versions: define a front-end module which will
* Support multiple VLC versions: define a front-end module which will
load the appropriate versionned module from a subdirectory.
load the appropriate versionned module from a subdirectory.
* Support options: --debug/-c, --output/-o, --check-symbols/-s, ...
* Use setup.py
* Refactor code:
class Parser(list_of_includes) -> properties enums, methods...,
dump()
check()...
class PythonGenerator(parser) -> p.save( filename )
bindings/python-ctypes/generate.py
View file @
612953e0
...
@@ -114,10 +114,10 @@ typ2class={
...
@@ -114,10 +114,10 @@ typ2class={
'
mediacontrol_Instance
*
': '
MediaControl
',
'
mediacontrol_Instance
*
': '
MediaControl
',
'
mediacontrol_Exception
*
': '
MediaControlException
',
'
mediacontrol_Exception
*
': '
MediaControlException
',
'
mediacontrol_RGBPicture
*
': '
RGBPicture
',
'
mediacontrol_RGBPicture
*
': '
ctypes
.
POINTER
(
RGBPicture
)
',
'
mediacontrol_PlaylistSeq
*
': '
MediaControlPlaylistSeq
',
'
mediacontrol_PlaylistSeq
*
': '
MediaControlPlaylistSeq
',
'
mediacontrol_Position
*
': '
MediaControlPosition
',
'
mediacontrol_Position
*
': '
ctypes
.
POINTER
(
MediaControlPosition
)
',
'
mediacontrol_StreamInformation
*
': '
MediaControlStreamInformation
',
'
mediacontrol_StreamInformation
*
': '
ctypes
.
POINTER
(
MediaControlStreamInformation
)
',
'
WINDOWHANDLE
': '
ctypes
.
c_ulong
',
'
WINDOWHANDLE
': '
ctypes
.
c_ulong
',
'
void
': '
None
',
'
void
': '
None
',
...
...
bindings/python-ctypes/header.py
View file @
612953e0
...
@@ -97,6 +97,9 @@ class PlaylistItem(ctypes.Structure):
...
@@ -97,6 +97,9 @@ class PlaylistItem(ctypes.Structure):
(
'name'
,
ctypes
.
c_char_p
),
(
'name'
,
ctypes
.
c_char_p
),
]
]
def
__str__
(
self
):
return
"PlaylistItem #%d %s (%uri)"
%
(
self
.
id
,
self
.
name
,
self
.
uri
)
class
LogMessage
(
ctypes
.
Structure
):
class
LogMessage
(
ctypes
.
Structure
):
_fields_
=
[
_fields_
=
[
(
'size'
,
ctypes
.
c_uint
),
(
'size'
,
ctypes
.
c_uint
),
...
@@ -108,15 +111,22 @@ class LogMessage(ctypes.Structure):
...
@@ -108,15 +111,22 @@ class LogMessage(ctypes.Structure):
]
]
def
__str__
(
self
):
def
__str__
(
self
):
print
"vlc.LogMessage(%d:%s): %s"
%
(
self
.
severity
,
self
.
type
,
self
.
message
)
return
"vlc.LogMessage(%d:%s): %s"
%
(
self
.
severity
,
self
.
type
,
self
.
message
)
class
MediaControlPosition
(
ctypes
.
Structure
):
class
MediaControlPosition
(
ctypes
.
Structure
):
_fields_
=
[
_fields_
=
[
(
'origin'
,
ctypes
.
c_
ushor
t
),
(
'origin'
,
ctypes
.
c_
in
t
),
(
'key'
,
ctypes
.
c_
ushor
t
),
(
'key'
,
ctypes
.
c_
in
t
),
(
'value'
,
ctypes
.
c_longlong
),
(
'value'
,
ctypes
.
c_longlong
),
]
]
def
__str__
(
self
):
return
"MediaControlPosition %ld (%s, %s)"
%
(
self
.
value
,
str
(
PositionOrigin
(
self
.
origin
)),
str
(
PositionKey
(
self
.
key
))
)
@
staticmethod
@
staticmethod
def
from_param
(
arg
):
def
from_param
(
arg
):
if
isinstance
(
arg
,
(
int
,
long
)):
if
isinstance
(
arg
,
(
int
,
long
)):
...
@@ -127,15 +137,6 @@ class MediaControlPosition(ctypes.Structure):
...
@@ -127,15 +137,6 @@ class MediaControlPosition(ctypes.Structure):
else
:
else
:
return
arg
return
arg
class
MediaControlPositionOrigin
(
ctypes
.
c_uint
):
enum
=
(
'AbsolutePosition'
,
'RelativePosition'
,
'ModuloPosition'
,
)
def
__repr__
(
self
):
return
self
.
enum
[
self
.
value
]
class
MediaControlException
(
ctypes
.
Structure
):
class
MediaControlException
(
ctypes
.
Structure
):
_fields_
=
[
_fields_
=
[
(
'code'
,
ctypes
.
c_int
),
(
'code'
,
ctypes
.
c_int
),
...
@@ -149,20 +150,35 @@ class MediaControlException(ctypes.Structure):
...
@@ -149,20 +150,35 @@ class MediaControlException(ctypes.Structure):
class
MediaControlStreamInformation
(
ctypes
.
Structure
):
class
MediaControlStreamInformation
(
ctypes
.
Structure
):
_fields_
=
[
_fields_
=
[
(
'code'
,
ctypes
.
c_int
),
(
'status'
,
ctypes
.
c_int
),
(
'message'
,
ctypes
.
c_char_p
),
(
'url'
,
ctypes
.
c_char_p
),
(
'position'
,
ctypes
.
c_longlong
),
(
'length'
,
ctypes
.
c_longlong
),
]
]
def
__str__
(
self
):
return
"%s (%s) : %ld / %ld"
%
(
self
.
url
,
str
(
PlayerStatus
(
self
.
status
)),
self
.
position
,
self
.
length
)
class
RGBPicture
(
ctypes
.
Structure
):
class
RGBPicture
(
ctypes
.
Structure
):
_fields_
=
[
_fields_
=
[
(
'width'
,
ctypes
.
c_int
),
(
'width'
,
ctypes
.
c_int
),
(
'height'
,
ctypes
.
c_int
),
(
'height'
,
ctypes
.
c_int
),
(
'type'
,
ctypes
.
c_uint32
),
(
'type'
,
ctypes
.
c_uint32
),
(
'date'
,
ctypes
.
c_longlong
),
(
'date'
,
ctypes
.
c_
u
longlong
),
(
'size'
,
ctypes
.
c_int
),
(
'size'
,
ctypes
.
c_int
),
(
'data
'
,
ctypes
.
c_char
_p
),
(
'data
_pointer'
,
ctypes
.
c_void
_p
),
]
]
@
property
def
data
(
self
):
return
ctypes
.
string_at
(
self
.
data_pointer
,
self
.
size
)
def
__str__
(
self
):
return
"RGBPicture (%d, %d) - %ld ms - %d bytes"
%
(
self
.
width
,
self
.
height
,
self
.
date
,
self
.
size
)
def
free
(
self
):
def
free
(
self
):
mediacontrol_RGBPicture__free
(
self
)
mediacontrol_RGBPicture__free
(
self
)
...
...
bindings/python-ctypes/override.py
View file @
612953e0
...
@@ -77,6 +77,48 @@ class MediaControl:
...
@@ -77,6 +77,48 @@ class MediaControl:
e
=
MediaControlException
()
e
=
MediaControlException
()
return
mediacontrol_new
(
len
(
p
),
p
,
e
)
return
mediacontrol_new
(
len
(
p
),
p
,
e
)
def
get_media_position
(
self
,
origin
=
PositionOrigin
.
AbsolutePosition
,
key
=
PositionKey
.
MediaTime
):
e
=
MediaControlException
()
p
=
mediacontrol_get_media_position
(
self
,
origin
,
key
,
e
)
if
p
:
return
p
.
contents
else
:
return
None
def
set_media_position
(
self
,
pos
):
if
not
isinstance
(
pos
,
MediaControlPosition
):
pos
=
MediaControlPosition
(
origin
=
PositionOrigin
.
AbsolutePosition
,
key
=
PositionKey
.
MediaTime
,
value
=
long
(
pos
))
e
=
MediaControlException
()
mediacontrol_set_media_position
(
self
,
pos
,
e
)
def
start
(
self
,
pos
=
0
):
if
not
isinstance
(
pos
,
MediaControlPosition
):
pos
=
MediaControlPosition
(
origin
=
PositionOrigin
.
AbsolutePosition
,
key
=
PositionKey
.
MediaTime
,
value
=
long
(
pos
))
e
=
MediaControlException
()
mediacontrol_start
(
self
,
pos
,
e
)
def
snapshot
(
self
,
pos
=
0
):
if
not
isinstance
(
pos
,
MediaControlPosition
):
pos
=
MediaControlPosition
(
origin
=
PositionOrigin
.
AbsolutePosition
,
key
=
PositionKey
.
MediaTime
,
value
=
long
(
pos
))
e
=
MediaControlException
()
p
=
mediacontrol_snapshot
(
self
,
pos
,
e
)
if
p
:
return
p
.
contents
else
:
return
None
def
display_text
(
self
,
message
=
''
,
begin
=
0
,
end
=
1000
):
if
not
isinstance
(
begin
,
MediaControlPosition
):
begin
=
MediaControlPosition
(
origin
=
PositionOrigin
.
AbsolutePosition
,
key
=
PositionKey
.
MediaTime
,
value
=
long
(
begin
))
if
not
isinstance
(
end
,
MediaControlPosition
):
begin
=
MediaControlPosition
(
origin
=
PositionOrigin
.
AbsolutePosition
,
key
=
PositionKey
.
MediaTime
,
value
=
long
(
end
))
e
=
MediaControlException
()
mediacontrol_display_text
(
self
,
message
,
begin
,
end
,
e
)
def
get_stream_information
(
self
,
key
=
PositionKey
.
MediaTime
):
e
=
MediaControlException
()
return
mediacontrol_get_stream_information
(
self
,
key
,
e
).
contents
class
MediaPlayer
:
class
MediaPlayer
:
"""Create a new MediaPlayer instance.
"""Create a new MediaPlayer instance.
...
...
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