From 0c26cf3f1a5d96d33acd4696963c20e14872389c Mon Sep 17 00:00:00 2001 From: Regis Merlino Date: Thu, 22 Aug 2013 18:11:22 +0200 Subject: [PATCH] Update dLeyna to v0.2.1 --- ChangeLog | 7 + configure | 20 +- configure.ac | 2 +- dleyna-connector-dbus/ChangeLog | 3 + dleyna-connector-dbus/build-aux/ltmain.sh | 4 +- dleyna-connector-dbus/configure | 71 ++- dleyna-connector-dbus/configure.ac | 4 +- dleyna-connector-dbus/m4/libtool.m4 | 40 +- dleyna-connector-dbus/src/connector-dbus.c | 16 +- dleyna-core/ChangeLog | 5 + dleyna-core/Makefile.am | 8 +- dleyna-core/Makefile.in | 15 +- dleyna-core/build-aux/ltmain.sh | 4 +- dleyna-core/configure | 71 ++- dleyna-core/configure.ac | 4 +- dleyna-core/libdleyna/core/connector-mgr.c | 2 +- dleyna-core/libdleyna/core/connector.h | 2 +- dleyna-core/libdleyna/core/log.h | 12 +- dleyna-core/libdleyna/core/main-loop.c | 2 + dleyna-core/libdleyna/core/settings.c | 157 ++++++- dleyna-core/libdleyna/core/settings.h | 4 + dleyna-core/libdleyna/core/white-list.c | 125 ++++++ dleyna-core/libdleyna/core/white-list.h | 50 +++ dleyna-core/m4/libtool.m4 | 40 +- dleyna-renderer/ChangeLog | 24 ++ dleyna-renderer/build-aux/ltmain.sh | 4 +- dleyna-renderer/configure | 91 ++-- dleyna-renderer/configure.ac | 8 +- dleyna-renderer/libdleyna/renderer/Makefile.am | 6 +- dleyna-renderer/libdleyna/renderer/Makefile.in | 60 +-- dleyna-renderer/libdleyna/renderer/async.c | 3 +- dleyna-renderer/libdleyna/renderer/device.c | 475 +++++++++++++++++---- dleyna-renderer/libdleyna/renderer/device.h | 1 + .../libdleyna/renderer/dleyna-renderer-1.0.pc.in | 2 +- .../renderer/dleyna-renderer-service.conf | 12 + .../renderer/dleyna-renderer-service.conf.in | 12 + dleyna-renderer/libdleyna/renderer/manager.c | 273 ++++++++++++ dleyna-renderer/libdleyna/renderer/manager.h | 55 +++ dleyna-renderer/libdleyna/renderer/prop-defs.h | 7 + dleyna-renderer/libdleyna/renderer/server.c | 294 +++++++++++-- dleyna-renderer/libdleyna/renderer/server.h | 2 + dleyna-renderer/libdleyna/renderer/task.c | 196 ++++++++- dleyna-renderer/libdleyna/renderer/task.h | 57 ++- dleyna-renderer/libdleyna/renderer/upnp.c | 21 +- dleyna-renderer/libdleyna/renderer/upnp.h | 3 + dleyna-renderer/m4/libtool.m4 | 40 +- dleyna-server/ChangeLog | 9 + dleyna-server/build-aux/ltmain.sh | 4 +- dleyna-server/configure | 73 ++-- dleyna-server/configure.ac | 6 +- dleyna-server/libdleyna/server/Makefile.am | 6 +- dleyna-server/libdleyna/server/Makefile.in | 63 +-- dleyna-server/libdleyna/server/async.c | 1 + dleyna-server/libdleyna/server/device.c | 38 +- .../libdleyna/server/dleyna-server-1.0.pc.in | 2 +- .../libdleyna/server/dleyna-server-service.conf | 13 + .../libdleyna/server/dleyna-server-service.conf.in | 13 + dleyna-server/libdleyna/server/interface.h | 19 + dleyna-server/libdleyna/server/manager.c | 210 +++++++++ dleyna-server/libdleyna/server/manager.h | 55 +++ dleyna-server/libdleyna/server/props.c | 334 +++++++++------ dleyna-server/libdleyna/server/props.h | 13 +- dleyna-server/libdleyna/server/search.c | 13 + dleyna-server/libdleyna/server/server.c | 237 +++++++--- dleyna-server/libdleyna/server/task.c | 171 ++++++-- dleyna-server/libdleyna/server/task.h | 37 +- dleyna-server/libdleyna/server/upnp.c | 17 +- dleyna-server/libdleyna/server/upnp.h | 2 + dleyna-server/m4/libtool.m4 | 40 +- packaging/dLeyna.changes | 3 + packaging/dLeyna.spec | 10 +- 71 files changed, 2922 insertions(+), 781 deletions(-) create mode 100644 dleyna-core/libdleyna/core/white-list.c create mode 100644 dleyna-core/libdleyna/core/white-list.h create mode 100644 dleyna-renderer/libdleyna/renderer/manager.c create mode 100644 dleyna-renderer/libdleyna/renderer/manager.h create mode 100644 dleyna-server/libdleyna/server/manager.c create mode 100644 dleyna-server/libdleyna/server/manager.h diff --git a/ChangeLog b/ChangeLog index ece835c..beabd68 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +version 0.2.1 + - dleyna-connector-dbus v0.2.0 + - dleyna-core v0.2.2 + - dleyna-renderer v0.2.2 + - dleyna-server v0.2.1 + - dleyna-control v0.2.0 + version 0.1.0 - dleyna-connector-dbus v0.1.0 - dleyna-core v0.1.0 diff --git a/configure b/configure index d808891..a7e90ca 100755 --- a/configure +++ b/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for dleyna-linux 0.2.0. +# Generated by GNU Autoconf 2.69 for dleyna-linux 0.2.1. # # Report bugs to . # @@ -579,8 +579,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='dleyna-linux' PACKAGE_TARNAME='dleyna-linux' -PACKAGE_VERSION='0.2.0' -PACKAGE_STRING='dleyna-linux 0.2.0' +PACKAGE_VERSION='0.2.1' +PACKAGE_STRING='dleyna-linux 0.2.1' PACKAGE_BUGREPORT='https://github.com/01org/dleyna-linux/issues/new' PACKAGE_URL='https://01.org/dleyna/' @@ -1206,7 +1206,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures dleyna-linux 0.2.0 to adapt to many kinds of systems. +\`configure' configures dleyna-linux 0.2.1 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1272,7 +1272,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of dleyna-linux 0.2.0:";; + short | recursive ) echo "Configuration of dleyna-linux 0.2.1:";; esac cat <<\_ACEOF @@ -1349,7 +1349,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -dleyna-linux configure 0.2.0 +dleyna-linux configure 0.2.1 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -1366,7 +1366,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by dleyna-linux $as_me 0.2.0, which was +It was created by dleyna-linux $as_me 0.2.1, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -2188,7 +2188,7 @@ fi # Define the identity of the package. PACKAGE='dleyna-linux' - VERSION='0.2.0' + VERSION='0.2.1' cat >>confdefs.h <<_ACEOF @@ -2811,7 +2811,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by dleyna-linux $as_me 0.2.0, which was +This file was extended by dleyna-linux $as_me 0.2.1, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -2874,7 +2874,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -dleyna-linux config.status 0.2.0 +dleyna-linux config.status 0.2.1 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" diff --git a/configure.ac b/configure.ac index 0f5fd77..ff2e9d1 100644 --- a/configure.ac +++ b/configure.ac @@ -1,7 +1,7 @@ AC_PREREQ([2.66]) AC_INIT([dleyna-linux], - [0.2.0], + [0.2.1], [https://github.com/01org/dleyna-linux/issues/new], , [https://01.org/dleyna/]) diff --git a/dleyna-connector-dbus/ChangeLog b/dleyna-connector-dbus/ChangeLog index 74aaf68..5d18c39 100644 --- a/dleyna-connector-dbus/ChangeLog +++ b/dleyna-connector-dbus/ChangeLog @@ -1,3 +1,6 @@ +version 0.2.0 + - Change publish_object() signature + version 0.1.0 - Prepare for first stable branch diff --git a/dleyna-connector-dbus/build-aux/ltmain.sh b/dleyna-connector-dbus/build-aux/ltmain.sh index 0096fe6..b9205ee 100644 --- a/dleyna-connector-dbus/build-aux/ltmain.sh +++ b/dleyna-connector-dbus/build-aux/ltmain.sh @@ -70,7 +70,7 @@ # compiler: $LTCC # compiler flags: $LTCFLAGS # linker: $LD (gnu? $with_gnu_ld) -# $progname: (GNU libtool) 2.4.2 Debian-2.4.2-1ubuntu2 +# $progname: (GNU libtool) 2.4.2 Debian-2.4.2-1.2ubuntu1 # automake: $automake_version # autoconf: $autoconf_version # @@ -80,7 +80,7 @@ PROGRAM=libtool PACKAGE=libtool -VERSION="2.4.2 Debian-2.4.2-1ubuntu2" +VERSION="2.4.2 Debian-2.4.2-1.2ubuntu1" TIMESTAMP="" package_revision=1.3337 diff --git a/dleyna-connector-dbus/configure b/dleyna-connector-dbus/configure index 65bee6e..d4a9e0e 100755 --- a/dleyna-connector-dbus/configure +++ b/dleyna-connector-dbus/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for dleyna-connector-dbus 0.1.0. +# Generated by GNU Autoconf 2.69 for dleyna-connector-dbus 0.2.0. # # Report bugs to . # @@ -591,8 +591,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='dleyna-connector-dbus' PACKAGE_TARNAME='dleyna-connector-dbus' -PACKAGE_VERSION='0.1.0' -PACKAGE_STRING='dleyna-connector-dbus 0.1.0' +PACKAGE_VERSION='0.2.0' +PACKAGE_STRING='dleyna-connector-dbus 0.2.0' PACKAGE_BUGREPORT='https://github.com/01org/dleyna-connector-dbus/issues/new' PACKAGE_URL='https://01.org/dleyna/' @@ -1343,7 +1343,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures dleyna-connector-dbus 0.1.0 to adapt to many kinds of systems. +\`configure' configures dleyna-connector-dbus 0.2.0 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1414,7 +1414,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of dleyna-connector-dbus 0.1.0:";; + short | recursive ) echo "Configuration of dleyna-connector-dbus 0.2.0:";; esac cat <<\_ACEOF @@ -1542,7 +1542,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -dleyna-connector-dbus configure 0.1.0 +dleyna-connector-dbus configure 0.2.0 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -2019,7 +2019,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by dleyna-connector-dbus $as_me 0.1.0, which was +It was created by dleyna-connector-dbus $as_me 0.2.0, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -2842,7 +2842,7 @@ fi # Define the identity of the package. PACKAGE='dleyna-connector-dbus' - VERSION='0.1.0' + VERSION='0.2.0' cat >>confdefs.h <<_ACEOF @@ -4985,7 +4985,8 @@ else ;; *) lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null` - if test -n "$lt_cv_sys_max_cmd_len"; then + if test -n "$lt_cv_sys_max_cmd_len" && \ + test undefined != "$lt_cv_sys_max_cmd_len"; then lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` else @@ -5386,10 +5387,6 @@ freebsd* | dragonfly*) fi ;; -gnu*) - lt_cv_deplibs_check_method=pass_all - ;; - haiku*) lt_cv_deplibs_check_method=pass_all ;; @@ -5428,7 +5425,7 @@ irix5* | irix6* | nonstopux*) ;; # This must be glibc/ELF. -linux* | k*bsd*-gnu | kopensolaris*-gnu) +linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) lt_cv_deplibs_check_method=pass_all ;; @@ -6526,7 +6523,14 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*) LD="${LD-ld} -m elf_i386_fbsd" ;; x86_64-*linux*) - LD="${LD-ld} -m elf_i386" + case `/usr/bin/file conftest.o` in + *x86-64*) + LD="${LD-ld} -m elf32_x86_64" + ;; + *) + LD="${LD-ld} -m elf_i386" + ;; + esac ;; ppc64-*linux*|powerpc64-*linux*) LD="${LD-ld} -m elf32ppclinux" @@ -8353,7 +8357,7 @@ lt_prog_compiler_static= lt_prog_compiler_static='-non_shared' ;; - linux* | k*bsd*-gnu | kopensolaris*-gnu) + linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) case $cc_basename in # old Intel for x86_64 which still supported -KPIC. ecc*) @@ -10523,17 +10527,6 @@ freebsd* | dragonfly*) esac ;; -gnu*) - version_type=linux # correct to gnu/linux during the next big refactor - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - ;; - haiku*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no @@ -10650,7 +10643,7 @@ linux*oldld* | linux*aout* | linux*coff*) ;; # This must be glibc/ELF. -linux* | k*bsd*-gnu | kopensolaris*-gnu) +linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no @@ -12451,12 +12444,12 @@ if test -n "$DLEYNA_CORE_CFLAGS"; then pkg_cv_DLEYNA_CORE_CFLAGS="$DLEYNA_CORE_CFLAGS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ - { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"dleyna-core-1.0 >= 0.0.1\""; } >&5 - ($PKG_CONFIG --exists --print-errors "dleyna-core-1.0 >= 0.0.1") 2>&5 + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"dleyna-core-1.0 >= 0.2.1\""; } >&5 + ($PKG_CONFIG --exists --print-errors "dleyna-core-1.0 >= 0.2.1") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then - pkg_cv_DLEYNA_CORE_CFLAGS=`$PKG_CONFIG --cflags "dleyna-core-1.0 >= 0.0.1" 2>/dev/null` + pkg_cv_DLEYNA_CORE_CFLAGS=`$PKG_CONFIG --cflags "dleyna-core-1.0 >= 0.2.1" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes @@ -12468,12 +12461,12 @@ if test -n "$DLEYNA_CORE_LIBS"; then pkg_cv_DLEYNA_CORE_LIBS="$DLEYNA_CORE_LIBS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ - { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"dleyna-core-1.0 >= 0.0.1\""; } >&5 - ($PKG_CONFIG --exists --print-errors "dleyna-core-1.0 >= 0.0.1") 2>&5 + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"dleyna-core-1.0 >= 0.2.1\""; } >&5 + ($PKG_CONFIG --exists --print-errors "dleyna-core-1.0 >= 0.2.1") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then - pkg_cv_DLEYNA_CORE_LIBS=`$PKG_CONFIG --libs "dleyna-core-1.0 >= 0.0.1" 2>/dev/null` + pkg_cv_DLEYNA_CORE_LIBS=`$PKG_CONFIG --libs "dleyna-core-1.0 >= 0.2.1" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes @@ -12494,14 +12487,14 @@ else _pkg_short_errors_supported=no fi if test $_pkg_short_errors_supported = yes; then - DLEYNA_CORE_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "dleyna-core-1.0 >= 0.0.1" 2>&1` + DLEYNA_CORE_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "dleyna-core-1.0 >= 0.2.1" 2>&1` else - DLEYNA_CORE_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "dleyna-core-1.0 >= 0.0.1" 2>&1` + DLEYNA_CORE_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "dleyna-core-1.0 >= 0.2.1" 2>&1` fi # Put the nasty error message in config.log where it belongs echo "$DLEYNA_CORE_PKG_ERRORS" >&5 - as_fn_error $? "Package requirements (dleyna-core-1.0 >= 0.0.1) were not met: + as_fn_error $? "Package requirements (dleyna-core-1.0 >= 0.2.1) were not met: $DLEYNA_CORE_PKG_ERRORS @@ -13202,7 +13195,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by dleyna-connector-dbus $as_me 0.1.0, which was +This file was extended by dleyna-connector-dbus $as_me 0.2.0, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -13269,7 +13262,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -dleyna-connector-dbus config.status 0.1.0 +dleyna-connector-dbus config.status 0.2.0 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" diff --git a/dleyna-connector-dbus/configure.ac b/dleyna-connector-dbus/configure.ac index 81edb3f..392f756 100644 --- a/dleyna-connector-dbus/configure.ac +++ b/dleyna-connector-dbus/configure.ac @@ -1,7 +1,7 @@ AC_PREREQ([2.66]) AC_INIT([dleyna-connector-dbus], - [0.1.0], + [0.2.0], [https://github.com/01org/dleyna-connector-dbus/issues/new], , [https://01.org/dleyna/]) @@ -79,7 +79,7 @@ AC_ARG_ENABLE(master-build,, [master_build=no]) AS_IF([test "x$master_build" = "xno"], - [PKG_CHECK_MODULES([DLEYNA_CORE], [dleyna-core-1.0 >= 0.0.1])], + [PKG_CHECK_MODULES([DLEYNA_CORE], [dleyna-core-1.0 >= 0.2.1])], [DLEYNA_CORE_CFLAGS="-I../dleyna-core"; DLEYNA_CORE_LIBS="-L../dleyna-core/.libs -ldleyna-core-1.0" ]) diff --git a/dleyna-connector-dbus/m4/libtool.m4 b/dleyna-connector-dbus/m4/libtool.m4 index 828104c..02b4bbe 100644 --- a/dleyna-connector-dbus/m4/libtool.m4 +++ b/dleyna-connector-dbus/m4/libtool.m4 @@ -1324,7 +1324,14 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*) LD="${LD-ld} -m elf_i386_fbsd" ;; x86_64-*linux*) - LD="${LD-ld} -m elf_i386" + case `/usr/bin/file conftest.o` in + *x86-64*) + LD="${LD-ld} -m elf32_x86_64" + ;; + *) + LD="${LD-ld} -m elf_i386" + ;; + esac ;; ppc64-*linux*|powerpc64-*linux*) LD="${LD-ld} -m elf32ppclinux" @@ -1688,7 +1695,8 @@ AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl ;; *) lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null` - if test -n "$lt_cv_sys_max_cmd_len"; then + if test -n "$lt_cv_sys_max_cmd_len" && \ + test undefined != "$lt_cv_sys_max_cmd_len"; then lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` else @@ -2512,17 +2520,6 @@ freebsd* | dragonfly*) esac ;; -gnu*) - version_type=linux # correct to gnu/linux during the next big refactor - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - ;; - haiku*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no @@ -2639,7 +2636,7 @@ linux*oldld* | linux*aout* | linux*coff*) ;; # This must be glibc/ELF. -linux* | k*bsd*-gnu | kopensolaris*-gnu) +linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no @@ -3255,10 +3252,6 @@ freebsd* | dragonfly*) fi ;; -gnu*) - lt_cv_deplibs_check_method=pass_all - ;; - haiku*) lt_cv_deplibs_check_method=pass_all ;; @@ -3297,7 +3290,7 @@ irix5* | irix6* | nonstopux*) ;; # This must be glibc/ELF. -linux* | k*bsd*-gnu | kopensolaris*-gnu) +linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) lt_cv_deplibs_check_method=pass_all ;; @@ -4049,7 +4042,7 @@ m4_if([$1], [CXX], [ ;; esac ;; - linux* | k*bsd*-gnu | kopensolaris*-gnu) + linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) case $cc_basename in KCC*) # KAI C++ Compiler @@ -4348,7 +4341,7 @@ m4_if([$1], [CXX], [ _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; - linux* | k*bsd*-gnu | kopensolaris*-gnu) + linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) case $cc_basename in # old Intel for x86_64 which still supported -KPIC. ecc*) @@ -6241,9 +6234,6 @@ if test "$_lt_caught_CXX_error" != yes; then _LT_TAGVAR(ld_shlibs, $1)=yes ;; - gnu*) - ;; - haiku*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(link_all_deplibs, $1)=yes @@ -6405,7 +6395,7 @@ if test "$_lt_caught_CXX_error" != yes; then _LT_TAGVAR(inherit_rpath, $1)=yes ;; - linux* | k*bsd*-gnu | kopensolaris*-gnu) + linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) case $cc_basename in KCC*) # Kuck and Associates, Inc. (KAI) C++ Compiler diff --git a/dleyna-connector-dbus/src/connector-dbus.c b/dleyna-connector-dbus/src/connector-dbus.c index b93d14c..0e16239 100644 --- a/dleyna-connector-dbus/src/connector-dbus.c +++ b/dleyna-connector-dbus/src/connector-dbus.c @@ -319,13 +319,21 @@ static void prv_connector_set_client_lost_cb( } static GDBusInterfaceInfo *prv_find_interface_info(gboolean root, - guint interface_index) + const gchar *interface_name) { GDBusNodeInfo *node; + GDBusInterfaceInfo **interface; node = (root) ? g_context.root_node_info : g_context.server_node_info; - return node->interfaces[interface_index]; + interface = node->interfaces; + while (*interface) { + if (!strcmp(interface_name, (*interface)->name)) + break; + interface++; + } + + return *interface; } static void prv_object_method_call(GDBusConnection *conn, @@ -372,7 +380,7 @@ static guint prv_connector_publish_object( dleyna_connector_id_t connection, const gchar *object_path, gboolean root, - guint interface_index, + const gchar* interface_name, const dleyna_connector_dispatch_cb_t *cb_table_1) { guint object_id; @@ -384,7 +392,7 @@ static guint prv_connector_publish_object( object = g_new0(dleyna_dbus_object_t, 1); - info = prv_find_interface_info(root, interface_index); + info = prv_find_interface_info(root, interface_name); object_id = g_dbus_connection_register_object( (GDBusConnection *)connection, object_path, diff --git a/dleyna-core/ChangeLog b/dleyna-core/ChangeLog index 513201a..b0da9a8 100644 --- a/dleyna-core/ChangeLog +++ b/dleyna-core/ChangeLog @@ -1,3 +1,8 @@ +version 0.2.2 + - Change connector publish_object() signature + - Add network filtering support + - Code cleanup + version 0.1.0 - Prepare for first stable branch diff --git a/dleyna-core/Makefile.am b/dleyna-core/Makefile.am index c166e83..9fc4360 100644 --- a/dleyna-core/Makefile.am +++ b/dleyna-core/Makefile.am @@ -2,7 +2,7 @@ libdleyna_coreincdir = $(includedir)/dleyna-1.0/libdleyna/core connectordir = $(libdir)/dleyna-1.0/connectors sysconfigdir = $(sysconfdir) -DLEYNA_CORE_VERSION = 1:2:0 +DLEYNA_CORE_VERSION = 2:0:1 AM_CFLAGS = $(GLIB_CFLAGS) \ $(GIO_CFLAGS) \ @@ -25,7 +25,8 @@ libdleyna_coreinc_HEADERS = libdleyna/core/connector.h \ libdleyna/core/service-task.h \ libdleyna/core/settings.h \ libdleyna/core/task-atom.h \ - libdleyna/core/task-processor.h + libdleyna/core/task-processor.h \ + libdleyna/core/white-list.h libdleyna_core_1_0_la_LDFLAGS = -version-info $(DLEYNA_CORE_VERSION) \ @@ -38,7 +39,8 @@ libdleyna_core_1_0_la_SOURCES = $(libdleyna_coreinc_HEADERS) \ libdleyna/core/main-loop.c \ libdleyna/core/service-task.c \ libdleyna/core/settings.c \ - libdleyna/core/task-processor.c + libdleyna/core/task-processor.c \ + libdleyna/core/white-list.c libdleyna_core_1_0_la_LIBADD = $(GLIB_LIBS) \ $(GIO_LIBS) \ diff --git a/dleyna-core/Makefile.in b/dleyna-core/Makefile.in index 9a9693c..bd5e15e 100644 --- a/dleyna-core/Makefile.in +++ b/dleyna-core/Makefile.in @@ -115,7 +115,7 @@ am_libdleyna_core_1_0_la_OBJECTS = $(am__objects_1) \ libdleyna/core/connector-mgr.lo libdleyna/core/error.lo \ libdleyna/core/log.lo libdleyna/core/main-loop.lo \ libdleyna/core/service-task.lo libdleyna/core/settings.lo \ - libdleyna/core/task-processor.lo + libdleyna/core/task-processor.lo libdleyna/core/white-list.lo libdleyna_core_1_0_la_OBJECTS = $(am_libdleyna_core_1_0_la_OBJECTS) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) @@ -309,7 +309,7 @@ with_log_level = @with_log_level@ libdleyna_coreincdir = $(includedir)/dleyna-1.0/libdleyna/core connectordir = $(libdir)/dleyna-1.0/connectors sysconfigdir = $(sysconfdir) -DLEYNA_CORE_VERSION = 1:2:0 +DLEYNA_CORE_VERSION = 2:0:1 AM_CFLAGS = $(GLIB_CFLAGS) \ $(GIO_CFLAGS) \ $(GMODULE_CFLAGS) \ @@ -329,7 +329,8 @@ libdleyna_coreinc_HEADERS = libdleyna/core/connector.h \ libdleyna/core/service-task.h \ libdleyna/core/settings.h \ libdleyna/core/task-atom.h \ - libdleyna/core/task-processor.h + libdleyna/core/task-processor.h \ + libdleyna/core/white-list.h libdleyna_core_1_0_la_LDFLAGS = -version-info $(DLEYNA_CORE_VERSION) \ -no-undefined @@ -341,7 +342,8 @@ libdleyna_core_1_0_la_SOURCES = $(libdleyna_coreinc_HEADERS) \ libdleyna/core/main-loop.c \ libdleyna/core/service-task.c \ libdleyna/core/settings.c \ - libdleyna/core/task-processor.c + libdleyna/core/task-processor.c \ + libdleyna/core/white-list.c libdleyna_core_1_0_la_LIBADD = $(GLIB_LIBS) \ $(GIO_LIBS) \ @@ -470,6 +472,8 @@ libdleyna/core/settings.lo: libdleyna/core/$(am__dirstamp) \ libdleyna/core/$(DEPDIR)/$(am__dirstamp) libdleyna/core/task-processor.lo: libdleyna/core/$(am__dirstamp) \ libdleyna/core/$(DEPDIR)/$(am__dirstamp) +libdleyna/core/white-list.lo: libdleyna/core/$(am__dirstamp) \ + libdleyna/core/$(DEPDIR)/$(am__dirstamp) libdleyna-core-1.0.la: $(libdleyna_core_1_0_la_OBJECTS) $(libdleyna_core_1_0_la_DEPENDENCIES) $(EXTRA_libdleyna_core_1_0_la_DEPENDENCIES) $(AM_V_CCLD)$(libdleyna_core_1_0_la_LINK) -rpath $(libdir) $(libdleyna_core_1_0_la_OBJECTS) $(libdleyna_core_1_0_la_LIBADD) $(LIBS) @@ -489,6 +493,8 @@ mostlyclean-compile: -rm -f libdleyna/core/settings.lo -rm -f libdleyna/core/task-processor.$(OBJEXT) -rm -f libdleyna/core/task-processor.lo + -rm -f libdleyna/core/white-list.$(OBJEXT) + -rm -f libdleyna/core/white-list.lo distclean-compile: -rm -f *.tab.c @@ -500,6 +506,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@libdleyna/core/$(DEPDIR)/service-task.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@libdleyna/core/$(DEPDIR)/settings.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@libdleyna/core/$(DEPDIR)/task-processor.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@libdleyna/core/$(DEPDIR)/white-list.Plo@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ diff --git a/dleyna-core/build-aux/ltmain.sh b/dleyna-core/build-aux/ltmain.sh index 0096fe6..b9205ee 100644 --- a/dleyna-core/build-aux/ltmain.sh +++ b/dleyna-core/build-aux/ltmain.sh @@ -70,7 +70,7 @@ # compiler: $LTCC # compiler flags: $LTCFLAGS # linker: $LD (gnu? $with_gnu_ld) -# $progname: (GNU libtool) 2.4.2 Debian-2.4.2-1ubuntu2 +# $progname: (GNU libtool) 2.4.2 Debian-2.4.2-1.2ubuntu1 # automake: $automake_version # autoconf: $autoconf_version # @@ -80,7 +80,7 @@ PROGRAM=libtool PACKAGE=libtool -VERSION="2.4.2 Debian-2.4.2-1ubuntu2" +VERSION="2.4.2 Debian-2.4.2-1.2ubuntu1" TIMESTAMP="" package_revision=1.3337 diff --git a/dleyna-core/configure b/dleyna-core/configure index fc3fbe6..ad6b183 100755 --- a/dleyna-core/configure +++ b/dleyna-core/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for dleyna-core 0.1.0. +# Generated by GNU Autoconf 2.69 for dleyna-core 0.2.2. # # Report bugs to . # @@ -590,8 +590,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='dleyna-core' PACKAGE_TARNAME='dleyna-core' -PACKAGE_VERSION='0.1.0' -PACKAGE_STRING='dleyna-core 0.1.0' +PACKAGE_VERSION='0.2.2' +PACKAGE_STRING='dleyna-core 0.2.2' PACKAGE_BUGREPORT='https://github.com/01org/dleyna-core/issues/new' PACKAGE_URL='https://01.org/dleyna/' @@ -1345,7 +1345,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures dleyna-core 0.1.0 to adapt to many kinds of systems. +\`configure' configures dleyna-core 0.2.2 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1415,7 +1415,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of dleyna-core 0.1.0:";; + short | recursive ) echo "Configuration of dleyna-core 0.2.2:";; esac cat <<\_ACEOF @@ -1543,7 +1543,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -dleyna-core configure 0.1.0 +dleyna-core configure 0.2.2 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -2020,7 +2020,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by dleyna-core $as_me 0.1.0, which was +It was created by dleyna-core $as_me 0.2.2, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -2843,7 +2843,7 @@ fi # Define the identity of the package. PACKAGE='dleyna-core' - VERSION='0.1.0' + VERSION='0.2.2' cat >>confdefs.h <<_ACEOF @@ -4986,7 +4986,8 @@ else ;; *) lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null` - if test -n "$lt_cv_sys_max_cmd_len"; then + if test -n "$lt_cv_sys_max_cmd_len" && \ + test undefined != "$lt_cv_sys_max_cmd_len"; then lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` else @@ -5387,10 +5388,6 @@ freebsd* | dragonfly*) fi ;; -gnu*) - lt_cv_deplibs_check_method=pass_all - ;; - haiku*) lt_cv_deplibs_check_method=pass_all ;; @@ -5429,7 +5426,7 @@ irix5* | irix6* | nonstopux*) ;; # This must be glibc/ELF. -linux* | k*bsd*-gnu | kopensolaris*-gnu) +linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) lt_cv_deplibs_check_method=pass_all ;; @@ -6527,7 +6524,14 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*) LD="${LD-ld} -m elf_i386_fbsd" ;; x86_64-*linux*) - LD="${LD-ld} -m elf_i386" + case `/usr/bin/file conftest.o` in + *x86-64*) + LD="${LD-ld} -m elf32_x86_64" + ;; + *) + LD="${LD-ld} -m elf_i386" + ;; + esac ;; ppc64-*linux*|powerpc64-*linux*) LD="${LD-ld} -m elf32ppclinux" @@ -8354,7 +8358,7 @@ lt_prog_compiler_static= lt_prog_compiler_static='-non_shared' ;; - linux* | k*bsd*-gnu | kopensolaris*-gnu) + linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) case $cc_basename in # old Intel for x86_64 which still supported -KPIC. ecc*) @@ -10524,17 +10528,6 @@ freebsd* | dragonfly*) esac ;; -gnu*) - version_type=linux # correct to gnu/linux during the next big refactor - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - ;; - haiku*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no @@ -10651,7 +10644,7 @@ linux*oldld* | linux*aout* | linux*coff*) ;; # This must be glibc/ELF. -linux* | k*bsd*-gnu | kopensolaris*-gnu) +linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no @@ -12102,12 +12095,12 @@ if test -n "$GUPNP_CFLAGS"; then pkg_cv_GUPNP_CFLAGS="$GUPNP_CFLAGS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ - { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"gupnp-1.0 >= 0.19.1\""; } >&5 - ($PKG_CONFIG --exists --print-errors "gupnp-1.0 >= 0.19.1") 2>&5 + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"gupnp-1.0 >= 0.20.5\""; } >&5 + ($PKG_CONFIG --exists --print-errors "gupnp-1.0 >= 0.20.5") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then - pkg_cv_GUPNP_CFLAGS=`$PKG_CONFIG --cflags "gupnp-1.0 >= 0.19.1" 2>/dev/null` + pkg_cv_GUPNP_CFLAGS=`$PKG_CONFIG --cflags "gupnp-1.0 >= 0.20.5" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes @@ -12119,12 +12112,12 @@ if test -n "$GUPNP_LIBS"; then pkg_cv_GUPNP_LIBS="$GUPNP_LIBS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ - { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"gupnp-1.0 >= 0.19.1\""; } >&5 - ($PKG_CONFIG --exists --print-errors "gupnp-1.0 >= 0.19.1") 2>&5 + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"gupnp-1.0 >= 0.20.5\""; } >&5 + ($PKG_CONFIG --exists --print-errors "gupnp-1.0 >= 0.20.5") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then - pkg_cv_GUPNP_LIBS=`$PKG_CONFIG --libs "gupnp-1.0 >= 0.19.1" 2>/dev/null` + pkg_cv_GUPNP_LIBS=`$PKG_CONFIG --libs "gupnp-1.0 >= 0.20.5" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes @@ -12145,14 +12138,14 @@ else _pkg_short_errors_supported=no fi if test $_pkg_short_errors_supported = yes; then - GUPNP_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "gupnp-1.0 >= 0.19.1" 2>&1` + GUPNP_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "gupnp-1.0 >= 0.20.5" 2>&1` else - GUPNP_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "gupnp-1.0 >= 0.19.1" 2>&1` + GUPNP_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "gupnp-1.0 >= 0.20.5" 2>&1` fi # Put the nasty error message in config.log where it belongs echo "$GUPNP_PKG_ERRORS" >&5 - as_fn_error $? "Package requirements (gupnp-1.0 >= 0.19.1) were not met: + as_fn_error $? "Package requirements (gupnp-1.0 >= 0.20.5) were not met: $GUPNP_PKG_ERRORS @@ -13220,7 +13213,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by dleyna-core $as_me 0.1.0, which was +This file was extended by dleyna-core $as_me 0.2.2, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -13287,7 +13280,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -dleyna-core config.status 0.1.0 +dleyna-core config.status 0.2.2 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" diff --git a/dleyna-core/configure.ac b/dleyna-core/configure.ac index 1f3bc84..d6a5af5 100644 --- a/dleyna-core/configure.ac +++ b/dleyna-core/configure.ac @@ -1,7 +1,7 @@ AC_PREREQ([2.66]) AC_INIT([dleyna-core], - [0.1.0], + [0.2.2], [https://github.com/01org/dleyna-core/issues/new], , [https://01.org/dleyna/]) @@ -39,7 +39,7 @@ PKG_PROG_PKG_CONFIG(0.16) PKG_CHECK_MODULES([GLIB], [glib-2.0 >= 2.28]) PKG_CHECK_MODULES([GIO], [gio-2.0 >= 2.28]) PKG_CHECK_MODULES([GMODULE], [gmodule-2.0 >= 2.28]) -PKG_CHECK_MODULES([GUPNP], [gupnp-1.0 >= 0.19.1]) +PKG_CHECK_MODULES([GUPNP], [gupnp-1.0 >= 0.20.5]) # Checks for header files. AC_CHECK_HEADERS([stdlib.h string.h syslog.h]) diff --git a/dleyna-core/libdleyna/core/connector-mgr.c b/dleyna-core/libdleyna/core/connector-mgr.c index d1a6f93..38e6899 100644 --- a/dleyna-core/libdleyna/core/connector-mgr.c +++ b/dleyna-core/libdleyna/core/connector-mgr.c @@ -26,7 +26,7 @@ #include "connector-mgr.h" #include "log.h" -static GHashTable *g_connectors = NULL; +static GHashTable *g_connectors; const dleyna_connector_t *dleyna_connector_mgr_load(const gchar *name) { diff --git a/dleyna-core/libdleyna/core/connector.h b/dleyna-core/libdleyna/core/connector.h index d9599a6..ca3e7f3 100644 --- a/dleyna-core/libdleyna/core/connector.h +++ b/dleyna-core/libdleyna/core/connector.h @@ -67,7 +67,7 @@ typedef guint (*dleyna_connector_publish_object_t)( dleyna_connector_id_t connection, const gchar *object_path, gboolean root, - guint interface_index, + const gchar *interface_name, const dleyna_connector_dispatch_cb_t *cb_table_1); typedef guint (*dleyna_connector_publish_subtree_t)( dleyna_connector_id_t connection, diff --git a/dleyna-core/libdleyna/core/log.h b/dleyna-core/libdleyna/core/log.h index 7e7f7a9..50eefc0 100644 --- a/dleyna-core/libdleyna/core/log.h +++ b/dleyna-core/libdleyna/core/log.h @@ -47,15 +47,11 @@ void dleyna_log_trace(int priority, GLogLevelFlags flags, */ #ifdef DLEYNA_DEBUG_ENABLED #define DLEYNA_LOG_HELPER(priority, flags, fmt, ...) \ - do { \ dleyna_log_trace(priority, flags, "%s : %s() --- " fmt,\ - __FILE__, __func__, ## __VA_ARGS__); \ - } while (0) + __FILE__, __func__, ## __VA_ARGS__); #else #define DLEYNA_LOG_HELPER(priority, flags, fmt, ...) \ - do { \ - dleyna_log_trace(priority, flags, fmt, ## __VA_ARGS__);\ - } while (0) + dleyna_log_trace(priority, flags, fmt, ## __VA_ARGS__); #endif @@ -126,9 +122,7 @@ void dleyna_log_trace(int priority, GLogLevelFlags flags, */ #if DLEYNA_LOG_LEVEL & DLEYNA_LOG_LEVEL_DEBUG #define DLEYNA_LOG_DEBUG_NL() \ - do { \ - dleyna_log_trace(LOG_DEBUG, G_LOG_LEVEL_DEBUG, " "); \ - } while (0) + dleyna_log_trace(LOG_DEBUG, G_LOG_LEVEL_DEBUG, " "); #else #define DLEYNA_LOG_DEBUG_NL() #endif diff --git a/dleyna-core/libdleyna/core/main-loop.c b/dleyna-core/libdleyna/core/main-loop.c index ae200dd..2b05bd8 100644 --- a/dleyna-core/libdleyna/core/main-loop.c +++ b/dleyna-core/libdleyna/core/main-loop.c @@ -125,7 +125,9 @@ int dleyna_main_loop_start(char *server, { int retval = 1; +#if !GLIB_CHECK_VERSION(2, 35, 0) g_type_init(); +#endif dleyna_log_init(server); diff --git a/dleyna-core/libdleyna/core/settings.c b/dleyna-core/libdleyna/core/settings.c index 701f527..c86ace9 100644 --- a/dleyna-core/libdleyna/core/settings.c +++ b/dleyna-core/libdleyna/core/settings.c @@ -25,6 +25,7 @@ #include "log.h" #include "settings.h" +#include "white-list.h" struct dleyna_settings_t_ { GKeyFile *keyfile; @@ -40,15 +41,23 @@ struct dleyna_settings_t_ { /* Log section */ dleyna_log_type_t log_type; int log_level; + + /* netf section */ + gboolean netf_enabled; + GVariant *netf_entries; }; #define DLEYNA_SETTINGS_GROUP_GENERAL "general" #define DLEYNA_SETTINGS_KEY_NEVER_QUIT "never-quit" #define DLEYNA_SETTINGS_KEY_CONNECTOR_NAME "connector-name" -#define DLEYNA_SETTINGS_GROUP_LOG "log" -#define DLEYNA_SETTINGS_KEY_LOG_TYPE "log-type" -#define DLEYNA_SETTINGS_KEY_LOG_LEVEL "log-level" +#define DLEYNA_SETTINGS_GROUP_LOG "log" +#define DLEYNA_SETTINGS_KEY_LOG_TYPE "log-type" +#define DLEYNA_SETTINGS_KEY_LOG_LEVEL "log-level" + +#define DLEYNA_SETTINGS_GROUP_NETF "netf" +#define DLEYNA_SETTINGS_KEY_NETF_ENABLED "netf-enabled" +#define DLEYNA_SETTINGS_KEY_NETF_LIST "netf-list" #define DLEYNA_SETTINGS_DEFAULT_NEVER_QUIT DLEYNA_NEVER_QUIT #define DLEYNA_SETTINGS_DEFAULT_CONNECTOR_NAME DLEYNA_CONNECTOR_NAME @@ -57,18 +66,30 @@ struct dleyna_settings_t_ { #define DLEYNA_SETTINGS_LOG_KEYS(sys, loc, settings) \ do { \ + gchar *str = NULL; \ + \ DLEYNA_LOG_DEBUG_NL(); \ DLEYNA_LOG_INFO("Load file [%s]", loc ? loc : sys); \ DLEYNA_LOG_DEBUG_NL(); \ + \ DLEYNA_LOG_DEBUG("[General settings]"); \ DLEYNA_LOG_DEBUG("Never Quit: %s", (settings)->never_quit ? "T" : "F");\ DLEYNA_LOG_DEBUG_NL(); \ DLEYNA_LOG_DEBUG("Connector Name: %s", (settings)->connector_name);\ DLEYNA_LOG_DEBUG_NL(); \ + \ DLEYNA_LOG_DEBUG("[Logging settings]"); \ DLEYNA_LOG_DEBUG("Log Type : %d", (settings)->log_type); \ DLEYNA_LOG_DEBUG("Log Level: 0x%02X", (settings)->log_level); \ DLEYNA_LOG_DEBUG_NL(); \ + \ + if ((settings)->netf_entries != NULL) \ + str = g_variant_print((settings)->netf_entries, FALSE); \ + DLEYNA_LOG_DEBUG("[Network filtering settings]"); \ + DLEYNA_LOG_DEBUG("Enabled : %s", (settings)->netf_enabled ? "T" : "F");\ + DLEYNA_LOG_DEBUG("Entries: %s", str); \ + g_free(str); \ + DLEYNA_LOG_DEBUG_NL(); \ } while (0) @@ -148,6 +169,25 @@ exit: return keyfile; } +static GVariant *prv_to_netf_entries(char **list) +{ + GVariantBuilder vb; + GVariant *result = NULL; + + if ((list != NULL) && (*list != NULL)) { + g_variant_builder_init(&vb, G_VARIANT_TYPE("as")); + + while (*list != NULL) { + g_variant_builder_add(&vb, "s", *list); + list++; + } + + result = g_variant_ref_sink(g_variant_builder_end(&vb)); + } + + return result; +} + static int prv_to_log_level(gint *int_list, gsize length) { gsize i; @@ -205,6 +245,7 @@ static void prv_read_keys(dleyna_settings_t *settings) gchar *s_val; gint *int_star; gsize length; + gchar **list; b_val = g_key_file_get_boolean(keyfile, DLEYNA_SETTINGS_GROUP_GENERAL, @@ -252,13 +293,38 @@ static void prv_read_keys(dleyna_settings_t *settings) &error); if (error == NULL) { - settings->log_level = prv_to_log_level(int_star, - length); + settings->log_level = prv_to_log_level(int_star, length); g_free(int_star); } else { g_error_free(error); error = NULL; } + + b_val = g_key_file_get_boolean(keyfile, + DLEYNA_SETTINGS_GROUP_NETF, + DLEYNA_SETTINGS_KEY_NETF_ENABLED, + &error); + + if (error == NULL) { + settings->netf_enabled = b_val; + } else { + g_error_free(error); + error = NULL; + } + + list = g_key_file_get_string_list(keyfile, + DLEYNA_SETTINGS_GROUP_NETF, + DLEYNA_SETTINGS_KEY_NETF_LIST, + NULL, + &error); + + if (error == NULL) { + settings->netf_entries = prv_to_netf_entries(list); + g_strfreev(list); + } else { + g_error_free(error); + error = NULL; + } } static void prv_init_default(dleyna_settings_t *settings) @@ -269,6 +335,9 @@ static void prv_init_default(dleyna_settings_t *settings) settings->log_type = DLEYNA_SETTINGS_DEFAULT_LOG_TYPE; settings->log_level = DLEYNA_SETTINGS_DEFAULT_LOG_LEVEL; + + settings->netf_enabled = FALSE; + settings->netf_entries = NULL; } static void prv_keyfile_init(dleyna_settings_t *settings, @@ -289,19 +358,64 @@ static void prv_keyfile_init(dleyna_settings_t *settings, static void prv_keyfile_finalize(dleyna_settings_t *settings) { + if (settings->netf_entries != NULL) { + g_variant_unref(settings->netf_entries); + settings->netf_entries = NULL; + } + if (settings->keyfile != NULL) { g_key_file_free(settings->keyfile); settings->keyfile = NULL; } } +static gboolean prv_netf_entries_are_equal(GVariant *old, GVariant *new) +{ + gboolean match; + GVariantIter iter1; + GVariantIter iter2; + gchar *entry1; + gchar *entry2; + + match = (old == new); + + if (match || + ((old == NULL) && (new != NULL)) || + ((old != NULL) && (new == NULL))) + goto exit; + + (void) g_variant_iter_init(&iter1, old); + + while (g_variant_iter_next(&iter1, "&s", &entry1)) { + (void) g_variant_iter_init(&iter2, new); + + while (g_variant_iter_next(&iter2, "&s", &entry2) && !match) + match = !strcmp(entry1, entry2); + + if (!match) + break; + } + +exit: + return match; +} + static void prv_reload(dleyna_settings_t *settings) { gchar *sys_path = NULL; gchar *loc_path = NULL; + gboolean saved_netf_enabled; + GVariant *saved_netf_entries; + GVariant *netf_entries; DLEYNA_LOG_INFO("Reload local configuration file"); + /* Save all White List information */ + saved_netf_enabled = settings->netf_enabled; + saved_netf_entries = settings->netf_entries; + /* Prevent prv_keyfile_finalize()) to free it */ + settings->netf_entries = NULL; + prv_keyfile_finalize(settings); prv_init_default(settings); prv_get_keyfile_path(settings->file_name, &sys_path, &loc_path); @@ -309,6 +423,32 @@ static void prv_reload(dleyna_settings_t *settings) if (sys_path || loc_path) prv_keyfile_init(settings, sys_path, loc_path); + netf_entries = settings->netf_entries; + + /* FIXME: Block white list signals instead */ + /* A little optimization hack: + * 1 - Updating the wl list has no effect if the wl is disabled. + * 2 - If the enabled settings has changed to disabled, apply first. + * 3 - If it has changed to enabled, update the list first, then + * apply the change last. + */ + if (!settings->netf_enabled && saved_netf_enabled) + dleyna_white_list_enable(settings->netf_enabled, TRUE); + + /* Remove old entries if new ones are different. + * Don't clear() to avoid to loose entries added by a client + */ + if (!prv_netf_entries_are_equal(saved_netf_entries, netf_entries)) { + dleyna_white_list_remove_entries(saved_netf_entries, FALSE); + dleyna_white_list_add_entries(netf_entries, TRUE); + } + + if (settings->netf_enabled && !saved_netf_enabled) + dleyna_white_list_enable(settings->netf_enabled, TRUE); + + if (saved_netf_entries != NULL) + g_variant_unref(saved_netf_entries); + DLEYNA_SETTINGS_LOG_KEYS(sys_path, loc_path, settings); g_free(sys_path); @@ -430,6 +570,7 @@ void dleyna_settings_delete(dleyna_settings_t *settings) g_file_monitor_cancel(settings->monitor); g_object_unref(settings->monitor); } + g_free(settings->connector_name); g_free(settings->file_name); @@ -437,3 +578,9 @@ void dleyna_settings_delete(dleyna_settings_t *settings) g_free(settings); } + +void dleyna_settings_init_white_list(dleyna_settings_t *settings) +{ + dleyna_white_list_add_entries(settings->netf_entries, TRUE); + dleyna_white_list_enable(settings->netf_enabled, TRUE); +} diff --git a/dleyna-core/libdleyna/core/settings.h b/dleyna-core/libdleyna/core/settings.h index 4274879..b09456f 100644 --- a/dleyna-core/libdleyna/core/settings.h +++ b/dleyna-core/libdleyna/core/settings.h @@ -28,9 +28,13 @@ typedef struct dleyna_settings_t_ dleyna_settings_t; void dleyna_settings_new(const gchar *server, dleyna_settings_t **settings); + void dleyna_settings_delete(dleyna_settings_t *settings); +void dleyna_settings_init_white_list(dleyna_settings_t *settings); + gboolean dleyna_settings_is_never_quit(dleyna_settings_t *settings); + const gchar *dleyna_settings_connector_name(dleyna_settings_t *settings); #endif /* DLEYNA_SETTINGS_H__ */ diff --git a/dleyna-core/libdleyna/core/white-list.c b/dleyna-core/libdleyna/core/white-list.c new file mode 100644 index 0000000..fa5d2d0 --- /dev/null +++ b/dleyna-core/libdleyna/core/white-list.c @@ -0,0 +1,125 @@ +/* + * dLeyna + * + * Copyright (C) 2013 Intel Corporation. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms and conditions of the GNU Lesser General Public License, + * version 2.1, as published by the Free Software Foundation. + * + * This program is distributed in the hope it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License + * for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. + * + * Ludovic Ferrandis + * + */ + +#include + +#include "white-list.h" +#include "log.h" + +static dleyna_white_list_t g_wl_cb; + +#if DLEYNA_LOG_LEVEL & DLEYNA_LOG_LEVEL_DEBUG +static void prv_dump_wl_entries(GUPnPWhiteList *wl) +{ + GList *l; + + l = gupnp_white_list_get_entries(wl); + + DLEYNA_LOG_DEBUG_NL(); + DLEYNA_LOG_DEBUG("White List entries:"); + + if (l != NULL) { + while (l != NULL) { + DLEYNA_LOG_DEBUG(" Entry: [%s].", (char *)l->data); + l = l->next; + } + } else { + DLEYNA_LOG_DEBUG(" White List Empty."); + } + + DLEYNA_LOG_DEBUG_NL(); +} +#endif + +void dleyna_white_list_enable(gboolean enabled, gboolean notify) +{ + if (g_wl_cb.wl != NULL) { + gupnp_white_list_set_enabled(g_wl_cb.wl, enabled); + + DLEYNA_LOG_DEBUG("White List enabled: %d", enabled); + + if (notify && (g_wl_cb.cb_enabled != NULL)) + g_wl_cb.cb_enabled(g_wl_cb.user_data); + } +} + +void dleyna_white_list_add_entries(GVariant *entries, gboolean notify) +{ + GVariantIter viter; + gchar *entry; + + if ((entries != NULL) && (g_wl_cb.wl != NULL)) { + (void) g_variant_iter_init(&viter, entries); + + while (g_variant_iter_next(&viter, "&s", &entry)) + (void) gupnp_white_list_add_entry(g_wl_cb.wl, entry); + +#if DLEYNA_LOG_LEVEL & DLEYNA_LOG_LEVEL_DEBUG + prv_dump_wl_entries(g_wl_cb.wl); +#endif + + if (notify && (g_wl_cb.cb_entries != NULL)) + g_wl_cb.cb_entries(g_wl_cb.user_data); + } +} + +void dleyna_white_list_remove_entries(GVariant *entries, gboolean notify) +{ + GVariantIter viter; + gchar *entry; + + if ((entries != NULL) && (g_wl_cb.wl != NULL)) { + (void) g_variant_iter_init(&viter, entries); + + while (g_variant_iter_next(&viter, "&s", &entry)) + (void) gupnp_white_list_remove_entry(g_wl_cb.wl, entry); + +#if DLEYNA_LOG_LEVEL & DLEYNA_LOG_LEVEL_DEBUG + prv_dump_wl_entries(g_wl_cb.wl); +#endif + + if (notify && (g_wl_cb.cb_entries != NULL)) + g_wl_cb.cb_entries(g_wl_cb.user_data); + } +} + +void dleyna_white_list_clear(gboolean notify) +{ + if (g_wl_cb.wl != NULL) { + gupnp_white_list_clear(g_wl_cb.wl); + +#if DLEYNA_LOG_LEVEL & DLEYNA_LOG_LEVEL_DEBUG + prv_dump_wl_entries(g_wl_cb.wl); +#endif + + if (notify && (g_wl_cb.cb_entries != NULL)) + g_wl_cb.cb_entries(g_wl_cb.user_data); + } +} + +void dleyna_white_list_set_info(dleyna_white_list_t *data) +{ + if (data != NULL) + memcpy(&g_wl_cb, data, sizeof(dleyna_white_list_t)); + else + memset(&g_wl_cb, 0, sizeof(dleyna_white_list_t)); +} diff --git a/dleyna-core/libdleyna/core/white-list.h b/dleyna-core/libdleyna/core/white-list.h new file mode 100644 index 0000000..a0e760e --- /dev/null +++ b/dleyna-core/libdleyna/core/white-list.h @@ -0,0 +1,50 @@ +/* + * dLeyna + * + * Copyright (C) 2013 Intel Corporation. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms and conditions of the GNU Lesser General Public License, + * version 2.1, as published by the Free Software Foundation. + * + * This program is distributed in the hope it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License + * for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. + * + * Ludovic Ferrandis + * + */ + +#ifndef DLEYNA_WHITE_LIST_H__ +#define DLEYNA_WHITE_LIST_H__ + +#include +#include + +typedef void (*dleyna_white_list_notify_t)(gpointer user_data); + +typedef struct dleyna_white_list_t_ dleyna_white_list_t; + +struct dleyna_white_list_t_ { + GUPnPWhiteList *wl; + dleyna_white_list_notify_t cb_enabled; + dleyna_white_list_notify_t cb_entries; + gpointer user_data; +}; + +void dleyna_white_list_enable(gboolean enabled, gboolean notify); + +void dleyna_white_list_add_entries(GVariant *entries, gboolean notify); + +void dleyna_white_list_remove_entries(GVariant *entries, gboolean notify); + +void dleyna_white_list_clear(gboolean notify); + +void dleyna_white_list_set_info(dleyna_white_list_t *data); + +#endif /* DLEYNA_WHITE_LIST_H__ */ diff --git a/dleyna-core/m4/libtool.m4 b/dleyna-core/m4/libtool.m4 index 828104c..02b4bbe 100644 --- a/dleyna-core/m4/libtool.m4 +++ b/dleyna-core/m4/libtool.m4 @@ -1324,7 +1324,14 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*) LD="${LD-ld} -m elf_i386_fbsd" ;; x86_64-*linux*) - LD="${LD-ld} -m elf_i386" + case `/usr/bin/file conftest.o` in + *x86-64*) + LD="${LD-ld} -m elf32_x86_64" + ;; + *) + LD="${LD-ld} -m elf_i386" + ;; + esac ;; ppc64-*linux*|powerpc64-*linux*) LD="${LD-ld} -m elf32ppclinux" @@ -1688,7 +1695,8 @@ AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl ;; *) lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null` - if test -n "$lt_cv_sys_max_cmd_len"; then + if test -n "$lt_cv_sys_max_cmd_len" && \ + test undefined != "$lt_cv_sys_max_cmd_len"; then lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` else @@ -2512,17 +2520,6 @@ freebsd* | dragonfly*) esac ;; -gnu*) - version_type=linux # correct to gnu/linux during the next big refactor - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - ;; - haiku*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no @@ -2639,7 +2636,7 @@ linux*oldld* | linux*aout* | linux*coff*) ;; # This must be glibc/ELF. -linux* | k*bsd*-gnu | kopensolaris*-gnu) +linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no @@ -3255,10 +3252,6 @@ freebsd* | dragonfly*) fi ;; -gnu*) - lt_cv_deplibs_check_method=pass_all - ;; - haiku*) lt_cv_deplibs_check_method=pass_all ;; @@ -3297,7 +3290,7 @@ irix5* | irix6* | nonstopux*) ;; # This must be glibc/ELF. -linux* | k*bsd*-gnu | kopensolaris*-gnu) +linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) lt_cv_deplibs_check_method=pass_all ;; @@ -4049,7 +4042,7 @@ m4_if([$1], [CXX], [ ;; esac ;; - linux* | k*bsd*-gnu | kopensolaris*-gnu) + linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) case $cc_basename in KCC*) # KAI C++ Compiler @@ -4348,7 +4341,7 @@ m4_if([$1], [CXX], [ _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; - linux* | k*bsd*-gnu | kopensolaris*-gnu) + linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) case $cc_basename in # old Intel for x86_64 which still supported -KPIC. ecc*) @@ -6241,9 +6234,6 @@ if test "$_lt_caught_CXX_error" != yes; then _LT_TAGVAR(ld_shlibs, $1)=yes ;; - gnu*) - ;; - haiku*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(link_all_deplibs, $1)=yes @@ -6405,7 +6395,7 @@ if test "$_lt_caught_CXX_error" != yes; then _LT_TAGVAR(inherit_rpath, $1)=yes ;; - linux* | k*bsd*-gnu | kopensolaris*-gnu) + linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) case $cc_basename in KCC*) # Kuck and Associates, Inc. (KAI) C++ Compiler diff --git a/dleyna-renderer/ChangeLog b/dleyna-renderer/ChangeLog index dc6054a..585d4a0 100644 --- a/dleyna-renderer/ChangeLog +++ b/dleyna-renderer/ChangeLog @@ -1,3 +1,27 @@ +version 0.2.2 + - Various build optimizations + - Fix a crash case when the server stops + - Code cleanup + - Documentation fixes + - GetAll: do not fail if the DMR returns an error for GetPositionInf + https://github.com/01org/dleyna-renderer/issues/92 + - Fix a crash case for Rescan() + - Fix #78: MPRIS OpenUri() does not start playing + https://github.com/01org/dleyna-renderer/issues/78 + - Add new SetUri API to Player + https://github.com/01org/dleyna-renderer/issues/94 + - Add OpenNextUri() method + https://github.com/01org/dleyna-renderer/issues/35 + - Handling of the publish_object() connector API change + - Fix bug #97 - dLeyna renderer can crash if renderer dissapears + https://github.com/01org/dleyna-renderer/issues/97 + - Enable byte seek + https://github.com/01org/dleyna-renderer/issues/59 + - Change GetRenderers() API as well as FoundRenderer/LostRenderer + signals: use object paths instead of strings + https://github.com/01org/dleyna-renderer/issues/110 + - Add Network Filtering support + version 0.1.0 - Prepare for first stable branch diff --git a/dleyna-renderer/build-aux/ltmain.sh b/dleyna-renderer/build-aux/ltmain.sh index 0096fe6..b9205ee 100644 --- a/dleyna-renderer/build-aux/ltmain.sh +++ b/dleyna-renderer/build-aux/ltmain.sh @@ -70,7 +70,7 @@ # compiler: $LTCC # compiler flags: $LTCFLAGS # linker: $LD (gnu? $with_gnu_ld) -# $progname: (GNU libtool) 2.4.2 Debian-2.4.2-1ubuntu2 +# $progname: (GNU libtool) 2.4.2 Debian-2.4.2-1.2ubuntu1 # automake: $automake_version # autoconf: $autoconf_version # @@ -80,7 +80,7 @@ PROGRAM=libtool PACKAGE=libtool -VERSION="2.4.2 Debian-2.4.2-1ubuntu2" +VERSION="2.4.2 Debian-2.4.2-1.2ubuntu1" TIMESTAMP="" package_revision=1.3337 diff --git a/dleyna-renderer/configure b/dleyna-renderer/configure index bbd8e56..8a53b23 100755 --- a/dleyna-renderer/configure +++ b/dleyna-renderer/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for dleyna-renderer 0.2.0. +# Generated by GNU Autoconf 2.69 for dleyna-renderer 0.2.2. # # Report bugs to . # @@ -591,8 +591,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='dleyna-renderer' PACKAGE_TARNAME='dleyna-renderer' -PACKAGE_VERSION='0.2.0' -PACKAGE_STRING='dleyna-renderer 0.2.0' +PACKAGE_VERSION='0.2.2' +PACKAGE_STRING='dleyna-renderer 0.2.2' PACKAGE_BUGREPORT='https://github.com/01org/dleyna-renderer/issues/new' PACKAGE_URL='https://01.org/dleyna/' @@ -1376,7 +1376,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures dleyna-renderer 0.2.0 to adapt to many kinds of systems. +\`configure' configures dleyna-renderer 0.2.2 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1446,7 +1446,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of dleyna-renderer 0.2.0:";; + short | recursive ) echo "Configuration of dleyna-renderer 0.2.2:";; esac cat <<\_ACEOF @@ -1596,7 +1596,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -dleyna-renderer configure 0.2.0 +dleyna-renderer configure 0.2.2 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -2073,7 +2073,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by dleyna-renderer $as_me 0.2.0, which was +It was created by dleyna-renderer $as_me 0.2.2, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -2896,7 +2896,7 @@ fi # Define the identity of the package. PACKAGE='dleyna-renderer' - VERSION='0.2.0' + VERSION='0.2.2' cat >>confdefs.h <<_ACEOF @@ -5039,7 +5039,8 @@ else ;; *) lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null` - if test -n "$lt_cv_sys_max_cmd_len"; then + if test -n "$lt_cv_sys_max_cmd_len" && \ + test undefined != "$lt_cv_sys_max_cmd_len"; then lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` else @@ -5440,10 +5441,6 @@ freebsd* | dragonfly*) fi ;; -gnu*) - lt_cv_deplibs_check_method=pass_all - ;; - haiku*) lt_cv_deplibs_check_method=pass_all ;; @@ -5482,7 +5479,7 @@ irix5* | irix6* | nonstopux*) ;; # This must be glibc/ELF. -linux* | k*bsd*-gnu | kopensolaris*-gnu) +linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) lt_cv_deplibs_check_method=pass_all ;; @@ -6580,7 +6577,14 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*) LD="${LD-ld} -m elf_i386_fbsd" ;; x86_64-*linux*) - LD="${LD-ld} -m elf_i386" + case `/usr/bin/file conftest.o` in + *x86-64*) + LD="${LD-ld} -m elf32_x86_64" + ;; + *) + LD="${LD-ld} -m elf_i386" + ;; + esac ;; ppc64-*linux*|powerpc64-*linux*) LD="${LD-ld} -m elf32ppclinux" @@ -8407,7 +8411,7 @@ lt_prog_compiler_static= lt_prog_compiler_static='-non_shared' ;; - linux* | k*bsd*-gnu | kopensolaris*-gnu) + linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) case $cc_basename in # old Intel for x86_64 which still supported -KPIC. ecc*) @@ -10577,17 +10581,6 @@ freebsd* | dragonfly*) esac ;; -gnu*) - version_type=linux # correct to gnu/linux during the next big refactor - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - ;; - haiku*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no @@ -10704,7 +10697,7 @@ linux*oldld* | linux*aout* | linux*coff*) ;; # This must be glibc/ELF. -linux* | k*bsd*-gnu | kopensolaris*-gnu) +linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no @@ -12155,12 +12148,12 @@ if test -n "$GUPNP_CFLAGS"; then pkg_cv_GUPNP_CFLAGS="$GUPNP_CFLAGS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ - { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"gupnp-1.0 >= 0.20.3\""; } >&5 - ($PKG_CONFIG --exists --print-errors "gupnp-1.0 >= 0.20.3") 2>&5 + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"gupnp-1.0 >= 0.20.5\""; } >&5 + ($PKG_CONFIG --exists --print-errors "gupnp-1.0 >= 0.20.5") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then - pkg_cv_GUPNP_CFLAGS=`$PKG_CONFIG --cflags "gupnp-1.0 >= 0.20.3" 2>/dev/null` + pkg_cv_GUPNP_CFLAGS=`$PKG_CONFIG --cflags "gupnp-1.0 >= 0.20.5" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes @@ -12172,12 +12165,12 @@ if test -n "$GUPNP_LIBS"; then pkg_cv_GUPNP_LIBS="$GUPNP_LIBS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ - { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"gupnp-1.0 >= 0.20.3\""; } >&5 - ($PKG_CONFIG --exists --print-errors "gupnp-1.0 >= 0.20.3") 2>&5 + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"gupnp-1.0 >= 0.20.5\""; } >&5 + ($PKG_CONFIG --exists --print-errors "gupnp-1.0 >= 0.20.5") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then - pkg_cv_GUPNP_LIBS=`$PKG_CONFIG --libs "gupnp-1.0 >= 0.20.3" 2>/dev/null` + pkg_cv_GUPNP_LIBS=`$PKG_CONFIG --libs "gupnp-1.0 >= 0.20.5" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes @@ -12198,14 +12191,14 @@ else _pkg_short_errors_supported=no fi if test $_pkg_short_errors_supported = yes; then - GUPNP_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "gupnp-1.0 >= 0.20.3" 2>&1` + GUPNP_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "gupnp-1.0 >= 0.20.5" 2>&1` else - GUPNP_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "gupnp-1.0 >= 0.20.3" 2>&1` + GUPNP_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "gupnp-1.0 >= 0.20.5" 2>&1` fi # Put the nasty error message in config.log where it belongs echo "$GUPNP_PKG_ERRORS" >&5 - as_fn_error $? "Package requirements (gupnp-1.0 >= 0.20.3) were not met: + as_fn_error $? "Package requirements (gupnp-1.0 >= 0.20.5) were not met: $GUPNP_PKG_ERRORS @@ -12869,12 +12862,12 @@ if test -n "$DLEYNA_CORE_CFLAGS"; then pkg_cv_DLEYNA_CORE_CFLAGS="$DLEYNA_CORE_CFLAGS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ - { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"dleyna-core-1.0 >= 0.0.1\""; } >&5 - ($PKG_CONFIG --exists --print-errors "dleyna-core-1.0 >= 0.0.1") 2>&5 + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"dleyna-core-1.0 >= 0.2.2\""; } >&5 + ($PKG_CONFIG --exists --print-errors "dleyna-core-1.0 >= 0.2.2") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then - pkg_cv_DLEYNA_CORE_CFLAGS=`$PKG_CONFIG --cflags "dleyna-core-1.0 >= 0.0.1" 2>/dev/null` + pkg_cv_DLEYNA_CORE_CFLAGS=`$PKG_CONFIG --cflags "dleyna-core-1.0 >= 0.2.2" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes @@ -12886,12 +12879,12 @@ if test -n "$DLEYNA_CORE_LIBS"; then pkg_cv_DLEYNA_CORE_LIBS="$DLEYNA_CORE_LIBS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ - { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"dleyna-core-1.0 >= 0.0.1\""; } >&5 - ($PKG_CONFIG --exists --print-errors "dleyna-core-1.0 >= 0.0.1") 2>&5 + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"dleyna-core-1.0 >= 0.2.2\""; } >&5 + ($PKG_CONFIG --exists --print-errors "dleyna-core-1.0 >= 0.2.2") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then - pkg_cv_DLEYNA_CORE_LIBS=`$PKG_CONFIG --libs "dleyna-core-1.0 >= 0.0.1" 2>/dev/null` + pkg_cv_DLEYNA_CORE_LIBS=`$PKG_CONFIG --libs "dleyna-core-1.0 >= 0.2.2" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes @@ -12912,14 +12905,14 @@ else _pkg_short_errors_supported=no fi if test $_pkg_short_errors_supported = yes; then - DLEYNA_CORE_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "dleyna-core-1.0 >= 0.0.1" 2>&1` + DLEYNA_CORE_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "dleyna-core-1.0 >= 0.2.2" 2>&1` else - DLEYNA_CORE_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "dleyna-core-1.0 >= 0.0.1" 2>&1` + DLEYNA_CORE_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "dleyna-core-1.0 >= 0.2.2" 2>&1` fi # Put the nasty error message in config.log where it belongs echo "$DLEYNA_CORE_PKG_ERRORS" >&5 - as_fn_error $? "Package requirements (dleyna-core-1.0 >= 0.0.1) were not met: + as_fn_error $? "Package requirements (dleyna-core-1.0 >= 0.2.2) were not met: $DLEYNA_CORE_PKG_ERRORS @@ -13759,7 +13752,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by dleyna-renderer $as_me 0.2.0, which was +This file was extended by dleyna-renderer $as_me 0.2.2, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -13826,7 +13819,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -dleyna-renderer config.status 0.2.0 +dleyna-renderer config.status 0.2.2 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" @@ -15612,7 +15605,7 @@ CFLAGS : '${CFLAGS}' - enable-werror : ${enable_werror} - enable-debug : ${enable_debug} - enable-never-quit : ${enable_never_quit} - - with_connector-name : ${with_connector_name} + - with-connector-name : ${with_connector_name} - disable-optimization: ${disable_optimization} - with-log-level : ${with_log_level} - with-log-type : ${with_log_type} diff --git a/dleyna-renderer/configure.ac b/dleyna-renderer/configure.ac index 9bf518a..1001e04 100644 --- a/dleyna-renderer/configure.ac +++ b/dleyna-renderer/configure.ac @@ -1,7 +1,7 @@ AC_PREREQ([2.66]) AC_INIT([dleyna-renderer], - [0.2.0], + [0.2.2], [https://github.com/01org/dleyna-renderer/issues/new], , [https://01.org/dleyna/]) @@ -39,7 +39,7 @@ PKG_PROG_PKG_CONFIG(0.16) PKG_CHECK_MODULES([GLIB], [glib-2.0 >= 2.28]) PKG_CHECK_MODULES([GIO], [gio-2.0 >= 2.28]) PKG_CHECK_MODULES([GSSDP], [gssdp-1.0 >= 0.13.2]) -PKG_CHECK_MODULES([GUPNP], [gupnp-1.0 >= 0.20.3]) +PKG_CHECK_MODULES([GUPNP], [gupnp-1.0 >= 0.20.5]) PKG_CHECK_MODULES([GUPNPAV], [gupnp-av-1.0 >= 0.11.5]) PKG_CHECK_MODULES([GUPNPDLNA], [gupnp-dlna-2.0 >= 0.9.4]) PKG_CHECK_MODULES([SOUP], [libsoup-2.4 >= 2.28.2]) @@ -83,7 +83,7 @@ AC_ARG_ENABLE(master-build,, [master_build=no]) AS_IF([test "x$master_build" = "xno"], - [PKG_CHECK_MODULES([DLEYNA_CORE], [dleyna-core-1.0 >= 0.0.1])], + [PKG_CHECK_MODULES([DLEYNA_CORE], [dleyna-core-1.0 >= 0.2.2])], [this_abs_top_srcdir=`cd "$srcdir" && pwd`; DLEYNA_CORE_CFLAGS="-I$this_abs_top_srcdir/../dleyna-core"; DLEYNA_CORE_LIBS="-L$this_abs_top_srcdir/../dleyna-core/.libs -ldleyna-core-1.0" @@ -252,7 +252,7 @@ CFLAGS : '${CFLAGS}' - enable-werror : ${enable_werror} - enable-debug : ${enable_debug} - enable-never-quit : ${enable_never_quit} - - with_connector-name : ${with_connector_name} + - with-connector-name : ${with_connector_name} - disable-optimization: ${disable_optimization} - with-log-level : ${with_log_level} - with-log-type : ${with_log_type} diff --git a/dleyna-renderer/libdleyna/renderer/Makefile.am b/dleyna-renderer/libdleyna/renderer/Makefile.am index 5c42daf..ba3c054 100644 --- a/dleyna-renderer/libdleyna/renderer/Makefile.am +++ b/dleyna-renderer/libdleyna/renderer/Makefile.am @@ -1,6 +1,6 @@ libdleyna_rendererincdir = $(includedir)/dleyna-1.0/libdleyna/renderer -DLEYNA_RENDERER_VERSION = 1:2:0 +DLEYNA_RENDERER_VERSION = 1:3:0 AM_CFLAGS = $(GLIB_CFLAGS) \ $(GIO_CFLAGS) \ @@ -14,7 +14,7 @@ AM_CFLAGS = $(GLIB_CFLAGS) \ ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS} -lib_LTLIBRARIES = libdleyna-renderer-1.0.la +pkglib_LTLIBRARIES = libdleyna-renderer-1.0.la libdleyna_rendererinc_HEADERS = control-point-renderer.h @@ -25,6 +25,7 @@ libdleyna_renderer_1_0_la_SOURCES = $(libdleyna_rendererinc_HEADERS) \ async.c \ device.c \ host-service.c \ + manager.c \ server.c \ task.c \ upnp.c @@ -58,6 +59,7 @@ EXTRA_DIST = $(sysconf_DATA) \ device.h \ host-service.h \ prop-defs.h \ + manager.h \ server.h \ task.h \ upnp.h diff --git a/dleyna-renderer/libdleyna/renderer/Makefile.in b/dleyna-renderer/libdleyna/renderer/Makefile.in index 793f579..e249f91 100644 --- a/dleyna-renderer/libdleyna/renderer/Makefile.in +++ b/dleyna-renderer/libdleyna/renderer/Makefile.in @@ -97,10 +97,10 @@ am__uninstall_files_from_dir = { \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } -am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(pkgconfigdir)" \ +am__installdirs = "$(DESTDIR)$(pkglibdir)" "$(DESTDIR)$(pkgconfigdir)" \ "$(DESTDIR)$(sysconfdir)" \ "$(DESTDIR)$(libdleyna_rendererincdir)" -LTLIBRARIES = $(lib_LTLIBRARIES) +LTLIBRARIES = $(pkglib_LTLIBRARIES) am__DEPENDENCIES_1 = libdleyna_renderer_1_0_la_DEPENDENCIES = $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \ @@ -109,7 +109,7 @@ libdleyna_renderer_1_0_la_DEPENDENCIES = $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) am__objects_1 = am_libdleyna_renderer_1_0_la_OBJECTS = $(am__objects_1) async.lo \ - device.lo host-service.lo server.lo task.lo upnp.lo + device.lo host-service.lo manager.lo server.lo task.lo upnp.lo libdleyna_renderer_1_0_la_OBJECTS = \ $(am_libdleyna_renderer_1_0_la_OBJECTS) AM_V_lt = $(am__v_lt_@AM_V@) @@ -301,7 +301,7 @@ with_connector_name = @with_connector_name@ with_log_level = @with_log_level@ with_log_type = @with_log_type@ libdleyna_rendererincdir = $(includedir)/dleyna-1.0/libdleyna/renderer -DLEYNA_RENDERER_VERSION = 1:2:0 +DLEYNA_RENDERER_VERSION = 1:3:0 AM_CFLAGS = $(GLIB_CFLAGS) \ $(GIO_CFLAGS) \ $(DLEYNA_CORE_CFLAGS) \ @@ -313,7 +313,7 @@ AM_CFLAGS = $(GLIB_CFLAGS) \ -include config.h ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS} -lib_LTLIBRARIES = libdleyna-renderer-1.0.la +pkglib_LTLIBRARIES = libdleyna-renderer-1.0.la libdleyna_rendererinc_HEADERS = control-point-renderer.h libdleyna_renderer_1_0_la_LDFLAGS = -version-info $(DLEYNA_RENDERER_VERSION) \ -no-undefined @@ -322,6 +322,7 @@ libdleyna_renderer_1_0_la_SOURCES = $(libdleyna_rendererinc_HEADERS) \ async.c \ device.c \ host-service.c \ + manager.c \ server.c \ task.c \ upnp.c @@ -353,6 +354,7 @@ EXTRA_DIST = $(sysconf_DATA) \ device.h \ host-service.h \ prop-defs.h \ + manager.h \ server.h \ task.h \ upnp.h @@ -397,40 +399,40 @@ dleyna-renderer-1.0.pc: $(top_builddir)/config.status $(srcdir)/dleyna-renderer- cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ dleyna-renderer-service.conf: $(top_builddir)/config.status $(srcdir)/dleyna-renderer-service.conf.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ -install-libLTLIBRARIES: $(lib_LTLIBRARIES) +install-pkglibLTLIBRARIES: $(pkglib_LTLIBRARIES) @$(NORMAL_INSTALL) - @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ + @list='$(pkglib_LTLIBRARIES)'; test -n "$(pkglibdir)" || list=; \ list2=; for p in $$list; do \ if test -f $$p; then \ list2="$$list2 $$p"; \ else :; fi; \ done; \ test -z "$$list2" || { \ - echo " $(MKDIR_P) '$(DESTDIR)$(libdir)'"; \ - $(MKDIR_P) "$(DESTDIR)$(libdir)" || exit 1; \ - echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \ - $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \ + echo " $(MKDIR_P) '$(DESTDIR)$(pkglibdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(pkglibdir)" || exit 1; \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(pkglibdir)'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(pkglibdir)"; \ } -uninstall-libLTLIBRARIES: +uninstall-pkglibLTLIBRARIES: @$(NORMAL_UNINSTALL) - @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ + @list='$(pkglib_LTLIBRARIES)'; test -n "$(pkglibdir)" || list=; \ for p in $$list; do \ $(am__strip_dir) \ - echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \ - $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(pkglibdir)/$$f'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(pkglibdir)/$$f"; \ done -clean-libLTLIBRARIES: - -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) - @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ +clean-pkglibLTLIBRARIES: + -test -z "$(pkglib_LTLIBRARIES)" || rm -f $(pkglib_LTLIBRARIES) + @list='$(pkglib_LTLIBRARIES)'; for p in $$list; do \ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ test "$$dir" != "$$p" || dir=.; \ echo "rm -f \"$${dir}/so_locations\""; \ rm -f "$${dir}/so_locations"; \ done libdleyna-renderer-1.0.la: $(libdleyna_renderer_1_0_la_OBJECTS) $(libdleyna_renderer_1_0_la_DEPENDENCIES) $(EXTRA_libdleyna_renderer_1_0_la_DEPENDENCIES) - $(AM_V_CCLD)$(libdleyna_renderer_1_0_la_LINK) -rpath $(libdir) $(libdleyna_renderer_1_0_la_OBJECTS) $(libdleyna_renderer_1_0_la_LIBADD) $(LIBS) + $(AM_V_CCLD)$(libdleyna_renderer_1_0_la_LINK) -rpath $(pkglibdir) $(libdleyna_renderer_1_0_la_OBJECTS) $(libdleyna_renderer_1_0_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) @@ -441,6 +443,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/async.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/device.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/host-service.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/manager.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/server.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/task.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/upnp.Plo@am__quote@ @@ -624,7 +627,7 @@ check-am: all-am check: check-am all-am: Makefile $(LTLIBRARIES) $(DATA) $(HEADERS) installdirs: - for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(pkgconfigdir)" "$(DESTDIR)$(sysconfdir)" "$(DESTDIR)$(libdleyna_rendererincdir)"; do \ + for dir in "$(DESTDIR)$(pkglibdir)" "$(DESTDIR)$(pkgconfigdir)" "$(DESTDIR)$(sysconfdir)" "$(DESTDIR)$(libdleyna_rendererincdir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am @@ -662,7 +665,7 @@ maintainer-clean-generic: -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) clean: clean-am -clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \ +clean-am: clean-generic clean-libtool clean-pkglibLTLIBRARIES \ mostlyclean-am distclean: distclean-am @@ -690,7 +693,7 @@ install-dvi: install-dvi-am install-dvi-am: -install-exec-am: install-libLTLIBRARIES install-sysconfDATA +install-exec-am: install-pkglibLTLIBRARIES install-sysconfDATA install-html: install-html-am @@ -731,29 +734,28 @@ ps: ps-am ps-am: -uninstall-am: uninstall-libLTLIBRARIES \ - uninstall-libdleyna_rendererincHEADERS uninstall-pkgconfigDATA \ +uninstall-am: uninstall-libdleyna_rendererincHEADERS \ + uninstall-pkgconfigDATA uninstall-pkglibLTLIBRARIES \ uninstall-sysconfDATA .MAKE: install-am install-strip .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ - clean-libLTLIBRARIES clean-libtool ctags distclean \ + clean-libtool clean-pkglibLTLIBRARIES ctags distclean \ distclean-compile distclean-generic distclean-libtool \ distclean-tags distdir dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am install-dvi \ install-dvi-am install-exec install-exec-am install-html \ install-html-am install-info install-info-am \ - install-libLTLIBRARIES install-libdleyna_rendererincHEADERS \ - install-man install-pdf install-pdf-am install-pkgconfigDATA \ + install-libdleyna_rendererincHEADERS install-man install-pdf \ + install-pdf-am install-pkgconfigDATA install-pkglibLTLIBRARIES \ install-ps install-ps-am install-strip install-sysconfDATA \ installcheck installcheck-am installdirs maintainer-clean \ maintainer-clean-generic maintainer-clean-local mostlyclean \ mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ pdf pdf-am ps ps-am tags uninstall uninstall-am \ - uninstall-libLTLIBRARIES \ uninstall-libdleyna_rendererincHEADERS uninstall-pkgconfigDATA \ - uninstall-sysconfDATA + uninstall-pkglibLTLIBRARIES uninstall-sysconfDATA maintainer-clean-local: diff --git a/dleyna-renderer/libdleyna/renderer/async.c b/dleyna-renderer/libdleyna/renderer/async.c index 03d48a6..e87d04f 100644 --- a/dleyna-renderer/libdleyna/renderer/async.c +++ b/dleyna-renderer/libdleyna/renderer/async.c @@ -37,7 +37,8 @@ gboolean dlr_async_task_complete(gpointer user_data) { dlr_async_task_t *cb_data = user_data; - DLEYNA_LOG_DEBUG("Enter. Error %p", (void *)cb_data->error); + DLEYNA_LOG_DEBUG("Enter. %s %s", cb_data->error ? "Error:" : "Success.", + cb_data->error ? cb_data->error->message : ""); DLEYNA_LOG_DEBUG_NL(); if (cb_data->proxy != NULL) diff --git a/dleyna-renderer/libdleyna/renderer/device.c b/dleyna-renderer/libdleyna/renderer/device.c index ff463db..d5aa82c 100644 --- a/dleyna-renderer/libdleyna/renderer/device.c +++ b/dleyna-renderer/libdleyna/renderer/device.c @@ -44,6 +44,14 @@ struct dlr_device_data_t_ { dlr_device_local_cb_t local_cb; }; +typedef struct dlr_rc_event_t_ dlr_rc_event_t; +struct dlr_rc_event_t_ { + dlr_device_t *device; + guint dev_volume; + guint mute; + guint source_id; +}; + /* Private structure used in chain task */ typedef struct prv_new_device_ct_t_ prv_new_device_ct_t; struct prv_new_device_ct_t_ { @@ -73,7 +81,7 @@ static void prv_rc_last_change_cb(GUPnPServiceProxy *proxy, GValue *value, gpointer user_data); -static void prv_props_update(dlr_device_t *device, dlr_task_t *task); +static gboolean prv_props_update(dlr_device_t *device, dlr_task_t *task); static void prv_get_rates_values(GList *allowed_tp_speeds, GVariant **mpris_tp_speeds, @@ -202,7 +210,7 @@ static void prv_emit_signal_properties_changed(dlr_device_t *device, const char *interface, GVariant *changed_props) { -#if DLR_LOG_LEVEL & DLR_LOG_LEVEL_DEBUG +#if DLEYNA_LOG_LEVEL & DLEYNA_LOG_LEVEL_DEBUG gchar *params; #endif GVariant *val = g_variant_ref_sink(g_variant_new("(s@a{sv}as)", @@ -215,7 +223,7 @@ static void prv_emit_signal_properties_changed(dlr_device_t *device, DLR_INTERFACE_PROPERTIES_CHANGED, device->path); -#if DLR_LOG_LEVEL & DLR_LOG_LEVEL_DEBUG +#if DLEYNA_LOG_LEVEL & DLEYNA_LOG_LEVEL_DEBUG params = g_variant_print(val, FALSE); DLEYNA_LOG_DEBUG("Params: %s", params); g_free(params); @@ -393,6 +401,7 @@ void dlr_device_delete(void *device) g_ptr_array_free(dev->dlna_transport_play_speeds, TRUE); if (dev->mpris_transport_play_speeds) g_variant_unref(dev->mpris_transport_play_speeds); + g_hash_table_unref(dev->rc_event_handlers); g_free(dev->rate); g_free(dev->icon.mime_type); @@ -745,7 +754,7 @@ static GUPnPServiceProxyAction *prv_declare(dleyna_service_task_t *task, device->connection, device->path, FALSE, - i, + dlr_renderer_get_interface_name(i), table + i); if (!device->ids[i]) { @@ -761,6 +770,15 @@ DLEYNA_LOG_DEBUG("Exit"); return NULL; } +static void prv_free_rc_event(gpointer user_data) +{ + dlr_rc_event_t *event = user_data; + + if (event->source_id) + g_source_remove(event->source_id); + g_free(event); +} + void dlr_device_construct( dlr_device_t *dev, dlr_device_context_t *context, @@ -821,6 +839,9 @@ dlr_device_t *dlr_device_new( dev->contexts = g_ptr_array_new_with_free_func(prv_dlr_context_delete); dev->path = new_path; dev->rate = g_strdup("1"); + dev->rc_event_handlers = g_hash_table_new_full(g_int_hash, g_int_equal, + g_free, + prv_free_rc_event); prv_props_init(&dev->props); @@ -1073,6 +1094,31 @@ exit: return; } +static GVariant *prv_as_prop_from_list(GList *list) +{ + GVariantBuilder vb; + + g_variant_builder_init(&vb, G_VARIANT_TYPE("as")); + + do { + g_variant_builder_add(&vb, "s", list->data); + } while ((list = g_list_next(list))); + + return g_variant_ref_sink(g_variant_builder_end(&vb)); +} + +static void prv_update_prop_dlna_device_classes(GUPnPDeviceInfo *proxy, + GHashTable *props) +{ + GList *dlna_classes = + gupnp_device_info_list_dlna_device_class_identifier(proxy); + + if (dlna_classes != NULL) + g_hash_table_insert(props, + DLR_INTERFACE_PROP_DLNA_DEVICE_CLASSES, + prv_as_prop_from_list(dlna_classes)); +} + static void prv_add_actions(dlr_device_t *device, const gchar *actions, GVariantBuilder *changed_props_vb) @@ -1084,12 +1130,18 @@ static void prv_add_actions(dlr_device_t *device, gboolean play = FALSE; gboolean ppause = FALSE; gboolean seek = FALSE; + gboolean timeseek_missing = FALSE; + gboolean byteseek = FALSE; gboolean next = FALSE; gboolean previous = FALSE; GVariant *val; GRegex *regex; gchar *tmp_str; gchar **speeds; + GVariantIter iter; + gchar *dlna_device_class; + gchar *pos; + GUPnPDeviceInfo *info; regex = g_regex_new("\\\\,", 0, 0, NULL); tmp_str = g_regex_replace_literal(regex, actions, -1, 0, "*", 0, NULL); @@ -1100,6 +1152,33 @@ static void prv_add_actions(dlr_device_t *device, true_val = g_variant_ref_sink(g_variant_new_boolean(TRUE)); false_val = g_variant_ref_sink(g_variant_new_boolean(FALSE)); + info = (GUPnPDeviceInfo *)dlr_device_get_context(device)->device_proxy; + + prv_update_prop_dlna_device_classes(info, device->props.device_props); + + val = g_hash_table_lookup(device->props.device_props, + DLR_INTERFACE_PROP_DLNA_DEVICE_CLASSES); + + /* If this device is not dlna compatible, there is no need */ + /* to check for “X_DLNA_SeekTime” */ + if (val) { + g_variant_iter_init(&iter, val); + while (g_variant_iter_next(&iter, "s", &dlna_device_class)) { + /* Could be DMR-version or M-DMR-version*/ + pos = g_strrstr(dlna_device_class, "DMR-"); + if (!pos || pos + 4 == 0 || strtof(pos + 4, 0) < 1.5f) { + g_free(dlna_device_class); + continue; + } + + DLEYNA_LOG_DEBUG("DLNA version ≥ 1.50 pour %s", + device->path); + timeseek_missing = TRUE; + g_free(dlna_device_class); + break; + } + } + while (parts[i]) { g_strstrip(parts[i]); @@ -1114,11 +1193,15 @@ static void prv_add_actions(dlr_device_t *device, } else if (!strcmp(parts[i], "Previous")) { previous = TRUE; } else if (!strncmp(parts[i], "X_DLNA_PS=", - strlen("X_DLNA_PS="))) { + strlen("X_DLNA_PS="))) { speeds = g_strsplit(parts[i] + strlen("X_DLNA_PS="), "*", 0); prv_add_dlna_speeds(device, speeds, changed_props_vb); g_strfreev(speeds); + } else if (!strcmp(parts[i], "X_DLNA_SeekTime")) { + timeseek_missing = FALSE; + } else if (!strcmp(parts[i], "X_DLNA_SeekByte")) { + byteseek = TRUE; } ++i; } @@ -1140,12 +1223,18 @@ static void prv_add_actions(dlr_device_t *device, DLR_INTERFACE_PROP_CAN_PAUSE, val, changed_props_vb); - val = seek ? true_val : false_val; + val = seek && !timeseek_missing ? true_val : false_val; g_variant_ref(val); prv_change_props(device->props.player_props, DLR_INTERFACE_PROP_CAN_SEEK, val, changed_props_vb); + val = seek && byteseek ? true_val : false_val; + g_variant_ref(val); + prv_change_props(device->props.player_props, + DLR_INTERFACE_PROP_CAN_BYTE_SEEK, val, + changed_props_vb); + val = next ? true_val : false_val; g_variant_ref(val); prv_change_props(device->props.player_props, @@ -1258,6 +1347,19 @@ static void prv_add_reltime(dlr_device_t *device, changed_props_vb); } +static void prv_add_relcount(dlr_device_t *device, + const gchar *relcount, + GVariantBuilder *changed_props_vb) +{ + GVariant *val; + guint64 count = strtoll(relcount, NULL, 10); + + val = g_variant_ref_sink(g_variant_new_uint64(count)); + prv_change_props(device->props.player_props, + DLR_INTERFACE_PROP_BYTE_POSITION, val, + changed_props_vb); +} + static void prv_found_item(GUPnPDIDLLiteParser *parser, GUPnPDIDLLiteObject *object, gpointer user_data) @@ -1516,50 +1618,37 @@ on_error: g_object_unref(parser); } -static void prv_rc_last_change_cb(GUPnPServiceProxy *proxy, - const char *variable, - GValue *value, - gpointer user_data) +static gboolean prv_process_rc_last_change(gpointer user_data) { - GUPnPLastChangeParser *parser; - dlr_device_t *device = user_data; + dlr_rc_event_t *event = user_data; GVariantBuilder *changed_props_vb; GVariant *changed_props; GVariant *val; - guint dev_volume = G_MAXUINT; double mpris_volume; - guint mute = G_MAXUINT; - - parser = gupnp_last_change_parser_new(); - - if (!gupnp_last_change_parser_parse_last_change( - parser, 0, - g_value_get_string(value), - NULL, - "Volume", G_TYPE_UINT, &dev_volume, - "Mute", G_TYPE_UINT, &mute, - NULL)) - goto on_error; + dlr_device_t *device = event->device; + gint source_id; - if (device->props.synced == FALSE) - prv_props_update(device, NULL); + if (!device->props.synced && !prv_props_update(device, NULL)) + goto on_lost_device; if (device->max_volume == 0) goto on_error; changed_props_vb = g_variant_builder_new(G_VARIANT_TYPE("a{sv}")); - if (dev_volume != G_MAXUINT) { - mpris_volume = (double)dev_volume / (double)device->max_volume; + if (event->dev_volume != G_MAXUINT) { + mpris_volume = (double) event->dev_volume / + (double) device->max_volume; val = g_variant_ref_sink(g_variant_new_double(mpris_volume)); prv_change_props(device->props.player_props, DLR_INTERFACE_PROP_VOLUME, val, changed_props_vb); } - if (mute != G_MAXUINT) { + if (event->mute != G_MAXUINT) { val = g_variant_ref_sink( - g_variant_new_boolean(mute ? TRUE : FALSE)); + g_variant_new_boolean(event->mute ? TRUE + : FALSE)); prv_change_props(device->props.player_props, DLR_INTERFACE_PROP_MUTE, val, changed_props_vb); @@ -1574,6 +1663,54 @@ static void prv_rc_last_change_cb(GUPnPServiceProxy *proxy, g_variant_builder_unref(changed_props_vb); on_error: + source_id = (gint) event->source_id; + event->source_id = 0; + g_hash_table_remove(device->rc_event_handlers, &source_id); + +on_lost_device: + + return FALSE; +} + +static void prv_rc_last_change_cb(GUPnPServiceProxy *proxy, + const char *variable, + GValue *value, + gpointer user_data) +{ + GUPnPLastChangeParser *parser; + dlr_rc_event_t *event; + guint dev_volume = G_MAXUINT; + guint mute = G_MAXUINT; + gint *key; + + parser = gupnp_last_change_parser_new(); + + if (!gupnp_last_change_parser_parse_last_change( + parser, 0, + g_value_get_string(value), + NULL, + "Volume", G_TYPE_UINT, &dev_volume, + "Mute", G_TYPE_UINT, &mute, + NULL)) + goto on_error; + + event = g_new0(dlr_rc_event_t, 1); + event->dev_volume = dev_volume; + event->mute = mute; + event->device = user_data; + + /* We cannot execute the code in prv_process_rc_last_change directly + in this function as it can cause the main loop to be iterated, which + may cause a crash when we return back to GUPnP. This code will be + re-written once we can cancel calls to retrieve the service + introspection data. */ + + event->source_id = g_idle_add(prv_process_rc_last_change, event); + key = g_new(gint, 1); + *key = (gint) event->source_id; + g_hash_table_insert(event->device->rc_event_handlers, key, event); + +on_error: g_object_unref(parser); } @@ -1597,6 +1734,7 @@ static void prv_get_position_info_cb(GUPnPServiceProxy *proxy, gpointer user_data) { gchar *rel_pos = NULL; + gchar *rel_cnt = NULL; const gchar *message; gboolean end; dlr_async_task_t *cb_data = user_data; @@ -1604,24 +1742,54 @@ static void prv_get_position_info_cb(GUPnPServiceProxy *proxy, dlr_device_data_t *device_data = cb_data->private; GVariantBuilder *changed_props_vb; GVariant *changed_props; + gint expected_props = 2; end = gupnp_service_proxy_end_action(cb_data->proxy, cb_data->action, - &error, "RelTime", - G_TYPE_STRING, &rel_pos, NULL); - if (!end || (rel_pos == NULL)) { - message = (error != NULL) ? error->message : "Invalid result"; - cb_data->error = g_error_new(DLEYNA_SERVER_ERROR, - DLEYNA_ERROR_OPERATION_FAILED, - "GetPositionInfo operation failed: %s", - message); + &error, + "RelTime", G_TYPE_STRING, &rel_pos, + "RelCount", G_TYPE_STRING, + &rel_cnt, NULL); + + if (!end && !cb_data->task.type == DLR_TASK_GET_ALL_PROPS) goto on_error; + + if (rel_pos == NULL) { + expected_props--; + if (cb_data->task.type == DLR_TASK_GET_ALL_PROPS) { + /* Do not fail, just remove the property */ + g_hash_table_remove(cb_data->device->props.player_props, + DLR_INTERFACE_PROP_POSITION); + } else if (!strcmp(cb_data->task.ut.get_prop.prop_name, + DLR_INTERFACE_PROP_POSITION)) { + goto on_error; + } + } + + if (rel_cnt == NULL) { + expected_props--; + if (cb_data->task.type == DLR_TASK_GET_ALL_PROPS) { + /* Do not fail, just remove the property */ + g_hash_table_remove(cb_data->device->props.player_props, + DLR_INTERFACE_PROP_BYTE_POSITION); + } else if (!strcmp(cb_data->task.ut.get_prop.prop_name, + DLR_INTERFACE_PROP_BYTE_POSITION)) { + goto on_error; + } } + if (!expected_props) + goto out; + changed_props_vb = g_variant_builder_new(G_VARIANT_TYPE("a{sv}")); - g_strstrip(rel_pos); - prv_add_reltime(cb_data->device, rel_pos, changed_props_vb); - g_free(rel_pos); + if (rel_pos != NULL) { + g_strstrip(rel_pos); + prv_add_reltime(cb_data->device, rel_pos, changed_props_vb); + } + if (rel_cnt != NULL) { + g_strstrip(rel_cnt); + prv_add_relcount(cb_data->device, rel_cnt, changed_props_vb); + } changed_props = g_variant_ref_sink( g_variant_builder_end(changed_props_vb)); @@ -1631,8 +1799,23 @@ static void prv_get_position_info_cb(GUPnPServiceProxy *proxy, g_variant_unref(changed_props); g_variant_builder_unref(changed_props_vb); + goto out; + on_error: + message = (error != NULL) ? error->message : + "Invalid result"; + cb_data->error = g_error_new( + DLEYNA_SERVER_ERROR, + DLEYNA_ERROR_OPERATION_FAILED, + "GetPositionInfo operation failed: %s", + message); + +out: + + g_free(rel_pos); + g_free(rel_cnt); + if (error != NULL) g_error_free(error); @@ -1778,21 +1961,42 @@ exit: return; } -static void prv_get_av_service_states_values(GUPnPServiceProxy *av_proxy, - GVariant **mpris_tp_speeds, - GPtrArray **upnp_tp_speeds, - double *min_rate, - double *max_rate) +static gboolean prv_get_av_service_states_values(GUPnPServiceProxy *av_proxy, + GVariant **mpris_tp_speeds, + GPtrArray **upnp_tp_speeds, + double *min_rate, + double *max_rate) { const GUPnPServiceStateVariableInfo *svi; GUPnPServiceIntrospection *introspection; GError *error = NULL; GVariant *speeds = NULL; GList *allowed_values; + gpointer weak_ref = NULL; + gboolean device_alive = TRUE; + + /* TODO: this weak_ref hack is needed as + gupnp_service_info_get_introspection iterates the main loop. + This can result in our device getting deleted before this + function returns. Ultimately, this code needs to be re-written + to use gupnp_service_info_get_introspection_async but this cannot + really be done until GUPnP provides a way to cancel this function. */ + + weak_ref = av_proxy; + g_object_add_weak_pointer(G_OBJECT(av_proxy), &weak_ref); + + introspection = gupnp_service_info_get_introspection( + GUPNP_SERVICE_INFO(av_proxy), + &error); + + if (!weak_ref) { + DLEYNA_LOG_WARNING("Lost device during introspection call"); + device_alive = FALSE; + goto exit; + } + + g_object_remove_weak_pointer(G_OBJECT(av_proxy), &weak_ref); - introspection = gupnp_service_info_get_introspection( - GUPNP_SERVICE_INFO(av_proxy), - &error); if (error != NULL) { DLEYNA_LOG_DEBUG( "failed to fetch AV service introspection file"); @@ -1821,19 +2025,40 @@ static void prv_get_av_service_states_values(GUPnPServiceProxy *av_proxy, exit: - return; + return device_alive; } -static void prv_get_rc_service_states_values(GUPnPServiceProxy *rc_proxy, - guint *max_volume) +static gboolean prv_get_rc_service_states_values(GUPnPServiceProxy *rc_proxy, + guint *max_volume) { const GUPnPServiceStateVariableInfo *svi; GUPnPServiceIntrospection *introspection; GError *error = NULL; + gpointer weak_ref = NULL; + gboolean device_alive = TRUE; + + /* TODO: this weak_ref hack is needed as + gupnp_service_info_get_introspection iterates the main loop. + This can result in our device getting deleted before this + function returns. Ultimately, this code needs to be re-written + to use gupnp_service_info_get_introspection_async but this cannot + really be done until GUPnP provides a way to cancel this function. */ + + weak_ref = rc_proxy; + g_object_add_weak_pointer(G_OBJECT(rc_proxy), &weak_ref); + + introspection = gupnp_service_info_get_introspection( + GUPNP_SERVICE_INFO(rc_proxy), + &error); + + if (!weak_ref) { + DLEYNA_LOG_WARNING("Lost device during introspection call"); + device_alive = FALSE; + goto exit; + } + + g_object_remove_weak_pointer(G_OBJECT(rc_proxy), &weak_ref); - introspection = gupnp_service_info_get_introspection( - GUPNP_SERVICE_INFO(rc_proxy), - &error); if (error != NULL) { DLEYNA_LOG_DEBUG( "failed to fetch RC service introspection file"); @@ -1852,7 +2077,7 @@ static void prv_get_rc_service_states_values(GUPnPServiceProxy *rc_proxy, exit: - return; + return device_alive; } static void prv_update_device_props(GUPnPDeviceInfo *proxy, GHashTable *props) @@ -1860,6 +2085,8 @@ static void prv_update_device_props(GUPnPDeviceInfo *proxy, GHashTable *props) GVariant *val; gchar *str; + prv_update_prop_dlna_device_classes(proxy, props); + val = g_variant_ref_sink(g_variant_new_string( gupnp_device_info_get_device_type(proxy))); g_hash_table_insert(props, DLR_INTERFACE_PROP_DEVICE_TYPE, val); @@ -1913,7 +2140,6 @@ static void prv_update_device_props(GUPnPDeviceInfo *proxy, GHashTable *props) val = g_variant_ref_sink(g_variant_new_string(str)); g_hash_table_insert(props, DLR_INTERFACE_PROP_PRESENTATION_URL, val); g_free(str); - } static void prv_add_player_speed_props(GHashTable *player_props, @@ -1945,7 +2171,7 @@ static void prv_add_player_speed_props(GHashTable *player_props, } } -static void prv_props_update(dlr_device_t *device, dlr_task_t *task) +static gboolean prv_props_update(dlr_device_t *device, dlr_task_t *task) { GVariant *val; GUPnPDeviceInfo *info; @@ -1954,6 +2180,7 @@ static void prv_props_update(dlr_device_t *device, dlr_task_t *task) dlr_props_t *props = &device->props; GVariantBuilder *changed_props_vb; GVariant *changed_props; + gboolean device_alive = TRUE; context = dlr_device_get_context(device); @@ -1981,21 +2208,36 @@ static void prv_props_update(dlr_device_t *device, dlr_task_t *task) g_hash_table_insert(props->root_props, DLR_INTERFACE_PROP_IDENTITY, g_variant_ref(val)); - changed_props_vb = g_variant_builder_new(G_VARIANT_TYPE("a{sv}")); - service_proxies = &context->service_proxies; + /* TODO: We should not retrieve these values here. They should be + retrieved during device construction. */ + if (service_proxies->av_proxy) - prv_get_av_service_states_values( - service_proxies->av_proxy, - &device->mpris_transport_play_speeds, - &device->transport_play_speeds, - &device->min_rate, - &device->max_rate); + if (!prv_get_av_service_states_values( + service_proxies->av_proxy, + &device->mpris_transport_play_speeds, + &device->transport_play_speeds, + &device->min_rate, + &device->max_rate)) { + DLEYNA_LOG_DEBUG("Lost Device AV"); + + device_alive = FALSE; + goto on_lost_device; + } + + /* TODO: We should not retrieve these values here. They should be + retrieved during device construction. */ if (service_proxies->rc_proxy) - prv_get_rc_service_states_values(service_proxies->rc_proxy, - &device->max_volume); + if (!prv_get_rc_service_states_values(service_proxies->rc_proxy, + &device->max_volume)) { + DLEYNA_LOG_DEBUG("Lost Device RC"); + device_alive = FALSE; + goto on_lost_device; + } + + changed_props_vb = g_variant_builder_new(G_VARIANT_TYPE("a{sv}")); prv_add_player_speed_props(device->props.player_props, device->min_rate, device->max_rate, @@ -2012,6 +2254,10 @@ static void prv_props_update(dlr_device_t *device, dlr_task_t *task) changed_props); g_variant_unref(changed_props); g_variant_builder_unref(changed_props_vb); + +on_lost_device: + + return device_alive; } static void prv_complete_get_prop(dlr_async_task_t *cb_data) @@ -2125,7 +2371,6 @@ static GVariant *prv_get_rate_value_from_double(GVariant *params, g_variant_iter_init(&iter, tps); while (g_variant_iter_next(&iter, "d", &tps_value)) { - if (fabs(mpris_rate - tps_value) <= 0.01) { val = g_variant_ref_sink( g_variant_new_double(tps_value)); @@ -2267,7 +2512,9 @@ void dlr_device_get_prop(dlr_device_t *device, dlr_task_t *task, if ((!strcmp(get_prop->interface_name, DLR_INTERFACE_PLAYER) || !strcmp(get_prop->interface_name, "")) && (!strcmp(task->ut.get_prop.prop_name, - DLR_INTERFACE_PROP_POSITION))) { + DLR_INTERFACE_PROP_POSITION) || + !strcmp(task->ut.get_prop.prop_name, + DLR_INTERFACE_PROP_BYTE_POSITION))) { /* Need to read the current position. This property is not evented */ @@ -2284,10 +2531,15 @@ void dlr_device_get_prop(dlr_device_t *device, dlr_task_t *task, cb_data->cb = cb; cb_data->device = device; - if (!device->props.synced) - prv_props_update(device, task); + if (!device->props.synced && !prv_props_update(device, task)) { + cb_data->error = g_error_new( + DLEYNA_SERVER_ERROR, + DLEYNA_ERROR_OPERATION_FAILED, + "Lost Device"); + } else { + prv_get_prop(cb_data); + } - prv_get_prop(cb_data); (void) g_idle_add(dlr_async_task_complete, cb_data); } } @@ -2299,28 +2551,28 @@ void dlr_device_get_all_props(dlr_device_t *device, dlr_task_t *task, dlr_task_get_props_t *get_props = &task->ut.get_props; dlr_device_data_t *device_cb_data; - if (!device->props.synced) - prv_props_update(device, task); + cb_data->cb = cb; + cb_data->device = device; - if ((!strcmp(get_props->interface_name, DLR_INTERFACE_PLAYER) || + if (!device->props.synced && !prv_props_update(device, task)) { + cb_data->error = g_error_new( + DLEYNA_SERVER_ERROR, + DLEYNA_ERROR_OPERATION_FAILED, + "Lost Device"); + (void) g_idle_add(dlr_async_task_complete, cb_data); + } else if ((!strcmp(get_props->interface_name, DLR_INTERFACE_PLAYER) || !strcmp(get_props->interface_name, ""))) { - /* Need to read the current position. This property is not evented */ device_cb_data = g_new(dlr_device_data_t, 1); device_cb_data->local_cb = prv_complete_get_props; - cb_data->cb = cb; cb_data->private = device_cb_data; - cb_data->device = device; cb_data->free_private = g_free; prv_get_position_info(cb_data); } else { - cb_data->cb = cb; - cb_data->device = device; - prv_get_props(cb_data); (void) g_idle_add(dlr_async_task_complete, cb_data); } @@ -2495,6 +2747,9 @@ static void prv_open_uri_cb(GUPnPServiceProxy *proxy, { dlr_async_task_t *cb_data = user_data; GError *upnp_error = NULL; +#if DLEYNA_LOG_LEVEL & DLEYNA_LOG_LEVEL_DEBUG + gchar *type; +#endif if (!gupnp_service_proxy_end_action(cb_data->proxy, cb_data->action, &upnp_error, NULL)) { @@ -2504,15 +2759,42 @@ static void prv_open_uri_cb(GUPnPServiceProxy *proxy, upnp_error->message); g_error_free(upnp_error); - goto exit; + goto on_error; } prv_reset_transport_speed_props(cb_data->device); -exit: +#if DLEYNA_LOG_LEVEL & DLEYNA_LOG_LEVEL_DEBUG + if (cb_data->task.type == DLR_TASK_OPEN_URI) + type = "OPEN URI"; + else if (cb_data->task.type == DLR_TASK_OPEN_NEXT_URI) + type = "OPEN NEXT URI"; + else if (cb_data->task.type == DLR_TASK_SET_URI) + type = "SET URI"; + + DLEYNA_LOG_DEBUG("Task: %s", type); +#endif + + if (cb_data->task.type == DLR_TASK_OPEN_URI) { + cb_data->action = + gupnp_service_proxy_begin_action( + cb_data->proxy, + "Play", + prv_simple_call_cb, + cb_data, + "InstanceID", G_TYPE_INT, 0, + "Speed", G_TYPE_STRING, + cb_data->device->rate, NULL); + goto on_exit; + } + +on_error: (void) g_idle_add(dlr_async_task_complete, cb_data); g_cancellable_disconnect(cb_data->cancellable, cb_data->cancel_id); + +on_exit: + return; } void dlr_device_open_uri(dlr_device_t *device, dlr_task_t *task, @@ -2525,6 +2807,7 @@ void dlr_device_open_uri(dlr_device_t *device, dlr_task_t *task, DLEYNA_LOG_INFO("URI: %s", open_uri_data->uri); DLEYNA_LOG_INFO("METADATA: %s", metadata ? metadata : "Not provided"); + DLEYNA_LOG_INFO("ACTION: %s", open_uri_data->operation); context = dlr_device_get_context(device); cb_data->cb = cb; @@ -2541,13 +2824,14 @@ void dlr_device_open_uri(dlr_device_t *device, dlr_task_t *task, cb_data->action = gupnp_service_proxy_begin_action(cb_data->proxy, - "SetAVTransportURI", + open_uri_data->operation, prv_open_uri_cb, cb_data, "InstanceID", G_TYPE_INT, 0, - "CurrentURI", G_TYPE_STRING, + open_uri_data->uri_type, + G_TYPE_STRING, open_uri_data->uri, - "CurrentURIMetaData", + open_uri_data->metadata_type, G_TYPE_STRING, metadata ? metadata : "", NULL); @@ -2568,8 +2852,11 @@ static void prv_device_set_position(dlr_device_t *device, dlr_task_t *task, if (!strcmp(pos_type, "TRACK_NR")) position = g_strdup_printf("%u", seek_data->track_number); - else + else if (g_strrstr(pos_type, "_TIME") != NULL) position = prv_int64_to_duration(seek_data->position); + else + position = g_strdup_printf("%llu", + (long long unsigned int)seek_data->counter_position); DLEYNA_LOG_INFO("set %s position : %s", pos_type, position); @@ -2601,13 +2888,19 @@ static void prv_device_set_position(dlr_device_t *device, dlr_task_t *task, void dlr_device_seek(dlr_device_t *device, dlr_task_t *task, dlr_upnp_task_complete_t cb) { - prv_device_set_position(device, task, "REL_TIME", cb); + if (task->type == DLR_TASK_SEEK) + prv_device_set_position(device, task, "REL_TIME", cb); + else + prv_device_set_position(device, task, "REL_COUNT", cb); } void dlr_device_set_position(dlr_device_t *device, dlr_task_t *task, dlr_upnp_task_complete_t cb) { - prv_device_set_position(device, task, "ABS_TIME", cb); + if (task->type == DLR_TASK_SET_POSITION) + prv_device_set_position(device, task, "ABS_TIME", cb); + else + prv_device_set_position(device, task, "ABS_COUNT", cb); } void dlr_device_goto_track(dlr_device_t *device, dlr_task_t *task, diff --git a/dleyna-renderer/libdleyna/renderer/device.h b/dleyna-renderer/libdleyna/renderer/device.h index 2fef1fb..70692f3 100644 --- a/dleyna-renderer/libdleyna/renderer/device.h +++ b/dleyna-renderer/libdleyna/renderer/device.h @@ -87,6 +87,7 @@ struct dlr_device_t_ { double max_rate; guint construct_step; dlr_device_icon_t icon; + GHashTable *rc_event_handlers; }; void dlr_device_construct( diff --git a/dleyna-renderer/libdleyna/renderer/dleyna-renderer-1.0.pc.in b/dleyna-renderer/libdleyna/renderer/dleyna-renderer-1.0.pc.in index 3e6857a..9704ef8 100644 --- a/dleyna-renderer/libdleyna/renderer/dleyna-renderer-1.0.pc.in +++ b/dleyna-renderer/libdleyna/renderer/dleyna-renderer-1.0.pc.in @@ -2,7 +2,7 @@ prefix=@prefix@ exec_prefix=@exec_prefix@ libexecdir=@libexecdir@ includedir=${prefix}/include -libdir=@libdir@ +libdir=@libdir@/@PACKAGE@ Name: @PACKAGE@ Description: UPnP & DLNA renderer library diff --git a/dleyna-renderer/libdleyna/renderer/dleyna-renderer-service.conf b/dleyna-renderer/libdleyna/renderer/dleyna-renderer-service.conf index ae38bc5..95cbaab 100644 --- a/dleyna-renderer/libdleyna/renderer/dleyna-renderer-service.conf +++ b/dleyna-renderer/libdleyna/renderer/dleyna-renderer-service.conf @@ -35,3 +35,15 @@ log-type=0 # You can't enable levels disabled at compile time # level=8 means all level flags defined at compile time. log-level=7 + + +# Network filtering +[netf] + +# true: Enable the network filtering. +# false: Disable the network filtering. +netf-enabled=false + +# Comma-separated list of interface name, SSID or IP address. +# If netf is enabled but the list is empty, it behaves as disabled. +netf-list= diff --git a/dleyna-renderer/libdleyna/renderer/dleyna-renderer-service.conf.in b/dleyna-renderer/libdleyna/renderer/dleyna-renderer-service.conf.in index 2edc4e3..3d045df 100644 --- a/dleyna-renderer/libdleyna/renderer/dleyna-renderer-service.conf.in +++ b/dleyna-renderer/libdleyna/renderer/dleyna-renderer-service.conf.in @@ -35,3 +35,15 @@ log-type=@with_log_type@ # You can't enable levels disabled at compile time # level=8 means all level flags defined at compile time. log-level=@with_log_level@ + + +# Network filtering +[netf] + +# true: Enable the network filtering. +# false: Disable the network filtering. +netf-enabled=false + +# Comma-separated list of interface name, SSID or IP address. +# If netf is enabled but the list is empty, it behaves as disabled. +netf-list= diff --git a/dleyna-renderer/libdleyna/renderer/manager.c b/dleyna-renderer/libdleyna/renderer/manager.c new file mode 100644 index 0000000..c55c039 --- /dev/null +++ b/dleyna-renderer/libdleyna/renderer/manager.c @@ -0,0 +1,273 @@ +/* + * dLeyna + * + * Copyright (C) 2013 Intel Corporation. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms and conditions of the GNU Lesser General Public License, + * version 2.1, as published by the Free Software Foundation. + * + * This program is distributed in the hope it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License + * for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. + * + * Ludovic Ferrandis + * + */ + +#include +#include + +#include +#include +#include +#include + +#include "async.h" +#include "manager.h" +#include "prop-defs.h" +#include "server.h" + +struct dlr_manager_t_ { + dleyna_connector_id_t connection; + GUPnPContextManager *cm; +}; + +static void prv_add_list_wl_entries(gpointer data, gpointer user_data) +{ + GVariantBuilder *vb = (GVariantBuilder *)user_data; + gchar *entry = (gchar *)data; + + g_variant_builder_add(vb, "s", entry); +} + +static void prv_add_all_props(GUPnPContextManager *manager, GVariantBuilder *vb) +{ + GUPnPWhiteList *wl; + GList *list; + GVariantBuilder vb2; + + wl = gupnp_context_manager_get_white_list(manager); + list = gupnp_white_list_get_entries(wl); + + g_variant_builder_add(vb, "{sv}", DLR_INTERFACE_PROP_WHITE_LIST_ENABLED, + g_variant_new_boolean( + gupnp_white_list_get_enabled(wl))); + + g_variant_builder_init(&vb2, G_VARIANT_TYPE("as")); + g_list_foreach(list, prv_add_list_wl_entries, &vb2); + + g_variant_builder_add(vb, "{sv}", DLR_INTERFACE_PROP_WHITE_LIST_ENTRIES, + g_variant_builder_end(&vb2)); +} + +static GVariant *prv_get_prop(GUPnPContextManager *manager, const gchar *prop) +{ + GVariant *retval = NULL; + GUPnPWhiteList *wl; + GVariantBuilder vb; + GList *list; + gboolean b_value; +#if DLEYNA_LOG_LEVEL & DLEYNA_LOG_LEVEL_DEBUG + gchar *prop_str; +#endif + + wl = gupnp_context_manager_get_white_list(manager); + + if (!strcmp(prop, DLR_INTERFACE_PROP_WHITE_LIST_ENABLED)) { + b_value = gupnp_white_list_get_enabled(wl); + retval = g_variant_ref_sink(g_variant_new_boolean(b_value)); + + } else if (!strcmp(prop, DLR_INTERFACE_PROP_WHITE_LIST_ENTRIES)) { + list = gupnp_white_list_get_entries(wl); + + g_variant_builder_init(&vb, G_VARIANT_TYPE("as")); + g_list_foreach(list, prv_add_list_wl_entries, &vb); + retval = g_variant_ref_sink(g_variant_builder_end(&vb)); + } + +#if DLEYNA_LOG_LEVEL & DLEYNA_LOG_LEVEL_DEBUG + if (retval) { + prop_str = g_variant_print(retval, FALSE); + DLEYNA_LOG_DEBUG("Prop %s = %s", prop, prop_str); + g_free(prop_str); + } +#endif + + return retval; +} + +static void prv_wl_notify_prop(dlr_manager_t *manager, const gchar *prop_name) +{ + GVariant *prop_val; + GVariant *val; + GVariantBuilder array; + + prop_val = prv_get_prop(manager->cm, prop_name); + + g_variant_builder_init(&array, G_VARIANT_TYPE("a{sv}")); + g_variant_builder_add(&array, "{sv}", prop_name, prop_val); + + val = g_variant_new("(s@a{sv}as)", DLEYNA_SERVER_INTERFACE_MANAGER, + g_variant_builder_end(&array), + NULL); + + (void) dlr_renderer_get_connector()->notify( + manager->connection, + DLEYNA_SERVER_OBJECT, + DLR_INTERFACE_PROPERTIES, + DLR_INTERFACE_PROPERTIES_CHANGED, + val, + NULL); + g_variant_unref(prop_val); +} + +static void prv_wl_notify_enabled_prop(gpointer user_data) +{ + prv_wl_notify_prop((dlr_manager_t *)user_data, + DLR_INTERFACE_PROP_WHITE_LIST_ENABLED); +} + +static void prv_wl_notify_entries_prop(gpointer user_data) +{ + prv_wl_notify_prop((dlr_manager_t *)user_data, + DLR_INTERFACE_PROP_WHITE_LIST_ENTRIES); +} + +dlr_manager_t *dlr_manager_new(dleyna_connector_id_t connection, + GUPnPContextManager *connection_manager) +{ + dlr_manager_t *manager = g_new0(dlr_manager_t, 1); + dleyna_white_list_t wl_info; + + manager->connection = connection; + manager->cm = connection_manager; + + wl_info.wl = gupnp_context_manager_get_white_list(manager->cm); + wl_info.cb_enabled = prv_wl_notify_enabled_prop; + wl_info.cb_entries = prv_wl_notify_entries_prop; + wl_info.user_data = manager; + + dleyna_white_list_set_info(&wl_info); + + return manager; +} + +void dlr_manager_delete(dlr_manager_t *manager) +{ + if (manager != NULL) { + dleyna_white_list_set_info(NULL); + g_free(manager); + } +} + +void dlr_manager_wl_enable(dlr_task_t *task) +{ + dleyna_white_list_enable(task->ut.white_list.enabled, TRUE); +} + +void dlr_manager_wl_add_entries(dlr_task_t *task) +{ + dleyna_white_list_add_entries(task->ut.white_list.entries, TRUE); +} + +void dlr_manager_wl_remove_entries(dlr_task_t *task) +{ + dleyna_white_list_remove_entries(task->ut.white_list.entries, TRUE); +} + +void dlr_manager_wl_clear(dlr_task_t *task) +{ + dleyna_white_list_clear(TRUE); +} + +void dlr_manager_get_all_props(dlr_manager_t *manager, + dlr_task_t *task, + dlr_manager_task_complete_t cb) +{ + dlr_async_task_t *cb_data = (dlr_async_task_t *)task; + dlr_task_get_props_t *task_data = &task->ut.get_props; + GVariantBuilder vb; + + DLEYNA_LOG_DEBUG("Enter"); + DLEYNA_LOG_DEBUG("Path: %s", task->path); + DLEYNA_LOG_DEBUG("Interface %s", task->ut.get_prop.interface_name); + + cb_data->cb = cb; + + g_variant_builder_init(&vb, G_VARIANT_TYPE("a{sv}")); + + if (!strcmp(task_data->interface_name, + DLEYNA_SERVER_INTERFACE_MANAGER) || + !strcmp(task_data->interface_name, "")) { + cb_data->cancel_id = g_cancellable_connect( + cb_data->cancellable, + G_CALLBACK(dlr_async_task_cancelled), + cb_data, NULL); + + prv_add_all_props(manager->cm, &vb); + + cb_data->task.result = g_variant_ref_sink( + g_variant_builder_end(&vb)); + } else { + DLEYNA_LOG_WARNING("Interface is unknown."); + + cb_data->error = g_error_new(DLEYNA_SERVER_ERROR, + DLEYNA_ERROR_UNKNOWN_INTERFACE, + "Interface is unknown."); + } + + (void) g_idle_add(dlr_async_task_complete, cb_data); + g_cancellable_disconnect(cb_data->cancellable, cb_data->cancel_id); + + DLEYNA_LOG_DEBUG("Exit"); +} + +void dlr_manager_get_prop(dlr_manager_t *manager, + dlr_task_t *task, + dlr_manager_task_complete_t cb) +{ + dlr_async_task_t *cb_data = (dlr_async_task_t *)task; + dlr_task_get_prop_t *task_data = &task->ut.get_prop; + + DLEYNA_LOG_DEBUG("Enter"); + DLEYNA_LOG_DEBUG("Path: %s", task->path); + DLEYNA_LOG_DEBUG("Interface %s", task->ut.get_prop.interface_name); + DLEYNA_LOG_DEBUG("Prop.%s", task->ut.get_prop.prop_name); + + cb_data->cb = cb; + + if (!strcmp(task_data->interface_name, + DLEYNA_SERVER_INTERFACE_MANAGER) || + !strcmp(task_data->interface_name, "")) { + cb_data->cancel_id = g_cancellable_connect( + cb_data->cancellable, + G_CALLBACK(dlr_async_task_cancelled), + cb_data, NULL); + + cb_data->task.result = prv_get_prop(manager->cm, + task_data->prop_name); + + if (!cb_data->task.result) + cb_data->error = g_error_new( + DLEYNA_SERVER_ERROR, + DLEYNA_ERROR_UNKNOWN_PROPERTY, + "Unknown property"); + } else { + DLEYNA_LOG_WARNING("Interface is unknown."); + + cb_data->error = g_error_new(DLEYNA_SERVER_ERROR, + DLEYNA_ERROR_UNKNOWN_INTERFACE, + "Interface is unknown."); + } + + (void) g_idle_add(dlr_async_task_complete, cb_data); + g_cancellable_disconnect(cb_data->cancellable, cb_data->cancel_id); + + DLEYNA_LOG_DEBUG("Exit"); +} diff --git a/dleyna-renderer/libdleyna/renderer/manager.h b/dleyna-renderer/libdleyna/renderer/manager.h new file mode 100644 index 0000000..c670430 --- /dev/null +++ b/dleyna-renderer/libdleyna/renderer/manager.h @@ -0,0 +1,55 @@ +/* + * dLeyna + * + * Copyright (C) 2013 Intel Corporation. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms and conditions of the GNU Lesser General Public License, + * version 2.1, as published by the Free Software Foundation. + * + * This program is distributed in the hope it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License + * for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. + * + * Ludovic Ferrandis + * + */ + +#ifndef DLR_MANAGER_H__ +#define DLR_MANAGER_H__ + +#include +#include + +#include "task.h" + +typedef struct dlr_manager_t_ dlr_manager_t; +typedef void (*dlr_manager_task_complete_t)(dlr_task_t *task, GError *error); + +dlr_manager_t *dlr_manager_new(dleyna_connector_id_t connection, + GUPnPContextManager *connection_manager); + +void dlr_manager_delete(dlr_manager_t *manager); + +void dlr_manager_wl_enable(dlr_task_t *task); + +void dlr_manager_wl_add_entries(dlr_task_t *task); + +void dlr_manager_wl_remove_entries(dlr_task_t *task); + +void dlr_manager_wl_clear(dlr_task_t *task); + +void dlr_manager_get_all_props(dlr_manager_t *manager, + dlr_task_t *task, + dlr_manager_task_complete_t cb); + +void dlr_manager_get_prop(dlr_manager_t *manager, + dlr_task_t *task, + dlr_manager_task_complete_t cb); + +#endif /* DLR_MANAGER_H__ */ diff --git a/dleyna-renderer/libdleyna/renderer/prop-defs.h b/dleyna-renderer/libdleyna/renderer/prop-defs.h index d9164ae..ca7efc6 100644 --- a/dleyna-renderer/libdleyna/renderer/prop-defs.h +++ b/dleyna-renderer/libdleyna/renderer/prop-defs.h @@ -29,6 +29,10 @@ #define DLR_INTERFACE_PROPERTIES_CHANGED "PropertiesChanged" +/* Manager Properties */ +#define DLR_INTERFACE_PROP_WHITE_LIST_ENTRIES "WhiteListEntries" +#define DLR_INTERFACE_PROP_WHITE_LIST_ENABLED "WhiteListEnabled" + #define DLR_INTERFACE_PROP_CAN_QUIT "CanQuit" #define DLR_INTERFACE_PROP_CAN_RAISE "CanRaise" #define DLR_INTERFACE_PROP_CAN_SET_FULLSCREEN "CanSetFullscreen" @@ -41,11 +45,13 @@ #define DLR_INTERFACE_PROP_RATE "Rate" #define DLR_INTERFACE_PROP_CAN_PLAY "CanPlay" #define DLR_INTERFACE_PROP_CAN_SEEK "CanSeek" +#define DLR_INTERFACE_PROP_CAN_BYTE_SEEK "CanByteSeek" #define DLR_INTERFACE_PROP_CAN_CONTROL "CanControl" #define DLR_INTERFACE_PROP_CAN_PAUSE "CanPause" #define DLR_INTERFACE_PROP_CAN_NEXT "CanGoNext" #define DLR_INTERFACE_PROP_CAN_PREVIOUS "CanGoPrevious" #define DLR_INTERFACE_PROP_POSITION "Position" +#define DLR_INTERFACE_PROP_BYTE_POSITION "BytePosition" #define DLR_INTERFACE_PROP_METADATA "Metadata" #define DLR_INTERFACE_PROP_TRANSPORT_PLAY_SPEEDS "TransportPlaySpeeds" #define DLR_INTERFACE_PROP_MINIMUM_RATE "MinimumRate" @@ -55,6 +61,7 @@ #define DLR_INTERFACE_PROP_NUMBER_OF_TRACKS "NumberOfTracks" #define DLR_INTERFACE_PROP_MUTE "Mute" +#define DLR_INTERFACE_PROP_DLNA_DEVICE_CLASSES "DeviceClasses" #define DLR_INTERFACE_PROP_DEVICE_TYPE "DeviceType" #define DLR_INTERFACE_PROP_UDN "UDN" #define DLR_INTERFACE_PROP_FRIENDLY_NAME "FriendlyName" diff --git a/dleyna-renderer/libdleyna/renderer/server.c b/dleyna-renderer/libdleyna/renderer/server.c index f8fa47e..be5ac36 100644 --- a/dleyna-renderer/libdleyna/renderer/server.c +++ b/dleyna-renderer/libdleyna/renderer/server.c @@ -28,7 +28,6 @@ #include #include #include -#include #include #include @@ -39,6 +38,7 @@ #include "async.h" #include "control-point-renderer.h" #include "device.h" +#include "manager.h" #include "prop-defs.h" #include "server.h" #include "upnp.h" @@ -53,6 +53,13 @@ #define DLR_INTERFACE_GET_RENDERERS "GetRenderers" #define DLR_INTERFACE_RESCAN "Rescan" #define DLR_INTERFACE_RELEASE "Release" +#define DLR_INTERFACE_WHITE_LIST_ENABLE "WhiteListEnable" +#define DLR_INTERFACE_WHITE_LIST_ADD_ENTRIES "WhiteListAddEntries" +#define DLR_INTERFACE_WHITE_LIST_REMOVE_ENTRIES "WhiteListRemoveEntries" +#define DLR_INTERFACE_WHITE_LIST_CLEAR "WhiteListClear" + +#define DLR_INTERFACE_ENTRY_LIST "EntryList" +#define DLR_INTERFACE_IS_ENABLED "IsEnabled" #define DLR_INTERFACE_FOUND_RENDERER "FoundRenderer" #define DLR_INTERFACE_LOST_RENDERER "LostRenderer" @@ -79,6 +86,7 @@ #define DLR_INTERFACE_VALUE "value" #define DLR_INTERFACE_OFFSET "offset" #define DLR_INTERFACE_POSITION "position" +#define DLR_INTERFACE_BYTE_POSITION "byte_position" #define DLR_INTERFACE_TRACKID "trackid" #define DLR_INTERFACE_TRACK_NUMBER "TrackNumber" @@ -92,8 +100,12 @@ #define DLR_INTERFACE_STOP "Stop" #define DLR_INTERFACE_OPEN_URI "OpenUri" #define DLR_INTERFACE_OPEN_URI_EX "OpenUriEx" +#define DLR_INTERFACE_OPEN_NEXT_URI "OpenNextUri" +#define DLR_INTERFACE_SET_URI "SetUri" #define DLR_INTERFACE_SEEK "Seek" +#define DLR_INTERFACE_BYTE_SEEK "ByteSeek" #define DLR_INTERFACE_SET_POSITION "SetPosition" +#define DLR_INTERFACE_SET_BYTE_POSITION "SetBytePosition" #define DLR_INTERFACE_GOTO_TRACK "GotoTrack" #define DLR_INTERFACE_CANCEL "Cancel" @@ -103,15 +115,22 @@ #define DLR_INTERFACE_MIME_TYPE "MimeType" #define DLR_INTERFACE_REQ_MIME_TYPE "RequestedMimeType" +enum dlr_manager_interface_type_ { + DLR_MANAGER_INTERFACE_MANAGER, + DLR_MANAGER_INTERFACE_INFO_PROPERTIES, + DLR_MANAGER_INTERFACE_INFO_MAX +}; + typedef struct dlr_context_t_ dlr_context_t; struct dlr_context_t_ { - guint dlr_id; + guint dlr_id[DLR_MANAGER_INTERFACE_INFO_MAX]; dleyna_connector_id_t connection; guint watchers; dleyna_task_processor_t *processor; const dleyna_connector_t *connector; dlr_upnp_t *upnp; dleyna_settings_t *settings; + dlr_manager_t *manager; }; static dlr_context_t g_context; @@ -126,16 +145,56 @@ static const gchar g_root_introspection[] = " " " " " " - " " " " " " " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " " " - " " + " " " " " " - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " " " " " ""; @@ -214,16 +273,38 @@ static const gchar g_server_introspection[] = " " " " + " " + " " + " " + " " + " " + " " + " " + " " " " " " " " + " " + " " + " " " " " " " " " " + " " + " " + " " + " " " " " " @@ -245,6 +326,8 @@ static const gchar g_server_introspection[] = " access='read'/>" " " + " " " " " " + " " " " " " " " + " " " " " "; +static const gchar *g_manager_interfaces[DLR_MANAGER_INTERFACE_INFO_MAX] = { + /* MUST be in the exact same order as g_root_introspection */ + DLEYNA_SERVER_INTERFACE_MANAGER, + DLR_INTERFACE_PROPERTIES +}; + static void prv_process_task(dleyna_task_atom_t *task, gpointer user_data); -static void prv_dlr_method_call(dleyna_connector_id_t conn, - const gchar *sender, - const gchar *object, - const gchar *interface, - const gchar *method, - GVariant *parameters, - dleyna_connector_msg_id_t invocation); +static void prv_manager_root_method_call(dleyna_connector_id_t conn, + const gchar *sender, + const gchar *object, + const gchar *interface, + const gchar *method, + GVariant *parameters, + dleyna_connector_msg_id_t invocation); + +static void prv_manager_props_method_call(dleyna_connector_id_t conn, + const gchar *sender, + const gchar *object, + const gchar *interface, + const gchar *method, + GVariant *parameters, + dleyna_connector_msg_id_t invocation); static void prv_dlr_device_method_call(dleyna_connector_id_t conn, const gchar *sender, @@ -367,13 +469,16 @@ static void prv_renderer_device_method_call( GVariant *parameters, dleyna_connector_msg_id_t invocation); -static const dleyna_connector_dispatch_cb_t g_root_vtables[1] = { - prv_dlr_method_call +static const dleyna_connector_dispatch_cb_t + g_root_vtables[DLR_MANAGER_INTERFACE_INFO_MAX] = { + /* MUST be in the exact same order as g_root_introspection */ + prv_manager_root_method_call, + prv_manager_props_method_call }; static const dleyna_connector_dispatch_cb_t g_server_vtables[DLR_INTERFACE_INFO_MAX] = { - /* MUST be in the exact same order as g_msu_server_introspection */ + /* MUST be in the exact same order as g_server_introspection */ prv_props_method_call, prv_dlr_device_method_call, prv_dlr_player_method_call, @@ -381,6 +486,20 @@ static const dleyna_connector_dispatch_cb_t prv_renderer_device_method_call }; +static const gchar *g_server_interfaces[DLR_INTERFACE_INFO_MAX] = { + /* MUST be in the exact same order as g_server_introspection */ + DLR_INTERFACE_PROPERTIES, + DLR_INTERFACE_SERVER, + DLR_INTERFACE_PLAYER, + DLEYNA_INTERFACE_PUSH_HOST, + DLEYNA_SERVER_INTERFACE_RENDERER_DEVICE +}; + +const gchar *dlr_renderer_get_interface_name(guint index) +{ + return g_server_interfaces[index]; +} + const dleyna_connector_t *dlr_renderer_get_connector(void) { return g_context.connector; @@ -402,18 +521,33 @@ static void prv_process_sync_task(dlr_task_t *task) switch (task->type) { case DLR_TASK_GET_VERSION: + task->result = g_variant_ref_sink(g_variant_new_string( + VERSION)); dlr_task_complete(task); - dleyna_task_queue_task_completed(task->atom.queue_id); break; case DLR_TASK_GET_SERVERS: task->result = dlr_upnp_get_server_ids(g_context.upnp); dlr_task_complete(task); - dleyna_task_queue_task_completed(task->atom.queue_id); break; case DLR_TASK_RESCAN: dlr_upnp_rescan(g_context.upnp); dlr_task_complete(task); - dleyna_task_queue_task_completed(task->atom.queue_id); + break; + case DLR_TASK_WHITE_LIST_ENABLE: + dlr_manager_wl_enable(task); + dlr_task_complete(task); + break; + case DLR_TASK_WHITE_LIST_ADD_ENTRIES: + dlr_manager_wl_add_entries(task); + dlr_task_complete(task); + break; + case DLR_TASK_WHITE_LIST_REMOVE_ENTRIES: + dlr_manager_wl_remove_entries(task); + dlr_task_complete(task); + break; + case DLR_TASK_WHITE_LIST_CLEAR: + dlr_manager_wl_clear(task); + dlr_task_complete(task); break; case DLR_TASK_RAISE: case DLR_TASK_QUIT: @@ -421,23 +555,28 @@ static void prv_process_sync_task(dlr_task_t *task) DLEYNA_ERROR_NOT_SUPPORTED, "Command not supported."); dlr_task_fail(task, error); - dleyna_task_queue_task_completed(task->atom.queue_id); g_error_free(error); break; default: + goto finished; break; } + + dleyna_task_queue_task_completed(task->atom.queue_id); + +finished: + return; } static void prv_async_task_complete(dlr_task_t *task, GError *error) { DLEYNA_LOG_DEBUG("Enter"); - if (error) { + if (!error) { + dlr_task_complete(task); + } else { dlr_task_fail(task, error); g_error_free(error); - } else { - dlr_task_complete(task); } dleyna_task_queue_task_completed(task->atom.queue_id); @@ -491,14 +630,18 @@ static void prv_process_async_task(dlr_task_t *task) prv_async_task_complete); break; case DLR_TASK_OPEN_URI: + case DLR_TASK_OPEN_NEXT_URI: + case DLR_TASK_SET_URI: dlr_upnp_open_uri(g_context.upnp, task, prv_async_task_complete); break; case DLR_TASK_SEEK: + case DLR_TASK_BYTE_SEEK: dlr_upnp_seek(g_context.upnp, task, prv_async_task_complete); break; case DLR_TASK_SET_POSITION: + case DLR_TASK_SET_BYTE_POSITION: dlr_upnp_set_position(g_context.upnp, task, prv_async_task_complete); break; @@ -518,6 +661,14 @@ static void prv_process_async_task(dlr_task_t *task) dlr_upnp_get_icon(g_context.upnp, task, prv_async_task_complete); break; + case DLR_TASK_MANAGER_GET_PROP: + dlr_manager_get_prop(g_context.manager, task, + prv_async_task_complete); + break; + case DLR_TASK_MANAGER_GET_ALL_PROPS: + dlr_manager_get_all_props(g_context.manager, task, + prv_async_task_complete); + break; default: break; } @@ -580,16 +731,19 @@ static void prv_control_point_initialize(const dleyna_connector_t *connector, static void prv_control_point_stop_service(void) { + uint i; + if (g_context.upnp) { dlr_upnp_unsubscribe(g_context.upnp); dlr_upnp_delete(g_context.upnp); } if (g_context.connection) { - if (g_context.dlr_id) - g_context.connector->unpublish_object( + for (i = 0; i < DLR_MANAGER_INTERFACE_INFO_MAX; i++) + if (g_context.dlr_id[i]) + g_context.connector->unpublish_object( g_context.connection, - g_context.dlr_id); + g_context.dlr_id[i]); } } @@ -620,7 +774,8 @@ static void prv_add_task(dlr_task_t *task, const gchar *source, dleyna_task_queue_add_task(queue_id, &task->atom); } -static void prv_dlr_method_call(dleyna_connector_id_t conn, +static void prv_manager_root_method_call( + dleyna_connector_id_t conn, const gchar *sender, const gchar *object, const gchar *interface, const gchar *method, GVariant *parameters, @@ -641,6 +796,18 @@ static void prv_dlr_method_call(dleyna_connector_id_t conn, task = dlr_task_get_servers_new(invocation); else if (!strcmp(method, DLR_INTERFACE_RESCAN)) task = dlr_task_rescan_new(invocation); + else if (!strcmp(method, DLR_INTERFACE_WHITE_LIST_ENABLE)) + task = dlr_task_wl_enable_new(invocation, + parameters); + else if (!strcmp(method, DLR_INTERFACE_WHITE_LIST_ADD_ENTRIES)) + task = dlr_task_wl_add_entries_new(invocation, + parameters); + else if (!strcmp(method, + DLR_INTERFACE_WHITE_LIST_REMOVE_ENTRIES)) + task = dlr_task_wl_remove_entries_new(invocation, + parameters); + else if (!strcmp(method, DLR_INTERFACE_WHITE_LIST_CLEAR)) + task = dlr_task_wl_clear_new(invocation); else goto finished; @@ -652,6 +819,40 @@ finished: return; } +static void prv_manager_props_method_call(dleyna_connector_id_t conn, + const gchar *sender, + const gchar *object, + const gchar *interface, + const gchar *method, + GVariant *parameters, + dleyna_connector_msg_id_t invocation) +{ + dlr_task_t *task; + GError *error = NULL; + + if (!strcmp(method, DLR_INTERFACE_GET_ALL)) + task = dlr_task_manager_get_props_new(invocation, object, + parameters, &error); + else if (!strcmp(method, DLR_INTERFACE_GET)) + task = dlr_task_manager_get_prop_new(invocation, object, + parameters, &error); + else + goto finished; + + if (!task) { + g_context.connector->return_error(invocation, error); + g_error_free(error); + + goto finished; + } + + prv_add_task(task, sender, task->path); + +finished: + + return; +} + static const gchar *prv_get_device_id(const gchar *object, GError **error) { dlr_device_t *device; @@ -782,11 +983,21 @@ static void prv_dlr_player_method_call(dleyna_connector_id_t conn, task = dlr_task_open_uri_new(invocation, object, parameters); else if (!strcmp(method, DLR_INTERFACE_OPEN_URI_EX)) task = dlr_task_open_uri_ex_new(invocation, object, parameters); + else if (!strcmp(method, DLR_INTERFACE_OPEN_NEXT_URI)) + task = dlr_task_open_next_uri_new(invocation, object, + parameters); + else if (!strcmp(method, DLR_INTERFACE_SET_URI)) + task = dlr_task_set_uri_new(invocation, object, parameters); else if (!strcmp(method, DLR_INTERFACE_SEEK)) task = dlr_task_seek_new(invocation, object, parameters); + else if (!strcmp(method, DLR_INTERFACE_BYTE_SEEK)) + task = dlr_task_byte_seek_new(invocation, object, parameters); else if (!strcmp(method, DLR_INTERFACE_SET_POSITION)) task = dlr_task_set_position_new(invocation, object, parameters); + else if (!strcmp(method, DLR_INTERFACE_SET_BYTE_POSITION)) + task = dlr_task_set_byte_position_new(invocation, object, + parameters); else if (!strcmp(method, DLR_INTERFACE_GOTO_TRACK)) task = dlr_task_goto_track_new(invocation, object, parameters); else @@ -884,7 +1095,7 @@ static void prv_found_media_server(const gchar *path) DLEYNA_SERVER_OBJECT, DLEYNA_SERVER_INTERFACE_MANAGER, DLR_INTERFACE_FOUND_RENDERER, - g_variant_new("(s)", path), + g_variant_new("(o)", path), NULL); } @@ -896,7 +1107,7 @@ static void prv_lost_media_server(const gchar *path) DLEYNA_SERVER_OBJECT, DLEYNA_SERVER_INTERFACE_MANAGER, DLR_INTERFACE_LOST_RENDERER, - g_variant_new("(s)", path), + g_variant_new("(o)", path), NULL); dleyna_task_processor_remove_queues_for_sink(g_context.processor, path); @@ -906,27 +1117,31 @@ static gboolean prv_control_point_start_service( dleyna_connector_id_t connection) { gboolean retval = TRUE; + uint i; g_context.connection = connection; - g_context.dlr_id = g_context.connector->publish_object( - connection, - DLEYNA_SERVER_OBJECT, - TRUE, - 0, - g_root_vtables); + for (i = 0; i < DLR_MANAGER_INTERFACE_INFO_MAX; i++) + g_context.dlr_id[i] = g_context.connector->publish_object( + connection, + DLEYNA_SERVER_OBJECT, + TRUE, + g_manager_interfaces[i], + g_root_vtables + i); - if (!g_context.dlr_id) { - retval = FALSE; - goto out; - } else { + if (g_context.dlr_id[DLR_MANAGER_INTERFACE_MANAGER]) { g_context.upnp = dlr_upnp_new(connection, g_server_vtables, prv_found_media_server, prv_lost_media_server); + + g_context.manager = dlr_manager_new(connection, + dlr_upnp_get_context_manager(g_context.upnp)); + } else { + retval = FALSE; } -out: + dleyna_settings_init_white_list(g_context.settings); return retval; } @@ -960,4 +1175,3 @@ const dleyna_control_point_t *dleyna_control_point_get_renderer(void) { return &g_control_point; } - diff --git a/dleyna-renderer/libdleyna/renderer/server.h b/dleyna-renderer/libdleyna/renderer/server.h index ad770e9..3951b17 100644 --- a/dleyna-renderer/libdleyna/renderer/server.h +++ b/dleyna-renderer/libdleyna/renderer/server.h @@ -37,4 +37,6 @@ dleyna_task_processor_t *dlr_renderer_service_get_task_processor(void); const dleyna_connector_t *dlr_renderer_get_connector(void); +const gchar *dlr_renderer_get_interface_name(guint index); + #endif /* DLR_SERVER_H__ */ diff --git a/dleyna-renderer/libdleyna/renderer/task.c b/dleyna-renderer/libdleyna/renderer/task.c index 6e5c8cd..eb701ca 100644 --- a/dleyna-renderer/libdleyna/renderer/task.c +++ b/dleyna-renderer/libdleyna/renderer/task.c @@ -26,6 +26,14 @@ #include "async.h" #include "server.h" +#define DLR_TASK_SET_URI_OPERATION "SetAVTransportURI" +#define DLR_TASK_SET_URI_TYPE "CurrentURI" +#define DLR_TASK_SET_URI_META_DATA "CurrentURIMetaData" + +#define DLR_TASK_SET_NEXT_URI_OPERATION "SetNextAVTransportURI" +#define DLR_TASK_SET_NEXT_URI_TYPE "NextURI" +#define DLR_TASK_SET_NEXT_URI_META_DATA "NextURIMetaData" + dlr_task_t *dlr_task_rescan_new(dleyna_connector_msg_id_t invocation) { dlr_task_t *task = g_new0(dlr_task_t, 1); @@ -44,7 +52,6 @@ dlr_task_t *dlr_task_get_version_new(dleyna_connector_msg_id_t invocation) task->type = DLR_TASK_GET_VERSION; task->invocation = invocation; task->result_format = "(@s)"; - task->result = g_variant_ref_sink(g_variant_new_string(VERSION)); task->synchronous = TRUE; return task; @@ -56,7 +63,7 @@ dlr_task_t *dlr_task_get_servers_new(dleyna_connector_msg_id_t invocation) task->type = DLR_TASK_GET_SERVERS; task->invocation = invocation; - task->result_format = "(@as)"; + task->result_format = "(@ao)"; task->synchronous = TRUE; return task; @@ -90,9 +97,11 @@ static void prv_dlr_task_delete(dlr_task_t *task) dlr_async_task_delete((dlr_async_task_t *)task); switch (task->type) { + case DLR_TASK_MANAGER_GET_ALL_PROPS: case DLR_TASK_GET_ALL_PROPS: g_free(task->ut.get_props.interface_name); break; + case DLR_TASK_MANAGER_GET_PROP: case DLR_TASK_GET_PROP: g_free(task->ut.get_prop.interface_name); g_free(task->ut.get_prop.prop_name); @@ -103,6 +112,8 @@ static void prv_dlr_task_delete(dlr_task_t *task) g_variant_unref(task->ut.set_prop.params); break; case DLR_TASK_OPEN_URI: + case DLR_TASK_OPEN_NEXT_URI: + case DLR_TASK_SET_URI: g_free(task->ut.open_uri.uri); g_free(task->ut.open_uri.metadata); break; @@ -115,6 +126,10 @@ static void prv_dlr_task_delete(dlr_task_t *task) g_free(task->ut.get_icon.mime_type); g_free(task->ut.get_icon.resolution); break; + case DLR_TASK_WHITE_LIST_ADD_ENTRIES: + case DLR_TASK_WHITE_LIST_REMOVE_ENTRIES: + if (task->ut.white_list.entries != NULL) + g_variant_unref(task->ut.white_list.entries); default: break; } @@ -236,6 +251,17 @@ dlr_task_t *dlr_task_seek_new(dleyna_connector_msg_id_t invocation, return task; } +dlr_task_t *dlr_task_byte_seek_new(dleyna_connector_msg_id_t invocation, + const gchar *path, GVariant *parameters) +{ + dlr_task_t *task = prv_device_task_new(DLR_TASK_BYTE_SEEK, invocation, + path, NULL); + + g_variant_get(parameters, "(x)", &task->ut.seek.counter_position); + + return task; +} + dlr_task_t *dlr_task_set_position_new(dleyna_connector_msg_id_t invocation, const gchar *path, GVariant *parameters) { @@ -249,6 +275,21 @@ dlr_task_t *dlr_task_set_position_new(dleyna_connector_msg_id_t invocation, return task; } +dlr_task_t *dlr_task_set_byte_position_new(dleyna_connector_msg_id_t invocation, + const gchar *path, + GVariant *parameters) +{ + gchar *track_id; + + dlr_task_t *task = prv_device_task_new(DLR_TASK_SET_BYTE_POSITION, + invocation, path, NULL); + + g_variant_get(parameters, "(&ox)", &track_id, + &task->ut.seek.counter_position); + + return task; +} + dlr_task_t *dlr_task_goto_track_new(dleyna_connector_msg_id_t invocation, const gchar *path, GVariant *parameters) { @@ -271,7 +312,26 @@ dlr_task_t *dlr_task_open_uri_new(dleyna_connector_msg_id_t invocation, g_variant_get(parameters, "(s)", &task->ut.open_uri.uri); g_strstrip(task->ut.open_uri.uri); - task->ut.open_uri.metadata = NULL; + task->ut.open_uri.operation = DLR_TASK_SET_URI_OPERATION; + task->ut.open_uri.uri_type = DLR_TASK_SET_URI_TYPE; + task->ut.open_uri.metadata_type = DLR_TASK_SET_URI_META_DATA; + + return task; +} + +static dlr_task_t *prv_open_uri_ex_generic(dlr_task_t *task, + GVariant *parameters, + const gchar *operation, + const gchar *uri_type, + const gchar *metadata_type) +{ + g_variant_get(parameters, "(ss)", &task->ut.open_uri.uri, + &task->ut.open_uri.metadata); + g_strstrip(task->ut.open_uri.uri); + g_strstrip(task->ut.open_uri.metadata); + task->ut.open_uri.operation = operation; + task->ut.open_uri.uri_type = uri_type; + task->ut.open_uri.metadata_type = metadata_type; return task; } @@ -284,12 +344,41 @@ dlr_task_t *dlr_task_open_uri_ex_new(dleyna_connector_msg_id_t invocation, task = prv_device_task_new(DLR_TASK_OPEN_URI, invocation, path, NULL); - g_variant_get(parameters, "(ss)", - &task->ut.open_uri.uri, &task->ut.open_uri.metadata); - g_strstrip(task->ut.open_uri.uri); - g_strstrip(task->ut.open_uri.metadata); + return prv_open_uri_ex_generic(task, + parameters, + DLR_TASK_SET_URI_OPERATION, + DLR_TASK_SET_URI_TYPE, + DLR_TASK_SET_URI_META_DATA); +} - return task; +dlr_task_t *dlr_task_open_next_uri_new(dleyna_connector_msg_id_t invocation, + const gchar *path, GVariant *parameters) +{ + dlr_task_t *task; + + task = prv_device_task_new(DLR_TASK_OPEN_NEXT_URI, invocation, path, + NULL); + + return prv_open_uri_ex_generic(task, + parameters, + DLR_TASK_SET_NEXT_URI_OPERATION, + DLR_TASK_SET_NEXT_URI_TYPE, + DLR_TASK_SET_NEXT_URI_META_DATA); +} + +dlr_task_t *dlr_task_set_uri_new(dleyna_connector_msg_id_t invocation, + const gchar *path, GVariant *parameters) +{ + dlr_task_t *task; + + task = prv_device_task_new(DLR_TASK_SET_URI, invocation, path, + NULL); + + return prv_open_uri_ex_generic(task, + parameters, + DLR_TASK_SET_URI_OPERATION, + DLR_TASK_SET_URI_TYPE, + DLR_TASK_SET_URI_META_DATA); } dlr_task_t *dlr_task_host_uri_new(dleyna_connector_msg_id_t invocation, @@ -340,6 +429,97 @@ dlr_task_t *dlr_task_get_icon_new(dleyna_connector_msg_id_t invocation, return task; } +dlr_task_t *dlr_task_wl_enable_new(dleyna_connector_msg_id_t invocation, + GVariant *parameters) +{ + dlr_task_t *task = g_new0(dlr_task_t, 1); + + task->type = DLR_TASK_WHITE_LIST_ENABLE; + task->invocation = invocation; + task->synchronous = TRUE; + g_variant_get(parameters, "(b)", + &task->ut.white_list.enabled); + + return task; +} + +dlr_task_t *dlr_task_wl_clear_new(dleyna_connector_msg_id_t invocation) +{ + dlr_task_t *task = g_new0(dlr_task_t, 1); + + task->type = DLR_TASK_WHITE_LIST_CLEAR; + task->invocation = invocation; + task->synchronous = TRUE; + + return task; +} + +dlr_task_t *dlr_task_wl_add_entries_new(dleyna_connector_msg_id_t invocation, + GVariant *parameters) +{ + dlr_task_t *task = g_new0(dlr_task_t, 1); + + task->type = DLR_TASK_WHITE_LIST_ADD_ENTRIES; + task->invocation = invocation; + task->synchronous = TRUE; + g_variant_get(parameters, "(@as)", &task->ut.white_list.entries); + + return task; +} + +dlr_task_t *dlr_task_wl_remove_entries_new(dleyna_connector_msg_id_t invocation, + GVariant *parameters) +{ + dlr_task_t *task = g_new0(dlr_task_t, 1); + + task->type = DLR_TASK_WHITE_LIST_REMOVE_ENTRIES; + task->invocation = invocation; + task->synchronous = TRUE; + g_variant_get(parameters, "(@as)", &task->ut.white_list.entries); + + return task; +} + +dlr_task_t *dlr_task_manager_get_prop_new(dleyna_connector_msg_id_t invocation, + const gchar *path, + GVariant *parameters, + GError **error) +{ + dlr_task_t *task = (dlr_task_t *)g_new0(dlr_async_task_t, 1); + + g_variant_get(parameters, "(ss)", &task->ut.get_prop.interface_name, + &task->ut.get_prop.prop_name); + g_strstrip(task->ut.get_prop.interface_name); + g_strstrip(task->ut.get_prop.prop_name); + + task->path = g_strstrip(g_strdup(path)); + + task->type = DLR_TASK_MANAGER_GET_PROP; + task->invocation = invocation; + task->result_format = "(v)"; + + return task; +} + +dlr_task_t *dlr_task_manager_get_props_new(dleyna_connector_msg_id_t invocation, + const gchar *path, + GVariant *parameters, + GError **error) +{ + dlr_task_t *task = (dlr_task_t *)g_new0(dlr_async_task_t, 1); + + g_variant_get(parameters, "(s)", &task->ut.get_props.interface_name); + g_strstrip(task->ut.get_props.interface_name); + + task->path = g_strstrip(g_strdup(path)); + + task->type = DLR_TASK_MANAGER_GET_ALL_PROPS; + task->invocation = invocation; + task->result_format = "(@a{sv})"; + + return task; +} + void dlr_task_complete(dlr_task_t *task) { GVariant *result; diff --git a/dleyna-renderer/libdleyna/renderer/task.h b/dleyna-renderer/libdleyna/renderer/task.h index 3aa8c8b..161e6ad 100644 --- a/dleyna-renderer/libdleyna/renderer/task.h +++ b/dleyna-renderer/libdleyna/renderer/task.h @@ -45,12 +45,22 @@ enum dlr_task_type_t_ { DLR_TASK_NEXT, DLR_TASK_PREVIOUS, DLR_TASK_OPEN_URI, + DLR_TASK_OPEN_NEXT_URI, + DLR_TASK_SET_URI, DLR_TASK_SEEK, + DLR_TASK_BYTE_SEEK, DLR_TASK_SET_POSITION, + DLR_TASK_SET_BYTE_POSITION, DLR_TASK_GOTO_TRACK, DLR_TASK_HOST_URI, DLR_TASK_REMOVE_URI, - DLR_TASK_GET_ICON + DLR_TASK_GET_ICON, + DLR_TASK_WHITE_LIST_ENABLE, + DLR_TASK_WHITE_LIST_ADD_ENTRIES, + DLR_TASK_WHITE_LIST_REMOVE_ENTRIES, + DLR_TASK_WHITE_LIST_CLEAR, + DLR_TASK_MANAGER_GET_ALL_PROPS, + DLR_TASK_MANAGER_GET_PROP }; typedef enum dlr_task_type_t_ dlr_task_type_t; @@ -78,10 +88,14 @@ typedef struct dlr_task_open_uri_t_ dlr_task_open_uri_t; struct dlr_task_open_uri_t_ { gchar *uri; gchar *metadata; + const gchar *operation; + const gchar *uri_type; + const gchar *metadata_type; }; typedef struct dlr_task_seek_t_ dlr_task_seek_t; struct dlr_task_seek_t_ { + guint64 counter_position; gint64 position; guint32 track_number; }; @@ -98,6 +112,12 @@ struct dlr_task_get_icon_t_ { gchar *resolution; }; +typedef struct dlr_task_white_list_t_ dlr_task_white_list_t; +struct dlr_task_white_list_t_ { + gboolean enabled; + GVariant *entries; +}; + typedef struct dlr_task_t_ dlr_task_t; struct dlr_task_t_ { dleyna_task_atom_t atom; /* pseudo inheritance - MUST be first field */ @@ -116,6 +136,7 @@ struct dlr_task_t_ { dlr_task_host_uri_t host_uri; dlr_task_seek_t seek; dlr_task_get_icon_t get_icon; + dlr_task_white_list_t white_list; } ut; }; @@ -159,9 +180,16 @@ dlr_task_t *dlr_task_previous_new(dleyna_connector_msg_id_t invocation, dlr_task_t *dlr_task_seek_new(dleyna_connector_msg_id_t invocation, const gchar *path, GVariant *parameters); +dlr_task_t *dlr_task_byte_seek_new(dleyna_connector_msg_id_t invocation, + const gchar *path, GVariant *parameters); + dlr_task_t *dlr_task_set_position_new(dleyna_connector_msg_id_t invocation, const gchar *path, GVariant *parameters); +dlr_task_t *dlr_task_set_byte_position_new(dleyna_connector_msg_id_t invocation, + const gchar *path, + GVariant *parameters); + dlr_task_t *dlr_task_goto_track_new(dleyna_connector_msg_id_t invocation, const gchar *path, GVariant *parameters); @@ -171,6 +199,12 @@ dlr_task_t *dlr_task_open_uri_new(dleyna_connector_msg_id_t invocation, dlr_task_t *dlr_task_open_uri_ex_new(dleyna_connector_msg_id_t invocation, const gchar *path, GVariant *parameters); +dlr_task_t *dlr_task_open_next_uri_new(dleyna_connector_msg_id_t invocation, + const gchar *path, GVariant *parameters); + +dlr_task_t *dlr_task_set_uri_new(dleyna_connector_msg_id_t invocation, + const gchar *path, GVariant *parameters); + dlr_task_t *dlr_task_host_uri_new(dleyna_connector_msg_id_t invocation, const gchar *path, const gchar *sender, GVariant *parameters); @@ -182,6 +216,27 @@ dlr_task_t *dlr_task_remove_uri_new(dleyna_connector_msg_id_t invocation, dlr_task_t *dlr_task_get_icon_new(dleyna_connector_msg_id_t invocation, const gchar *path, GVariant *parameters); +dlr_task_t *dlr_task_wl_enable_new(dleyna_connector_msg_id_t invocation, + GVariant *parameters); + +dlr_task_t *dlr_task_wl_clear_new(dleyna_connector_msg_id_t invocation); + +dlr_task_t *dlr_task_wl_add_entries_new(dleyna_connector_msg_id_t invocation, + GVariant *parameters); + +dlr_task_t *dlr_task_wl_remove_entries_new(dleyna_connector_msg_id_t invocation, + GVariant *parameters); + +dlr_task_t *dlr_task_manager_get_prop_new(dleyna_connector_msg_id_t invocation, + const gchar *path, + GVariant *parameters, + GError **error); + +dlr_task_t *dlr_task_manager_get_props_new(dleyna_connector_msg_id_t invocation, + const gchar *path, + GVariant *parameters, + GError **error); + void dlr_task_complete(dlr_task_t *task); void dlr_task_fail(dlr_task_t *task, GError *error); diff --git a/dleyna-renderer/libdleyna/renderer/upnp.c b/dleyna-renderer/libdleyna/renderer/upnp.c index ee45166..fefc340 100644 --- a/dleyna-renderer/libdleyna/renderer/upnp.c +++ b/dleyna-renderer/libdleyna/renderer/upnp.c @@ -162,12 +162,12 @@ static void prv_server_available_cb(GUPnPControlPoint *cp, udn = gupnp_device_info_get_udn((GUPnPDeviceInfo *)proxy); - if (!udn) - goto on_error; - ip_address = gupnp_context_get_host_ip( gupnp_control_point_get_context(cp)); + if (!udn || !ip_address) + goto on_error; + DLEYNA_LOG_DEBUG("UDN %s", udn); DLEYNA_LOG_DEBUG("IP Address %s", ip_address); @@ -248,12 +248,12 @@ static void prv_server_unavailable_cb(GUPnPControlPoint *cp, udn = gupnp_device_info_get_udn((GUPnPDeviceInfo *)proxy); - if (!udn) - goto on_error; - ip_address = gupnp_context_get_host_ip( gupnp_control_point_get_context(cp)); + if (!udn || !ip_address) + goto on_error; + DLEYNA_LOG_DEBUG("UDN %s", udn); DLEYNA_LOG_DEBUG("IP Address %s", ip_address); @@ -411,12 +411,12 @@ GVariant *dlr_upnp_get_server_ids(dlr_upnp_t *upnp) DLEYNA_LOG_DEBUG("Enter"); - g_variant_builder_init(&vb, G_VARIANT_TYPE("as")); + g_variant_builder_init(&vb, G_VARIANT_TYPE("ao")); g_hash_table_iter_init(&iter, upnp->server_udn_map); while (g_hash_table_iter_next(&iter, NULL, &value)) { device = value; - g_variant_builder_add(&vb, "s", device->path); + g_variant_builder_add(&vb, "o", device->path); } DLEYNA_LOG_DEBUG("Exit"); @@ -846,3 +846,8 @@ void dlr_upnp_rescan(dlr_upnp_t *upnp) gupnp_context_manager_rescan_control_points(upnp->context_manager); } + +GUPnPContextManager *dlr_upnp_get_context_manager(dlr_upnp_t *upnp) +{ + return upnp->context_manager; +} diff --git a/dleyna-renderer/libdleyna/renderer/upnp.h b/dleyna-renderer/libdleyna/renderer/upnp.h index db98bd3..9a42e60 100644 --- a/dleyna-renderer/libdleyna/renderer/upnp.h +++ b/dleyna-renderer/libdleyna/renderer/upnp.h @@ -23,6 +23,7 @@ #ifndef DLR_UPNP_H__ #define DLR_UPNP_H__ +#include #include #include "server.h" @@ -105,4 +106,6 @@ void dlr_upnp_unsubscribe(dlr_upnp_t *upnp); void dlr_upnp_rescan(dlr_upnp_t *upnp); +GUPnPContextManager *dlr_upnp_get_context_manager(dlr_upnp_t *upnp); + #endif /* DLR_UPNP_H__ */ diff --git a/dleyna-renderer/m4/libtool.m4 b/dleyna-renderer/m4/libtool.m4 index 828104c..02b4bbe 100644 --- a/dleyna-renderer/m4/libtool.m4 +++ b/dleyna-renderer/m4/libtool.m4 @@ -1324,7 +1324,14 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*) LD="${LD-ld} -m elf_i386_fbsd" ;; x86_64-*linux*) - LD="${LD-ld} -m elf_i386" + case `/usr/bin/file conftest.o` in + *x86-64*) + LD="${LD-ld} -m elf32_x86_64" + ;; + *) + LD="${LD-ld} -m elf_i386" + ;; + esac ;; ppc64-*linux*|powerpc64-*linux*) LD="${LD-ld} -m elf32ppclinux" @@ -1688,7 +1695,8 @@ AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl ;; *) lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null` - if test -n "$lt_cv_sys_max_cmd_len"; then + if test -n "$lt_cv_sys_max_cmd_len" && \ + test undefined != "$lt_cv_sys_max_cmd_len"; then lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` else @@ -2512,17 +2520,6 @@ freebsd* | dragonfly*) esac ;; -gnu*) - version_type=linux # correct to gnu/linux during the next big refactor - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - ;; - haiku*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no @@ -2639,7 +2636,7 @@ linux*oldld* | linux*aout* | linux*coff*) ;; # This must be glibc/ELF. -linux* | k*bsd*-gnu | kopensolaris*-gnu) +linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no @@ -3255,10 +3252,6 @@ freebsd* | dragonfly*) fi ;; -gnu*) - lt_cv_deplibs_check_method=pass_all - ;; - haiku*) lt_cv_deplibs_check_method=pass_all ;; @@ -3297,7 +3290,7 @@ irix5* | irix6* | nonstopux*) ;; # This must be glibc/ELF. -linux* | k*bsd*-gnu | kopensolaris*-gnu) +linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) lt_cv_deplibs_check_method=pass_all ;; @@ -4049,7 +4042,7 @@ m4_if([$1], [CXX], [ ;; esac ;; - linux* | k*bsd*-gnu | kopensolaris*-gnu) + linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) case $cc_basename in KCC*) # KAI C++ Compiler @@ -4348,7 +4341,7 @@ m4_if([$1], [CXX], [ _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; - linux* | k*bsd*-gnu | kopensolaris*-gnu) + linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) case $cc_basename in # old Intel for x86_64 which still supported -KPIC. ecc*) @@ -6241,9 +6234,6 @@ if test "$_lt_caught_CXX_error" != yes; then _LT_TAGVAR(ld_shlibs, $1)=yes ;; - gnu*) - ;; - haiku*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(link_all_deplibs, $1)=yes @@ -6405,7 +6395,7 @@ if test "$_lt_caught_CXX_error" != yes; then _LT_TAGVAR(inherit_rpath, $1)=yes ;; - linux* | k*bsd*-gnu | kopensolaris*-gnu) + linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) case $cc_basename in KCC*) # Kuck and Associates, Inc. (KAI) C++ Compiler diff --git a/dleyna-server/ChangeLog b/dleyna-server/ChangeLog index f88001f..ed08b55 100644 --- a/dleyna-server/ChangeLog +++ b/dleyna-server/ChangeLog @@ -1,3 +1,12 @@ +version 0.2.1 + - Various build optimizations + - Fix a crash case when the server stops + - Added the new TypeEx property and fixed Type + - Some documentation fixes + - Code cleanup + - Add a sample upload sync controller app + - Add network filtering support + version 0.1.0 - Prepare for first stable branch diff --git a/dleyna-server/build-aux/ltmain.sh b/dleyna-server/build-aux/ltmain.sh index 0096fe6..b9205ee 100644 --- a/dleyna-server/build-aux/ltmain.sh +++ b/dleyna-server/build-aux/ltmain.sh @@ -70,7 +70,7 @@ # compiler: $LTCC # compiler flags: $LTCFLAGS # linker: $LD (gnu? $with_gnu_ld) -# $progname: (GNU libtool) 2.4.2 Debian-2.4.2-1ubuntu2 +# $progname: (GNU libtool) 2.4.2 Debian-2.4.2-1.2ubuntu1 # automake: $automake_version # autoconf: $autoconf_version # @@ -80,7 +80,7 @@ PROGRAM=libtool PACKAGE=libtool -VERSION="2.4.2 Debian-2.4.2-1ubuntu2" +VERSION="2.4.2 Debian-2.4.2-1.2ubuntu1" TIMESTAMP="" package_revision=1.3337 diff --git a/dleyna-server/configure b/dleyna-server/configure index d7f98a4..5679d33 100755 --- a/dleyna-server/configure +++ b/dleyna-server/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for dleyna-server 0.2.0. +# Generated by GNU Autoconf 2.69 for dleyna-server 0.2.1. # # Report bugs to . # @@ -590,8 +590,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='dleyna-server' PACKAGE_TARNAME='dleyna-server' -PACKAGE_VERSION='0.2.0' -PACKAGE_STRING='dleyna-server 0.2.0' +PACKAGE_VERSION='0.2.1' +PACKAGE_STRING='dleyna-server 0.2.1' PACKAGE_BUGREPORT='https://github.com/01org/dleyna-server/issues/new' PACKAGE_URL='https://01.org/dleyna/' @@ -1374,7 +1374,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures dleyna-server 0.2.0 to adapt to many kinds of systems. +\`configure' configures dleyna-server 0.2.1 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1444,7 +1444,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of dleyna-server 0.2.0:";; + short | recursive ) echo "Configuration of dleyna-server 0.2.1:";; esac cat <<\_ACEOF @@ -1594,7 +1594,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -dleyna-server configure 0.2.0 +dleyna-server configure 0.2.1 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -2071,7 +2071,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by dleyna-server $as_me 0.2.0, which was +It was created by dleyna-server $as_me 0.2.1, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -2894,7 +2894,7 @@ fi # Define the identity of the package. PACKAGE='dleyna-server' - VERSION='0.2.0' + VERSION='0.2.1' cat >>confdefs.h <<_ACEOF @@ -5037,7 +5037,8 @@ else ;; *) lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null` - if test -n "$lt_cv_sys_max_cmd_len"; then + if test -n "$lt_cv_sys_max_cmd_len" && \ + test undefined != "$lt_cv_sys_max_cmd_len"; then lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` else @@ -5438,10 +5439,6 @@ freebsd* | dragonfly*) fi ;; -gnu*) - lt_cv_deplibs_check_method=pass_all - ;; - haiku*) lt_cv_deplibs_check_method=pass_all ;; @@ -5480,7 +5477,7 @@ irix5* | irix6* | nonstopux*) ;; # This must be glibc/ELF. -linux* | k*bsd*-gnu | kopensolaris*-gnu) +linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) lt_cv_deplibs_check_method=pass_all ;; @@ -6578,7 +6575,14 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*) LD="${LD-ld} -m elf_i386_fbsd" ;; x86_64-*linux*) - LD="${LD-ld} -m elf_i386" + case `/usr/bin/file conftest.o` in + *x86-64*) + LD="${LD-ld} -m elf32_x86_64" + ;; + *) + LD="${LD-ld} -m elf_i386" + ;; + esac ;; ppc64-*linux*|powerpc64-*linux*) LD="${LD-ld} -m elf32ppclinux" @@ -8405,7 +8409,7 @@ lt_prog_compiler_static= lt_prog_compiler_static='-non_shared' ;; - linux* | k*bsd*-gnu | kopensolaris*-gnu) + linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) case $cc_basename in # old Intel for x86_64 which still supported -KPIC. ecc*) @@ -10575,17 +10579,6 @@ freebsd* | dragonfly*) esac ;; -gnu*) - version_type=linux # correct to gnu/linux during the next big refactor - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - ;; - haiku*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no @@ -10702,7 +10695,7 @@ linux*oldld* | linux*aout* | linux*coff*) ;; # This must be glibc/ELF. -linux* | k*bsd*-gnu | kopensolaris*-gnu) +linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no @@ -12867,12 +12860,12 @@ if test -n "$DLEYNA_CORE_CFLAGS"; then pkg_cv_DLEYNA_CORE_CFLAGS="$DLEYNA_CORE_CFLAGS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ - { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"dleyna-core-1.0 >= 0.0.1\""; } >&5 - ($PKG_CONFIG --exists --print-errors "dleyna-core-1.0 >= 0.0.1") 2>&5 + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"dleyna-core-1.0 >= 0.2.2\""; } >&5 + ($PKG_CONFIG --exists --print-errors "dleyna-core-1.0 >= 0.2.2") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then - pkg_cv_DLEYNA_CORE_CFLAGS=`$PKG_CONFIG --cflags "dleyna-core-1.0 >= 0.0.1" 2>/dev/null` + pkg_cv_DLEYNA_CORE_CFLAGS=`$PKG_CONFIG --cflags "dleyna-core-1.0 >= 0.2.2" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes @@ -12884,12 +12877,12 @@ if test -n "$DLEYNA_CORE_LIBS"; then pkg_cv_DLEYNA_CORE_LIBS="$DLEYNA_CORE_LIBS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ - { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"dleyna-core-1.0 >= 0.0.1\""; } >&5 - ($PKG_CONFIG --exists --print-errors "dleyna-core-1.0 >= 0.0.1") 2>&5 + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"dleyna-core-1.0 >= 0.2.2\""; } >&5 + ($PKG_CONFIG --exists --print-errors "dleyna-core-1.0 >= 0.2.2") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then - pkg_cv_DLEYNA_CORE_LIBS=`$PKG_CONFIG --libs "dleyna-core-1.0 >= 0.0.1" 2>/dev/null` + pkg_cv_DLEYNA_CORE_LIBS=`$PKG_CONFIG --libs "dleyna-core-1.0 >= 0.2.2" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes @@ -12910,14 +12903,14 @@ else _pkg_short_errors_supported=no fi if test $_pkg_short_errors_supported = yes; then - DLEYNA_CORE_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "dleyna-core-1.0 >= 0.0.1" 2>&1` + DLEYNA_CORE_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "dleyna-core-1.0 >= 0.2.2" 2>&1` else - DLEYNA_CORE_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "dleyna-core-1.0 >= 0.0.1" 2>&1` + DLEYNA_CORE_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "dleyna-core-1.0 >= 0.2.2" 2>&1` fi # Put the nasty error message in config.log where it belongs echo "$DLEYNA_CORE_PKG_ERRORS" >&5 - as_fn_error $? "Package requirements (dleyna-core-1.0 >= 0.0.1) were not met: + as_fn_error $? "Package requirements (dleyna-core-1.0 >= 0.2.2) were not met: $DLEYNA_CORE_PKG_ERRORS @@ -13750,7 +13743,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by dleyna-server $as_me 0.2.0, which was +This file was extended by dleyna-server $as_me 0.2.1, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -13817,7 +13810,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -dleyna-server config.status 0.2.0 +dleyna-server config.status 0.2.1 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" @@ -15604,7 +15597,7 @@ CFLAGS : '${CFLAGS}' - enable-werror : ${enable_werror} - enable-debug : ${enable_debug} - enable-never-quit : ${enable_never_quit} - - with_connector-name : ${with_connector_name} + - with-connector-name : ${with_connector_name} - disable-optimization : ${disable_optimization} - with-log-level : ${with_log_level} - with-log-type : ${with_log_type} diff --git a/dleyna-server/configure.ac b/dleyna-server/configure.ac index 4641653..03d5642 100644 --- a/dleyna-server/configure.ac +++ b/dleyna-server/configure.ac @@ -1,7 +1,7 @@ AC_PREREQ([2.66]) AC_INIT([dleyna-server], - [0.2.0], + [0.2.1], [https://github.com/01org/dleyna-server/issues/new], , [https://01.org/dleyna/]) @@ -83,7 +83,7 @@ AC_ARG_ENABLE(master-build,, [master_build=no]) AS_IF([test "x$master_build" = "xno"], - [PKG_CHECK_MODULES([DLEYNA_CORE], [dleyna-core-1.0 >= 0.0.1])], + [PKG_CHECK_MODULES([DLEYNA_CORE], [dleyna-core-1.0 >= 0.2.2])], [this_abs_top_srcdir=`cd "$srcdir" && pwd`; DLEYNA_CORE_CFLAGS="-I$this_abs_top_srcdir/../dleyna-core"; DLEYNA_CORE_LIBS="-L$this_abs_top_srcdir/../dleyna-core/.libs -ldleyna-core-1.0" @@ -247,7 +247,7 @@ CFLAGS : '${CFLAGS}' - enable-werror : ${enable_werror} - enable-debug : ${enable_debug} - enable-never-quit : ${enable_never_quit} - - with_connector-name : ${with_connector_name} + - with-connector-name : ${with_connector_name} - disable-optimization : ${disable_optimization} - with-log-level : ${with_log_level} - with-log-type : ${with_log_type} diff --git a/dleyna-server/libdleyna/server/Makefile.am b/dleyna-server/libdleyna/server/Makefile.am index 7b2996d..9c5c26b 100644 --- a/dleyna-server/libdleyna/server/Makefile.am +++ b/dleyna-server/libdleyna/server/Makefile.am @@ -1,6 +1,6 @@ libdleyna_serverincdir = $(includedir)/dleyna-1.0/libdleyna/server -DLEYNA_SERVER_VERSION = 1:2:0 +DLEYNA_SERVER_VERSION = 1:3:0 AM_CFLAGS = $(GLIB_CFLAGS) \ $(GIO_CFLAGS) \ @@ -14,7 +14,7 @@ AM_CFLAGS = $(GLIB_CFLAGS) \ ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS} -lib_LTLIBRARIES = libdleyna-server-1.0.la +pkglib_LTLIBRARIES = libdleyna-server-1.0.la libdleyna_serverinc_HEADERS = control-point-server.h @@ -25,6 +25,7 @@ libdleyna_server_1_0_la_SOURCES = $(libdleyna_serverinc_HEADERS) \ server.c \ async.c \ device.c \ + manager.c \ path.c \ props.c \ search.c \ @@ -61,6 +62,7 @@ EXTRA_DIST = $(sysconf_DATA) \ client.h \ device.h \ interface.h \ + manager.h \ path.h \ props.h \ search.h \ diff --git a/dleyna-server/libdleyna/server/Makefile.in b/dleyna-server/libdleyna/server/Makefile.in index 58002b5..efac75c 100644 --- a/dleyna-server/libdleyna/server/Makefile.in +++ b/dleyna-server/libdleyna/server/Makefile.in @@ -96,10 +96,10 @@ am__uninstall_files_from_dir = { \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } -am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(pkgconfigdir)" \ +am__installdirs = "$(DESTDIR)$(pkglibdir)" "$(DESTDIR)$(pkgconfigdir)" \ "$(DESTDIR)$(sysconfdir)" \ "$(DESTDIR)$(libdleyna_serverincdir)" -LTLIBRARIES = $(lib_LTLIBRARIES) +LTLIBRARIES = $(pkglib_LTLIBRARIES) am__DEPENDENCIES_1 = libdleyna_server_1_0_la_DEPENDENCIES = $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \ @@ -108,8 +108,8 @@ libdleyna_server_1_0_la_DEPENDENCIES = $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) am__objects_1 = am_libdleyna_server_1_0_la_OBJECTS = $(am__objects_1) server.lo \ - async.lo device.lo path.lo props.lo search.lo sort.lo task.lo \ - upnp.lo + async.lo device.lo manager.lo path.lo props.lo search.lo \ + sort.lo task.lo upnp.lo libdleyna_server_1_0_la_OBJECTS = \ $(am_libdleyna_server_1_0_la_OBJECTS) AM_V_lt = $(am__v_lt_@AM_V@) @@ -300,7 +300,7 @@ with_connector_name = @with_connector_name@ with_log_level = @with_log_level@ with_log_type = @with_log_type@ libdleyna_serverincdir = $(includedir)/dleyna-1.0/libdleyna/server -DLEYNA_SERVER_VERSION = 1:2:0 +DLEYNA_SERVER_VERSION = 1:3:0 AM_CFLAGS = $(GLIB_CFLAGS) \ $(GIO_CFLAGS) \ $(DLEYNA_CORE_CFLAGS) \ @@ -312,7 +312,7 @@ AM_CFLAGS = $(GLIB_CFLAGS) \ -include config.h ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS} -lib_LTLIBRARIES = libdleyna-server-1.0.la +pkglib_LTLIBRARIES = libdleyna-server-1.0.la libdleyna_serverinc_HEADERS = control-point-server.h libdleyna_server_1_0_la_LDFLAGS = -version-info $(DLEYNA_SERVER_VERSION) \ -no-undefined @@ -321,6 +321,7 @@ libdleyna_server_1_0_la_SOURCES = $(libdleyna_serverinc_HEADERS) \ server.c \ async.c \ device.c \ + manager.c \ path.c \ props.c \ search.c \ @@ -355,6 +356,7 @@ EXTRA_DIST = $(sysconf_DATA) \ client.h \ device.h \ interface.h \ + manager.h \ path.h \ props.h \ search.h \ @@ -403,40 +405,40 @@ dleyna-server-1.0.pc: $(top_builddir)/config.status $(srcdir)/dleyna-server-1.0. cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ dleyna-server-service.conf: $(top_builddir)/config.status $(srcdir)/dleyna-server-service.conf.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ -install-libLTLIBRARIES: $(lib_LTLIBRARIES) +install-pkglibLTLIBRARIES: $(pkglib_LTLIBRARIES) @$(NORMAL_INSTALL) - @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ + @list='$(pkglib_LTLIBRARIES)'; test -n "$(pkglibdir)" || list=; \ list2=; for p in $$list; do \ if test -f $$p; then \ list2="$$list2 $$p"; \ else :; fi; \ done; \ test -z "$$list2" || { \ - echo " $(MKDIR_P) '$(DESTDIR)$(libdir)'"; \ - $(MKDIR_P) "$(DESTDIR)$(libdir)" || exit 1; \ - echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \ - $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \ + echo " $(MKDIR_P) '$(DESTDIR)$(pkglibdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(pkglibdir)" || exit 1; \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(pkglibdir)'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(pkglibdir)"; \ } -uninstall-libLTLIBRARIES: +uninstall-pkglibLTLIBRARIES: @$(NORMAL_UNINSTALL) - @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ + @list='$(pkglib_LTLIBRARIES)'; test -n "$(pkglibdir)" || list=; \ for p in $$list; do \ $(am__strip_dir) \ - echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \ - $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(pkglibdir)/$$f'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(pkglibdir)/$$f"; \ done -clean-libLTLIBRARIES: - -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) - @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ +clean-pkglibLTLIBRARIES: + -test -z "$(pkglib_LTLIBRARIES)" || rm -f $(pkglib_LTLIBRARIES) + @list='$(pkglib_LTLIBRARIES)'; for p in $$list; do \ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ test "$$dir" != "$$p" || dir=.; \ echo "rm -f \"$${dir}/so_locations\""; \ rm -f "$${dir}/so_locations"; \ done libdleyna-server-1.0.la: $(libdleyna_server_1_0_la_OBJECTS) $(libdleyna_server_1_0_la_DEPENDENCIES) $(EXTRA_libdleyna_server_1_0_la_DEPENDENCIES) - $(AM_V_CCLD)$(libdleyna_server_1_0_la_LINK) -rpath $(libdir) $(libdleyna_server_1_0_la_OBJECTS) $(libdleyna_server_1_0_la_LIBADD) $(LIBS) + $(AM_V_CCLD)$(libdleyna_server_1_0_la_LINK) -rpath $(pkglibdir) $(libdleyna_server_1_0_la_OBJECTS) $(libdleyna_server_1_0_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) @@ -446,6 +448,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/async.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/device.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/manager.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/path.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/props.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/search.Plo@am__quote@ @@ -633,7 +636,7 @@ check-am: all-am check: check-am all-am: Makefile $(LTLIBRARIES) $(DATA) $(HEADERS) installdirs: - for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(pkgconfigdir)" "$(DESTDIR)$(sysconfdir)" "$(DESTDIR)$(libdleyna_serverincdir)"; do \ + for dir in "$(DESTDIR)$(pkglibdir)" "$(DESTDIR)$(pkgconfigdir)" "$(DESTDIR)$(sysconfdir)" "$(DESTDIR)$(libdleyna_serverincdir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am @@ -671,7 +674,7 @@ maintainer-clean-generic: -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) clean: clean-am -clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \ +clean-am: clean-generic clean-libtool clean-pkglibLTLIBRARIES \ mostlyclean-am distclean: distclean-am @@ -699,7 +702,7 @@ install-dvi: install-dvi-am install-dvi-am: -install-exec-am: install-libLTLIBRARIES install-sysconfDATA +install-exec-am: install-pkglibLTLIBRARIES install-sysconfDATA install-html: install-html-am @@ -740,28 +743,28 @@ ps: ps-am ps-am: -uninstall-am: uninstall-libLTLIBRARIES \ - uninstall-libdleyna_serverincHEADERS uninstall-pkgconfigDATA \ +uninstall-am: uninstall-libdleyna_serverincHEADERS \ + uninstall-pkgconfigDATA uninstall-pkglibLTLIBRARIES \ uninstall-sysconfDATA .MAKE: install-am install-strip .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ - clean-libLTLIBRARIES clean-libtool ctags distclean \ + clean-libtool clean-pkglibLTLIBRARIES ctags distclean \ distclean-compile distclean-generic distclean-libtool \ distclean-tags distdir dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am install-dvi \ install-dvi-am install-exec install-exec-am install-html \ install-html-am install-info install-info-am \ - install-libLTLIBRARIES install-libdleyna_serverincHEADERS \ - install-man install-pdf install-pdf-am install-pkgconfigDATA \ + install-libdleyna_serverincHEADERS install-man install-pdf \ + install-pdf-am install-pkgconfigDATA install-pkglibLTLIBRARIES \ install-ps install-ps-am install-strip install-sysconfDATA \ installcheck installcheck-am installdirs maintainer-clean \ maintainer-clean-generic maintainer-clean-local mostlyclean \ mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ pdf pdf-am ps ps-am tags uninstall uninstall-am \ - uninstall-libLTLIBRARIES uninstall-libdleyna_serverincHEADERS \ - uninstall-pkgconfigDATA uninstall-sysconfDATA + uninstall-libdleyna_serverincHEADERS uninstall-pkgconfigDATA \ + uninstall-pkglibLTLIBRARIES uninstall-sysconfDATA maintainer-clean-local: diff --git a/dleyna-server/libdleyna/server/async.c b/dleyna-server/libdleyna/server/async.c index 324e8ee..5571f70 100644 --- a/dleyna-server/libdleyna/server/async.c +++ b/dleyna-server/libdleyna/server/async.c @@ -34,6 +34,7 @@ void dls_async_task_delete(dls_async_task_t *cb_data) if (cb_data->ut.bas.vbs) g_ptr_array_unref(cb_data->ut.bas.vbs); break; + case DLS_TASK_MANAGER_GET_ALL_PROPS: case DLS_TASK_GET_ALL_PROPS: case DLS_TASK_GET_RESOURCE: if (cb_data->ut.get_all.vb) diff --git a/dleyna-server/libdleyna/server/device.c b/dleyna-server/libdleyna/server/device.c index 1c3b6a4..fdcaa2d 100644 --- a/dleyna-server/libdleyna/server/device.c +++ b/dleyna-server/libdleyna/server/device.c @@ -295,7 +295,7 @@ static void prv_last_change_decode(GUPnPCDSLastChangeEntry *entry, if (!mclass) goto on_error; - media_class = dls_props_upnp_class_to_media_spec(mclass); + media_class = dls_props_upnp_class_to_media_spec_ex(mclass); if (!media_class) goto on_error; @@ -769,9 +769,19 @@ static void prv_get_capabilities_analyze(GHashTable *property_map, while (caps && *caps) { prop_name = g_hash_table_lookup(property_map, *caps); - if (prop_name) + if (prop_name) { g_variant_builder_add(&caps_vb, "s", prop_name); + /* TODO: Okay this is not very nice. A better + way to fix this would be to change the p_map + to be many : many. */ + + if (!strcmp(*caps, "upnp:class")) + g_variant_builder_add( + &caps_vb, "s", + DLS_INTERFACE_PROP_TYPE_EX); + } + caps++; } @@ -1705,7 +1715,7 @@ static int prv_get_media_server_version(const dls_device_t *device) device_type = gupnp_device_info_get_device_type((GUPnPDeviceInfo *) context->device_proxy); - if (!g_str_has_prefix(device_type, DLS_DMS_DEVICE_TYPE)) + if (!device_type || !g_str_has_prefix(device_type, DLS_DMS_DEVICE_TYPE)) goto on_error; version = device_type + sizeof(DLS_DMS_DEVICE_TYPE) - 1; @@ -2858,11 +2868,11 @@ static gchar *prv_create_new_container_didl(const gchar *parent_id, GUPnPDIDLLiteContainer *container; GVariantIter iter; GVariant *child_type; - const gchar *actual_type; + gchar *actual_type; GUPnPOCMFlags flags; gchar *retval = NULL; - actual_type = dls_props_media_spec_to_upnp_class( + actual_type = dls_props_media_spec_ex_to_upnp_class( task->ut.create_container.type); if (!actual_type) goto on_error; @@ -2878,6 +2888,7 @@ static gchar *prv_create_new_container_didl(const gchar *parent_id, task->ut.create_container.display_name); gupnp_didl_lite_object_set_parent_id(item, parent_id); gupnp_didl_lite_object_set_upnp_class(item, actual_type); + g_free(actual_type); gupnp_didl_lite_object_set_restricted(item, FALSE); flags = GUPNP_OCM_FLAGS_UPLOAD | @@ -2890,11 +2901,13 @@ static gchar *prv_create_new_container_didl(const gchar *parent_id, g_variant_iter_init(&iter, task->ut.create_container.child_types); while ((child_type = g_variant_iter_next_value(&iter))) { - actual_type = dls_props_media_spec_to_upnp_class( + actual_type = dls_props_media_spec_ex_to_upnp_class( g_variant_get_string(child_type, NULL)); - if (actual_type != NULL) + if (actual_type != NULL) { gupnp_didl_lite_container_add_create_class(container, actual_type); + g_free(actual_type); + } g_variant_unref(child_type); } @@ -3785,7 +3798,7 @@ static gchar *prv_get_current_xml_fragment(GUPnPDIDLLiteObject *object, retval = gupnp_didl_lite_object_get_album_xml_string(object); else if (mask & DLS_UPNP_MASK_PROP_DATE) retval = gupnp_didl_lite_object_get_date_xml_string(object); - else if (mask & DLS_UPNP_MASK_PROP_TYPE) + else if (mask & DLS_UPNP_MASK_PROP_TYPE_EX) retval = gupnp_didl_lite_object_get_upnp_class_xml_string( object); else if (mask & DLS_UPNP_MASK_PROP_TRACK_NUMBER) @@ -3803,7 +3816,7 @@ static gchar *prv_get_new_xml_fragment(GUPnPDIDLLiteObject *object, { GUPnPDIDLLiteContributor *artist; const gchar *artist_name; - const gchar *upnp_class; + gchar *upnp_class; GVariantIter viter; gchar *retval = NULL; @@ -3825,13 +3838,14 @@ static gchar *prv_get_new_xml_fragment(GUPnPDIDLLiteObject *object, g_variant_get_string(value, NULL)); retval = gupnp_didl_lite_object_get_date_xml_string(object); - } else if (mask & DLS_UPNP_MASK_PROP_TYPE) { - upnp_class = dls_props_media_spec_to_upnp_class( - g_variant_get_string(value, NULL)); + } else if (mask & DLS_UPNP_MASK_PROP_TYPE_EX) { + upnp_class = dls_props_media_spec_ex_to_upnp_class( + g_variant_get_string(value, NULL)); if (!upnp_class) goto on_error; gupnp_didl_lite_object_set_upnp_class(object, upnp_class); + g_free(upnp_class); retval = gupnp_didl_lite_object_get_upnp_class_xml_string( object); diff --git a/dleyna-server/libdleyna/server/dleyna-server-1.0.pc.in b/dleyna-server/libdleyna/server/dleyna-server-1.0.pc.in index 4f7f5a2..c56881a 100644 --- a/dleyna-server/libdleyna/server/dleyna-server-1.0.pc.in +++ b/dleyna-server/libdleyna/server/dleyna-server-1.0.pc.in @@ -2,7 +2,7 @@ prefix=@prefix@ exec_prefix=@exec_prefix@ libexecdir=@libexecdir@ includedir=${prefix}/include -libdir=@libdir@ +libdir=@libdir@/@PACKAGE@ Name: @PACKAGE@ Description: UPnP & DLNA server library diff --git a/dleyna-server/libdleyna/server/dleyna-server-service.conf b/dleyna-server/libdleyna/server/dleyna-server-service.conf index 1a2fe6d..0f647ab 100644 --- a/dleyna-server/libdleyna/server/dleyna-server-service.conf +++ b/dleyna-server/libdleyna/server/dleyna-server-service.conf @@ -12,6 +12,7 @@ never-quit=false # IPC connector name connector-name=dbus + # Log configuration options [log] @@ -35,3 +36,15 @@ log-type=0 # You can't enable levels disabled at compile time # level=8 means all level flags defined at compile time. log-level=7 + + +# Network filtering +[netf] + +# true: Enable the network filtering. +# false: Disable the network filtering. +netf-enabled=false + +# Comma-separated list of interface name, SSID or IP address. +# If netf is enabled but the list is empty, it behaves as disabled. +netf-list= diff --git a/dleyna-server/libdleyna/server/dleyna-server-service.conf.in b/dleyna-server/libdleyna/server/dleyna-server-service.conf.in index 0acca2c..5cec2b8 100644 --- a/dleyna-server/libdleyna/server/dleyna-server-service.conf.in +++ b/dleyna-server/libdleyna/server/dleyna-server-service.conf.in @@ -12,6 +12,7 @@ never-quit=@never_quit@ # IPC connector name connector-name=@with_connector_name@ + # Log configuration options [log] @@ -35,3 +36,15 @@ log-type=@with_log_type@ # You can't enable levels disabled at compile time # level=8 means all level flags defined at compile time. log-level=@with_log_level@ + + +# Network filtering +[netf] + +# true: Enable the network filtering. +# false: Disable the network filtering. +netf-enabled=false + +# Comma-separated list of interface name, SSID or IP address. +# If netf is enabled but the list is empty, it behaves as disabled. +netf-list= diff --git a/dleyna-server/libdleyna/server/interface.h b/dleyna-server/libdleyna/server/interface.h index 14a214b..d06eefc 100644 --- a/dleyna-server/libdleyna/server/interface.h +++ b/dleyna-server/libdleyna/server/interface.h @@ -23,6 +23,12 @@ #ifndef DLEYNA_SERVER_INTERFACE_H__ #define DLEYNA_SERVER_INTERFACE_H__ +enum dls_manager_interface_type_ { + DLS_MANAGER_INTERFACE_MANAGER, + DLS_MANAGER_INTERFACE_INFO_PROPERTIES, + DLS_MANAGER_INTERFACE_INFO_MAX +}; + enum dls_interface_type_ { DLS_INTERFACE_INFO_PROPERTIES, DLS_INTERFACE_INFO_OBJECT, @@ -37,12 +43,17 @@ enum dls_interface_type_ { #define DLS_INTERFACE_MEDIA_OBJECT "org.gnome.UPnP.MediaObject2" #define DLS_INTERFACE_MEDIA_ITEM "org.gnome.UPnP.MediaItem2" +/* Manager Properties */ +#define DLS_INTERFACE_PROP_WHITE_LIST_ENTRIES "WhiteListEntries" +#define DLS_INTERFACE_PROP_WHITE_LIST_ENABLED "WhiteListEnabled" + /* Object Properties */ #define DLS_INTERFACE_PROP_PATH "Path" #define DLS_INTERFACE_PROP_PARENT "Parent" #define DLS_INTERFACE_PROP_RESTRICTED "Restricted" #define DLS_INTERFACE_PROP_DISPLAY_NAME "DisplayName" #define DLS_INTERFACE_PROP_TYPE "Type" +#define DLS_INTERFACE_PROP_TYPE_EX "TypeEx" #define DLS_INTERFACE_PROP_CREATOR "Creator" #define DLS_INTERFACE_PROP_DLNA_MANAGED "DLNAManaged" #define DLS_INTERFACE_PROP_OBJECT_UPDATE_ID "ObjectUpdateID" @@ -114,6 +125,11 @@ enum dls_interface_type_ { #define DLS_INTERFACE_SET_PROTOCOL_INFO "SetProtocolInfo" #define DLS_INTERFACE_PREFER_LOCAL_ADDRESSES "PreferLocalAddresses" +#define DLS_INTERFACE_WHITE_LIST_ENABLE "WhiteListEnable" +#define DLS_INTERFACE_WHITE_LIST_ADD_ENTRIES "WhiteListAddEntries" +#define DLS_INTERFACE_WHITE_LIST_REMOVE_ENTRIES "WhiteListRemoveEntries" +#define DLS_INTERFACE_WHITE_LIST_CLEAR "WhiteListClear" + #define DLS_INTERFACE_FOUND_SERVER "FoundServer" #define DLS_INTERFACE_LOST_SERVER "LostServer" @@ -194,4 +210,7 @@ enum dls_interface_type_ { #define DLS_INTERFACE_CREATE_REFERENCE "CreateReference" #define DLS_INTERFACE_REFPATH "RefPath" +#define DLS_INTERFACE_ENTRY_LIST "EntryList" +#define DLS_INTERFACE_IS_ENABLED "IsEnabled" + #endif /* DLEYNA_SERVER_INTERFACE_H__ */ diff --git a/dleyna-server/libdleyna/server/manager.c b/dleyna-server/libdleyna/server/manager.c new file mode 100644 index 0000000..b92ebc5 --- /dev/null +++ b/dleyna-server/libdleyna/server/manager.c @@ -0,0 +1,210 @@ +/* + * dLeyna + * + * Copyright (C) 2013 Intel Corporation. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms and conditions of the GNU Lesser General Public License, + * version 2.1, as published by the Free Software Foundation. + * + * This program is distributed in the hope it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License + * for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. + * + * Ludovic Ferrandis + * + */ + +#include +#include + +#include +#include +#include +#include + +#include "interface.h" +#include "manager.h" +#include "props.h" + +struct dls_manager_t_ { + dleyna_connector_id_t connection; + GUPnPContextManager *cm; +}; + +static void prv_wl_notify_prop(dls_manager_t *manager, const gchar *prop_name) +{ + GVariant *prop_val; + GVariant *val; + GVariantBuilder array; + + prop_val = dls_props_get_manager_prop(manager->cm, prop_name); + + g_variant_builder_init(&array, G_VARIANT_TYPE("a{sv}")); + g_variant_builder_add(&array, "{sv}", prop_name, prop_val); + + val = g_variant_new("(s@a{sv}as)", DLEYNA_SERVER_INTERFACE_MANAGER, + g_variant_builder_end(&array), + NULL); + + (void) dls_server_get_connector()->notify(manager->connection, + DLEYNA_SERVER_OBJECT, + DLS_INTERFACE_PROPERTIES, + DLS_INTERFACE_PROPERTIES_CHANGED, + val, + NULL); + g_variant_unref(prop_val); +} + +static void prv_wl_notify_enabled_prop(gpointer user_data) +{ + prv_wl_notify_prop((dls_manager_t *)user_data, + DLS_INTERFACE_PROP_WHITE_LIST_ENABLED); +} + +static void prv_wl_notify_entries_prop(gpointer user_data) +{ + prv_wl_notify_prop((dls_manager_t *)user_data, + DLS_INTERFACE_PROP_WHITE_LIST_ENTRIES); +} + +dls_manager_t *dls_manager_new(dleyna_connector_id_t connection, + GUPnPContextManager *connection_manager) +{ + dls_manager_t *manager = g_new0(dls_manager_t, 1); + dleyna_white_list_t wl_info; + + manager->connection = connection; + manager->cm = connection_manager; + + wl_info.wl = gupnp_context_manager_get_white_list(manager->cm); + wl_info.cb_enabled = prv_wl_notify_enabled_prop; + wl_info.cb_entries = prv_wl_notify_entries_prop; + wl_info.user_data = manager; + + dleyna_white_list_set_info(&wl_info); + + return manager; +} + +void dls_manager_delete(dls_manager_t *manager) +{ + if (manager != NULL) { + dleyna_white_list_set_info(NULL); + g_free(manager); + } +} + +void dls_manager_wl_enable(dls_task_t *task) +{ + dleyna_white_list_enable(task->ut.white_list.enabled, TRUE); +} + +void dls_manager_wl_add_entries(dls_task_t *task) +{ + dleyna_white_list_add_entries(task->ut.white_list.entries, TRUE); +} + +void dls_manager_wl_remove_entries(dls_task_t *task) +{ + dleyna_white_list_remove_entries(task->ut.white_list.entries, TRUE); +} + +void dls_manager_wl_clear(dls_task_t *task) +{ + dleyna_white_list_clear(TRUE); +} + +void dls_manager_get_all_props(dls_manager_t *manager, + dls_task_t *task, + dls_manager_task_complete_t cb) +{ + dls_async_task_t *cb_data = (dls_async_task_t *)task; + dls_async_get_all_t *cb_task_data; + dls_task_get_props_t *task_data = &task->ut.get_props; + + DLEYNA_LOG_DEBUG("Enter"); + DLEYNA_LOG_DEBUG("Path: %s", task->target.path); + DLEYNA_LOG_DEBUG("Interface %s", task->ut.get_prop.interface_name); + + cb_data->cb = cb; + + cb_task_data = &cb_data->ut.get_all; + cb_task_data->vb = g_variant_builder_new(G_VARIANT_TYPE("a{sv}")); + + if (!strcmp(task_data->interface_name, + DLEYNA_SERVER_INTERFACE_MANAGER) || + !strcmp(task_data->interface_name, "")) { + cb_data->cancel_id = g_cancellable_connect( + cb_data->cancellable, + G_CALLBACK(dls_async_task_cancelled_cb), + cb_data, NULL); + + dls_props_add_manager(manager->cm, cb_task_data->vb); + + cb_data->task.result = g_variant_ref_sink( + g_variant_builder_end( + cb_task_data->vb)); + } else { + DLEYNA_LOG_WARNING("Interface is unknown."); + + cb_data->error = g_error_new(DLEYNA_SERVER_ERROR, + DLEYNA_ERROR_UNKNOWN_INTERFACE, + "Interface is unknown."); + } + + (void) g_idle_add(dls_async_task_complete, cb_data); + g_cancellable_disconnect(cb_data->cancellable, cb_data->cancel_id); + + DLEYNA_LOG_DEBUG("Exit"); +} + +void dls_manager_get_prop(dls_manager_t *manager, + dls_task_t *task, + dls_manager_task_complete_t cb) +{ + dls_async_task_t *cb_data = (dls_async_task_t *)task; + dls_task_get_prop_t *task_data = &task->ut.get_prop; + + DLEYNA_LOG_DEBUG("Enter"); + DLEYNA_LOG_DEBUG("Path: %s", task->target.path); + DLEYNA_LOG_DEBUG("Interface %s", task->ut.get_prop.interface_name); + DLEYNA_LOG_DEBUG("Prop.%s", task->ut.get_prop.prop_name); + + cb_data->cb = cb; + + if (!strcmp(task_data->interface_name, + DLEYNA_SERVER_INTERFACE_MANAGER) || + !strcmp(task_data->interface_name, "")) { + cb_data->cancel_id = g_cancellable_connect( + cb_data->cancellable, + G_CALLBACK(dls_async_task_cancelled_cb), + cb_data, NULL); + + cb_data->task.result = dls_props_get_manager_prop( + manager->cm, + task_data->prop_name); + + if (!cb_data->task.result) + cb_data->error = g_error_new( + DLEYNA_SERVER_ERROR, + DLEYNA_ERROR_UNKNOWN_PROPERTY, + "Unknown property"); + } else { + DLEYNA_LOG_WARNING("Interface is unknown."); + + cb_data->error = g_error_new(DLEYNA_SERVER_ERROR, + DLEYNA_ERROR_UNKNOWN_INTERFACE, + "Interface is unknown."); + } + + (void) g_idle_add(dls_async_task_complete, cb_data); + g_cancellable_disconnect(cb_data->cancellable, cb_data->cancel_id); + + DLEYNA_LOG_DEBUG("Exit"); +} diff --git a/dleyna-server/libdleyna/server/manager.h b/dleyna-server/libdleyna/server/manager.h new file mode 100644 index 0000000..c7542f7 --- /dev/null +++ b/dleyna-server/libdleyna/server/manager.h @@ -0,0 +1,55 @@ +/* + * dLeyna + * + * Copyright (C) 2013 Intel Corporation. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms and conditions of the GNU Lesser General Public License, + * version 2.1, as published by the Free Software Foundation. + * + * This program is distributed in the hope it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License + * for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. + * + * Ludovic Ferrandis + * + */ + +#ifndef DLS_MANAGER_H__ +#define DLS_MANAGER_H__ + +#include +#include + +#include "task.h" + +typedef struct dls_manager_t_ dls_manager_t; +typedef void (*dls_manager_task_complete_t)(dls_task_t *task, GError *error); + +dls_manager_t *dls_manager_new(dleyna_connector_id_t connection, + GUPnPContextManager *connection_manager); + +void dls_manager_delete(dls_manager_t *manager); + +void dls_manager_wl_enable(dls_task_t *task); + +void dls_manager_wl_add_entries(dls_task_t *task); + +void dls_manager_wl_remove_entries(dls_task_t *task); + +void dls_manager_wl_clear(dls_task_t *task); + +void dls_manager_get_all_props(dls_manager_t *manager, + dls_task_t *task, + dls_manager_task_complete_t cb); + +void dls_manager_get_prop(dls_manager_t *manager, + dls_task_t *task, + dls_manager_task_complete_t cb); + +#endif /* DLS_MANAGER_H__ */ diff --git a/dleyna-server/libdleyna/server/props.c b/dleyna-server/libdleyna/server/props.c index ad36174..84e2033 100644 --- a/dleyna-server/libdleyna/server/props.c +++ b/dleyna-server/libdleyna/server/props.c @@ -32,80 +32,46 @@ #include "path.h" #include "props.h" +static const gchar gUPnPObject[] = "object"; static const gchar gUPnPContainer[] = "object.container"; -static const gchar gUPnPAlbum[] = "object.container.album"; -static const gchar gUPnPPerson[] = "object.container.person"; -static const gchar gUPnPGenre[] = "object.container.genre"; -static const gchar gUPnPPlaylist[] = "object.container.playlistContainer"; -static const gchar gUPnPStorage[] = "object.container.storageFolder"; static const gchar gUPnPAudioItem[] = "object.item.audioItem"; static const gchar gUPnPVideoItem[] = "object.item.videoItem"; static const gchar gUPnPImageItem[] = "object.item.imageItem"; -static const gchar gUPnPPlaylistItem[] = "object.item.playlistItem"; static const gchar gUPnPItem[] = "object.item"; +static const unsigned int gUPnPObjectLen = + (sizeof(gUPnPObject) / sizeof(gchar)) - 1; static const unsigned int gUPnPContainerLen = (sizeof(gUPnPContainer) / sizeof(gchar)) - 1; -static const unsigned int gUPnPAlbumLen = - (sizeof(gUPnPAlbum) / sizeof(gchar)) - 1; -static const unsigned int gUPnPPersonLen = - (sizeof(gUPnPPerson) / sizeof(gchar)) - 1; -static const unsigned int gUPnPGenreLen = - (sizeof(gUPnPGenre) / sizeof(gchar)) - 1; -static const unsigned int gUPnPPlaylistLen = - (sizeof(gUPnPPlaylist) / sizeof(gchar)) - 1; -static const unsigned int gUPnPStorageLen = - (sizeof(gUPnPStorage) / sizeof(gchar)) - 1; static const unsigned int gUPnPAudioItemLen = (sizeof(gUPnPAudioItem) / sizeof(gchar)) - 1; static const unsigned int gUPnPVideoItemLen = (sizeof(gUPnPVideoItem) / sizeof(gchar)) - 1; static const unsigned int gUPnPImageItemLen = (sizeof(gUPnPImageItem) / sizeof(gchar)) - 1; -static const unsigned int gUPnPPlaylistItemLen = - (sizeof(gUPnPPlaylistItem) / sizeof(gchar)) - 1; static const unsigned int gUPnPItemLen = (sizeof(gUPnPItem) / sizeof(gchar)) - 1; -static const gchar gUPnPPhotoAlbum[] = "object.container.album.photoAlbum"; -static const gchar gUPnPMusicAlbum[] = "object.container.album.musicAlbum"; -static const gchar gUPnPMusicArtist[] = "object.container.person.musicArtist"; -static const gchar gUPnPMovieGenre[] = "object.container.genre.movieGenre"; -static const gchar gUPnPMusicGenre[] = "object.container.genre.musicGenre"; static const gchar gUPnPMusicTrack[] = "object.item.audioItem.musicTrack"; -static const gchar gUPnPAudioBroadcast[] = - "object.item.audioItem.audioBroadcast"; -static const gchar gUPnPAudioBook[] = "object.item.audioItem.audioBook"; static const gchar gUPnPMovie[] = "object.item.videoItem.movie"; -static const gchar gUPnPMusicVideoClip[] = - "object.item.videoItem.musicVideoClip"; -static const gchar gUPnPVideoBroadcast[] = - "object.item.videoItem.videoBroadcast"; static const gchar gUPnPPhoto[] = "object.item.imageItem.photo"; static const gchar gMediaSpec2Container[] = "container"; -static const gchar gMediaSpec2Album[] = "album"; -static const gchar gMediaSpec2AlbumPhoto[] = "album.photo"; -static const gchar gMediaSpec2AlbumMusic[] = "album.music"; -static const gchar gMediaSpec2Person[] = "person"; -static const gchar gMediaSpec2PersonMusicArtist[] = "person.musicartist"; -static const gchar gMediaSpec2Genre[] = "genre"; -static const gchar gMediaSpec2GenreMovie[] = "genre.movie"; -static const gchar gMediaSpec2GenreMusic[] = "genre.music"; -static const gchar gMediaSpec2AudioMusic[] = "audio.music"; -static const gchar gMediaSpec2AudioBroadcast[] = "audio.broadcast"; +static const gchar gMediaSpec2AudioMusic[] = "music"; static const gchar gMediaSpec2Audio[] = "audio"; -static const gchar gMediaSpec2AudioBook[] = "audio.book"; static const gchar gMediaSpec2Video[] = "video"; static const gchar gMediaSpec2VideoMovie[] = "video.movie"; -static const gchar gMediaSpec2VideoMusicClip[] = "video.musicclip"; -static const gchar gMediaSpec2VideoBroadcast[] = "video.broadcast"; static const gchar gMediaSpec2Image[] = "image"; static const gchar gMediaSpec2ImagePhoto[] = "image.photo"; -static const gchar gMediaSpec2Playlist[] = "playlist"; -static const gchar gMediaSpec2PlaylistItem[] = "item.playlist"; -static const gchar gMediaSpec2Item[] = "item"; -static const gchar gMediaSpec2Storage[] = "storage"; +static const gchar gMediaSpec2ItemUnclassified[] = "item.unclassified"; + +static const gchar gMediaSpec2ExItem[] = "item"; + +static const unsigned int gMediaSpec2ExItemLen = + (sizeof(gMediaSpec2ExItem) / sizeof(gchar)) - 1; + +static const unsigned int gMediaSpec2ContainerLen = + (sizeof(gMediaSpec2Container) / sizeof(gchar)) - 1; typedef struct dls_prop_dlna_t_ dls_prop_dlna_t; struct dls_prop_dlna_t_ { @@ -396,10 +362,15 @@ void dls_prop_maps_new(GHashTable **property_map, GHashTable **filter_map) /* upnp:class */ prop_t = prv_prop_map_new("upnp:class", DLS_UPNP_MASK_PROP_TYPE, - FALSE, TRUE, TRUE); + FALSE, TRUE, FALSE); g_hash_table_insert(f_map, DLS_INTERFACE_PROP_TYPE, prop_t); g_hash_table_insert(p_map, "upnp:class", DLS_INTERFACE_PROP_TYPE); + prop_t = prv_prop_map_new("upnp:class", + DLS_UPNP_MASK_PROP_TYPE_EX, + FALSE, TRUE, TRUE); + g_hash_table_insert(f_map, DLS_INTERFACE_PROP_TYPE_EX, prop_t); + /* upnp:containerUpdateID */ prop_t = prv_prop_map_new("upnp:containerUpdateID", DLS_UPNP_MASK_PROP_CONTAINER_UPDATE_ID, @@ -1147,7 +1118,7 @@ static GVariant *prv_compute_create_classes(GUPnPDIDLLiteContainer *container) create_class = ptr->data; content = gupnp_didl_lite_create_class_get_content( create_class); - ms2_class = dls_props_upnp_class_to_media_spec(content); + ms2_class = dls_props_upnp_class_to_media_spec_ex(content); inc_derived = gupnp_didl_lite_create_class_get_include_derived( create_class); g_variant_builder_add(&create_classes_vb, @@ -1160,66 +1131,75 @@ static GVariant *prv_compute_create_classes(GUPnPDIDLLiteContainer *container) return g_variant_builder_end(&create_classes_vb); } -const gchar *dls_props_media_spec_to_upnp_class(const gchar *m2spec_class) +static const gchar *prv_media_spec_to_upnp_class(const gchar *m2spec_class) { const gchar *retval = NULL; - if (!m2spec_class) - goto on_error; - - if (!strcmp(m2spec_class, gMediaSpec2AlbumPhoto)) - retval = gUPnPPhotoAlbum; - else if (!strcmp(m2spec_class, gMediaSpec2AlbumMusic)) - retval = gUPnPMusicAlbum; - else if (!strcmp(m2spec_class, gMediaSpec2Album)) - retval = gUPnPAlbum; - else if (!strcmp(m2spec_class, gMediaSpec2PersonMusicArtist)) - retval = gUPnPMusicArtist; - else if (!strcmp(m2spec_class, gMediaSpec2Person)) - retval = gUPnPPerson; - else if (!strcmp(m2spec_class, gMediaSpec2GenreMovie)) - retval = gUPnPMovieGenre; - else if (!strcmp(m2spec_class, gMediaSpec2GenreMusic)) - retval = gUPnPMusicGenre; - else if (!strcmp(m2spec_class, gMediaSpec2Genre)) - retval = gUPnPGenre; - else if (!strcmp(m2spec_class, gMediaSpec2Container)) + if (!strcmp(m2spec_class, gMediaSpec2Container)) retval = gUPnPContainer; else if (!strcmp(m2spec_class, gMediaSpec2AudioMusic)) retval = gUPnPMusicTrack; - else if (!strcmp(m2spec_class, gMediaSpec2AudioBroadcast)) - retval = gUPnPAudioBroadcast; - else if (!strcmp(m2spec_class, gMediaSpec2AudioBook)) - retval = gUPnPAudioBook; else if (!strcmp(m2spec_class, gMediaSpec2Audio)) retval = gUPnPAudioItem; else if (!strcmp(m2spec_class, gMediaSpec2VideoMovie)) retval = gUPnPMovie; - else if (!strcmp(m2spec_class, gMediaSpec2VideoMusicClip)) - retval = gUPnPMusicVideoClip; - else if (!strcmp(m2spec_class, gMediaSpec2VideoBroadcast)) - retval = gUPnPVideoBroadcast; else if (!strcmp(m2spec_class, gMediaSpec2Video)) retval = gUPnPVideoItem; else if (!strcmp(m2spec_class, gMediaSpec2ImagePhoto)) retval = gUPnPPhoto; else if (!strcmp(m2spec_class, gMediaSpec2Image)) retval = gUPnPImageItem; - else if (!strcmp(m2spec_class, gMediaSpec2Playlist)) - retval = gUPnPPlaylist; - else if (!strcmp(m2spec_class, gMediaSpec2PlaylistItem)) - retval = gUPnPPlaylistItem; - else if (!strcmp(m2spec_class, gMediaSpec2Item)) + + return retval; +} + +const gchar *dls_props_media_spec_to_upnp_class(const gchar *m2spec_class) +{ + const gchar *retval = NULL; + + if (!m2spec_class) + goto on_error; + + retval = prv_media_spec_to_upnp_class(m2spec_class); + + if (!retval && !strcmp(m2spec_class, gMediaSpec2ItemUnclassified)) retval = gUPnPItem; - else if (!strcmp(m2spec_class, gMediaSpec2Storage)) - retval = gUPnPStorage; on_error: return retval; } -const gchar *dls_props_upnp_class_to_media_spec(const gchar *upnp_class) +gchar *dls_props_media_spec_ex_to_upnp_class(const gchar *m2spec_class) +{ + gchar *retval = NULL; + const gchar *basic_type; + const gchar *ptr = NULL; + + if (!m2spec_class) + goto on_error; + + basic_type = prv_media_spec_to_upnp_class(m2spec_class); + if (basic_type) { + retval = g_strdup(basic_type); + } else { + if (!strncmp(m2spec_class, gMediaSpec2ExItem, + gMediaSpec2ExItemLen)) + ptr = m2spec_class + gMediaSpec2ExItemLen; + else if (!strncmp(m2spec_class, gMediaSpec2Container, + gMediaSpec2ContainerLen)) + ptr = m2spec_class + gMediaSpec2ContainerLen; + if (ptr && (!*ptr || *ptr == '.')) + retval = g_strdup_printf("object.%s", m2spec_class); + } + +on_error: + + return retval; +} + +static const gchar *prv_upnp_class_to_media_spec(const gchar *upnp_class, + gboolean *exact) { const gchar *retval = NULL; const gchar *ptr; @@ -1227,71 +1207,73 @@ const gchar *dls_props_upnp_class_to_media_spec(const gchar *upnp_class) if (!upnp_class) goto on_error; - if (!strncmp(upnp_class, gUPnPAlbum, gUPnPAlbumLen)) { - ptr = upnp_class + gUPnPAlbumLen; - if (!strcmp(ptr, ".photoAlbum")) - retval = gMediaSpec2AlbumPhoto; - else if (!strcmp(ptr, ".musicAlbum")) - retval = gMediaSpec2AlbumMusic; - else - retval = gMediaSpec2Album; - } else if (!strncmp(upnp_class, gUPnPPerson, gUPnPPersonLen)) { - ptr = upnp_class + gUPnPPersonLen; - if (!strcmp(ptr, ".musicArtist")) - retval = gMediaSpec2PersonMusicArtist; - else - retval = gMediaSpec2Person; - } else if (!strncmp(upnp_class, gUPnPGenre, gUPnPGenreLen)) { - ptr = upnp_class + gUPnPGenreLen; - if (!strcmp(ptr, ".movieGenre")) - retval = gMediaSpec2GenreMovie; - else if (!strcmp(ptr, ".musicGenre")) - retval = gMediaSpec2GenreMusic; - else - retval = gMediaSpec2Genre; - } else if (!strncmp(upnp_class, gUPnPContainer, gUPnPContainerLen)) { + if (!strncmp(upnp_class, gUPnPContainer, gUPnPContainerLen)) { ptr = upnp_class + gUPnPContainerLen; - if (!*ptr || *ptr == '.') + if (!*ptr || *ptr == '.') { retval = gMediaSpec2Container; + *exact = *ptr == 0; + } } else if (!strncmp(upnp_class, gUPnPAudioItem, gUPnPAudioItemLen)) { ptr = upnp_class + gUPnPAudioItemLen; - if (!strcmp(ptr, ".musicTrack")) + if (!strcmp(ptr, ".musicTrack")) { retval = gMediaSpec2AudioMusic; - else if (!strcmp(ptr, ".audioBroadcast")) - retval = gMediaSpec2AudioBroadcast; - else if (!strcmp(ptr, ".audioBook")) - retval = gMediaSpec2AudioBook; - else + *exact = TRUE; + } else if (!*ptr || *ptr == '.') { retval = gMediaSpec2Audio; + *exact = *ptr == 0; + } } else if (!strncmp(upnp_class, gUPnPVideoItem, gUPnPVideoItemLen)) { ptr = upnp_class + gUPnPVideoItemLen; - if (!strcmp(ptr, ".movie")) + if (!strcmp(ptr, ".movie")) { retval = gMediaSpec2VideoMovie; - else if (!strcmp(ptr, ".musicVideoClip")) - retval = gMediaSpec2VideoMusicClip; - else if (!strcmp(ptr, ".videoBroadcast")) - retval = gMediaSpec2VideoBroadcast; - else + *exact = TRUE; + } else if (!*ptr || *ptr == '.') { retval = gMediaSpec2Video; + *exact = *ptr == 0; + } } else if (!strncmp(upnp_class, gUPnPImageItem, gUPnPImageItemLen)) { ptr = upnp_class + gUPnPImageItemLen; - if (!strcmp(ptr, ".photo")) + if (!strcmp(ptr, ".photo")) { retval = gMediaSpec2ImagePhoto; - else + *exact = TRUE; + } else if (!*ptr || *ptr == '.') { retval = gMediaSpec2Image; - } else if (!strncmp(upnp_class, gUPnPPlaylist, - gUPnPPlaylistLen)) { - retval = gMediaSpec2Playlist; - } else if (!strncmp(upnp_class, gUPnPPlaylistItem, - gUPnPPlaylistItemLen)) { - retval = gMediaSpec2PlaylistItem; + *exact = *ptr == 0; + } } else if (!strncmp(upnp_class, gUPnPItem, gUPnPItemLen)) { ptr = upnp_class + gUPnPItemLen; - if (!*ptr || *ptr == '.') - retval = gMediaSpec2Item; - } else if (!strncmp(upnp_class, gUPnPStorage, - gUPnPStorageLen)) { - retval = gMediaSpec2Storage; + if (!*ptr || *ptr == '.') { + retval = gMediaSpec2ItemUnclassified; + *exact = *ptr == 0; + } + } + +on_error: + + return retval; +} + +const gchar *dls_props_upnp_class_to_media_spec(const gchar *upnp_class) +{ + gboolean exact; + + return prv_upnp_class_to_media_spec(upnp_class, &exact); +} + +const gchar *dls_props_upnp_class_to_media_spec_ex(const gchar *upnp_class) +{ + const gchar *retval; + gboolean exact; + + retval = prv_upnp_class_to_media_spec(upnp_class, &exact); + if (!retval) + goto on_error; + + if (exact) { + if (retval == gMediaSpec2ItemUnclassified) + retval = gMediaSpec2ExItem; + } else { + retval = upnp_class + gUPnPObjectLen + 1; } on_error: @@ -1368,6 +1350,7 @@ gboolean dls_props_add_object(GVariantBuilder *item_vb, const char *creator; const char *upnp_class; const char *media_spec_type; + const char *media_spec_type_ex; gboolean retval = FALSE; gboolean rest; GUPnPOCMFlags flags; @@ -1383,6 +1366,8 @@ gboolean dls_props_add_object(GVariantBuilder *item_vb, if (!media_spec_type) goto on_error; + media_spec_type_ex = dls_props_upnp_class_to_media_spec_ex(upnp_class); + title = gupnp_didl_lite_object_get_title(object); creator = gupnp_didl_lite_object_get_creator(object); rest = gupnp_didl_lite_object_get_restricted(object); @@ -1407,6 +1392,10 @@ gboolean dls_props_add_object(GVariantBuilder *item_vb, prv_add_string_prop(item_vb, DLS_INTERFACE_PROP_TYPE, media_spec_type); + if (filter_mask & DLS_UPNP_MASK_PROP_TYPE_EX) + prv_add_string_prop(item_vb, DLS_INTERFACE_PROP_TYPE_EX, + media_spec_type_ex); + if (filter_mask & DLS_UPNP_MASK_PROP_RESTRICTED) prv_add_bool_prop(item_vb, DLS_INTERFACE_PROP_RESTRICTED, rest); @@ -1785,6 +1774,17 @@ GVariant *dls_props_get_object_prop(const gchar *prop, const gchar *root_path, retval = g_variant_ref_sink(g_variant_new_string( media_spec_type)); + } else if (!strcmp(prop, DLS_INTERFACE_PROP_TYPE_EX)) { + upnp_class = gupnp_didl_lite_object_get_upnp_class(object); + media_spec_type = + dls_props_upnp_class_to_media_spec_ex(upnp_class); + if (!media_spec_type) + goto on_error; + + DLEYNA_LOG_DEBUG("Prop %s = %s", prop, media_spec_type); + + retval = g_variant_ref_sink(g_variant_new_string( + media_spec_type)); } else if (!strcmp(prop, DLS_INTERFACE_PROP_DISPLAY_NAME)) { title = gupnp_didl_lite_object_get_title(object); if (!title) @@ -2042,3 +2042,67 @@ on_error: return retval; } + +static void prv_add_list_wl_entries(gpointer data, gpointer user_data) +{ + GVariantBuilder *vb = (GVariantBuilder *)user_data; + gchar *entry = (gchar *)data; + + g_variant_builder_add(vb, "s", entry); +} + +void dls_props_add_manager(GUPnPContextManager *manager, GVariantBuilder *vb) +{ + GUPnPWhiteList *wl; + GList *list; + GVariantBuilder vb2; + + wl = gupnp_context_manager_get_white_list(manager); + list = gupnp_white_list_get_entries(wl); + + prv_add_bool_prop(vb, DLS_INTERFACE_PROP_WHITE_LIST_ENABLED, + gupnp_white_list_get_enabled(wl)); + + g_variant_builder_init(&vb2, G_VARIANT_TYPE("as")); + g_list_foreach(list, prv_add_list_wl_entries, &vb2); + + g_variant_builder_add(vb, "{sv}", DLS_INTERFACE_PROP_WHITE_LIST_ENTRIES, + g_variant_builder_end(&vb2)); +} + +GVariant *dls_props_get_manager_prop(GUPnPContextManager *manager, + const gchar *prop) +{ + GVariant *retval = NULL; + GUPnPWhiteList *wl; + GVariantBuilder vb; + GList *list; + gboolean b_value; +#if DLEYNA_LOG_LEVEL & DLEYNA_LOG_LEVEL_DEBUG + gchar *prop_str; +#endif + + wl = gupnp_context_manager_get_white_list(manager); + + if (!strcmp(prop, DLS_INTERFACE_PROP_WHITE_LIST_ENABLED)) { + b_value = gupnp_white_list_get_enabled(wl); + retval = g_variant_ref_sink(g_variant_new_boolean(b_value)); + + } else if (!strcmp(prop, DLS_INTERFACE_PROP_WHITE_LIST_ENTRIES)) { + list = gupnp_white_list_get_entries(wl); + + g_variant_builder_init(&vb, G_VARIANT_TYPE("as")); + g_list_foreach(list, prv_add_list_wl_entries, &vb); + retval = g_variant_ref_sink(g_variant_builder_end(&vb)); + } + +#if DLEYNA_LOG_LEVEL & DLEYNA_LOG_LEVEL_DEBUG + if (retval) { + prop_str = g_variant_print(retval, FALSE); + DLEYNA_LOG_DEBUG("Prop %s = %s", prop, prop_str); + g_free(prop_str); + } +#endif + + return retval; +} diff --git a/dleyna-server/libdleyna/server/props.h b/dleyna-server/libdleyna/server/props.h index f219573..07596b4 100644 --- a/dleyna-server/libdleyna/server/props.h +++ b/dleyna-server/libdleyna/server/props.h @@ -23,6 +23,7 @@ #ifndef DLS_PROPS_H__ #define DLS_PROPS_H__ +#include #include #include "async.h" @@ -48,7 +49,7 @@ #define DLS_UPNP_MASK_PROP_WIDTH (1LL << 19) #define DLS_UPNP_MASK_PROP_HEIGHT (1LL << 20) #define DLS_UPNP_MASK_PROP_COLOR_DEPTH (1LL << 21) -#define DLS_UPNP_MASK_PROP_ALBUM_ART_URL (1LL << 22) +#define DLS_UPNP_MASK_PROP_ALBUM_ART_URL (1LL << 22) #define DLS_UPNP_MASK_PROP_RESOURCES (1LL << 23) #define DLS_UPNP_MASK_PROP_URL (1LL << 24) #define DLS_UPNP_MASK_PROP_REFPATH (1LL << 25) @@ -64,6 +65,7 @@ #define DLS_UPNP_MASK_PROP_DLNA_CONVERSION (1LL << 35) #define DLS_UPNP_MASK_PROP_DLNA_OPERATION (1LL << 36) #define DLS_UPNP_MASK_PROP_DLNA_FLAGS (1LL << 37) +#define DLS_UPNP_MASK_PROP_TYPE_EX (1LL << 38) #define DLS_UPNP_MASK_ALL_PROPS 0xffffffffffffffff @@ -134,6 +136,15 @@ GVariant *dls_props_get_item_prop(const gchar *prop, const gchar *root_path, const gchar *dls_props_media_spec_to_upnp_class(const gchar *m2spec_class); +gchar *dls_props_media_spec_ex_to_upnp_class(const gchar *m2spec_class); + const gchar *dls_props_upnp_class_to_media_spec(const gchar *upnp_class); +const gchar *dls_props_upnp_class_to_media_spec_ex(const gchar *upnp_class); + +void dls_props_add_manager(GUPnPContextManager *manager, GVariantBuilder *vb); + +GVariant *dls_props_get_manager_prop(GUPnPContextManager *manager, + const gchar *prop); + #endif /* DLS_PROPS_H__ */ diff --git a/dleyna-server/libdleyna/server/search.c b/dleyna-server/libdleyna/server/search.c index 264654e..c331ceb 100644 --- a/dleyna-server/libdleyna/server/search.c +++ b/dleyna-server/libdleyna/server/search.c @@ -37,6 +37,7 @@ gchar *dls_search_translate_search_string(GHashTable *filter_map, gchar *op = NULL; gchar *value = NULL; const gchar *translated_value; + gchar *translated_type_ex; dls_prop_map_t *prop_map; GString *str; gint start_pos; @@ -80,6 +81,18 @@ gchar *dls_search_translate_search_string(GHashTable *filter_map, goto on_error; g_free(value); value = g_strdup_printf("\"%s\"", translated_value); + } else if (!strcmp(prop, DLS_INTERFACE_PROP_TYPE_EX)) { + /* Skip the quotes */ + + value[strlen(value) - 1] = 0; + translated_type_ex = + dls_props_media_spec_ex_to_upnp_class( + value + 1); + if (!translated_type_ex) + goto on_error; + g_free(value); + value = g_strdup_printf("\"%s\"", translated_type_ex); + g_free(translated_type_ex); } else if (!strcmp(prop, DLS_INTERFACE_PROP_PARENT) || !strcmp(prop, DLS_INTERFACE_PROP_PATH)) { value[strlen(value) - 1] = 0; diff --git a/dleyna-server/libdleyna/server/server.c b/dleyna-server/libdleyna/server/server.c index 4db03e4..fff5ca9 100644 --- a/dleyna-server/libdleyna/server/server.c +++ b/dleyna-server/libdleyna/server/server.c @@ -35,6 +35,7 @@ #include "control-point-server.h" #include "device.h" #include "interface.h" +#include "manager.h" #include "path.h" #include "server.h" #include "upnp.h" @@ -52,9 +53,10 @@ struct dls_server_context_t_ { dleyna_task_processor_t *processor; const dleyna_connector_t *connector; dleyna_settings_t *settings; - guint dls_id; + guint dls_id[DLS_MANAGER_INTERFACE_INFO_MAX]; GHashTable *watchers; dls_upnp_t *upnp; + dls_manager_t *manager; }; static dls_server_context_t g_context; @@ -82,12 +84,52 @@ static const gchar g_root_introspection[] = " " " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " " " " " " " " " " " " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " " " ""; @@ -120,6 +162,8 @@ static const gchar g_server_introspection[] = " access='read'/>" " " + " " " " " "; +static const gchar *g_manager_interfaces[DLS_MANAGER_INTERFACE_INFO_MAX] = { + /* MUST be in the exact same order as g_root_introspection */ + DLEYNA_SERVER_INTERFACE_MANAGER, + DLS_INTERFACE_PROPERTIES +}; + const dleyna_connector_t *dls_server_get_connector(void) { return g_context.connector; @@ -484,12 +534,6 @@ dleyna_task_processor_t *dls_server_get_task_processor(void) return g_context.processor; } -static void prv_sync_task_complete(dls_task_t *task) -{ - dls_task_complete(task); - dleyna_task_queue_task_completed(task->atom.queue_id); -} - static void prv_process_sync_task(dls_task_t *task) { dls_client_t *client; @@ -497,15 +541,17 @@ static void prv_process_sync_task(dls_task_t *task) switch (task->type) { case DLS_TASK_GET_VERSION: - prv_sync_task_complete(task); + task->result = g_variant_ref_sink(g_variant_new_string( + VERSION)); + dls_task_complete(task); break; case DLS_TASK_GET_SERVERS: task->result = dls_upnp_get_server_ids(g_context.upnp); - prv_sync_task_complete(task); + dls_task_complete(task); break; case DLS_TASK_RESCAN: dls_upnp_rescan(g_context.upnp); - prv_sync_task_complete(task); + dls_task_complete(task); break; case DLS_TASK_SET_PROTOCOL_INFO: client_name = dleyna_task_queue_get_source(task->atom.queue_id); @@ -520,7 +566,7 @@ static void prv_process_sync_task(dls_task_t *task) client->protocol_info = NULL; } } - prv_sync_task_complete(task); + dls_task_complete(task); break; case DLS_TASK_SET_PREFER_LOCAL_ADDRESSES: client_name = dleyna_task_queue_get_source(task->atom.queue_id); @@ -529,34 +575,53 @@ static void prv_process_sync_task(dls_task_t *task) client->prefer_local_addresses = task->ut.prefer_local_addresses.prefer; } - prv_sync_task_complete(task); + dls_task_complete(task); break; case DLS_TASK_GET_UPLOAD_STATUS: dls_upnp_get_upload_status(g_context.upnp, task); - dleyna_task_queue_task_completed(task->atom.queue_id); break; case DLS_TASK_GET_UPLOAD_IDS: dls_upnp_get_upload_ids(g_context.upnp, task); - dleyna_task_queue_task_completed(task->atom.queue_id); break; case DLS_TASK_CANCEL_UPLOAD: dls_upnp_cancel_upload(g_context.upnp, task); - dleyna_task_queue_task_completed(task->atom.queue_id); + break; + case DLS_TASK_WHITE_LIST_ENABLE: + dls_manager_wl_enable(task); + dls_task_complete(task); + break; + case DLS_TASK_WHITE_LIST_ADD_ENTRIES: + dls_manager_wl_add_entries(task); + dls_task_complete(task); + break; + case DLS_TASK_WHITE_LIST_REMOVE_ENTRIES: + dls_manager_wl_remove_entries(task); + dls_task_complete(task); + break; + case DLS_TASK_WHITE_LIST_CLEAR: + dls_manager_wl_clear(task); + dls_task_complete(task); break; default: + goto finished; break; } + + dleyna_task_queue_task_completed(task->atom.queue_id); + +finished: + return; } static void prv_async_task_complete(dls_task_t *task, GError *error) { DLEYNA_LOG_DEBUG("Enter"); - if (error) { + if (!error) { + dls_task_complete(task); + } else { dls_task_fail(task, error); g_error_free(error); - } else { - dls_task_complete(task); } dleyna_task_queue_task_completed(task->atom.queue_id); @@ -577,6 +642,14 @@ static void prv_process_async_task(dls_task_t *task) client = g_hash_table_lookup(g_context.watchers, client_name); switch (task->type) { + case DLS_TASK_MANAGER_GET_PROP: + dls_manager_get_prop(g_context.manager, task, + prv_async_task_complete); + break; + case DLS_TASK_MANAGER_GET_ALL_PROPS: + dls_manager_get_all_props(g_context.manager, task, + prv_async_task_complete); + break; case DLS_TASK_GET_CHILDREN: dls_upnp_get_children(g_context.upnp, client, task, prv_async_task_complete); @@ -660,13 +733,21 @@ static void prv_delete_task(dleyna_task_atom_t *task, gpointer user_data) dls_task_delete((dls_task_t *)task); } -static void prv_method_call(dleyna_connector_id_t conn, - const gchar *sender, - const gchar *object, - const gchar *interface, - const gchar *method, - GVariant *parameters, - dleyna_connector_msg_id_t invocation); +static void prv_manager_root_method_call(dleyna_connector_id_t conn, + const gchar *sender, + const gchar *object, + const gchar *interface, + const gchar *method, + GVariant *parameters, + dleyna_connector_msg_id_t invocation); + +static void prv_manager_props_method_call(dleyna_connector_id_t conn, + const gchar *sender, + const gchar *object, + const gchar *interface, + const gchar *method, + GVariant *parameters, + dleyna_connector_msg_id_t invocation); static void prv_object_method_call(dleyna_connector_id_t conn, const gchar *sender, @@ -708,13 +789,16 @@ static void prv_device_method_call(dleyna_connector_id_t conn, GVariant *parameters, dleyna_connector_msg_id_t invocation); -static const dleyna_connector_dispatch_cb_t g_root_vtables[1] = { - prv_method_call +static const dleyna_connector_dispatch_cb_t + g_root_vtables[DLS_MANAGER_INTERFACE_INFO_MAX] = { + /* MUST be in the exact same order as g_root_introspection */ + prv_manager_root_method_call, + prv_manager_props_method_call }; static const dleyna_connector_dispatch_cb_t g_server_vtables[DLS_INTERFACE_INFO_MAX] = { - /* MUST be in the exact same order as g_dls_server_introspection */ + /* MUST be in the exact same order as g_server_introspection */ prv_props_method_call, prv_object_method_call, prv_con_method_call, @@ -770,7 +854,8 @@ static void prv_add_task(dls_task_t *task, const gchar *source, dleyna_task_queue_add_task(queue_id, &task->atom); } -static void prv_method_call(dleyna_connector_id_t conn, +static void prv_manager_root_method_call( + dleyna_connector_id_t conn, const gchar *sender, const gchar *object, const gchar *interface, const gchar *method, GVariant *parameters, @@ -781,24 +866,70 @@ static void prv_method_call(dleyna_connector_id_t conn, if (!strcmp(method, DLS_INTERFACE_RELEASE)) { prv_remove_client(sender); g_context.connector->return_response(invocation, NULL); + goto finished; } else if (!strcmp(method, DLS_INTERFACE_RESCAN)) { task = dls_task_rescan_new(invocation); - prv_add_task(task, sender, DLS_SERVER_SINK); } else if (!strcmp(method, DLS_INTERFACE_GET_VERSION)) { task = dls_task_get_version_new(invocation); - prv_add_task(task, sender, DLS_SERVER_SINK); } else if (!strcmp(method, DLS_INTERFACE_GET_SERVERS)) { task = dls_task_get_servers_new(invocation); - prv_add_task(task, sender, DLS_SERVER_SINK); } else if (!strcmp(method, DLS_INTERFACE_SET_PROTOCOL_INFO)) { task = dls_task_set_protocol_info_new(invocation, parameters); - prv_add_task(task, sender, DLS_SERVER_SINK); } else if (!strcmp(method, DLS_INTERFACE_PREFER_LOCAL_ADDRESSES)) { task = dls_task_prefer_local_addresses_new(invocation, parameters); - prv_add_task(task, sender, DLS_SERVER_SINK); + } else if (!strcmp(method, DLS_INTERFACE_WHITE_LIST_ENABLE)) { + task = dls_task_wl_enable_new(invocation, parameters); + } else if (!strcmp(method, DLS_INTERFACE_WHITE_LIST_ADD_ENTRIES)) { + task = dls_task_wl_add_entries_new(invocation, parameters); + } else if (!strcmp(method, DLS_INTERFACE_WHITE_LIST_REMOVE_ENTRIES)) { + task = dls_task_wl_remove_entries_new(invocation, parameters); + } else if (!strcmp(method, DLS_INTERFACE_WHITE_LIST_CLEAR)) { + task = dls_task_wl_clear_new(invocation); + } else { + goto finished; } + + prv_add_task(task, sender, DLS_SERVER_SINK); + +finished: + + return; +} + +static void prv_manager_props_method_call(dleyna_connector_id_t conn, + const gchar *sender, + const gchar *object, + const gchar *interface, + const gchar *method, + GVariant *parameters, + dleyna_connector_msg_id_t invocation) +{ + dls_task_t *task; + GError *error = NULL; + + if (!strcmp(method, DLS_INTERFACE_GET_ALL)) + task = dls_task_manager_get_props_new(invocation, object, + parameters, &error); + else if (!strcmp(method, DLS_INTERFACE_GET)) + task = dls_task_manager_get_prop_new(invocation, object, + parameters, &error); + else + goto finished; + + if (!task) { + g_context.connector->return_error(invocation, error); + g_error_free(error); + + goto finished; + } + + prv_add_task(task, sender, task->target.path); + +finished: + + return; } gboolean dls_server_get_object_info(const gchar *object_path, @@ -1136,44 +1267,54 @@ static gboolean prv_control_point_start_service( dleyna_connector_id_t connection) { gboolean retval = TRUE; + uint i; g_context.connection = connection; - g_context.dls_id = g_context.connector->publish_object( - connection, - DLEYNA_SERVER_OBJECT, - TRUE, - 0, - g_root_vtables); + for (i = 0; i < DLS_MANAGER_INTERFACE_INFO_MAX; i++) + g_context.dls_id[i] = g_context.connector->publish_object( + connection, + DLEYNA_SERVER_OBJECT, + TRUE, + g_manager_interfaces[i], + g_root_vtables + i); - if (!g_context.dls_id) { - retval = FALSE; - goto out; - } else { + if (g_context.dls_id[DLS_MANAGER_INTERFACE_MANAGER]) { g_context.upnp = dls_upnp_new(connection, g_server_vtables, prv_found_media_server, prv_lost_media_server, NULL); + + g_context.manager = dls_manager_new(connection, + dls_upnp_get_context_manager(g_context.upnp)); + } else { + retval = FALSE; } -out: + dleyna_settings_init_white_list(g_context.settings); return retval; } static void prv_control_point_stop_service(void) { + uint i; + + if (g_context.manager) + dls_manager_delete(g_context.manager); + if (g_context.upnp) { dls_upnp_unsubscribe(g_context.upnp); dls_upnp_delete(g_context.upnp); } if (g_context.connection) { - if (g_context.dls_id) - g_context.connector->unpublish_object( + for (i = 0; i < DLS_MANAGER_INTERFACE_INFO_MAX; i++) + if (g_context.dls_id[i]) + g_context.connector->unpublish_object( g_context.connection, - g_context.dls_id); + g_context.dls_id[i]); } } diff --git a/dleyna-server/libdleyna/server/task.c b/dleyna-server/libdleyna/server/task.c index 94f4cf2..9943319 100644 --- a/dleyna-server/libdleyna/server/task.c +++ b/dleyna-server/libdleyna/server/task.c @@ -21,44 +21,10 @@ */ #include +#include #include "async.h" - -dls_task_t *dls_task_rescan_new(dleyna_connector_msg_id_t invocation) -{ - dls_task_t *task = g_new0(dls_task_t, 1); - - task->type = DLS_TASK_RESCAN; - task->invocation = invocation; - task->synchronous = TRUE; - - return task; -} - -dls_task_t *dls_task_get_version_new(dleyna_connector_msg_id_t invocation) -{ - dls_task_t *task = g_new0(dls_task_t, 1); - - task->type = DLS_TASK_GET_VERSION; - task->invocation = invocation; - task->result_format = "(@s)"; - task->result = g_variant_ref_sink(g_variant_new_string(VERSION)); - task->synchronous = TRUE; - - return task; -} - -dls_task_t *dls_task_get_servers_new(dleyna_connector_msg_id_t invocation) -{ - dls_task_t *task = g_new0(dls_task_t, 1); - - task->type = DLS_TASK_GET_SERVERS; - task->invocation = invocation; - task->result_format = "(@ao)"; - task->synchronous = TRUE; - - return task; -} +#include "path.h" static void prv_delete(dls_task_t *task) { @@ -71,9 +37,11 @@ static void prv_delete(dls_task_t *task) g_variant_unref(task->ut.get_children.filter); g_free(task->ut.get_children.sort_by); break; + case DLS_TASK_MANAGER_GET_ALL_PROPS: case DLS_TASK_GET_ALL_PROPS: g_free(task->ut.get_props.interface_name); break; + case DLS_TASK_MANAGER_GET_PROP: case DLS_TASK_GET_PROP: g_free(task->ut.get_prop.interface_name); g_free(task->ut.get_prop.prop_name); @@ -118,6 +86,11 @@ static void prv_delete(dls_task_t *task) g_free(task->ut.get_icon.resolution); g_free(task->ut.get_icon.mime_type); break; + case DLS_TASK_WHITE_LIST_ADD_ENTRIES: + case DLS_TASK_WHITE_LIST_REMOVE_ENTRIES: + if (task->ut.white_list.entries) + g_variant_unref(task->ut.white_list.entries); + break; default: break; } @@ -132,6 +105,132 @@ static void prv_delete(dls_task_t *task) g_free(task); } +dls_task_t *dls_task_rescan_new(dleyna_connector_msg_id_t invocation) +{ + dls_task_t *task = g_new0(dls_task_t, 1); + + task->type = DLS_TASK_RESCAN; + task->invocation = invocation; + task->synchronous = TRUE; + + return task; +} + +dls_task_t *dls_task_get_version_new(dleyna_connector_msg_id_t invocation) +{ + dls_task_t *task = g_new0(dls_task_t, 1); + + task->type = DLS_TASK_GET_VERSION; + task->invocation = invocation; + task->result_format = "(@s)"; + task->synchronous = TRUE; + + return task; +} + +dls_task_t *dls_task_get_servers_new(dleyna_connector_msg_id_t invocation) +{ + dls_task_t *task = g_new0(dls_task_t, 1); + + task->type = DLS_TASK_GET_SERVERS; + task->invocation = invocation; + task->result_format = "(@ao)"; + task->synchronous = TRUE; + + return task; +} + +dls_task_t *dls_task_wl_enable_new(dleyna_connector_msg_id_t invocation, + GVariant *parameters) +{ + dls_task_t *task = g_new0(dls_task_t, 1); + + task->type = DLS_TASK_WHITE_LIST_ENABLE; + task->invocation = invocation; + task->synchronous = TRUE; + g_variant_get(parameters, "(b)", + &task->ut.white_list.enabled); + + return task; +} + +dls_task_t *dls_task_wl_clear_new(dleyna_connector_msg_id_t invocation) +{ + dls_task_t *task = g_new0(dls_task_t, 1); + + task->type = DLS_TASK_WHITE_LIST_CLEAR; + task->invocation = invocation; + task->synchronous = TRUE; + + return task; +} + +dls_task_t *dls_task_wl_add_entries_new(dleyna_connector_msg_id_t invocation, + GVariant *parameters) +{ + dls_task_t *task = g_new0(dls_task_t, 1); + + task->type = DLS_TASK_WHITE_LIST_ADD_ENTRIES; + task->invocation = invocation; + task->synchronous = TRUE; + g_variant_get(parameters, "(@as)", &task->ut.white_list.entries); + + return task; +} + +dls_task_t *dls_task_wl_remove_entries_new(dleyna_connector_msg_id_t invocation, + GVariant *parameters) +{ + dls_task_t *task = g_new0(dls_task_t, 1); + + task->type = DLS_TASK_WHITE_LIST_REMOVE_ENTRIES; + task->invocation = invocation; + task->synchronous = TRUE; + g_variant_get(parameters, "(@as)", &task->ut.white_list.entries); + + return task; +} + +dls_task_t *dls_task_manager_get_prop_new(dleyna_connector_msg_id_t invocation, + const gchar *path, + GVariant *parameters, + GError **error) +{ + dls_task_t *task = (dls_task_t *)g_new0(dls_async_task_t, 1); + + g_variant_get(parameters, "(ss)", &task->ut.get_prop.interface_name, + &task->ut.get_prop.prop_name); + g_strstrip(task->ut.get_prop.interface_name); + g_strstrip(task->ut.get_prop.prop_name); + + task->target.path = g_strstrip(g_strdup(path)); + + task->type = DLS_TASK_MANAGER_GET_PROP; + task->invocation = invocation; + task->result_format = "(v)"; + + return task; +} + +dls_task_t *dls_task_manager_get_props_new(dleyna_connector_msg_id_t invocation, + const gchar *path, + GVariant *parameters, + GError **error) +{ + dls_task_t *task = (dls_task_t *)g_new0(dls_async_task_t, 1); + + g_variant_get(parameters, "(s)", &task->ut.get_props.interface_name); + g_strstrip(task->ut.get_props.interface_name); + + task->target.path = g_strstrip(g_strdup(path)); + + task->type = DLS_TASK_MANAGER_GET_ALL_PROPS; + task->invocation = invocation; + task->result_format = "(@a{sv})"; + + return task; +} + static gboolean prv_set_task_target_info(dls_task_t *task, const gchar *path, GError **error) { diff --git a/dleyna-server/libdleyna/server/task.h b/dleyna-server/libdleyna/server/task.h index bf9f3ba..fb00e10 100644 --- a/dleyna-server/libdleyna/server/task.h +++ b/dleyna-server/libdleyna/server/task.h @@ -53,7 +53,13 @@ enum dls_task_type_t_ { DLS_TASK_UPDATE_OBJECT, DLS_TASK_GET_OBJECT_METADATA, DLS_TASK_CREATE_REFERENCE, - DLS_TASK_GET_ICON + DLS_TASK_GET_ICON, + DLS_TASK_WHITE_LIST_ENABLE, + DLS_TASK_WHITE_LIST_ADD_ENTRIES, + DLS_TASK_WHITE_LIST_REMOVE_ENTRIES, + DLS_TASK_WHITE_LIST_CLEAR, + DLS_TASK_MANAGER_GET_ALL_PROPS, + DLS_TASK_MANAGER_GET_PROP }; typedef enum dls_task_type_t_ dls_task_type_t; @@ -149,6 +155,12 @@ struct dls_task_get_icon_t_ { gchar *resolution; }; +typedef struct dls_task_white_list_t_ dls_task_white_list_t; +struct dls_task_white_list_t_ { + gboolean enabled; + GVariant *entries; +}; + typedef struct dls_task_t_ dls_task_t; struct dls_task_t_ { dleyna_task_atom_t atom; /* pseudo inheritance - MUST be first field */ @@ -173,6 +185,7 @@ struct dls_task_t_ { dls_task_update_t update; dls_task_create_reference_t create_reference; dls_task_get_icon_t get_icon; + dls_task_white_list_t white_list; } ut; }; @@ -271,6 +284,28 @@ dls_task_t *dls_task_get_icon_new(dleyna_connector_msg_id_t invocation, const gchar *path, GVariant *parameters, GError **error); + +dls_task_t *dls_task_wl_enable_new(dleyna_connector_msg_id_t invocation, + GVariant *parameters); + +dls_task_t *dls_task_wl_clear_new(dleyna_connector_msg_id_t invocation); + +dls_task_t *dls_task_wl_add_entries_new(dleyna_connector_msg_id_t invocation, + GVariant *parameters); + +dls_task_t *dls_task_wl_remove_entries_new(dleyna_connector_msg_id_t invocation, + GVariant *parameters); + +dls_task_t *dls_task_manager_get_prop_new(dleyna_connector_msg_id_t invocation, + const gchar *path, + GVariant *parameters, + GError **error); + +dls_task_t *dls_task_manager_get_props_new(dleyna_connector_msg_id_t invocation, + const gchar *path, + GVariant *parameters, + GError **error); + void dls_task_cancel(dls_task_t *task); void dls_task_complete(dls_task_t *task); diff --git a/dleyna-server/libdleyna/server/upnp.c b/dleyna-server/libdleyna/server/upnp.c index 92b3943..dc2ff12 100644 --- a/dleyna-server/libdleyna/server/upnp.c +++ b/dleyna-server/libdleyna/server/upnp.c @@ -163,12 +163,13 @@ static void prv_server_available_cb(GUPnPControlPoint *cp, prv_device_new_ct_t *priv_t; udn = gupnp_device_info_get_udn((GUPnPDeviceInfo *)proxy); - if (!udn) - goto on_error; ip_address = gupnp_context_get_host_ip( gupnp_control_point_get_context(cp)); + if (!udn || !ip_address) + goto on_error; + DLEYNA_LOG_DEBUG("UDN %s", udn); DLEYNA_LOG_DEBUG("IP Address %s", ip_address); @@ -248,12 +249,13 @@ static void prv_server_unavailable_cb(GUPnPControlPoint *cp, DLEYNA_LOG_DEBUG("Enter"); udn = gupnp_device_info_get_udn((GUPnPDeviceInfo *)proxy); - if (!udn) - goto on_error; ip_address = gupnp_context_get_host_ip( gupnp_control_point_get_context(cp)); + if (!udn || !ip_address) + goto on_error; + DLEYNA_LOG_DEBUG("UDN %s", udn); DLEYNA_LOG_DEBUG("IP Address %s", ip_address); @@ -381,7 +383,7 @@ dls_upnp_t *dls_upnp_new(dleyna_connector_id_t connection, dls_device_delete); upnp->server_uc_map = g_hash_table_new_full(g_str_hash, g_str_equal, - g_free, NULL); + g_free, NULL); dls_prop_maps_new(&upnp->property_map, &upnp->filter_map); @@ -1129,3 +1131,8 @@ void dls_upnp_rescan(dls_upnp_t *upnp) gupnp_context_manager_rescan_control_points(upnp->context_manager); } + +GUPnPContextManager *dls_upnp_get_context_manager(dls_upnp_t *upnp) +{ + return upnp->context_manager; +} diff --git a/dleyna-server/libdleyna/server/upnp.h b/dleyna-server/libdleyna/server/upnp.h index 833723f..b5df0e3 100644 --- a/dleyna-server/libdleyna/server/upnp.h +++ b/dleyna-server/libdleyna/server/upnp.h @@ -112,4 +112,6 @@ gboolean dls_upnp_device_context_exist(dls_device_t *device, void dls_upnp_rescan(dls_upnp_t *upnp); +GUPnPContextManager *dls_upnp_get_context_manager(dls_upnp_t *upnp); + #endif /* DLS_UPNP_H__ */ diff --git a/dleyna-server/m4/libtool.m4 b/dleyna-server/m4/libtool.m4 index 828104c..02b4bbe 100644 --- a/dleyna-server/m4/libtool.m4 +++ b/dleyna-server/m4/libtool.m4 @@ -1324,7 +1324,14 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*) LD="${LD-ld} -m elf_i386_fbsd" ;; x86_64-*linux*) - LD="${LD-ld} -m elf_i386" + case `/usr/bin/file conftest.o` in + *x86-64*) + LD="${LD-ld} -m elf32_x86_64" + ;; + *) + LD="${LD-ld} -m elf_i386" + ;; + esac ;; ppc64-*linux*|powerpc64-*linux*) LD="${LD-ld} -m elf32ppclinux" @@ -1688,7 +1695,8 @@ AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl ;; *) lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null` - if test -n "$lt_cv_sys_max_cmd_len"; then + if test -n "$lt_cv_sys_max_cmd_len" && \ + test undefined != "$lt_cv_sys_max_cmd_len"; then lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` else @@ -2512,17 +2520,6 @@ freebsd* | dragonfly*) esac ;; -gnu*) - version_type=linux # correct to gnu/linux during the next big refactor - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - ;; - haiku*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no @@ -2639,7 +2636,7 @@ linux*oldld* | linux*aout* | linux*coff*) ;; # This must be glibc/ELF. -linux* | k*bsd*-gnu | kopensolaris*-gnu) +linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no @@ -3255,10 +3252,6 @@ freebsd* | dragonfly*) fi ;; -gnu*) - lt_cv_deplibs_check_method=pass_all - ;; - haiku*) lt_cv_deplibs_check_method=pass_all ;; @@ -3297,7 +3290,7 @@ irix5* | irix6* | nonstopux*) ;; # This must be glibc/ELF. -linux* | k*bsd*-gnu | kopensolaris*-gnu) +linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) lt_cv_deplibs_check_method=pass_all ;; @@ -4049,7 +4042,7 @@ m4_if([$1], [CXX], [ ;; esac ;; - linux* | k*bsd*-gnu | kopensolaris*-gnu) + linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) case $cc_basename in KCC*) # KAI C++ Compiler @@ -4348,7 +4341,7 @@ m4_if([$1], [CXX], [ _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; - linux* | k*bsd*-gnu | kopensolaris*-gnu) + linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) case $cc_basename in # old Intel for x86_64 which still supported -KPIC. ecc*) @@ -6241,9 +6234,6 @@ if test "$_lt_caught_CXX_error" != yes; then _LT_TAGVAR(ld_shlibs, $1)=yes ;; - gnu*) - ;; - haiku*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(link_all_deplibs, $1)=yes @@ -6405,7 +6395,7 @@ if test "$_lt_caught_CXX_error" != yes; then _LT_TAGVAR(inherit_rpath, $1)=yes ;; - linux* | k*bsd*-gnu | kopensolaris*-gnu) + linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) case $cc_basename in KCC*) # Kuck and Associates, Inc. (KAI) C++ Compiler diff --git a/packaging/dLeyna.changes b/packaging/dLeyna.changes index e350c8f..c5e95bf 100644 --- a/packaging/dLeyna.changes +++ b/packaging/dLeyna.changes @@ -1,3 +1,6 @@ +* Thu Aug 22 2013 Regis Merlino +- Update dleyna to 0.2.1 (5af1b9e) + * Mon Jul 15 23:56:26 UTC 2013 - tracy.graydon@intel.com - Stripped out the old yaml cruft from spec file diff --git a/packaging/dLeyna.spec b/packaging/dLeyna.spec index eac625b..d3613da 100644 --- a/packaging/dLeyna.spec +++ b/packaging/dLeyna.spec @@ -1,6 +1,6 @@ Name: dleyna Summary: dLeyna hosts a number of DLNA middleware components -Version: 0.2.0 +Version: 0.2.1 Release: 0 Group: System/Libraries License: LGPLv2+ @@ -58,8 +58,8 @@ rm -rf %{buildroot} %{_libexecdir}/dleyna-server-service %{_libexecdir}/dleyna-renderer-service %{_libdir}/libdleyna-core-1.0.so.* -%{_libdir}/libdleyna-server-1.0.so.* -%{_libdir}/libdleyna-renderer-1.0.so.* +%{_libdir}/dleyna-server/libdleyna-server-1.0.so.* +%{_libdir}/dleyna-renderer/libdleyna-renderer-1.0.so.* %{_libdir}/dleyna-1.0/connectors/libdleyna-connector-dbus.so %{_sysconfdir}/dleyna-server-service.conf %{_sysconfdir}/dleyna-renderer-service.conf @@ -69,8 +69,8 @@ rm -rf %{buildroot} %defattr(-,root,root,-) %{_includedir}/dleyna-1.0/libdleyna %{_libdir}/libdleyna-core-1.0.so -%{_libdir}/libdleyna-server-1.0.so -%{_libdir}/libdleyna-renderer-1.0.so +%{_libdir}/dleyna-server/libdleyna-server-1.0.so +%{_libdir}/dleyna-renderer/libdleyna-renderer-1.0.so %{_libdir}/pkgconfig/dleyna-connector-dbus-1.0.pc %{_libdir}/pkgconfig/dleyna-core-1.0.pc %{_libdir}/pkgconfig/dleyna-server-1.0.pc -- 2.7.4