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
b25a3bb4
Commit
b25a3bb4
authored
Aug 03, 2009
by
Olivier Aubert
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
python-ctypes: make the executable version more interactive
parent
3ef6a48d
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
57 additions
and
4 deletions
+57
-4
bindings/python-ctypes/footer.py
bindings/python-ctypes/footer.py
+57
-4
No files found.
bindings/python-ctypes/footer.py
View file @
b25a3bb4
...
@@ -45,7 +45,20 @@ def debug_callback(event, data):
...
@@ -45,7 +45,20 @@ def debug_callback(event, data):
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
import
sys
import
sys
import
gobject
try
:
from
msvcrt
import
getch
except
ImportError
:
def
getch
():
import
tty
import
termios
fd
=
sys
.
stdin
.
fileno
()
old_settings
=
termios
.
tcgetattr
(
fd
)
try
:
tty
.
setraw
(
fd
)
ch
=
sys
.
stdin
.
read
(
1
)
finally
:
termios
.
tcsetattr
(
fd
,
termios
.
TCSADRAIN
,
old_settings
)
return
ch
@
callbackmethod
@
callbackmethod
def
end_callback
(
event
,
data
):
def
end_callback
(
event
,
data
):
...
@@ -58,8 +71,48 @@ if __name__ == '__main__':
...
@@ -58,8 +71,48 @@ if __name__ == '__main__':
p
=
i
.
media_player_new
()
p
=
i
.
media_player_new
()
p
.
set_media
(
m
)
p
.
set_media
(
m
)
p
.
play
()
p
.
play
()
# Loop
e
=
p
.
event_manager
()
e
=
p
.
event_manager
()
e
.
event_attach
(
EventType
.
MediaPlayerPaused
,
end_callback
,
None
)
e
.
event_attach
(
EventType
.
MediaPlayerStopped
,
end_callback
,
None
)
gobject
.
MainLoop
().
run
()
def
print_info
():
"""Print information about the media."""
m
=
p
.
get_media
()
print
"Playing "
,
m
.
get_mrl
()
print
"Current time:"
,
p
.
get_time
(),
"/"
,
m
.
get_duration
()
print
"Position"
,
p
.
get_position
()
def
forward
():
"""Go forward 1s"""
p
.
set_time
(
p
.
get_time
()
+
1000
)
def
backward
():
"""Go backward 1s"""
p
.
set_time
(
p
.
get_time
()
-
1000
)
def
print_help
():
"""Print help
"""
print
"Commands:"
for
k
,
m
in
keybindings
.
iteritems
():
print
" %s: %s"
%
(
k
,
(
m
.
__doc__
or
m
.
__name__
).
splitlines
()[
0
])
def
quit
():
"""Exit."""
sys
.
exit
(
0
)
keybindings
=
{
'f'
:
p
.
toggle_fullscreen
,
' '
:
p
.
pause
,
'+'
:
forward
,
'-'
:
backward
,
'?'
:
print_help
,
'i'
:
print_info
,
'q'
:
quit
,
}
while
True
:
k
=
getch
()
method
=
keybindings
.
get
(
k
,
None
)
if
method
is
not
None
:
method
()
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