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
b64a3e09
Commit
b64a3e09
authored
May 01, 2012
by
Mirsal Ennaime
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dbus: Use the AfterTrack parameter in the tracklist's Add method
parent
d774b349
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
78 additions
and
5 deletions
+78
-5
modules/control/dbus/dbus_tracklist.c
modules/control/dbus/dbus_tracklist.c
+75
-5
modules/control/dbus/dbus_tracklist.h
modules/control/dbus/dbus_tracklist.h
+3
-0
No files found.
modules/control/dbus/dbus_tracklist.c
View file @
b64a3e09
...
...
@@ -36,16 +36,57 @@
#include "dbus_tracklist.h"
#include "dbus_common.h"
/**
* Retrieves the position of an input item in the playlist, given its id
*
* This function must be called with the playlist locked
*
* @param playlist_t* p_playlist The playlist
* @param input_item_t* i_input_id An input item ID
*
* @return int The position of the input item or a VLC error constant
*/
static
int
getInputPosition
(
playlist_t
*
p_playlist
,
int
i_input_id
)
{
input_item_t
*
p_input
=
NULL
;
assert
(
p_playlist
);
assert
(
i_input_id
>=
0
);
playlist_AssertLocked
(
p_playlist
);
for
(
int
i
=
0
;
i
<
playlist_CurrentSize
(
p_playlist
);
i
++
)
{
p_input
=
p_playlist
->
current
.
p_elems
[
i
]
->
p_input
;
if
(
!
p_input
)
return
VLC_EGENERIC
;
if
(
p_input
->
i_id
==
i_input_id
)
return
i
;
}
return
VLC_ENOITEM
;
}
DBUS_METHOD
(
AddTrack
)
{
/* add the string to the playlist, and play it if the boolean is true */
{
REPLY_INIT
;
DBusError
error
;
dbus_error_init
(
&
error
);
char
*
psz_mrl
,
*
psz_aftertrack
;
playlist_t
*
p_playlist
=
PL
;
dbus_bool_t
b_play
;
int
i_input_id
=
-
1
;
int
i_mode
=
PLAYLIST_APPEND
;
int
i_pos
=
PLAYLIST_END
;
size_t
i_append_len
=
sizeof
(
DBUS_MPRIS_APPEND
);
size_t
i_notrack_len
=
sizeof
(
DBUS_MPRIS_NOTRACK
);
dbus_message_get_args
(
p_from
,
&
error
,
DBUS_TYPE_STRING
,
&
psz_mrl
,
DBUS_TYPE_OBJECT_PATH
,
&
psz_aftertrack
,
...
...
@@ -56,14 +97,43 @@ DBUS_METHOD( AddTrack )
{
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
;
}
#warning psz_aftertrack is not used
playlist_Add
(
PL
,
psz_mrl
,
NULL
,
PLAYLIST_APPEND
|
(
(
b_play
==
TRUE
)
?
PLAYLIST_GO
:
0
)
,
PLAYLIST_END
,
true
,
false
);
if
(
!
strncmp
(
DBUS_MPRIS_APPEND
,
psz_aftertrack
,
i_append_len
)
)
{
i_mode
=
PLAYLIST_APPEND
;
i_pos
=
PLAYLIST_END
;
}
else
if
(
!
strncmp
(
DBUS_MPRIS_NOTRACK
,
psz_aftertrack
,
i_notrack_len
)
)
{
i_mode
=
PLAYLIST_INSERT
;
i_pos
=
0
;
}
else
if
(
1
==
sscanf
(
psz_aftertrack
,
MPRIS_TRACKID_FORMAT
,
&
i_input_id
)
)
{
PL_LOCK
;
int
i_res
=
getInputPosition
(
p_playlist
,
i_input_id
);
PL_UNLOCK
;
if
(
i_res
<
0
)
goto
invalidTrackID
;
i_mode
=
PLAYLIST_INSERT
;
i_pos
=
i_res
+
1
;
}
else
{
invalidTrackID:
msg_Warn
(
(
vlc_object_t
*
)
p_this
,
"AfterTrack: Invalid track ID
\"
%s
\"
, appending instead"
,
psz_aftertrack
);
}
i_mode
|=
(
TRUE
==
b_play
)
?
PLAYLIST_GO
:
0
;
playlist_Add
(
PL
,
psz_mrl
,
NULL
,
i_mode
,
i_pos
,
true
,
false
);
REPLY_SEND
;
}
...
...
modules/control/dbus/dbus_tracklist.h
View file @
b64a3e09
...
...
@@ -34,6 +34,9 @@
#define DBUS_MPRIS_TRACKLIST_INTERFACE "org.mpris.MediaPlayer2.TrackList"
#define DBUS_MPRIS_TRACKLIST_PATH "/org/mpris/MediaPlayer2/TrackList"
#define DBUS_MPRIS_NOTRACK "/org/mpris/MediaPlayer2/TrackList/NoTrack"
#define DBUS_MPRIS_APPEND "/org/mpris/MediaPlayer2/TrackList/Append"
/* Handle incoming dbus messages */
DBusHandlerResult
handle_tracklist
(
DBusConnection
*
p_conn
,
DBusMessage
*
p_from
,
...
...
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