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
54ece28f
Commit
54ece28f
authored
May 19, 2011
by
Mirsal Ennaime
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dbus: Update the TrackList interface implementation
* Remove legacy methods * Implement the GoTo method
parent
7b77afbc
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
38 additions
and
77 deletions
+38
-77
modules/control/dbus/dbus_tracklist.c
modules/control/dbus/dbus_tracklist.c
+38
-77
No files found.
modules/control/dbus/dbus_tracklist.c
View file @
54ece28f
/*****************************************************************************
* dbus-tracklist.c : dbus control module (mpris v
1.0) - /TrackList object
* dbus-tracklist.c : dbus control module (mpris v
2.1) - TrackList interface
*****************************************************************************
* Copyright © 2006-2011 Rafaël Carré
* Copyright © 2007-2011 Mirsal Ennaime
* Copyright © 2009-201
0
The VideoLAN team
* Copyright © 2009-201
1
The VideoLAN team
* $Id$
*
* Authors: Mirsal Ennaime <mirsal at mirsal fr>
...
...
@@ -68,21 +68,6 @@ DBUS_METHOD( AddTrack )
REPLY_SEND
;
}
DBUS_METHOD
(
GetCurrentTrack
)
{
REPLY_INIT
;
OUT_ARGUMENTS
;
playlist_t
*
p_playlist
=
PL
;
PL_LOCK
;
dbus_int32_t
i_position
=
PL
->
i_current_index
;
PL_UNLOCK
;
ADD_INT32
(
&
i_position
);
REPLY_SEND
;
}
DBUS_METHOD
(
GetTracksMetadata
)
{
REPLY_INIT
;
...
...
@@ -95,7 +80,6 @@ DBUS_METHOD( GetTracksMetadata )
input_item_t
*
p_input
=
NULL
;
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
)
)
...
...
@@ -139,34 +123,19 @@ DBUS_METHOD( GetTracksMetadata )
REPLY_SEND
;
}
DBUS_METHOD
(
G
etLength
)
DBUS_METHOD
(
G
oTo
)
{
REPLY_INIT
;
OUT_ARGUMENTS
;
playlist_t
*
p_playlist
=
PL
;
PL_LOCK
;
dbus_int32_t
i_elements
=
PL
->
current
.
i_size
;
PL_UNLOCK
;
ADD_INT32
(
&
i_elements
);
REPLY_SEND
;
}
DBUS_METHOD
(
RemoveTrack
)
{
REPLY_INIT
;
int
i_track_id
=
-
1
;
const
char
*
psz_track_id
=
NULL
;
playlist_t
*
p_playlist
=
PL
;
DBusError
error
;
dbus_error_init
(
&
error
);
int
i_id
=
-
1
,
i
;
char
*
psz_id
=
NULL
;
playlist_t
*
p_playlist
=
PL
;
input_item_t
*
p_input
=
NULL
;
dbus_message_get_args
(
p_from
,
&
error
,
DBUS_TYPE_OBJECT_PATH
,
&
psz_id
,
DBUS_TYPE_OBJECT_PATH
,
&
psz_
track_
id
,
DBUS_TYPE_INVALID
);
if
(
dbus_error_is_set
(
&
error
)
)
...
...
@@ -177,21 +146,21 @@ DBUS_METHOD( RemoveTrack )
return
DBUS_HANDLER_RESULT_NOT_YET_HANDLED
;
}
if
(
1
!=
sscanf
(
psz_
id
,
MPRIS_TRACKID_FORMAT
,
&
i
_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
_id
);
msg_Err
(
(
vlc_object_t
*
)
p_this
,
"Invalid track id
%s"
,
psz_track
_id
);
return
DBUS_HANDLER_RESULT_NOT_YET_HANDLED
;
}
PL_LOCK
;
for
(
i
=
0
;
i
<
playlist_CurrentSize
(
p_playlist
);
i
++
)
for
(
i
nt
i
=
0
;
i
<
playlist_CurrentSize
(
p_playlist
);
i
++
)
{
p_input
=
p_playlist
->
current
.
p_elems
[
i
]
->
p_input
;
if
(
i_id
==
p_input
->
i_id
)
if
(
i_track_id
==
p_playlist
->
current
.
p_elems
[
i
]
->
p_input
->
i_id
)
{
playlist_DeleteFromInput
(
p_playlist
,
p_input
,
true
);
playlist_Control
(
p_playlist
,
PLAYLIST_VIEWPLAY
,
true
,
p_playlist
->
current
.
p_elems
[
i
]
->
p_parent
,
p_playlist
->
current
.
p_elems
[
i
]
);
break
;
}
}
...
...
@@ -200,17 +169,20 @@ DBUS_METHOD( RemoveTrack )
REPLY_SEND
;
}
DBUS_METHOD
(
SetLoop
)
DBUS_METHOD
(
RemoveTrack
)
{
REPLY_INIT
;
OUT_ARGUMENTS
;
DBusError
error
;
dbus_bool_t
b_loop
;
dbus_error_init
(
&
error
);
int
i_id
=
-
1
,
i
;
char
*
psz_id
=
NULL
;
playlist_t
*
p_playlist
=
PL
;
input_item_t
*
p_input
=
NULL
;
dbus_message_get_args
(
p_from
,
&
error
,
DBUS_TYPE_
BOOLEAN
,
&
b_loop
,
DBUS_TYPE_
OBJECT_PATH
,
&
psz_id
,
DBUS_TYPE_INVALID
);
if
(
dbus_error_is_set
(
&
error
)
)
...
...
@@ -221,34 +193,26 @@ DBUS_METHOD( SetLoop )
return
DBUS_HANDLER_RESULT_NOT_YET_HANDLED
;
}
var_SetBool
(
PL
,
"loop"
,
(
b_loop
==
TRUE
)
);
REPLY_SEND
;
}
DBUS_METHOD
(
SetRandom
)
{
REPLY_INIT
;
OUT_ARGUMENTS
;
DBusError
error
;
dbus_bool_t
b_random
;
dbus_error_init
(
&
error
);
dbus_message_get_args
(
p_from
,
&
error
,
DBUS_TYPE_BOOLEAN
,
&
b_random
,
DBUS_TYPE_INVALID
);
if
(
dbus_error_is_set
(
&
error
)
)
if
(
1
!=
sscanf
(
psz_id
,
MPRIS_TRACKID_FORMAT
,
&
i_id
)
)
{
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 track id: %s"
,
psz_id
);
return
DBUS_HANDLER_RESULT_NOT_YET_HANDLED
;
}
var_SetBool
(
PL
,
"random"
,
(
b_random
==
TRUE
)
)
;
PL_LOCK
;
for
(
i
=
0
;
i
<
playlist_CurrentSize
(
p_playlist
);
i
++
)
{
p_input
=
p_playlist
->
current
.
p_elems
[
i
]
->
p_input
;
if
(
i_id
==
p_input
->
i_id
)
{
playlist_DeleteFromInput
(
p_playlist
,
p_input
,
true
);
break
;
}
}
PL_UNLOCK
;
REPLY_SEND
;
}
...
...
@@ -288,12 +252,9 @@ 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
,
"GetTracksMetadata"
,
GetTracksMetadata
);
METHOD_FUNC
(
DBUS_MPRIS_TRACKLIST_INTERFACE
,
"GetCurrentTrack"
,
GetCurrentTrack
);
METHOD_FUNC
(
DBUS_MPRIS_TRACKLIST_INTERFACE
,
"GetLength"
,
GetLength
);
METHOD_FUNC
(
DBUS_MPRIS_TRACKLIST_INTERFACE
,
"AddTrack"
,
AddTrack
);
METHOD_FUNC
(
DBUS_MPRIS_TRACKLIST_INTERFACE
,
"RemoveTrack"
,
RemoveTrack
);
METHOD_FUNC
(
DBUS_MPRIS_TRACKLIST_INTERFACE
,
"SetLoop"
,
SetLoop
);
METHOD_FUNC
(
DBUS_MPRIS_TRACKLIST_INTERFACE
,
"SetRandom"
,
SetRandom
);
METHOD_FUNC
(
DBUS_MPRIS_TRACKLIST_INTERFACE
,
"GoTo"
,
GoTo
);
return
DBUS_HANDLER_RESULT_NOT_YET_HANDLED
;
}
...
...
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