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
2e1208e6
Commit
2e1208e6
authored
Jul 31, 2009
by
Olivier Aubert
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
python-ctypes: offer shortcuts for MediaList and MediaListPlayer creation
parent
8cc51ed5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
82 additions
and
2 deletions
+82
-2
bindings/python-ctypes/override.py
bindings/python-ctypes/override.py
+82
-2
No files found.
bindings/python-ctypes/override.py
View file @
2e1208e6
...
...
@@ -17,7 +17,7 @@ class Instance:
return
o
elif
len
(
p
)
==
1
and
isinstance
(
p
[
0
],
basestring
):
# Only 1 string parameter: should be a parameter line
p
=
p
[
0
].
split
()
p
=
p
[
0
].
split
(
' '
)
elif
len
(
p
)
==
1
and
isinstance
(
p
[
0
],
(
tuple
,
list
)):
p
=
p
[
0
]
...
...
@@ -27,6 +27,26 @@ class Instance:
e
=
VLCException
()
return
libvlc_new
(
len
(
p
),
p
,
e
)
def
media_player_new
(
self
,
uri
=
None
):
"""Create a new Media Player object.
@param uri: an optional URI to play in the player.
"""
e
=
VLCException
()
p
=
libvlc_media_player_new
(
self
,
e
)
if
uri
:
p
.
set_media
(
self
.
media_new
(
uri
))
p
.
_instance
=
self
return
p
def
media_list_player_new
(
self
):
"""Create an empty Media Player object
"""
e
=
VLCException
()
p
=
libvlc_media_list_player_new
(
self
,
e
)
p
.
_instance
=
self
return
p
class
MediaControl
:
"""Create a new MediaControl instance
...
...
@@ -46,7 +66,7 @@ class MediaControl:
return
o
elif
len
(
p
)
==
1
and
isinstance
(
p
[
0
],
basestring
):
# Only 1 string parameter: should be a parameter line
p
=
p
[
0
].
split
()
p
=
p
[
0
].
split
(
' '
)
elif
len
(
p
)
==
1
and
isinstance
(
p
[
0
],
(
tuple
,
list
)):
p
=
p
[
0
]
...
...
@@ -56,3 +76,63 @@ class MediaControl:
else
:
e
=
MediaControlException
()
return
mediacontrol_new
(
len
(
p
),
p
,
e
)
class
MediaPlayer
:
"""Create a new MediaPlayer instance.
It may take as parameter either:
* a string (media URI). In this case, a vlc.Instance will be created.
* a vlc.Instance
"""
def
__new__
(
cls
,
*
p
):
if
p
and
p
[
0
]
==
0
:
return
None
elif
p
and
isinstance
(
p
[
0
],
(
int
,
long
)):
# instance creation from ctypes
o
=
object
.
__new__
(
cls
)
o
.
_as_parameter_
=
ctypes
.
c_void_p
(
p
[
0
])
return
o
if
p
and
isinstance
(
p
[
0
],
Instance
):
return
p
[
0
].
media_player_new
()
else
:
i
=
Instance
()
o
=
i
.
media_player_new
()
if
p
:
o
.
set_media
(
i
.
media_new
(
p
[
0
]))
return
o
def
get_instance
(
self
):
return
self
.
_instance
class
MediaListPlayer
:
"""Create a new MediaPlayer instance.
It may take as parameter either:
* a vlc.Instance
* nothing
"""
def
__new__
(
cls
,
*
p
):
if
p
and
p
[
0
]
==
0
:
return
None
elif
p
and
isinstance
(
p
[
0
],
(
int
,
long
)):
# instance creation from ctypes
o
=
object
.
__new__
(
cls
)
o
.
_as_parameter_
=
ctypes
.
c_void_p
(
p
[
0
])
return
o
elif
len
(
p
)
==
1
and
isinstance
(
p
[
0
],
(
tuple
,
list
)):
p
=
p
[
0
]
if
p
and
isinstance
(
p
[
0
],
Instance
):
return
p
[
0
].
media_list_player_new
()
else
:
i
=
Instance
()
o
=
i
.
media_list_player_new
()
return
o
def
get_instance
(
self
):
return
self
.
_instance
class
LogIterator
:
def
__iter__
(
self
):
return
self
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