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
147753f6
Commit
147753f6
authored
Nov 18, 2006
by
Rafaël Carré
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Initial support of D-Bus based control interface
parent
a9658993
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
531 additions
and
12 deletions
+531
-12
configure.ac
configure.ac
+30
-12
modules/control/Modules.am
modules/control/Modules.am
+1
-0
modules/control/dbus.c
modules/control/dbus.c
+383
-0
modules/control/dbus.h
modules/control/dbus.h
+117
-0
No files found.
configure.ac
View file @
147753f6
...
...
@@ -848,26 +848,44 @@ AC_ARG_ENABLE(dbus,
if test "${enable_dbus}" != "no"
then
PKG_CHECK_MODULES(DBUS, dbus-1 >= 0.92,
[ AC_DEFINE( HAVE_DBUS_2, 1, [Define if you have the D-BUS library API >= 0.92] )
dnl api stable dbus
PKG_CHECK_MODULES(DBUS, dbus-1 >= 1.0.0,
[ AC_DEFINE( HAVE_DBUS_3, 1, [Define if you have the D-BUS library API >= 1.0.0] )
AC_DEFINE( HAVE_DBUS_2, 1, [Define if you have the D-BUS library API >= 0.92] )
AC_DEFINE( HAVE_DBUS_1, 1, [Define if you have the D-BUS library API >= 0.30] )
AC_DEFINE( HAVE_DBUS, 1, [Define if you have the D-BUS library] )
VLC_ADD_LDFLAGS([screensaver],[$DBUS_LIBS])
VLC_ADD_CFLAGS([screensaver],[$DBUS_CFLAGS])],
dnl older dbus
[ PKG_CHECK_MODULES(DBUS, dbus-1 >= 0.30,
[ AC_DEFINE( HAVE_DBUS_1, 1, [Define if you have the D-BUS library API >= 0.30 ] )
VLC_ADD_CFLAGS([screensaver],[$DBUS_CFLAGS])
dnl Check for dbus control interface
AC_ARG_ENABLE(dbus-control, [ --enable-dbus-control D-BUS control interface (default disabled)])
if test "${enable_dbus_control}" = "yes"
then
VLC_ADD_PLUGINS([dbus])
VLC_ADD_LDFLAGS([dbus],[$DBUS_LIBS])
VLC_ADD_CFLAGS([dbus],[$DBUS_CFLAGS])
fi],
dnl not too old dbus
PKG_CHECK_MODULES(DBUS, dbus-1 >= 0.92,
[ AC_DEFINE( HAVE_DBUS_2, 1, [Define if you have the D-BUS library API >= 0.92] )
AC_DEFINE( HAVE_DBUS_1, 1, [Define if you have the D-BUS library API >= 0.30] )
AC_DEFINE( HAVE_DBUS, 1, [Define if you have the D-BUS library] )
VLC_ADD_LDFLAGS([screensaver],[$DBUS_LIBS])
VLC_ADD_CFLAGS([screensaver],[$DBUS_CFLAGS])],
dnl much older dbus
[ PKG_CHECK_MODULES( DBUS, dbus-1,
[AC_DEFINE(HAVE_DBUS, 1, [Define if you have the D-BUS library])
dnl older dbus
[ PKG_CHECK_MODULES(DBUS, dbus-1 >= 0.30,
[ AC_DEFINE( HAVE_DBUS_1, 1, [Define if you have the D-BUS library API >= 0.30 ] )
AC_DEFINE( HAVE_DBUS, 1, [Define if you have the D-BUS library] )
VLC_ADD_LDFLAGS([screensaver],[$DBUS_LIBS])
VLC_ADD_CFLAGS([screensaver],[$DBUS_CFLAGS])],
[AC_MSG_WARN(DBUS library not found)])
]
)]
dnl much older dbus
[ PKG_CHECK_MODULES( DBUS, dbus-1,
[AC_DEFINE(HAVE_DBUS, 1, [Define if you have the D-BUS library])
VLC_ADD_LDFLAGS([screensaver],[$DBUS_LIBS])
VLC_ADD_CFLAGS([screensaver],[$DBUS_CFLAGS])],
[AC_MSG_WARN(DBUS library not found)])
]
)]
)
)
fi
...
...
modules/control/Modules.am
View file @
147753f6
...
...
@@ -7,3 +7,4 @@ SOURCES_hotkeys = hotkeys.c
SOURCES_lirc = lirc.c
SOURCES_rc = rc.c
SOURCES_motion = motion.c
SOURCES_dbus = dbus.c dbus.h
modules/control/dbus.c
0 → 100644
View file @
147753f6
This diff is collapsed.
Click to expand it.
modules/control/dbus.h
0 → 100644
View file @
147753f6
/*****************************************************************************
* dbus.h : D-Bus control interface
*****************************************************************************
* Copyright (C) 2006 Rafaël Carré
* $Id$
*
* Author: Rafaël Carré <funman at videolanorg>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
/* DBUS IDENTIFIERS */
#define VLC_DBUS_SERVICE "org.videolan.vlc"
#define VLC_DBUS_INTERFACE "org.videolan.vlc"
#define VLC_DBUS_OBJECT_PATH "/org/videolan/vlc"
/* MACROS */
#define DBUS_METHOD( method_function ) \
static DBusHandlerResult method_function \
( DBusConnection *p_conn, DBusMessage *p_from, void *p_this )
#define DBUS_SIGNAL( signal_function ) \
static DBusHandlerResult signal_function \
( DBusConnection *p_conn, void *p_data )
#define REPLY_INIT \
DBusMessage* p_msg = dbus_message_new_method_return( p_from ); \
if( !p_msg ) return DBUS_HANDLER_RESULT_NEED_MEMORY; \
dbus_uint32_t i_serial = 0
#define REPLY_SEND \
if( !dbus_connection_send( p_conn, p_msg, &i_serial ) ) \
return DBUS_HANDLER_RESULT_NEED_MEMORY; \
dbus_connection_flush( p_conn ); \
dbus_message_unref( p_msg ); \
return DBUS_HANDLER_RESULT_HANDLED
#define SIGNAL_INIT( signal ) \
DBusMessage *p_msg = dbus_message_new_signal( VLC_DBUS_OBJECT_PATH, \
VLC_DBUS_INTERFACE, signal ); \
if( !p_msg ) return DBUS_HANDLER_RESULT_NEED_MEMORY; \
dbus_uint32_t i_serial = 0
#define SIGNAL_SEND \
if( !dbus_connection_send( p_conn, p_msg, &i_serial ) ) \
return DBUS_HANDLER_RESULT_NEED_MEMORY; \
dbus_message_unref( p_msg ); \
dbus_connection_flush( p_conn ); \
return DBUS_HANDLER_RESULT_HANDLED
#define OUT_ARGUMENTS \
DBusMessageIter args; \
dbus_message_iter_init_append( p_msg, &args )
#define DBUS_ADD( dbus_type, value ) \
if( !dbus_message_iter_append_basic( &args, dbus_type, value ) ) \
return DBUS_HANDLER_RESULT_NEED_MEMORY
#define ADD_STRING( s ) DBUS_ADD( DBUS_TYPE_STRING, s )
#define ADD_BOOL( b ) DBUS_ADD( DBUS_TYPE_BOOLEAN, b )
#define ADD_UINT32( i ) DBUS_ADD( DBUS_TYPE_UINT32, i )
/* XML data to answer org.freedesktop.DBus.Introspectable.Introspect requests */
const
char
*
psz_introspection_xml_data
=
"<!DOCTYPE node PUBLIC
\"
-//freedesktop//DTD D-BUS Object Introspection 1.0//EN
\"\n
"
"
\"
http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd
\"
>
\n
"
"<node>"
" <interface name=
\"
org.freedesktop.DBus.Introspectable
\"
>
\n
"
" <method name=
\"
Introspect
\"
>
\n
"
" <arg name=
\"
data
\"
direction=
\"
out
\"
type=
\"
s
\"
/>
\n
"
" </method>
\n
"
" </interface>
\n
"
" <interface name=
\"
org.videolan.vlc
\"
>
\n
"
" <method name=
\"
GetPlayStatus
\"
>
\n
"
" <arg type=
\"
s
\"
direction=
\"
out
\"
/>
\n
"
" </method>
\n
"
" <method name=
\"
TogglePause
\"
>
\n
"
" <arg type=
\"
s
\"
direction=
\"
out
\"
/>
\n
"
" </method>
\n
"
" <method name=
\"
AddMRL
\"
>
\n
"
" <arg type=
\"
s
\"
direction=
\"
in
\"
/>
\n
"
" <arg type=
\"
b
\"
direction=
\"
in
\"
/>
\n
"
" </method>
\n
"
" <method name=
\"
Nothing
\"
>
\n
"
" </method>
\n
"
" </interface>
\n
"
"</node>
\n
"
;
/* Handling of messages received onn VLC_DBUS_OBJECT_PATH */
DBUS_METHOD
(
handle_messages
);
/* handler function */
/* vtable passed to dbus_connection_register_object_path() */
static
DBusObjectPathVTable
vlc_dbus_vtable
=
{
NULL
,
/* Called when vtable is unregistered or its connection is freed*/
handle_messages
,
/* handler function */
NULL
,
NULL
,
NULL
,
NULL
};
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