Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-2-2
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-2-2
Commits
96067e49
Commit
96067e49
authored
Jul 12, 2010
by
Rafaël Carré
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dbus: monitor input state change through "intf-event"
End of playlist is still not notified
parent
a34ed254
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
25 additions
and
34 deletions
+25
-34
modules/control/dbus/dbus.c
modules/control/dbus/dbus.c
+21
-18
modules/control/dbus/dbus_common.h
modules/control/dbus/dbus_common.h
+1
-0
modules/control/dbus/dbus_player.c
modules/control/dbus/dbus_player.c
+3
-16
No files found.
modules/control/dbus/dbus.c
View file @
96067e49
...
...
@@ -67,7 +67,7 @@ static int Open ( vlc_object_t * );
static
void
Close
(
vlc_object_t
*
);
static
void
Run
(
intf_thread_t
*
);
static
int
StateChange
(
intf_thread_t
*
,
int
);
static
int
StateChange
(
intf_thread_t
*
);
static
int
TrackChange
(
intf_thread_t
*
);
static
int
AllCallback
(
vlc_object_t
*
,
const
char
*
,
vlc_value_t
,
vlc_value_t
,
void
*
);
...
...
@@ -75,7 +75,6 @@ typedef struct
{
int
signal
;
int
i_node
;
int
i_input_state
;
}
callback_info_t
;
/*****************************************************************************
...
...
@@ -117,6 +116,7 @@ static int Open( vlc_object_t *p_this )
p_sys
->
i_caps
=
CAPS_NONE
;
p_sys
->
b_dead
=
false
;
p_sys
->
p_input
=
NULL
;
p_sys
->
i_playing_state
=
-
1
;
p_sys
->
b_unique
=
var_CreateGetBool
(
p_intf
,
"dbus-unique-service-id"
);
if
(
p_sys
->
b_unique
)
...
...
@@ -212,7 +212,7 @@ static void Close ( vlc_object_t *p_this )
if
(
p_sys
->
p_input
)
{
var_DelCallback
(
p_sys
->
p_input
,
"
state
"
,
AllCallback
,
p_intf
);
var_DelCallback
(
p_sys
->
p_input
,
"
intf-event
"
,
AllCallback
,
p_intf
);
vlc_object_release
(
p_sys
->
p_input
);
}
...
...
@@ -280,7 +280,7 @@ static void Run ( intf_thread_t *p_intf )
StatusChangeEmit
(
p_intf
);
break
;
case
SIGNAL_STATE
:
StateChange
(
p_intf
,
info
[
i
]
->
i_input_state
);
StateChange
(
p_intf
);
break
;
default:
assert
(
0
);
...
...
@@ -342,6 +342,8 @@ static int AllCallback( vlc_object_t *p_this, const char *psz_var,
if
(
!
info
)
return
VLC_ENOMEM
;
vlc_mutex_lock
(
&
p_intf
->
p_sys
->
lock
);
// Wich event is it ?
if
(
!
strcmp
(
"item-current"
,
psz_var
)
)
info
->
signal
=
SIGNAL_ITEM_CURRENT
;
...
...
@@ -360,17 +362,24 @@ static int AllCallback( vlc_object_t *p_this, const char *psz_var,
info
->
signal
=
SIGNAL_REPEAT
;
else
if
(
!
strcmp
(
"loop"
,
psz_var
)
)
info
->
signal
=
SIGNAL_LOOP
;
else
if
(
!
strcmp
(
"
state
"
,
psz_var
)
)
else
if
(
!
strcmp
(
"
intf-event
"
,
psz_var
)
)
{
dbus_int32_t
state
;
state
=
(
var_GetInteger
(
p_this
,
"state"
)
==
PAUSE_S
)
?
1
:
0
;
if
(
state
==
p_intf
->
p_sys
->
i_playing_state
)
goto
end
;
p_intf
->
p_sys
->
i_playing_state
=
state
;
info
->
signal
=
SIGNAL_STATE
;
info
->
i_input_state
=
newval
.
i_int
;
}
else
assert
(
0
);
// Append the event
vlc_mutex_lock
(
&
p_intf
->
p_sys
->
lock
);
vlc_array_append
(
p_intf
->
p_sys
->
p_events
,
info
);
end:
vlc_mutex_unlock
(
&
p_intf
->
p_sys
->
lock
);
return
VLC_SUCCESS
;
}
...
...
@@ -378,9 +387,7 @@ static int AllCallback( vlc_object_t *p_this, const char *psz_var,
/*****************************************************************************
* StateChange: callback on input "state"
*****************************************************************************/
//static int StateChange( vlc_object_t *p_this, const char* psz_var,
// vlc_value_t oldval, vlc_value_t newval, void *p_data )
static
int
StateChange
(
intf_thread_t
*
p_intf
,
int
i_input_state
)
static
int
StateChange
(
intf_thread_t
*
p_intf
)
{
intf_sys_t
*
p_sys
=
p_intf
->
p_sys
;
playlist_t
*
p_playlist
=
p_sys
->
p_playlist
;
...
...
@@ -392,7 +399,7 @@ static int StateChange( intf_thread_t *p_intf, int i_input_state )
UpdateCaps
(
p_intf
);
if
(
!
p_sys
->
b_meta_read
&&
i_input_state
==
PLAYING_S
)
if
(
!
p_sys
->
b_meta_read
&&
p_sys
->
i_playing_state
==
0
)
{
p_input
=
playlist_CurrentInput
(
p_playlist
);
if
(
p_input
)
...
...
@@ -407,11 +414,7 @@ static int StateChange( intf_thread_t *p_intf, int i_input_state )
}
}
if
(
i_input_state
==
PLAYING_S
||
i_input_state
==
PAUSE_S
||
i_input_state
==
END_S
)
{
StatusChangeEmit
(
p_intf
);
}
StatusChangeEmit
(
p_intf
);
return
VLC_SUCCESS
;
}
...
...
@@ -431,7 +434,7 @@ static int TrackChange( intf_thread_t *p_intf )
if
(
p_sys
->
p_input
)
{
var_DelCallback
(
p_sys
->
p_input
,
"
state
"
,
AllCallback
,
p_intf
);
var_DelCallback
(
p_sys
->
p_input
,
"
intf-event
"
,
AllCallback
,
p_intf
);
vlc_object_release
(
p_sys
->
p_input
);
p_sys
->
p_input
=
NULL
;
}
...
...
@@ -458,7 +461,7 @@ static int TrackChange( intf_thread_t *p_intf )
}
p_sys
->
p_input
=
p_input
;
var_AddCallback
(
p_input
,
"
state
"
,
AllCallback
,
p_intf
);
var_AddCallback
(
p_input
,
"
intf-event
"
,
AllCallback
,
p_intf
);
return
VLC_SUCCESS
;
}
...
...
modules/control/dbus/dbus_common.h
View file @
96067e49
...
...
@@ -85,6 +85,7 @@ struct intf_sys_t
playlist_t
*
p_playlist
;
bool
b_meta_read
;
dbus_int32_t
i_caps
;
dbus_int32_t
i_playing_state
;
bool
b_dead
;
vlc_array_t
*
p_events
;
vlc_mutex_t
lock
;
...
...
modules/control/dbus/dbus_player.c
View file @
96067e49
...
...
@@ -446,24 +446,11 @@ static int MarshalStatus( intf_thread_t* p_intf, DBusMessageIter* args )
DBusMessageIter
status
;
dbus_int32_t
i_state
,
i_random
,
i_repeat
,
i_loop
;
int
i_val
;
playlist_t
*
p_playlist
=
p_intf
->
p_sys
->
p_playlist
;
input_thread_t
*
p_input
=
NULL
;
i_state
=
2
;
p_input
=
playlist_CurrentInput
(
p_playlist
);
if
(
p_input
)
{
i_val
=
var_GetInteger
(
p_input
,
"state"
);
if
(
i_val
>=
END_S
)
i_state
=
2
;
else
if
(
i_val
==
PAUSE_S
)
i_state
=
1
;
else
if
(
i_val
<=
PLAYING_S
)
i_state
=
0
;
vlc_object_release
(
p_input
);
}
vlc_mutex_lock
(
&
p_intf
->
p_sys
->
lock
);
i_state
=
p_intf
->
p_sys
->
i_playing_state
;
vlc_mutex_unlock
(
&
p_intf
->
p_sys
->
lock
);
i_random
=
var_CreateGetBool
(
p_playlist
,
"random"
);
...
...
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