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
7b77afbc
Commit
7b77afbc
authored
May 19, 2011
by
Mirsal Ennaime
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dbus: Correctly implement the GetTracksMetadata method
parent
12ff3c04
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
41 additions
and
17 deletions
+41
-17
modules/control/dbus/dbus_tracklist.c
modules/control/dbus/dbus_tracklist.c
+41
-17
No files found.
modules/control/dbus/dbus_tracklist.c
View file @
7b77afbc
...
...
@@ -83,35 +83,59 @@ DBUS_METHOD( GetCurrentTrack )
REPLY_SEND
;
}
DBUS_METHOD
(
GetMetadata
)
DBUS_METHOD
(
Get
Tracks
Metadata
)
{
REPLY_INIT
;
OUT_ARGUMENTS
;
DBusError
error
;
dbus_error_init
(
&
error
);
dbus_int32_t
i_position
;
playlist_t
*
p_playlist
=
P
L
;
int
i_track_id
=
-
1
;
const
char
*
psz_track_id
=
NUL
L
;
dbus_message_get_args
(
p_from
,
&
error
,
DBUS_TYPE_INT32
,
&
i_position
,
DBUS_TYPE_INVALID
);
playlist_t
*
p_playlist
=
PL
;
input_item_t
*
p_input
=
NULL
;
if
(
dbus_error_is_set
(
&
error
)
)
DBusMessageIter
in_args
,
track_ids
,
meta
;
dbus_message_iter_init
(
p_from
,
&
in_args
);
if
(
DBUS_TYPE_ARRAY
!=
dbus_message_iter_get_arg_type
(
&
in_args
)
)
{
msg_Err
(
(
vlc_object_t
*
)
p_this
,
"D-Bus message reading : %s"
,
error
.
message
);
dbus_error_free
(
&
error
);
msg_Err
(
(
vlc_object_t
*
)
p_this
,
"Invalid arguments"
);
return
DBUS_HANDLER_RESULT_NOT_YET_HANDLED
;
}
PL_LOCK
;
if
(
i_position
<
p_playlist
->
current
.
i_size
)
dbus_message_iter_recurse
(
&
in_args
,
&
track_ids
);
dbus_message_iter_open_container
(
&
args
,
DBUS_TYPE_ARRAY
,
"a{sv}"
,
&
meta
);
while
(
DBUS_TYPE_OBJECT_PATH
==
dbus_message_iter_get_arg_type
(
&
track_ids
)
)
{
GetInputMeta
(
p_playlist
->
current
.
p_elems
[
i_position
]
->
p_input
,
&
args
);
dbus_message_iter_get_basic
(
&
track_ids
,
&
psz_track_id
);
if
(
1
!=
sscanf
(
psz_track_id
,
MPRIS_TRACKID_FORMAT
,
&
i_track_id
)
)
{
msg_Err
(
(
vlc_object_t
*
)
p_this
,
"Invalid track id: %s"
,
psz_track_id
);
continue
;
}
PL_LOCK
;
for
(
int
i
=
0
;
i
<
playlist_CurrentSize
(
p_playlist
);
i
++
)
{
p_input
=
p_playlist
->
current
.
p_elems
[
i
]
->
p_input
;
if
(
i_track_id
==
p_input
->
i_id
)
{
GetInputMeta
(
p_input
,
&
meta
);
break
;
}
}
PL_UNLOCK
;
dbus_message_iter_next
(
&
track_ids
);
}
PL_UNLOCK
;
dbus_message_iter_close_container
(
&
args
,
&
meta
)
;
REPLY_SEND
;
}
...
...
@@ -263,7 +287,7 @@ handle_tracklist ( DBusConnection *p_conn, DBusMessage *p_from, void *p_this )
/* here D-Bus method names are associated to an handler */
METHOD_FUNC
(
DBUS_MPRIS_TRACKLIST_INTERFACE
,
"Get
Metadata"
,
Get
Metadata
);
METHOD_FUNC
(
DBUS_MPRIS_TRACKLIST_INTERFACE
,
"Get
TracksMetadata"
,
GetTracks
Metadata
);
METHOD_FUNC
(
DBUS_MPRIS_TRACKLIST_INTERFACE
,
"GetCurrentTrack"
,
GetCurrentTrack
);
METHOD_FUNC
(
DBUS_MPRIS_TRACKLIST_INTERFACE
,
"GetLength"
,
GetLength
);
METHOD_FUNC
(
DBUS_MPRIS_TRACKLIST_INTERFACE
,
"AddTrack"
,
AddTrack
);
...
...
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