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
ac092194
Commit
ac092194
authored
May 31, 2011
by
Mirsal Ennaime
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dbus: Implement the TrackList interface's PropertiesChanged signal
parent
393d7e42
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
67 additions
and
4 deletions
+67
-4
modules/control/dbus/dbus.c
modules/control/dbus/dbus.c
+11
-3
modules/control/dbus/dbus_tracklist.c
modules/control/dbus/dbus_tracklist.c
+55
-1
modules/control/dbus/dbus_tracklist.h
modules/control/dbus/dbus_tracklist.h
+1
-0
No files found.
modules/control/dbus/dbus.c
View file @
ac092194
...
@@ -545,8 +545,9 @@ static void ProcessEvents( intf_thread_t *p_intf,
...
@@ -545,8 +545,9 @@ static void ProcessEvents( intf_thread_t *p_intf,
playlist_t
*
p_playlist
=
p_intf
->
p_sys
->
p_playlist
;
playlist_t
*
p_playlist
=
p_intf
->
p_sys
->
p_playlist
;
bool
b_can_play
=
p_intf
->
p_sys
->
b_can_play
;
bool
b_can_play
=
p_intf
->
p_sys
->
b_can_play
;
vlc_dictionary_t
player_properties
;
vlc_dictionary_t
player_properties
,
tracklist_properties
;
vlc_dictionary_init
(
&
player_properties
,
0
);
vlc_dictionary_init
(
&
player_properties
,
0
);
vlc_dictionary_init
(
&
tracklist_properties
,
0
);
for
(
int
i
=
0
;
i
<
i_events
;
i
++
)
for
(
int
i
=
0
;
i
<
i_events
;
i
++
)
{
{
...
@@ -562,11 +563,14 @@ static void ProcessEvents( intf_thread_t *p_intf,
...
@@ -562,11 +563,14 @@ static void ProcessEvents( intf_thread_t *p_intf,
PL_LOCK
;
PL_LOCK
;
b_can_play
=
playlist_CurrentSize
(
p_playlist
)
>
0
;
b_can_play
=
playlist_CurrentSize
(
p_playlist
)
>
0
;
PL_UNLOCK
;
PL_UNLOCK
;
if
(
b_can_play
!=
p_intf
->
p_sys
->
b_can_play
)
if
(
b_can_play
!=
p_intf
->
p_sys
->
b_can_play
)
{
{
p_intf
->
p_sys
->
b_can_play
=
b_can_play
;
p_intf
->
p_sys
->
b_can_play
=
b_can_play
;
vlc_dictionary_insert
(
&
player_properties
,
"CanPlay"
,
NULL
);
vlc_dictionary_insert
(
&
player_properties
,
"CanPlay"
,
NULL
);
}
}
vlc_dictionary_insert
(
&
tracklist_properties
,
"Tracks"
,
NULL
);
break
;
break
;
case
SIGNAL_VOLUME_MUTED
:
case
SIGNAL_VOLUME_MUTED
:
case
SIGNAL_VOLUME_CHANGE
:
case
SIGNAL_VOLUME_CHANGE
:
...
@@ -630,7 +634,11 @@ static void ProcessEvents( intf_thread_t *p_intf,
...
@@ -630,7 +634,11 @@ static void ProcessEvents( intf_thread_t *p_intf,
if
(
vlc_dictionary_keys_count
(
&
player_properties
)
)
if
(
vlc_dictionary_keys_count
(
&
player_properties
)
)
PlayerPropertiesChangedEmit
(
p_intf
,
&
player_properties
);
PlayerPropertiesChangedEmit
(
p_intf
,
&
player_properties
);
vlc_dictionary_clear
(
&
player_properties
,
NULL
,
NULL
);
if
(
vlc_dictionary_keys_count
(
&
tracklist_properties
)
)
TrackListPropertiesChangedEmit
(
p_intf
,
&
player_properties
);
vlc_dictionary_clear
(
&
player_properties
,
NULL
,
NULL
);
vlc_dictionary_clear
(
&
tracklist_properties
,
NULL
,
NULL
);
}
}
/**
/**
...
...
modules/control/dbus/dbus_tracklist.c
View file @
ac092194
...
@@ -229,7 +229,7 @@ DBUS_METHOD( Tracks )
...
@@ -229,7 +229,7 @@ DBUS_METHOD( Tracks )
input_item_t
*
p_input
=
NULL
;
input_item_t
*
p_input
=
NULL
;
dbus_message_iter_open_container
(
&
args
,
DBUS_TYPE_VARIANT
,
"ao"
,
&
v
);
dbus_message_iter_open_container
(
&
args
,
DBUS_TYPE_VARIANT
,
"ao"
,
&
v
);
dbus_message_iter_open_container
(
&
v
,
DBUS_TYPE_ARRAY
,
"o"
,
&
tracks
);
dbus_message_iter_open_container
(
&
v
,
DBUS_TYPE_ARRAY
,
"o"
,
&
tracks
);
PL_LOCK
;
PL_LOCK
;
...
@@ -405,3 +405,57 @@ int TrackListChangeEmit( intf_thread_t *p_intf, int signal, int i_node )
...
@@ -405,3 +405,57 @@ int TrackListChangeEmit( intf_thread_t *p_intf, int signal, int i_node )
}
}
#undef METHOD_FUNC
#undef METHOD_FUNC
/**
* PropertiesChangedSignal: synthetizes and sends the
* org.freedesktop.DBus.Properties.PropertiesChanged signal
*/
static
DBusHandlerResult
PropertiesChangedSignal
(
intf_thread_t
*
p_intf
,
vlc_dictionary_t
*
p_changed_properties
)
{
DBusConnection
*
p_conn
=
p_intf
->
p_sys
->
p_conn
;
DBusMessageIter
changed_properties
,
invalidated_properties
,
entry
,
variant
;
const
char
*
psz_interface_name
=
DBUS_MPRIS_TRACKLIST_INTERFACE
;
char
**
ppsz_properties
=
NULL
;
int
i_properties
=
0
;
SIGNAL_INIT
(
DBUS_INTERFACE_PROPERTIES
,
DBUS_MPRIS_OBJECT_PATH
,
"PropertiesChanged"
);
OUT_ARGUMENTS
;
ADD_STRING
(
&
psz_interface_name
);
dbus_message_iter_open_container
(
&
args
,
DBUS_TYPE_ARRAY
,
"{sv}"
,
&
changed_properties
);
dbus_message_iter_close_container
(
&
args
,
&
changed_properties
);
dbus_message_iter_open_container
(
&
args
,
DBUS_TYPE_ARRAY
,
"s"
,
&
invalidated_properties
);
i_properties
=
vlc_dictionary_keys_count
(
p_changed_properties
);
ppsz_properties
=
vlc_dictionary_all_keys
(
p_changed_properties
);
for
(
int
i
=
0
;
i
<
i_properties
;
i
++
)
if
(
!
strcmp
(
ppsz_properties
[
i
],
"Tracks"
)
)
dbus_message_iter_append_basic
(
&
entry
,
DBUS_TYPE_STRING
,
&
ppsz_properties
[
i
]
);
dbus_message_iter_close_container
(
&
args
,
&
invalidated_properties
);
SIGNAL_SEND
;
}
/**
* TrackListPropertiesChangedEmit: Emits the
* org.freedesktop.DBus.Properties.PropertiesChanged signal
*/
int
TrackListPropertiesChangedEmit
(
intf_thread_t
*
p_intf
,
vlc_dictionary_t
*
p_changed_properties
)
{
if
(
p_intf
->
p_sys
->
b_dead
)
return
VLC_SUCCESS
;
PropertiesChangedSignal
(
p_intf
,
p_changed_properties
);
return
VLC_SUCCESS
;
}
modules/control/dbus/dbus_tracklist.h
View file @
ac092194
...
@@ -45,5 +45,6 @@ static const DBusObjectPathVTable dbus_mpris_tracklist_vtable = {
...
@@ -45,5 +45,6 @@ static const DBusObjectPathVTable dbus_mpris_tracklist_vtable = {
};
};
int
TrackListChangeEmit
(
intf_thread_t
*
,
int
,
int
);
int
TrackListChangeEmit
(
intf_thread_t
*
,
int
,
int
);
int
TrackListPropertiesChangedEmit
(
intf_thread_t
*
,
vlc_dictionary_t
*
);
#endif //dbus_tracklist.h
#endif //dbus_tracklist.h
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