Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-2-2
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-2-2
Commits
a8fd6d95
Commit
a8fd6d95
authored
Jan 29, 2013
by
Alex Merry
Committed by
Mirsal Ennaime
Jan 30, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add Properties.GetAll support to all D-Bus interfaces
Signed-off-by:
Mirsal Ennaime
<
mirsal@videolan.org
>
parent
6ae4c72d
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
120 additions
and
5 deletions
+120
-5
modules/control/dbus/dbus_introspect.h
modules/control/dbus/dbus_introspect.h
+6
-0
modules/control/dbus/dbus_player.c
modules/control/dbus/dbus_player.c
+58
-1
modules/control/dbus/dbus_root.c
modules/control/dbus/dbus_root.c
+9
-4
modules/control/dbus/dbus_tracklist.c
modules/control/dbus/dbus_tracklist.c
+47
-0
No files found.
modules/control/dbus/dbus_introspect.h
View file @
a8fd6d95
...
...
@@ -4,10 +4,12 @@
* Copyright © 2006-2011 Rafaël Carré
* Copyright © 2007-2011 Mirsal Ennaime
* Copyright © 2009-2011 The VideoLAN team
* Copyright © 2013 Alex Merry
* $Id$
*
* Authors: Mirsal Ennaime <mirsal at mirsal fr>
* Rafaël Carré <funman at videolanorg>
* Alex Merry <dev at randomguy3 me uk>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
...
...
@@ -50,6 +52,10 @@ static const char* psz_introspection_xml =
" <arg direction=
\"
in
\"
type=
\"
s
\"
/>
\n
"
" <arg direction=
\"
in
\"
type=
\"
v
\"
/>
\n
"
" </method>
\n
"
" <method name=
\"
GetAll
\"
>
\n
"
" <arg direction=
\"
in
\"
type=
\"
s
\"
/>
\n
"
" <arg direction=
\"
out
\"
type=
\"
a{sv}
\"
/>
\n
"
" </method>
\n
"
" <signal name=
\"
PropertiesChanged
\"
>
\n
"
" <arg type=
\"
s
\"
/>
\n
"
" <arg type=
\"
a{sv}
\"
/>
\n
"
...
...
modules/control/dbus/dbus_player.c
View file @
a8fd6d95
...
...
@@ -687,6 +687,63 @@ DBUS_METHOD( SetProperty )
#undef PROPERTY_SET_FUNC
#undef PROPERTY_MAPPING_END
#define ADD_PROPERTY( prop, signature ) \
if( VLC_SUCCESS != AddProperty( (intf_thread_t*) p_this, \
&dict, #prop, signature, Marshal##prop ) ) { \
dbus_message_iter_abandon_container( &args, &dict ); \
return VLC_ENOMEM; \
}
DBUS_METHOD
(
GetAllProperties
)
{
REPLY_INIT
;
OUT_ARGUMENTS
;
DBusError
error
;
DBusMessageIter
dict
;
char
*
const
psz_interface_name
=
NULL
;
dbus_error_init
(
&
error
);
dbus_message_get_args
(
p_from
,
&
error
,
DBUS_TYPE_STRING
,
&
psz_interface_name
,
DBUS_TYPE_INVALID
);
if
(
dbus_error_is_set
(
&
error
)
)
{
msg_Err
(
(
vlc_object_t
*
)
p_this
,
"D-Bus message reading : %s"
,
error
.
message
);
dbus_error_free
(
&
error
);
return
DBUS_HANDLER_RESULT_NOT_YET_HANDLED
;
}
msg_Dbg
(
(
vlc_object_t
*
)
p_this
,
"Getting All properties"
);
if
(
!
dbus_message_iter_open_container
(
&
args
,
DBUS_TYPE_ARRAY
,
"{sv}"
,
&
dict
)
)
return
DBUS_HANDLER_RESULT_NEED_MEMORY
;
ADD_PROPERTY
(
Metadata
,
"a{sv}"
);
ADD_PROPERTY
(
Position
,
"x"
);
ADD_PROPERTY
(
PlaybackStatus
,
"s"
);
ADD_PROPERTY
(
LoopStatus
,
"s"
);
ADD_PROPERTY
(
Shuffle
,
"b"
);
ADD_PROPERTY
(
Volume
,
"d"
);
ADD_PROPERTY
(
Rate
,
"d"
);
ADD_PROPERTY
(
MinimumRate
,
"d"
);
ADD_PROPERTY
(
MaximumRate
,
"d"
);
ADD_PROPERTY
(
CanControl
,
"b"
);
ADD_PROPERTY
(
CanPlay
,
"b"
);
ADD_PROPERTY
(
CanPause
,
"b"
);
ADD_PROPERTY
(
CanSeek
,
"b"
);
if
(
!
dbus_message_iter_close_container
(
&
args
,
&
dict
))
return
DBUS_HANDLER_RESULT_NEED_MEMORY
;
REPLY_SEND
;
}
#undef ADD_PROPERTY
#define METHOD_FUNC( interface, method, function ) \
else if( dbus_message_is_method_call( p_from, interface, method ) )\
return function( p_conn, p_from, p_this )
...
...
@@ -697,7 +754,7 @@ handle_player ( DBusConnection *p_conn, DBusMessage *p_from, void *p_this )
if
(
0
);
METHOD_FUNC
(
DBUS_INTERFACE_PROPERTIES
,
"Get"
,
GetProperty
);
METHOD_FUNC
(
DBUS_INTERFACE_PROPERTIES
,
"Set"
,
SetProperty
);
/* METHOD_FUNC( DBUS_INTERFACE_PROPERTIES, "GetAll", GetAllProperties );*/
METHOD_FUNC
(
DBUS_INTERFACE_PROPERTIES
,
"GetAll"
,
GetAllProperties
);
/* here D-Bus method names are associated to an handler */
...
...
modules/control/dbus/dbus_root.c
View file @
a8fd6d95
...
...
@@ -370,8 +370,10 @@ DBUS_METHOD( SetProperty )
#define ADD_PROPERTY( prop, signature ) \
if( VLC_SUCCESS != AddProperty( (intf_thread_t*) p_this, \
&dict, #prop, signature, Marshal##prop ) ) \
return VLC_ENOMEM;
&dict, #prop, signature, Marshal##prop ) ) { \
dbus_message_iter_abandon_container( &args, &dict ); \
return VLC_ENOMEM; \
}
DBUS_METHOD
(
GetAllProperties
)
{
...
...
@@ -398,7 +400,8 @@ DBUS_METHOD( GetAllProperties )
msg_Dbg
(
(
vlc_object_t
*
)
p_this
,
"Getting All properties"
);
dbus_message_iter_open_container
(
&
args
,
DBUS_TYPE_ARRAY
,
"{sv}"
,
&
dict
);
if
(
!
dbus_message_iter_open_container
(
&
args
,
DBUS_TYPE_ARRAY
,
"{sv}"
,
&
dict
)
)
return
DBUS_HANDLER_RESULT_NEED_MEMORY
;
ADD_PROPERTY
(
Identity
,
"s"
);
ADD_PROPERTY
(
DesktopEntry
,
"s"
);
...
...
@@ -410,7 +413,9 @@ DBUS_METHOD( GetAllProperties )
ADD_PROPERTY
(
Fullscreen
,
"b"
);
ADD_PROPERTY
(
CanRaise
,
"b"
);
dbus_message_iter_close_container
(
&
args
,
&
dict
);
if
(
!
dbus_message_iter_close_container
(
&
args
,
&
dict
))
return
DBUS_HANDLER_RESULT_NEED_MEMORY
;
REPLY_SEND
;
}
...
...
modules/control/dbus/dbus_tracklist.c
View file @
a8fd6d95
...
...
@@ -405,6 +405,52 @@ DBUS_METHOD( GetProperty )
#undef PROPERTY_SET_FUNC
#undef PROPERTY_MAPPING_END
#define ADD_PROPERTY( prop, signature ) \
if( VLC_SUCCESS != AddProperty( (intf_thread_t*) p_this, \
&dict, #prop, signature, Marshal##prop ) ) { \
dbus_message_iter_abandon_container( &args, &dict ); \
return VLC_ENOMEM; \
}
DBUS_METHOD
(
GetAllProperties
)
{
REPLY_INIT
;
OUT_ARGUMENTS
;
DBusError
error
;
DBusMessageIter
dict
;
char
*
const
psz_interface_name
=
NULL
;
dbus_error_init
(
&
error
);
dbus_message_get_args
(
p_from
,
&
error
,
DBUS_TYPE_STRING
,
&
psz_interface_name
,
DBUS_TYPE_INVALID
);
if
(
dbus_error_is_set
(
&
error
)
)
{
msg_Err
(
(
vlc_object_t
*
)
p_this
,
"D-Bus message reading : %s"
,
error
.
message
);
dbus_error_free
(
&
error
);
return
DBUS_HANDLER_RESULT_NOT_YET_HANDLED
;
}
msg_Dbg
(
(
vlc_object_t
*
)
p_this
,
"Getting All properties"
);
if
(
!
dbus_message_iter_open_container
(
&
args
,
DBUS_TYPE_ARRAY
,
"{sv}"
,
&
dict
)
)
return
DBUS_HANDLER_RESULT_NEED_MEMORY
;
ADD_PROPERTY
(
Tracks
,
"ao"
)
ADD_PROPERTY
(
CanEditTracks
,
"b"
)
if
(
!
dbus_message_iter_close_container
(
&
args
,
&
dict
))
return
DBUS_HANDLER_RESULT_NEED_MEMORY
;
REPLY_SEND
;
}
#undef ADD_PROPERTY
#define METHOD_FUNC( interface, method, function ) \
else if( dbus_message_is_method_call( p_from, interface, method ) )\
return function( p_conn, p_from, p_this )
...
...
@@ -415,6 +461,7 @@ handle_tracklist ( DBusConnection *p_conn, DBusMessage *p_from, void *p_this )
if
(
0
);
METHOD_FUNC
(
DBUS_INTERFACE_PROPERTIES
,
"Get"
,
GetProperty
);
METHOD_FUNC
(
DBUS_INTERFACE_PROPERTIES
,
"GetAll"
,
GetAllProperties
);
/* here D-Bus method names are associated to an handler */
...
...
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