Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-1.1
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-1.1
Commits
7930c1b3
Commit
7930c1b3
authored
Nov 21, 2006
by
Rafaël Carré
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implement input position control
parent
e7bcc680
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
92 additions
and
24 deletions
+92
-24
extras/dbus-vlc.glade
extras/dbus-vlc.glade
+5
-16
extras/dbus-vlc.py
extras/dbus-vlc.py
+22
-7
modules/control/dbus.c
modules/control/dbus.c
+58
-1
modules/control/dbus.h
modules/control/dbus.h
+7
-0
No files found.
extras/dbus-vlc.glade
View file @
7930c1b3
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE glade-interface SYSTEM "glade-2.0.dtd">
<!--Generated with glade3 3.0.2 on Tue Nov 21 1
2:55:24
2006 by fun@zod-->
<!--Generated with glade3 3.0.2 on Tue Nov 21 1
5:28:41
2006 by fun@zod-->
<glade-interface>
<widget
class=
"GtkWindow"
id=
"window1"
>
<property
name=
"resizable"
>
False
</property>
...
...
@@ -132,7 +132,6 @@
<child>
<widget
class=
"GtkExpander"
id=
"expander2"
>
<property
name=
"visible"
>
True
</property>
<property
name=
"expanded"
>
True
</property>
<property
name=
"tooltip"
translatable=
"yes"
>
Show more options
</property>
<child>
<widget
class=
"GtkVBox"
id=
"vbox2"
>
...
...
@@ -141,7 +140,7 @@
<widget
class=
"GtkHBox"
id=
"hbox2"
>
<property
name=
"visible"
>
True
</property>
<child>
<widget
class=
"GtkHScale"
id=
"times"
>
<widget
class=
"GtkHScale"
id=
"time
_
s"
>
<property
name=
"width_request"
>
107
</property>
<property
name=
"height_request"
>
20
</property>
<property
name=
"visible"
>
True
</property>
...
...
@@ -151,31 +150,21 @@
<property
name=
"value_pos"
>
GTK_POS_RIGHT
</property>
</widget>
</child>
<child>
<widget
class=
"GtkLabel"
id=
"timel"
>
<property
name=
"width_request"
>
30
</property>
<property
name=
"height_request"
>
20
</property>
<property
name=
"visible"
>
True
</property>
<property
name=
"label"
translatable=
"yes"
>
time
</property>
</widget>
<packing>
<property
name=
"position"
>
1
</property>
</packing>
</child>
<child>
<widget
class=
"GtkSpinButton"
id=
"vol"
>
<property
name=
"width_request"
>
42
</property>
<property
name=
"height_request"
>
20
</property>
<property
name=
"visible"
>
True
</property>
<property
name=
"can_focus"
>
True
</property>
<property
name=
"editable"
>
False
</property>
<property
name=
"adjustment"
>
100 0 100 1 10 10
</property>
<property
name=
"snap_to_ticks"
>
True
</property>
<property
name=
"numeric"
>
True
</property>
<property
name=
"
wrap"
>
True
</property>
<property
name=
"
update_policy"
>
GTK_UPDATE_IF_VALID
</property>
</widget>
<packing>
<property
name=
"expand"
>
False
</property>
<property
name=
"position"
>
2
</property>
<property
name=
"position"
>
1
</property>
</packing>
</child>
</widget>
...
...
extras/dbus-vlc.py
View file @
7930c1b3
...
...
@@ -25,9 +25,11 @@ import dbus.glib
import
gtk
import
gtk.glade
import
egg.trayicon
import
gobject
import
os
global
position
global
timer
def
itemchange_handler
(
item
):
l_item
.
set_text
(
item
)
...
...
@@ -67,11 +69,14 @@ def update(widget):
GetPlayStatus
(
0
)
def
GetPlayStatus
(
widget
):
global
timer
status
=
str
(
interface
.
GetPlayStatus
())
if
status
==
"playing"
:
img_bt_toggle
.
set_from_stock
(
"gtk-media-pause"
,
gtk
.
ICON_SIZE_SMALL_TOOLBAR
)
timer
=
gobject
.
timeout_add
(
2000
,
timeset
)
else
:
img_bt_toggle
.
set_from_stock
(
"gtk-media-play"
,
gtk
.
ICON_SIZE_SMALL_TOOLBAR
)
gobject
.
timeout_remove
(
timer
)
def
Quit
(
widget
):
interface
.
Quit
()
...
...
@@ -84,8 +89,15 @@ def TogglePause(widget):
img_bt_toggle
.
set_from_stock
(
gtk
.
STOCK_MEDIA_PLAY
,
gtk
.
ICON_SIZE_SMALL_TOOLBAR
)
update
(
0
)
def
volchange
(
widget
):
interface
.
VolumeSet
(
vol
.
get_value_as_int
())
def
volchange
(
widget
,
data
):
interface
.
VolumeSet
(
vol
.
get_value_as_int
(),
reply_handler
=
(
lambda
:
None
),
error_handler
=
(
lambda
:
None
))
def
timechange
(
widget
,
x
=
None
,
y
=
None
):
interface
.
PositionSet
(
time_s
.
get_value
()
*
10
,
reply_handler
=
(
lambda
:
None
),
error_handler
=
(
lambda
:
None
))
def
timeset
():
time_s
.
set_value
(
interface
.
PositionGet
()
/
10
)
return
True
def
expander
(
widget
):
if
exp
.
get_expanded
()
==
False
:
...
...
@@ -138,6 +150,8 @@ menu = xml.get_widget('menu1')
menuitem
=
xml
.
get_widget
(
'menuquit'
)
vlcicon
=
xml
.
get_widget
(
'eventicon'
)
vol
=
xml
.
get_widget
(
'vol'
)
time_s
=
xml
.
get_widget
(
'time_s'
)
time_l
=
xml
.
get_widget
(
'time_l'
)
window
.
connect
(
'delete_event'
,
delete_event
)
window
.
connect
(
'destroy'
,
destroy
)
...
...
@@ -153,13 +167,10 @@ eventbox.add(image)
image
.
set_from_icon_name
(
"vlc"
,
gtk
.
ICON_SIZE_MENU
)
tray
.
show_all
()
def
fuck
():
return
def
icon_clicked
(
widget
,
event
):
update
(
0
)
menu
.
attach_to_widget
(
eventbox
,
fuck
)
menu
.
attach_to_widget
(
eventbox
,
None
)
bt_close
.
connect
(
'clicked'
,
destroy
)
bt_quit
.
connect
(
'clicked'
,
Quit
)
...
...
@@ -172,7 +183,11 @@ exp.connect('activate', expander)
menuitem
.
connect
(
'activate'
,
destroy
)
vlcicon
.
set_events
(
gtk
.
gdk
.
BUTTON_PRESS_MASK
)
vlcicon
.
connect
(
'button_press_event'
,
icon_clicked
)
vol
.
connect
(
'value-changed'
,
volchange
)
vol
.
connect
(
'change-value'
,
volchange
)
vol
.
connect
(
'scroll-event'
,
volchange
)
time_s
.
connect
(
'adjust-bounds'
,
timechange
)
time_s
.
set_update_policy
(
gtk
.
UPDATE_DISCONTINUOUS
)
library
=
"/media/mp3"
...
...
modules/control/dbus.c
View file @
7930c1b3
...
...
@@ -110,8 +110,63 @@ DBUS_METHOD( Quit )
REPLY_SEND
;
}
DBUS_METHOD
(
PositionGet
)
{
/* returns position as an int in the range [0;1000] */
REPLY_INIT
;
OUT_ARGUMENTS
;
vlc_value_t
position
;
dbus_uint16_t
i_pos
;
playlist_t
*
p_playlist
=
pl_Yield
(
((
vlc_object_t
*
)
p_this
)
);
input_thread_t
*
p_input
=
p_playlist
->
p_input
;
if
(
!
p_input
)
i_pos
=
0
;
else
{
var_Get
(
p_input
,
"position"
,
&
position
);
i_pos
=
position
.
f_float
*
1000
;
}
ADD_UINT16
(
&
i_pos
);
pl_Release
(
((
vlc_object_t
*
)
p_this
)
);
REPLY_SEND
;
}
DBUS_METHOD
(
PositionSet
)
{
/* set position from an int in the range [0;1000] */
REPLY_INIT
;
vlc_value_t
position
;
dbus_uint16_t
i_pos
;
DBusError
error
;
dbus_error_init
(
&
error
);
dbus_message_get_args
(
p_from
,
&
error
,
DBUS_TYPE_UINT16
,
&
i_pos
,
DBUS_TYPE_INVALID
);
if
(
dbus_error_is_set
(
&
error
)
)
{
msg_Err
(
(
vlc_object_t
*
)
p_this
,
"D-Bus message reading : %s
\n
"
,
error
.
message
);
dbus_error_free
(
&
error
);
return
DBUS_HANDLER_RESULT_NOT_YET_HANDLED
;
}
playlist_t
*
p_playlist
=
pl_Yield
(
((
vlc_object_t
*
)
p_this
)
);
input_thread_t
*
p_input
=
p_playlist
->
p_input
;
if
(
p_input
)
{
position
.
f_float
=
((
float
)
i_pos
)
/
1000
;
var_Set
(
p_input
,
"position"
,
position
);
}
pl_Release
(
((
vlc_object_t
*
)
p_this
)
);
REPLY_SEND
;
}
DBUS_METHOD
(
VolumeGet
)
{
/*
get
volume in percentage */
{
/*
returns
volume in percentage */
REPLY_INIT
;
OUT_ARGUMENTS
;
dbus_uint16_t
i_vol
;
...
...
@@ -332,6 +387,8 @@ DBUS_METHOD( handle_messages )
METHOD_FUNC
(
"Stop"
,
Stop
);
METHOD_FUNC
(
"VolumeSet"
,
VolumeSet
);
METHOD_FUNC
(
"VolumeGet"
,
VolumeGet
);
METHOD_FUNC
(
"PositionSet"
,
PositionSet
);
METHOD_FUNC
(
"PositionGet"
,
PositionGet
);
return
DBUS_HANDLER_RESULT_NOT_YET_HANDLED
;
}
...
...
modules/control/dbus.h
View file @
7930c1b3
...
...
@@ -68,6 +68,7 @@
#define ADD_BOOL( b ) DBUS_ADD( DBUS_TYPE_BOOLEAN, b )
#define ADD_UINT32( i ) DBUS_ADD( DBUS_TYPE_UINT32, i )
#define ADD_UINT16( i ) DBUS_ADD( DBUS_TYPE_UINT16, i )
#define ADD_BYTE( b ) DBUS_ADD( DBUS_TYPE_BYTE, b )
/* XML data to answer org.freedesktop.DBus.Introspectable.Introspect requests */
...
...
@@ -110,6 +111,12 @@ const char* psz_introspection_xml_data =
" <method name=
\"
VolumeGet
\"
>
\n
"
" <arg type=
\"
q
\"
direction=
\"
out
\"
/>
\n
"
" </method>
\n
"
" <method name=
\"
PositionSet
\"
>
\n
"
" <arg type=
\"
q
\"
direction=
\"
in
\"
/>
\n
"
" </method>
\n
"
" <method name=
\"
PositionGet
\"
>
\n
"
" <arg type=
\"
q
\"
direction=
\"
out
\"
/>
\n
"
" </method>
\n
"
" </interface>
\n
"
"</node>
\n
"
;
...
...
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