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
afbf0449
Commit
afbf0449
authored
Dec 29, 2011
by
Mirsal Ennaime
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dbus: Move DBus property marshaling code to separate functions
parent
51d31af4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
125 additions
and
46 deletions
+125
-46
modules/control/dbus/dbus_root.c
modules/control/dbus/dbus_root.c
+125
-46
No files found.
modules/control/dbus/dbus_root.c
View file @
afbf0449
...
...
@@ -2,8 +2,8 @@
* dbus_root.c : dbus control module (mpris v1.0) - root object
*****************************************************************************
* Copyright © 2006-2008 Rafaël Carré
* Copyright © 2007-201
0
Mirsal Ennaime
* Copyright © 2009-201
0
The VideoLAN team
* Copyright © 2007-201
1
Mirsal Ennaime
* Copyright © 2009-201
1
The VideoLAN team
* $Id$
*
* Authors: Mirsal Ennaime <mirsal at mirsal fr>
...
...
@@ -68,17 +68,25 @@ static const char const ppsz_supported_mime_types[][26] = {
"application/xspf+xml"
};
static
int
MarshalIdentity
(
intf_thread_t
*
p_intf
,
DBusMessageIter
*
container
)
{
VLC_UNUSED
(
p_intf
);
const
char
*
psz_id
=
_
(
"VLC media player"
);
dbus_message_iter_append_basic
(
container
,
DBUS_TYPE_STRING
,
&
psz_id
);
return
VLC_SUCCESS
;
}
DBUS_METHOD
(
Identity
)
{
VLC_UNUSED
(
p_this
);
REPLY_INIT
;
OUT_ARGUMENTS
;
const
char
*
psz_identity
=
_
(
"VLC media player"
);
DBusMessageIter
v
;
dbus_message_iter_open_container
(
&
args
,
DBUS_TYPE_VARIANT
,
"s"
,
&
v
);
dbus_message_iter_append_basic
(
&
v
,
DBUS_TYPE_STRING
,
&
psz_identity
);
MarshalIdentity
(
p_this
,
&
v
);
if
(
!
dbus_message_iter_close_container
(
&
args
,
&
v
)
)
return
DBUS_HANDLER_RESULT_NEED_MEMORY
;
...
...
@@ -86,17 +94,25 @@ DBUS_METHOD( Identity )
REPLY_SEND
;
}
static
int
MarshalCanQuit
(
intf_thread_t
*
p_intf
,
DBusMessageIter
*
container
)
{
VLC_UNUSED
(
p_intf
);
const
dbus_bool_t
b_ret
=
TRUE
;
dbus_message_iter_append_basic
(
container
,
DBUS_TYPE_BOOLEAN
,
&
b_ret
);
return
VLC_SUCCESS
;
}
DBUS_METHOD
(
CanQuit
)
{
VLC_UNUSED
(
p_this
);
REPLY_INIT
;
OUT_ARGUMENTS
;
const
dbus_bool_t
b_ret
=
TRUE
;
DBusMessageIter
v
;
dbus_message_iter_open_container
(
&
args
,
DBUS_TYPE_VARIANT
,
"b"
,
&
v
);
dbus_message_iter_append_basic
(
&
v
,
DBUS_TYPE_BOOLEAN
,
&
b_ret
);
MarshalCanQuit
(
p_this
,
&
v
);
if
(
!
dbus_message_iter_close_container
(
&
args
,
&
v
)
)
return
DBUS_HANDLER_RESULT_NEED_MEMORY
;
...
...
@@ -104,17 +120,25 @@ DBUS_METHOD( CanQuit )
REPLY_SEND
;
}
static
int
MarshalCanRaise
(
intf_thread_t
*
p_intf
,
DBusMessageIter
*
container
)
{
VLC_UNUSED
(
p_intf
);
const
dbus_bool_t
b_ret
=
FALSE
;
dbus_message_iter_append_basic
(
container
,
DBUS_TYPE_BOOLEAN
,
&
b_ret
);
return
VLC_SUCCESS
;
}
DBUS_METHOD
(
CanRaise
)
{
VLC_UNUSED
(
p_this
);
REPLY_INIT
;
OUT_ARGUMENTS
;
const
dbus_bool_t
b_ret
=
FALSE
;
DBusMessageIter
v
;
dbus_message_iter_open_container
(
&
args
,
DBUS_TYPE_VARIANT
,
"b"
,
&
v
);
dbus_message_iter_append_basic
(
&
v
,
DBUS_TYPE_BOOLEAN
,
&
b_ret
);
MarshalCanRaise
(
p_this
,
&
v
);
if
(
!
dbus_message_iter_close_container
(
&
args
,
&
v
)
)
return
DBUS_HANDLER_RESULT_NEED_MEMORY
;
...
...
@@ -122,17 +146,25 @@ DBUS_METHOD( CanRaise )
REPLY_SEND
;
}
static
int
MarshalHasTrackList
(
intf_thread_t
*
p_intf
,
DBusMessageIter
*
container
)
{
VLC_UNUSED
(
p_intf
);
const
dbus_bool_t
b_ret
=
FALSE
;
dbus_message_iter_append_basic
(
container
,
DBUS_TYPE_BOOLEAN
,
&
b_ret
);
return
VLC_SUCCESS
;
}
DBUS_METHOD
(
HasTrackList
)
{
VLC_UNUSED
(
p_this
);
REPLY_INIT
;
OUT_ARGUMENTS
;
const
dbus_bool_t
b_ret
=
FALSE
;
DBusMessageIter
v
;
dbus_message_iter_open_container
(
&
args
,
DBUS_TYPE_VARIANT
,
"b"
,
&
v
);
dbus_message_iter_append_basic
(
&
v
,
DBUS_TYPE_BOOLEAN
,
&
b_ret
);
MarshalHasTrackList
(
p_this
,
&
v
);
if
(
!
dbus_message_iter_close_container
(
&
args
,
&
v
)
)
return
DBUS_HANDLER_RESULT_NEED_MEMORY
;
...
...
@@ -140,17 +172,25 @@ DBUS_METHOD( HasTrackList )
REPLY_SEND
;
}
static
int
MarshalDesktopEntry
(
intf_thread_t
*
p_intf
,
DBusMessageIter
*
container
)
{
VLC_UNUSED
(
p_intf
);
const
char
*
psz_ret
=
PACKAGE
;
dbus_message_iter_append_basic
(
container
,
DBUS_TYPE_STRING
,
&
psz_ret
);
return
VLC_SUCCESS
;
}
DBUS_METHOD
(
DesktopEntry
)
{
VLC_UNUSED
(
p_this
);
REPLY_INIT
;
OUT_ARGUMENTS
;
const
char
*
psz_ret
=
PACKAGE
;
DBusMessageIter
v
;
dbus_message_iter_open_container
(
&
args
,
DBUS_TYPE_VARIANT
,
"s"
,
&
v
);
dbus_message_iter_append_basic
(
&
v
,
DBUS_TYPE_STRING
,
&
psz_ret
);
MarshalDesktopEntry
(
p_this
,
&
v
);
if
(
!
dbus_message_iter_close_container
(
&
args
,
&
v
)
)
return
DBUS_HANDLER_RESULT_NEED_MEMORY
;
...
...
@@ -158,25 +198,44 @@ DBUS_METHOD( DesktopEntry )
REPLY_SEND
;
}
DBUS_METHOD
(
SupportedMimeTypes
)
static
int
MarshalSupportedMimeTypes
(
intf_thread_t
*
p_intf
,
DBusMessageIter
*
container
)
{
VLC_UNUSED
(
p_this
);
REPLY_INIT
;
OUT_ARGUMENTS
;
VLC_UNUSED
(
p_intf
);
DBusMessageIter
ret
;
DBusMessageIter
ret
,
v
;
dbus_message_iter_open_container
(
&
args
,
DBUS_TYPE_VARIANT
,
"s"
,
&
v
);
size_t
i_len
=
sizeof
(
ppsz_supported_mime_types
)
/
sizeof
(
char
*
);
size_t
i_len
=
sizeof
(
ppsz_supported_mime_types
)
/
sizeof
(
*
ppsz_supported_mime_types
);
if
(
!
dbus_message_iter_open_container
(
&
v
,
DBUS_TYPE_ARRAY
,
"s"
,
&
ret
)
)
return
DBUS_HANDLER_RESULT_NEED_MEMORY
;
if
(
!
dbus_message_iter_open_container
(
container
,
DBUS_TYPE_ARRAY
,
"s"
,
&
ret
)
)
return
VLC_ENOMEM
;
for
(
size_t
i
=
0
;
i
<
i_len
;
++
i
)
{
const
char
*
const
psz_mime_type
=
ppsz_supported_mime_types
[
i
];
if
(
!
dbus_message_iter_append_basic
(
&
ret
,
DBUS_TYPE_STRING
,
&
ppsz_supported_mime_types
[
i
]
)
)
return
DBUS_HANDLER_RESULT_NEED_MEMORY
;
&
psz_mime_type
)
)
return
VLC_ENOMEM
;
}
if
(
!
dbus_message_iter_close_container
(
container
,
&
ret
)
)
return
VLC_ENOMEM
;
return
VLC_SUCCESS
;
}
DBUS_METHOD
(
SupportedMimeTypes
)
{
REPLY_INIT
;
OUT_ARGUMENTS
;
DBusMessageIter
v
;
dbus_message_iter_open_container
(
&
args
,
DBUS_TYPE_VARIANT
,
"as"
,
&
v
);
if
(
!
dbus_message_iter_close_container
(
&
v
,
&
ret
)
)
if
(
VLC_SUCCESS
!=
MarshalSupportedMimeTypes
(
p_this
,
&
v
)
)
return
DBUS_HANDLER_RESULT_NEED_MEMORY
;
if
(
!
dbus_message_iter_close_container
(
&
args
,
&
v
)
)
...
...
@@ -185,25 +244,45 @@ DBUS_METHOD( SupportedMimeTypes )
REPLY_SEND
;
}
DBUS_METHOD
(
SupportedUriSchemes
)
static
int
MarshalSupportedUriSchemes
(
intf_thread_t
*
p_intf
,
DBusMessageIter
*
container
)
{
VLC_UNUSED
(
p_this
);
REPLY_INIT
;
OUT_ARGUMENTS
;
VLC_UNUSED
(
p_intf
);
DBusMessageIter
ret
;
DBusMessageIter
ret
,
v
;
dbus_message_iter_open_container
(
&
args
,
DBUS_TYPE_VARIANT
,
"s"
,
&
v
);
size_t
i_len
=
sizeof
(
ppsz_supported_uri_schemes
)
/
sizeof
(
char
*
);
size_t
i_len
=
sizeof
(
ppsz_supported_uri_schemes
)
/
sizeof
(
*
ppsz_supported_uri_schemes
);
if
(
!
dbus_message_iter_open_container
(
&
v
,
DBUS_TYPE_ARRAY
,
"s"
,
&
ret
)
)
return
DBUS_HANDLER_RESULT_NEED_MEMORY
;
if
(
!
dbus_message_iter_open_container
(
container
,
DBUS_TYPE_ARRAY
,
"s"
,
&
ret
)
)
return
VLC_ENOMEM
;
for
(
size_t
i
=
0
;
i
<
i_len
;
++
i
)
{
const
char
*
const
psz_scheme
=
ppsz_supported_uri_schemes
[
i
];
if
(
!
dbus_message_iter_append_basic
(
&
ret
,
DBUS_TYPE_STRING
,
&
ppsz_supported_uri_schemes
[
i
]
)
)
return
DBUS_HANDLER_RESULT_NEED_MEMORY
;
&
psz_scheme
)
)
return
VLC_ENOMEM
;
}
if
(
!
dbus_message_iter_close_container
(
container
,
&
ret
)
)
return
VLC_ENOMEM
;
return
VLC_SUCCESS
;
}
DBUS_METHOD
(
SupportedUriSchemes
)
{
VLC_UNUSED
(
p_this
);
REPLY_INIT
;
OUT_ARGUMENTS
;
DBusMessageIter
v
;
dbus_message_iter_open_container
(
&
args
,
DBUS_TYPE_VARIANT
,
"as"
,
&
v
);
if
(
!
dbus_message_iter_close_container
(
&
v
,
&
ret
)
)
if
(
VLC_SUCCESS
!=
MarshalSupportedUriSchemes
(
p_this
,
&
v
)
)
return
DBUS_HANDLER_RESULT_NEED_MEMORY
;
if
(
!
dbus_message_iter_close_container
(
&
args
,
&
v
)
)
...
...
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