Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-1.1
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-1.1
Commits
f1e3dd73
Commit
f1e3dd73
authored
Sep 11, 2007
by
Rafaël Carré
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix TEST_NEXT macro usage (renamed to TEST_NEXT_ITEM)
Removes not used or deprecated methods
parent
e9cc3ff4
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
94 deletions
+33
-94
modules/control/dbus.c
modules/control/dbus.c
+31
-91
modules/control/dbus.h
modules/control/dbus.h
+2
-3
No files found.
modules/control/dbus.c
View file @
f1e3dd73
...
@@ -83,58 +83,6 @@ vlc_module_end();
...
@@ -83,58 +83,6 @@ vlc_module_end();
/*****************************************************************************
/*****************************************************************************
* Methods
* Methods
*****************************************************************************/
*****************************************************************************/
#if 0
DBUS_METHOD( PlaylistExport_XSPF )
{ /*export playlist to an xspf file */
/* reads the filename to export to */
/* returns the status as int32:
* 0 : success
* 1 : error
* 2 : playlist empty
*/
REPLY_INIT;
OUT_ARGUMENTS;
DBusError error;
dbus_error_init( &error );
char *psz_file;
dbus_int32_t i_ret;
dbus_message_get_args( p_from, &error,
DBUS_TYPE_STRING, &psz_file,
DBUS_TYPE_INVALID );
if( dbus_error_is_set( &error ) )
{
msg_Err( (vlc_object_t*) p_this, "D-Bus message reading : %s\n",
error.message );
dbus_error_free( &error );
return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
}
playlist_t *p_playlist = pl_Yield( (vlc_object_t*) p_this );
if( ( !playlist_IsEmpty( p_playlist ) ) &&
( p_playlist->p_root_category->i_children > 0 ) )
{
if( playlist_Export( p_playlist, psz_file,
p_playlist->p_root_category->pp_children[0],
"export-xspf" ) == VLC_SUCCESS )
i_ret = 0;
else
i_ret = 1;
}
else
i_ret = 2;
pl_Release( ((vlc_object_t*) p_this ) );
ADD_INT32( &i_ret );
REPLY_SEND;
}
#endif
/* Player */
/* Player */
...
@@ -317,28 +265,13 @@ DBUS_METHOD( Play )
...
@@ -317,28 +265,13 @@ DBUS_METHOD( Play )
REPLY_SEND
;
REPLY_SEND
;
}
}
DBUS_METHOD
(
Disconnect
)
{
REPLY_INIT
;
DBusError
error
;
int
i
;
dbus_error_init
(
&
error
);
i
=
dbus_bus_release_name
(
p_conn
,
VLC_MPRIS_DBUS_SERVICE
,
&
error
);
if
(
(
i
==
-
1
)
&&
(
dbus_error_is_set
(
&
error
)
)
)
{
msg_Err
(
(
vlc_object_t
*
)
p_this
,
"D-Bus disconnection failed : %s
\n
"
,
error
.
message
);
dbus_error_free
(
&
error
);
}
REPLY_SEND
;
}
DBUS_METHOD
(
GetCurrentMetadata
)
DBUS_METHOD
(
GetCurrentMetadata
)
{
{
REPLY_INIT
;
REPLY_INIT
;
OUT_ARGUMENTS
;
OUT_ARGUMENTS
;
playlist_t
*
p_playlist
=
pl_Yield
(
(
vlc_object_t
*
)
p_this
);
playlist_t
*
p_playlist
=
pl_Yield
(
(
vlc_object_t
*
)
p_this
);
if
(
p_playlist
->
status
.
p_item
)
GetInputMeta
(
p_playlist
->
status
.
p_item
->
p_input
,
&
args
);
GetInputMeta
(
p_playlist
->
status
.
p_item
->
p_input
,
&
args
);
pl_Release
(
p_playlist
);
pl_Release
(
p_playlist
);
...
@@ -397,17 +330,19 @@ DBUS_METHOD( GetCurrentTrack )
...
@@ -397,17 +330,19 @@ DBUS_METHOD( GetCurrentTrack )
{
{
REPLY_INIT
;
REPLY_INIT
;
OUT_ARGUMENTS
;
OUT_ARGUMENTS
;
/* FIXME 0 indicates the first item,
* what to do if we're stopped, or empty ? */
dbus_int32_t
i_position
=
0
;
dbus_int32_t
i_position
=
0
;
playlist_t
*
p_playlist
=
pl_Yield
(
(
vlc_object_t
*
)
p_this
);
playlist_t
*
p_playlist
=
pl_Yield
(
(
vlc_object_t
*
)
p_this
);
playlist_item_t
*
p_tested_item
=
p_playlist
->
p_root_onelevel
;
playlist_item_t
*
p_tested_item
=
p_playlist
->
p_root_onelevel
;
while
(
p_tested_item
->
p_input
->
i_id
!=
while
(
p_tested_item
&&
p_tested_item
->
p_input
->
i_id
!=
p_playlist
->
status
.
p_item
->
p_input
->
i_id
)
p_playlist
->
status
.
p_item
->
p_input
->
i_id
)
{
{
i_position
++
;
i_position
++
;
TEST_NEXT
;
TEST_NEXT
_ITEM
;
}
}
/* FIXME if p_tested_item is NULL at that point, what do we do ? */
pl_Release
(
p_playlist
);
pl_Release
(
p_playlist
);
ADD_INT32
(
&
i_position
);
ADD_INT32
(
&
i_position
);
...
@@ -438,12 +373,13 @@ DBUS_METHOD( GetMetadata )
...
@@ -438,12 +373,13 @@ DBUS_METHOD( GetMetadata )
return
DBUS_HANDLER_RESULT_NOT_YET_HANDLED
;
return
DBUS_HANDLER_RESULT_NOT_YET_HANDLED
;
}
}
while
(
i_count
<
i_position
)
while
(
p_tested_item
&&
(
i_count
<
i_position
)
)
{
{
i_count
++
;
i_count
++
;
TEST_NEXT
;
TEST_NEXT
_ITEM
;
}
}
if
(
p_tested_item
)
GetInputMeta
(
p_tested_item
->
p_input
,
&
args
);
GetInputMeta
(
p_tested_item
->
p_input
,
&
args
);
pl_Release
(
p_playlist
);
pl_Release
(
p_playlist
);
...
@@ -461,10 +397,11 @@ DBUS_METHOD( GetLength )
...
@@ -461,10 +397,11 @@ DBUS_METHOD( GetLength )
playlist_item_t
*
p_last_item
=
playlist_GetLastLeaf
(
p_playlist
,
playlist_item_t
*
p_last_item
=
playlist_GetLastLeaf
(
p_playlist
,
p_playlist
->
p_root_onelevel
);
p_playlist
->
p_root_onelevel
);
while
(
p_tested_item
->
p_input
->
i_id
!=
p_last_item
->
p_input
->
i_id
)
while
(
p_tested_item
&&
(
p_tested_item
->
p_input
->
i_id
!=
p_last_item
->
p_input
->
i_id
)
)
{
{
i_elements
++
;
i_elements
++
;
TEST_NEXT
;
TEST_NEXT
_ITEM
;
}
}
pl_Release
(
p_playlist
);
pl_Release
(
p_playlist
);
...
@@ -496,17 +433,20 @@ DBUS_METHOD( DelTrack )
...
@@ -496,17 +433,20 @@ DBUS_METHOD( DelTrack )
return
DBUS_HANDLER_RESULT_NOT_YET_HANDLED
;
return
DBUS_HANDLER_RESULT_NOT_YET_HANDLED
;
}
}
while
(
i_count
<
i_position
)
while
(
p_tested_item
&&
(
i_count
<
i_position
)
)
{
{
i_count
++
;
i_count
++
;
TEST_NEXT
;
TEST_NEXT
_ITEM
;
}
}
if
(
p_tested_item
)
{
PL_LOCK
;
PL_LOCK
;
playlist_DeleteFromInput
(
p_playlist
,
playlist_DeleteFromInput
(
p_playlist
,
p_tested_item
->
p_input
->
i_id
,
p_tested_item
->
p_input
->
i_id
,
VLC_TRUE
);
VLC_TRUE
);
PL_UNLOCK
;
PL_UNLOCK
;
}
pl_Release
(
p_playlist
);
pl_Release
(
p_playlist
);
...
@@ -673,7 +613,6 @@ DBUS_METHOD( handle_player )
...
@@ -673,7 +613,6 @@ DBUS_METHOD( handle_player )
METHOD_FUNC
(
"Play"
,
Play
);
METHOD_FUNC
(
"Play"
,
Play
);
METHOD_FUNC
(
"Pause"
,
Pause
);
METHOD_FUNC
(
"Pause"
,
Pause
);
METHOD_FUNC
(
"Repeat"
,
Repeat
);
METHOD_FUNC
(
"Repeat"
,
Repeat
);
METHOD_FUNC
(
"Disconnect"
,
Disconnect
);
METHOD_FUNC
(
"VolumeSet"
,
VolumeSet
);
METHOD_FUNC
(
"VolumeSet"
,
VolumeSet
);
METHOD_FUNC
(
"VolumeGet"
,
VolumeGet
);
METHOD_FUNC
(
"VolumeGet"
,
VolumeGet
);
METHOD_FUNC
(
"PositionSet"
,
PositionSet
);
METHOD_FUNC
(
"PositionSet"
,
PositionSet
);
...
@@ -737,8 +676,8 @@ static int Open( vlc_object_t *p_this )
...
@@ -737,8 +676,8 @@ static int Open( vlc_object_t *p_this )
dbus_bus_request_name
(
p_conn
,
VLC_MPRIS_DBUS_SERVICE
,
0
,
&
error
);
dbus_bus_request_name
(
p_conn
,
VLC_MPRIS_DBUS_SERVICE
,
0
,
&
error
);
if
(
dbus_error_is_set
(
&
error
)
)
if
(
dbus_error_is_set
(
&
error
)
)
{
{
msg_Err
(
p_this
,
"Error requesting
% service: %s
\n
"
msg_Err
(
p_this
,
"Error requesting
service "
VLC_MPRIS_DBUS_SERVICE
VLC_MPRIS_DBUS_SERVICE
,
error
.
message
);
": %s"
,
error
.
message
);
dbus_error_free
(
&
error
);
dbus_error_free
(
&
error
);
free
(
p_sys
);
free
(
p_sys
);
return
VLC_EGENERIC
;
return
VLC_EGENERIC
;
...
@@ -909,6 +848,7 @@ static int GetInputMeta( input_item_t* p_input,
...
@@ -909,6 +848,7 @@ static int GetInputMeta( input_item_t* p_input,
ADD_VLC_META_STRING
(
16
,
TrackID
);
ADD_VLC_META_STRING
(
16
,
TrackID
);
vlc_mutex_lock
(
&
p_input
->
lock
);
vlc_mutex_lock
(
&
p_input
->
lock
);
if
(
p_input
->
p_meta
)
ADD_META
(
17
,
DBUS_TYPE_INT32
,
p_input
->
p_meta
->
i_status
);
ADD_META
(
17
,
DBUS_TYPE_INT32
,
p_input
->
p_meta
->
i_status
);
vlc_mutex_unlock
(
&
p_input
->
lock
);
vlc_mutex_unlock
(
&
p_input
->
lock
);
...
...
modules/control/dbus.h
View file @
f1e3dd73
...
@@ -79,7 +79,8 @@
...
@@ -79,7 +79,8 @@
#define ADD_BYTE( b ) DBUS_ADD( DBUS_TYPE_BYTE, b )
#define ADD_BYTE( b ) DBUS_ADD( DBUS_TYPE_BYTE, b )
/* VLC related */
/* VLC related */
#define TEST_NEXT \
/* Don't forget to test p_tested_item for NULL on loops */
#define TEST_NEXT_ITEM \
p_tested_item = playlist_GetNextLeaf( p_playlist, \
p_tested_item = playlist_GetNextLeaf( p_playlist, \
p_playlist->p_root_onelevel, p_tested_item, VLC_FALSE, VLC_FALSE );
p_playlist->p_root_onelevel, p_tested_item, VLC_FALSE, VLC_FALSE );
...
@@ -147,8 +148,6 @@ const char* psz_introspection_xml_data_player =
...
@@ -147,8 +148,6 @@ const char* psz_introspection_xml_data_player =
" <method name=
\"
GetMetadata
\"
>
\n
"
" <method name=
\"
GetMetadata
\"
>
\n
"
" <arg type=
\"
a{sv}
\"
direction=
\"
out
\"
/>
\n
"
" <arg type=
\"
a{sv}
\"
direction=
\"
out
\"
/>
\n
"
" </method>
\n
"
" </method>
\n
"
" <method name=
\"
Disconnect
\"
>
\n
"
" </method>
\n
"
" <signal name=
\"
TrackChange
\"
>
\n
"
" <signal name=
\"
TrackChange
\"
>
\n
"
" <arg type=
\"
a{sv}
\"
/>
\n
"
" <arg type=
\"
a{sv}
\"
/>
\n
"
" </signal>
\n
"
" </signal>
\n
"
...
...
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