forked from enlightenment/efl
Merge in emotion generic players.
This commit only merges the repository in (including history) but doesn't actually build anything. This is the first steps towards the merge.
This commit is contained in:
commit
e649307d92
|
@ -0,0 +1,28 @@
|
|||
*~
|
||||
INSTALL
|
||||
Makefile
|
||||
Makefile.in
|
||||
aclocal.m4
|
||||
autom4te.cache/
|
||||
compile
|
||||
config.cache
|
||||
config.guess
|
||||
config.h
|
||||
config.h.in
|
||||
config.h.in~
|
||||
config.log
|
||||
config.status
|
||||
config.sub
|
||||
configure
|
||||
depcomp
|
||||
install-sh
|
||||
missing
|
||||
src/vlc/.deps/
|
||||
src/vlc/.dirstamp
|
||||
src/vlc/src_vlc_vlc-emotion_generic_vlc.o
|
||||
src/vlc/vlc
|
||||
stamp-h1
|
||||
pkgbuild/PKGBUILD
|
||||
pkgbuild/pkg
|
||||
pkgbuild/src
|
||||
pkgbuild/*.tar.xz
|
|
@ -0,0 +1,20 @@
|
|||
VLC
|
||||
---
|
||||
Cedric Bail <cedric.bail@free.fr>
|
||||
Hugo Camboulive <hugo.camboulive@zodiacaerospace.com>
|
||||
Leandro Dorileo <dorileo@profusion.mobi>
|
||||
Pierre Le Magourou <pierre.lemagourou@openwide.fr>
|
||||
Rafael Antognolli <antognolli@profusion.mobi>
|
||||
Sohyun Kim <anna1014.kim@samsung.com>
|
||||
Carsten Haitzler (Rasterman) <raster@rasterman.com>
|
||||
Davide Andreoli <dave@gurumeditation.it>
|
||||
Gustavo Sverzut Barbieri <barbieri@gmail.com>
|
||||
Stefan Schmidt <s.schmidt@samsung.com>
|
||||
Bruno Dilly <bdilly@profusion.mobi>
|
||||
ChunEon Park <hermet@hermet.pe.kr>
|
||||
Daniel Juyung Seo <juyung.seo@samsung.com>
|
||||
Doug Newgard <scimmia22@outlook.com>
|
||||
Jerome Pinot <ngc891@gmail.com>
|
||||
Mike Blumenkrantz <zmike@samsung.com>
|
||||
Sebastian Dransfeld <sd@tango.flipp.net>
|
||||
Vincent Torri <vincent.torri@gmail.com>
|
|
@ -0,0 +1,25 @@
|
|||
Copyright notice for Emotion:
|
||||
|
||||
Copyright (C) 2004-2014 Carsten Haitzler and various contributors (see AUTHORS)
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
|
||||
OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
||||
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
@ -0,0 +1,12 @@
|
|||
2012-01-10 Gustavo Sverzut Barbieri (k-s)
|
||||
|
||||
* Created the project based on previous
|
||||
emotion/src/generic_players, as it was removed when Emotion was
|
||||
merged into EFL single-tree.
|
||||
|
||||
|
||||
OUT OF DATE NOTICE:
|
||||
-------------------
|
||||
With the start of the 1.9.x release cycle we now longer update the ChangeLog and rely on git log for
|
||||
this functionality. We keep however a NEWS files for a high level overview of changes in a new
|
||||
release which will be filled at the end of the release cycle.
|
|
@ -0,0 +1,57 @@
|
|||
AUTOMAKE_OPTIONS = subdir-objects
|
||||
ACLOCAL_AMFLAGS = -I m4
|
||||
|
||||
AM_MAKEFLAGS = --no-print-directory
|
||||
AM_CFLAGS = \
|
||||
@EFL_CFLAGS@ \
|
||||
@EMOTION_CFLAGS@
|
||||
|
||||
AM_LDFLAGS = \
|
||||
@EFL_LDFLAGS@
|
||||
|
||||
EXTRA_DIST = \
|
||||
README \
|
||||
AUTHORS \
|
||||
COPYING \
|
||||
m4/efl_compiler.m4 \
|
||||
m4/emotion_generic_players.m4
|
||||
|
||||
MAINTAINERCLEANFILES = \
|
||||
aclocal.m4 \
|
||||
compile \
|
||||
config.guess \
|
||||
config.h.in \
|
||||
config.sub \
|
||||
configure \
|
||||
depcomp \
|
||||
install-sh \
|
||||
ltmain.sh \
|
||||
Makefile.in \
|
||||
missing \
|
||||
mkinstalldirs \
|
||||
m4/libtool.m4 \
|
||||
m4/lt~obsolete.m4 \
|
||||
m4/ltoptions.m4 \
|
||||
m4/ltsugar.m4 \
|
||||
m4/ltversion.m4
|
||||
|
||||
|
||||
# this won't pass distcheck :(
|
||||
#emotiongenericplayersdir = $(EMOTION_GENERIC_PLAYERS_DIR)
|
||||
|
||||
emotiongenericplayersdir = \
|
||||
$(libdir)/emotion/generic_players/$(MODULE_ARCH)
|
||||
|
||||
emotiongenericplayers_PROGRAMS =
|
||||
|
||||
if HAVE_VLC
|
||||
emotiongenericplayers_PROGRAMS += src/vlc/vlc
|
||||
src_vlc_vlc_SOURCES = src/vlc/emotion_generic_vlc.c
|
||||
src_vlc_vlc_CPPFLAGS = @VLC_CFLAGS@
|
||||
src_vlc_vlc_LDADD = @VLC_LIBS@
|
||||
endif
|
||||
|
||||
.PHONY: doc
|
||||
|
||||
doc:
|
||||
@echo "Empty doc target until we have real documentation."
|
|
@ -0,0 +1,70 @@
|
|||
==============================
|
||||
Emotion Generic Players 1.17.0
|
||||
==============================
|
||||
|
||||
Changes since 1.16.0:
|
||||
---------------------
|
||||
|
||||
No significant changes in this release.
|
||||
|
||||
Changes since 1.15.0:
|
||||
---------------------
|
||||
|
||||
No significant changes in this release.
|
||||
|
||||
Changes since 1.14.0:
|
||||
---------------------
|
||||
|
||||
No significant changes in this release.
|
||||
|
||||
Changes since 1.13.0:
|
||||
---------------------
|
||||
|
||||
No significant changes in this release.
|
||||
|
||||
Changes since 1.12.0:
|
||||
---------------------
|
||||
|
||||
No significant changes in this release.
|
||||
|
||||
Changes since 1.11.0:
|
||||
---------------------
|
||||
|
||||
No significant changes in this release.
|
||||
|
||||
Changes since Emotion Generic Players 1.10.0:
|
||||
---------------------------------------------
|
||||
|
||||
Fixes:
|
||||
* emotion generic players - work around vlc bug that segvs (T1530)
|
||||
|
||||
Changes since Emotion Generic Players 1.9.0:
|
||||
--------------------------------------------
|
||||
|
||||
No changes since version 1.9.0
|
||||
|
||||
Changes since Emotion Generic Players 1.8.0:
|
||||
--------------------------------------------
|
||||
|
||||
Improvements:
|
||||
|
||||
* Emotion VLC player: debug++
|
||||
* Emotion VLC: cleanup: only changed function order in file.
|
||||
* Simplify player version dir fallback to match efl 1.9 simplification changes
|
||||
* Emotion_generic_players - commented out unused func.
|
||||
* Emotion VLC: no more need to send the size twice.
|
||||
* Emotion VLC: use Eina_Bool instead of int for bools.
|
||||
* Emotion VLC: defer the resource free until the video is actually stopped.
|
||||
|
||||
Fixes:
|
||||
|
||||
* Emotion VLC backend: fix pause/stop to work again.
|
||||
The EM_CMD_STOP command do not have any parameter so it must be
|
||||
handled in the first call of the pipe.
|
||||
* Check for libvlc >= 2.0 as a minimum as we use 2.x funcs
|
||||
* Emotion VLC: remove quite all the old hacks from loading stage which fixes the problem that
|
||||
audio was audible on start
|
||||
* Emotion VLC: fix the random-player-stop bug !!
|
||||
* Emotion VLC: fix send position_change while paused.
|
||||
* Emotion VLC: recreate the player when end reached.
|
||||
* Emotion VLC: fix the volume/mute bug.
|
|
@ -0,0 +1,65 @@
|
|||
Emotion Generic Players 1.11.0
|
||||
==============================
|
||||
|
||||
******************************************************************************
|
||||
FOR ANY ISSUES PLEASE EMAIL:
|
||||
enlightenment-devel@lists.sourceforge.net
|
||||
******************************************************************************
|
||||
|
||||
These are binary players for Emotion using the "generic" module.
|
||||
|
||||
Emotion supports multiple modules provided as shared-objects under
|
||||
PREFIX/lib/emotion/modules, making it extensible. However these
|
||||
live in the same process as the application, thus problems handling
|
||||
the media may crash or halt the application. Unfortunately media
|
||||
handling is very error prone due multiple sources, sinks, decoders et
|
||||
al, each with their own level of stability.
|
||||
|
||||
To solve this, Emotion ships with a "generic" module that is a
|
||||
layer to talk to another process, the "player", using pipes and shared
|
||||
memory (shm). If this external process dies, the main application
|
||||
remains working (without any media, of course). Thus it is safer and
|
||||
has some nice side effects such as avoiding bringing in many libraries to
|
||||
decode media, saving memory in the application process, etc.
|
||||
|
||||
A secondary benefit is that the generic player is a separate process
|
||||
and does not link with the user application code or EFL, avoiding
|
||||
license conflicts. Many decoding libraries or elements exist with
|
||||
conflicting licenses with GPL, LGPL or even proprietary code.
|
||||
|
||||
|
||||
REQUIREMENTS
|
||||
------------
|
||||
|
||||
* vlc (libvlc >= 2.0)
|
||||
|
||||
|
||||
COMPONENTS
|
||||
----------
|
||||
|
||||
**VLC Generic Player:**
|
||||
|
||||
//GPL v2 license//
|
||||
|
||||
This is a binary that uses the VLC library (libvlc) to play videos
|
||||
inot shared memory.
|
||||
|
||||
COMPILING AND INSTALLING
|
||||
------------------------
|
||||
|
||||
./configure
|
||||
make
|
||||
sudo make install
|
||||
|
||||
|
||||
COMPILER FLAGS
|
||||
--------------
|
||||
|
||||
You may want to change the install prefix for EFL with:
|
||||
|
||||
--prefix=/path/to/prefix
|
||||
|
||||
**NOTE:**
|
||||
|
||||
You should put generic players in the same prefix as EFL or they will
|
||||
not be found by EFL at runtime.
|
|
@ -0,0 +1,10 @@
|
|||
#!/bin/sh
|
||||
|
||||
rm -rf autom4te.cache
|
||||
rm -f aclocal.m4 ltmain.sh config.cache
|
||||
|
||||
autoreconf -vif
|
||||
|
||||
if [ -z "$NOCONFIGURE" ]; then
|
||||
exec ./configure -C "$@"
|
||||
fi
|
|
@ -0,0 +1,126 @@
|
|||
EFL_VERSION([1], [17], [99], [dev])
|
||||
AC_INIT([emotion_generic_players], [efl_version], [enlightenment-devel@lists.sourceforge.net])
|
||||
AC_PREREQ([2.59])
|
||||
AC_CONFIG_SRCDIR([configure.ac])
|
||||
AC_CONFIG_MACRO_DIR([m4])
|
||||
|
||||
AC_CONFIG_HEADERS([config.h])
|
||||
|
||||
AC_USE_SYSTEM_EXTENSIONS
|
||||
AC_CANONICAL_HOST
|
||||
|
||||
AM_INIT_AUTOMAKE([1.6 dist-xz])
|
||||
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
|
||||
|
||||
AC_LANG([C])
|
||||
AC_PROG_CC_C99
|
||||
AM_PROG_CC_C_O
|
||||
|
||||
PKG_PROG_PKG_CONFIG
|
||||
if test "x${PKG_CONFIG}" = "x" ; then
|
||||
AC_MSG_ERROR([pkg-config tool not found. Install it or set PKG_CONFIG environment variable to that path tool. Exiting...])
|
||||
fi
|
||||
|
||||
#### Additional options to configure
|
||||
|
||||
AC_ARG_WITH([profile],
|
||||
[AC_HELP_STRING([--with-profile=PROFILE],
|
||||
[use the predefined build profile, one of: dev, debug and release.
|
||||
@<:@default=dev@:>@])],
|
||||
[build_profile=${withval}],
|
||||
[build_profile=dev])
|
||||
|
||||
case "${build_profile}" in
|
||||
dev|debug|release)
|
||||
;;
|
||||
*)
|
||||
AC_MSG_ERROR([Unknown build profile --with-profile=${build_profile}])
|
||||
;;
|
||||
esac
|
||||
|
||||
with_max_log_level=""
|
||||
case "${build_profile}" in
|
||||
release)
|
||||
with_max_log_level="3"
|
||||
;;
|
||||
esac
|
||||
|
||||
if test -n "${with_max_log_level}"; then
|
||||
AC_MSG_NOTICE([ignoring any EINA_LOG() with level greater than ${with_max_log_level}])
|
||||
AC_DEFINE_UNQUOTED([EINA_LOG_LEVEL_MAXIMUM], [${with_max_log_level}], [if set, logging is limited to this amount.])
|
||||
fi
|
||||
|
||||
|
||||
#### Checks for compiler characteristics
|
||||
|
||||
EFL_CHECK_COMPILER_FLAGS([EFL], [-Wall -Wextra -Wpointer-arith -Wno-missing-field-initializers -fvisibility=hidden -fdata-sections -ffunction-sections])
|
||||
EFL_CHECK_LINKER_FLAGS([EFL], [-fvisibility=hidden -fdata-sections -ffunction-sections -Wl,--gc-sections -fno-strict-aliasing -Wl,--as-needed])
|
||||
case "${build_profile}" in
|
||||
dev)
|
||||
EFL_CHECK_COMPILER_FLAGS([EFL], [-Wshadow])
|
||||
;;
|
||||
esac
|
||||
|
||||
|
||||
#### Main dependency: emotion
|
||||
|
||||
PKG_CHECK_MODULES([EMOTION], [emotion >= v_maj.v_min])
|
||||
|
||||
MODULE_ARCH=`pkg-config --variable=module_arch emotion`
|
||||
if test -z "${MODULE_ARCH}"; then
|
||||
EMOTION_VERSION=`pkg-config --modversion emotion | cut -d. -f1-2`
|
||||
case "$host_os" in
|
||||
mingw32ce*)
|
||||
MODULE_ARCH="v"
|
||||
;;
|
||||
*)
|
||||
MODULE_ARCH="v-${EMOTION_VERSION}"
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
EMOTION_GENERIC_PLAYERS_DIR=`pkg-config --variable=generic_players emotion`
|
||||
if test -z "${EMOTION_GENERIC_PLAYERS_DIR}"; then
|
||||
EMOTION_GENERIC_PLAYERS_DIR="`pkg-config --variable=libdir emotion`/emotion/generic_players"
|
||||
fi
|
||||
EMOTION_GENERIC_PLAYERS_DIR="${EMOTION_GENERIC_PLAYERS_DIR}/${MODULE_ARCH}"
|
||||
|
||||
AC_MSG_CHECKING([where to install generic players])
|
||||
AC_MSG_RESULT([${EMOTION_GENERIC_PLAYERS_DIR}])
|
||||
AC_SUBST(EMOTION_GENERIC_PLAYERS_DIR)
|
||||
AC_SUBST(MODULE_ARCH)
|
||||
|
||||
#### Players
|
||||
EMOTION_GENERIC_PLAYER([VLC], [yes], [libvlc >= 2.0 eina >= 1.1.99 ecore >= 1.7.99])
|
||||
|
||||
|
||||
AC_CONFIG_FILES([
|
||||
Makefile
|
||||
pkgbuild/PKGBUILD
|
||||
])
|
||||
|
||||
AC_OUTPUT
|
||||
|
||||
echo
|
||||
echo
|
||||
echo
|
||||
echo "------------------------------------------------------------------------"
|
||||
echo "$PACKAGE_NAME $PACKAGE_VERSION"
|
||||
echo "------------------------------------------------------------------------"
|
||||
echo
|
||||
echo "Configuration Options Summary:"
|
||||
echo " Build Profile..........: ${build_profile}"
|
||||
echo
|
||||
echo "Players:"
|
||||
echo " VLC....................: ${with_vlc}"
|
||||
echo
|
||||
echo "Compilation..............: make (or gmake)"
|
||||
echo " CPPFLAGS...............: $CPPFLAGS"
|
||||
echo " CFLAGS.................: $CFLAGS"
|
||||
echo " CXXFLAGS...............: $CXXFLAGS"
|
||||
echo " LDFLAGS................: $LDFLAGS"
|
||||
echo
|
||||
echo "Installation.............: make install (as root if needed, with 'su' or 'sudo')"
|
||||
echo " prefix.................: $prefix"
|
||||
echo " emotion generic players: ${EMOTION_GENERIC_PLAYERS_DIR}"
|
||||
echo
|
|
@ -0,0 +1,449 @@
|
|||
dnl file to manage modules in efl
|
||||
|
||||
dnl EFL_VERSION(major, minor, micro, release)
|
||||
dnl This setup EFL version information and should be called BEFORE AC_INIT().
|
||||
dnl
|
||||
dnl release parameter is 'dev' to use from SVN or libtool -release field.
|
||||
dnl It may be empty if not dev (svn/live build) and no -release is to be used.
|
||||
dnl
|
||||
dnl Examples:
|
||||
dnl EFL_VERSION(1, 7, 99, dev)
|
||||
dnl EFL_VERSION(1, 7, 99, ver-1234)
|
||||
dnl This will define couple of m4 symbols:
|
||||
dnl v_maj = given major number (first parameter)
|
||||
dnl v_min = given minor number (second parameter)
|
||||
dnl v_mic = given micro number (third parameter)
|
||||
dnl v_rev = if release, it's 0, otherwise it's dev_version.
|
||||
dnl v_rel = if release, it's -release followed by fourth parameter,
|
||||
dnl otherwise it's empty. (mostly for libtool)
|
||||
dnl efl_version = if release, it's major.minor.micro, otherwise it's
|
||||
dnl major.minor.micro.dev_version
|
||||
dnl dev_version = development version (svn revision).
|
||||
dnl def_build_profile = dev or release based on 'dev' release parameter.
|
||||
AC_DEFUN([EFL_VERSION],
|
||||
[dnl
|
||||
m4_define([v_maj], [$1])dnl
|
||||
m4_define([v_min], [$2])dnl
|
||||
m4_define([v_mic], [$3])dnl
|
||||
m4_define([dev_version], m4_esyscmd([(git rev-list --count HEAD 2>/dev/null || echo 0) | tr -d '\n']))dnl
|
||||
m4_define([v_rev], m4_if($4, dev, [dev_version], [0]))dnl
|
||||
m4_define([v_rel], [])dnl
|
||||
m4_define([def_build_profile], m4_if($4, dev, [dev], [release]))dnl
|
||||
m4_define([efl_version], m4_if($4, dev, [v_maj.v_min.v_mic.v_rev], [v_maj.v_min.v_mic]))dnl
|
||||
dnl m4_define([efl_version], [v_maj.v_min.v_mic])dnl
|
||||
])
|
||||
|
||||
dnl EFL_COLOR
|
||||
dnl will check if terminal supports color and if color is wanted by user.
|
||||
dnl
|
||||
dnl Used Variables:
|
||||
dnl WANT_COLOR: if no, forces no color output.
|
||||
dnl TERM: used to check if color should be enabled.
|
||||
dnl
|
||||
dnl Defined Variables:
|
||||
dnl COLOR_YES: to be used in positive/yes conditions
|
||||
dnl COLOR_NO: to be used in negative/no conditions
|
||||
dnl COLOR_OTHER: to be used to highlight some other condition
|
||||
dnl COLOR_RESET: to reset color
|
||||
dnl want_color: yes or no
|
||||
AC_DEFUN([EFL_COLOR],
|
||||
[dnl
|
||||
case "$TERM" in
|
||||
xterm|xterm-color|xterm-256color|Eterm|aterm|kterm|rxvt*|screen|gnome|interix)
|
||||
want_color="${WANT_COLOR:-yes}"
|
||||
;;
|
||||
*)
|
||||
want_color="no"
|
||||
;;
|
||||
esac
|
||||
|
||||
### echo compatibility
|
||||
|
||||
## the BSD echo does not have the -e option (it is the default behaviour)
|
||||
echo_e=
|
||||
if test "`echo -e x`" = "x"; then
|
||||
echo_e=-e
|
||||
fi
|
||||
AC_SUBST([ECHO_E], [${echo_e}])
|
||||
|
||||
if test "${want_color}" = "yes"; then
|
||||
COLOR_YES=`echo $echo_e "\033@<:@1;32m"`
|
||||
COLOR_NO=`echo $echo_e "\033@<:@1;31m"`
|
||||
COLOR_OTHER=`echo $echo_e "\033@<:@1;36m"`
|
||||
COLOR_RESET=`echo $echo_e "\033@<:@0m"`
|
||||
else
|
||||
COLOR_YES=""
|
||||
COLOR_NO=""
|
||||
COLOR_OTHER=""
|
||||
COLOR_RESET=""
|
||||
fi
|
||||
])
|
||||
|
||||
dnl EFL_INIT()
|
||||
dnl Will AC_DEFINE() the following:
|
||||
dnl VMAJ = v_maj
|
||||
dnl VMIN = v_min
|
||||
dnl VMIC = v_mic
|
||||
dnl VREV = v_rev
|
||||
dnl Will AC_SUBST() the following:
|
||||
dnl VMAJ = v_maj
|
||||
dnl VMIN = v_min
|
||||
dnl VMIC = v_mic
|
||||
dnl EFL_LTLIBRARY_FLAGS="-no-undefined -version-info ..."
|
||||
dnl EFL_LTMODULE_FLAGS="-no-undefined -avoid-version"
|
||||
dnl Will define the following m4:
|
||||
dnl lt_cur = libtool 'current' field of libtool's -version-info
|
||||
dnl lt_rev = libtool 'revision' field of libtool's -version-info
|
||||
dnl lt_age = libtool 'age' field of libtool's -version-info
|
||||
AC_DEFUN([EFL_INIT],
|
||||
[dnl
|
||||
AC_REQUIRE([EFL_COLOR])dnl
|
||||
AC_DEFINE_UNQUOTED([VMAJ], [v_maj], [Major version])dnl
|
||||
AC_DEFINE_UNQUOTED([VMIN], [v_min], [Minor version])dnl
|
||||
AC_DEFINE_UNQUOTED([VMIC], [v_mic], [Micro version])dnl
|
||||
AC_DEFINE_UNQUOTED([VREV], [v_rev], [Revison])dnl
|
||||
VMAJ=v_maj
|
||||
VMIN=v_min
|
||||
VMIC=v_mic
|
||||
AC_SUBST([VMAJ])dnl
|
||||
AC_SUBST([VMIN])dnl
|
||||
AC_SUBST([VMIC])dnl
|
||||
dnl
|
||||
dnl TODO: warning - lt_cur:
|
||||
dnl the previous code assumed v_maj + v_min, but this will be a problem when
|
||||
dnl we bump v_maj and reset v_min. 1 + 7 == 7 + 1, so if v_maj is bumped
|
||||
dnl we multiply it by 100.
|
||||
m4_define([lt_cur], m4_if(m4_cmp(v_maj, 1), 0, m4_eval(v_maj + v_min), m4_eval(v_maj * 100 + v_min)))dnl
|
||||
m4_define([lt_rev], v_mic)dnl
|
||||
m4_define([lt_age], v_min)dnl
|
||||
dnl
|
||||
EFL_LTLIBRARY_FLAGS="-no-undefined -version-info lt_cur:lt_rev:lt_age v_rel"
|
||||
AC_SUBST(EFL_LTLIBRARY_FLAGS)dnl
|
||||
EFL_LTMODULE_FLAGS="-no-undefined -avoid-version"
|
||||
AC_SUBST([EFL_LTMODULE_FLAGS])dnl
|
||||
AC_MSG_NOTICE([Initialized AC_PACKAGE_NAME (AC_PACKAGE_VERSION) development=dev_version v_rel])
|
||||
])
|
||||
|
||||
dnl EFL_EVAL_PKGS(EFL)
|
||||
dnl does PKG_CHECK_MODULES() for given EFL
|
||||
AC_DEFUN([EFL_EVAL_PKGS],
|
||||
[dnl
|
||||
m4_pushdef([DOWNEFL], m4_translit([$1], [-A-Z], [_a-z]))dnl
|
||||
if test "x${requirements_pc_deps_[]m4_defn([DOWNEFL])}" != "x"; then
|
||||
PKG_CHECK_MODULES([$1], [${requirements_pc_deps_[]m4_defn([DOWNEFL])}])
|
||||
fi
|
||||
m4_popdef([DOWNEFL])dnl
|
||||
])
|
||||
|
||||
dnl EFL_INTERNAL_DEPEND_PKG(EFL, OTHEREFL)
|
||||
dnl Adds a pkg-config dependency on another EFL.
|
||||
AC_DEFUN([EFL_INTERNAL_DEPEND_PKG],
|
||||
[dnl
|
||||
m4_pushdef([DOWNEFL], m4_translit([$1], [-A-Z], [_a-z]))dnl
|
||||
m4_pushdef([DOWNOTHER], m4_translit([$2], [-A-Z], [_a-z]))dnl
|
||||
dnl TODO: we need to fix the package config names for 2.0
|
||||
dnl TODO: and make them uniform in scheme.
|
||||
depname="$2"
|
||||
libdirname="m4_defn([DOWNOTHER])"
|
||||
libname="m4_defn([DOWNOTHER])"
|
||||
case "m4_defn([DOWNOTHER])" in
|
||||
ethumb_client)
|
||||
depname="ethumb_client"
|
||||
;;
|
||||
esac
|
||||
requirements_pc_[]m4_defn([DOWNEFL])="${depname} >= ${PACKAGE_VERSION} ${requirements_pc_[][]m4_defn([DOWNEFL])}"
|
||||
requirements_cflags_[]m4_defn([DOWNEFL])="-I\$(top_srcdir)/src/lib/${libdirname} -I\$(top_builddir)/src/lib/${libdirname} ${requirements_cflags_[][]m4_defn([DOWNEFL])}"
|
||||
requirements_internal_libs_[]m4_defn([DOWNEFL])="lib/${libdirname}/lib${libname}.la ${requirements_internal_libs_[][]m4_defn([DOWNEFL])}"
|
||||
requirements_internal_deps_libs_[]m4_defn([DOWNEFL])="${requirements_public_libs_[]m4_defn([DOWNOTHER])} ${requirements_internal_deps_libs_[][]m4_defn([DOWNEFL])}"
|
||||
m4_popdef([DOWNOTHER])dnl
|
||||
m4_popdef([DOWNEFL])dnl
|
||||
])
|
||||
|
||||
dnl EFL_PLATFORM_DEPEND(EFL, PLATFORM)
|
||||
dnl PLATFORM is one of: all, evil, escape, exotic
|
||||
AC_DEFUN([EFL_PLATFORM_DEPEND],
|
||||
[dnl
|
||||
m4_pushdef([DOWNOTHER], m4_translit([$2], [-A-Z], [_a-z]))dnl
|
||||
case "m4_defn([DOWNOTHER])" in
|
||||
all)
|
||||
if test "x${efl_lib_optional_evil}" = "xyes"; then
|
||||
EFL_INTERNAL_DEPEND_PKG([$1], [evil])
|
||||
elif test "x${efl_lib_optional_escape}" = "xyes"; then
|
||||
EFL_INTERNAL_DEPEND_PKG([$1], [escape])
|
||||
elif test "x${efl_lib_optional_exotic}" = "xyes"; then
|
||||
EFL_INTERNAL_DEPEND_PKG([$1], [exotic])
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
if test "x${efl_lib_optional_[]m4_defn([DOWNOTHER])}" = "xyes"; then
|
||||
EFL_INTERNAL_DEPEND_PKG([$1], [$2])
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
m4_popdef([DOWNOTHER])dnl
|
||||
])
|
||||
|
||||
dnl EFL_CRYPTO_DEPEND(EFL)
|
||||
dnl the given EFL will use/depend on system crypto settings
|
||||
AC_DEFUN([EFL_CRYPTO_DEPEND],
|
||||
[dnl
|
||||
m4_pushdef([DOWNEFL], m4_translit([$1], [-A-Z], [_a-z]))dnl
|
||||
requirements_pc_[]m4_defn([DOWNEFL])="${requirements_pc_crypto} ${requirements_pc_[][]m4_defn([DOWNEFL])}"
|
||||
requirements_pc_deps_[]m4_defn([DOWNEFL])="${requirements_pc_deps_crypto} ${requirements_pc_deps_[][]m4_defn([DOWNEFL])}"
|
||||
requirements_libs_[]m4_defn([DOWNEFL])="${requirements_libs_crypto} ${requirements_libs_[][]m4_defn([DOWNEFL])}"
|
||||
requirements_cflags_[]m4_defn([DOWNEFL])="${requirements_cflags_crypto} ${requirements_cflags_[][]m4_defn([DOWNEFL])}"
|
||||
m4_popdef([DOWNEFL])dnl
|
||||
])
|
||||
|
||||
dnl EFL_DEPEND_PKG(EFL, NAME, PACKAGE, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
|
||||
dnl Adds a pkg-config dependency to an efl, AC_DEFINE() HAVE_NAME,
|
||||
dnl and inserts dependencies in proper variables
|
||||
AC_DEFUN([EFL_DEPEND_PKG],
|
||||
[dnl
|
||||
m4_pushdef([UPEFL], m4_translit([$1], [-a-z], [_A-Z]))dnl
|
||||
m4_pushdef([DOWNEFL], m4_translit([$1], [-A-Z], [_a-z]))dnl
|
||||
m4_pushdef([UPNAME], m4_translit([$2], [-a-z], [_A-Z]))dnl
|
||||
m4_pushdef([DOWNNAME], m4_translit([$2], [-A-Z], [_a-z]))dnl
|
||||
|
||||
have_[]m4_defn([DOWNNAME])="no"
|
||||
|
||||
EFL_PKG_CHECK_STRICT([$3], [
|
||||
AC_DEFINE([HAVE_]m4_defn([UPNAME]), [1], [Have `]m4_defn([DOWNNAME])[' pkg-config installed.])
|
||||
requirements_pc_[]m4_defn([DOWNEFL])="$3 ${requirements_pc_[][]m4_defn([DOWNEFL])}"
|
||||
requirements_pc_deps_[]m4_defn([DOWNEFL])="$3 ${requirements_pc_deps_[]m4_defn([DOWNEFL])}"
|
||||
have_[]m4_defn([DOWNNAME])="yes"
|
||||
|
||||
$4
|
||||
|
||||
], [$5])
|
||||
|
||||
m4_popdef([DOWNNAME])
|
||||
m4_popdef([UPNAME])
|
||||
m4_popdef([DOWNEFL])
|
||||
m4_popdef([UPEFL])
|
||||
])
|
||||
|
||||
dnl EFL_OPTIONAL_DEPEND_PKG(EFL, VARIABLE, NAME, PACKAGE, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
|
||||
AC_DEFUN([EFL_OPTIONAL_DEPEND_PKG],
|
||||
[dnl
|
||||
m4_pushdef([DOWN], m4_translit([$3], [-A-Z], [_a-z]))dnl
|
||||
|
||||
have_[]m4_defn([DOWN])="no"
|
||||
if test "x$2" = "xyes"; then
|
||||
EFL_DEPEND_PKG([$1], [$3], [$4], [$5], [$6])
|
||||
fi
|
||||
m4_popdef([DOWN])dnl
|
||||
])
|
||||
|
||||
dnl EFL_OPTIONAL_INTERNAL_DEPEND_PKG(EFL, VARIABLE, NAME)
|
||||
AC_DEFUN([EFL_OPTIONAL_INTERNAL_DEPEND_PKG],
|
||||
[dnl
|
||||
if test "x$2" = "xyes"; then
|
||||
EFL_INTERNAL_DEPEND_PKG([$1], [$3])
|
||||
fi
|
||||
])
|
||||
|
||||
dnl EFL_ADD_LIBS(PKG, LIBS)
|
||||
dnl Add libraries that the EFL library will depend on
|
||||
dnl See EFL_DEPEND_PKG() for pkg-config version.
|
||||
AC_DEFUN([EFL_ADD_LIBS],
|
||||
[dnl
|
||||
m4_pushdef([DOWN], m4_translit([$1], [-A-Z], [_a-z]))dnl
|
||||
requirements_libs_[]m4_defn([DOWN])="${requirements_libs_[]m4_defn([DOWN])} $2"
|
||||
m4_popdef([DOWN])dnl
|
||||
])
|
||||
|
||||
dnl EFL_ADD_PUBLIC_LIBS(PKG, PUBLIC_LIBS)
|
||||
dnl Add libraries that the EFL library will depend on when used.
|
||||
dnl
|
||||
dnl Unlike EFL_ADD_LIBS(), that is only used when generating PKG,
|
||||
dnl this one is used when linking PKG to other libraries or applications.
|
||||
dnl
|
||||
dnl For instance if you use some other library in your header that user
|
||||
dnl inclues.
|
||||
AC_DEFUN([EFL_ADD_PUBLIC_LIBS],
|
||||
[dnl
|
||||
m4_pushdef([DOWN], m4_translit([$1], [-A-Z], [_a-z]))dnl
|
||||
requirements_public_libs_[]m4_defn([DOWN])="${requirements_public_libs_[]m4_defn([DOWN])} $2"
|
||||
m4_popdef([DOWN])dnl
|
||||
])
|
||||
|
||||
dnl EFL_ADD_CFLAGS(PKG, CFLAGS)
|
||||
dnl Add CFLAGS that the EFL library will use
|
||||
dnl See EFL_DEPEND_PKG() for pkg-config version.
|
||||
AC_DEFUN([EFL_ADD_CFLAGS],
|
||||
[dnl
|
||||
m4_pushdef([DOWN], m4_translit([$1], [-A-Z], [_a-z]))dnl
|
||||
requirements_cflags_[]m4_defn([DOWN])="${requirements_cflags_[]m4_defn([DOWN])} $2"
|
||||
m4_popdef([DOWN])dnl
|
||||
])
|
||||
|
||||
dnl EFL_LIB_START(PKG)
|
||||
dnl start the setup of an EFL library, defines variables and prints a notice
|
||||
dnl
|
||||
dnl Exports (AC_SUBST)
|
||||
dnl PKG_CFLAGS: what to use for CFLAGS
|
||||
dnl
|
||||
dnl PKG_LDFLAGS: what to use for LDFLAGS
|
||||
dnl
|
||||
dnl PKG_LIBS: what to use in automake's _LIBADD or _LDADD. Includes
|
||||
dnl everything else.
|
||||
dnl
|
||||
dnl PKG_INTERNAL_LIBS: all other EFL as lib/name/libname.la that this
|
||||
dnl package depend. Used in automake's _DEPENDENCIES.
|
||||
dnl
|
||||
dnl USE_PKG_LIBS: what to use in automake's _LIBADD or _LDADD when using
|
||||
dnl this PKG (PKG_LIBS + libpkg.la)
|
||||
dnl
|
||||
dnl USE_PKG_INTERNAL_LIBS: extends PKG_INTERNAL_LIBS with lib/pkg/libpkg.la
|
||||
dnl
|
||||
dnl requirements_pc_pkg: all pkg-config (pc) files used by this pkg,
|
||||
dnl includes internal EFL (used in 'Requires.private' in pkg.pc)
|
||||
dnl
|
||||
dnl requirements_libs_pkg: external libraries this package needs when
|
||||
dnl linking (used in 'Libs.private' in pkg.pc)
|
||||
dnl
|
||||
dnl requirements_public_libs_pkg: external libraries other packages need
|
||||
dnl when using this (used in 'Libs' in pkg.pc)
|
||||
dnl
|
||||
dnl requirements_cflags_pkg: what to use for CFLAGS (same as PKG_CFLAGS).
|
||||
dnl
|
||||
dnl Variables:
|
||||
dnl requirements_pc_deps_pkg: external pkg-config (pc) files used by this
|
||||
dnl pkg (used in EFL_EVAL_PKGS())
|
||||
dnl
|
||||
dnl requirements_internal_libs_pkg: all other EFL as lib/name/libname.la
|
||||
dnl that this package depend.
|
||||
dnl
|
||||
dnl requirements_internal_deps_libs_pkg: external libraries that are public
|
||||
dnl dependencies (due internal libs).
|
||||
dnl
|
||||
AC_DEFUN([EFL_LIB_START],
|
||||
[dnl
|
||||
m4_pushdef([DOWN], m4_translit([$1], [-A-Z], [_a-z]))dnl
|
||||
m4_pushdef([UP], m4_translit([$1], [-a-z], [_A-Z]))dnl
|
||||
|
||||
requirements_internal_libs_[]m4_defn([DOWN])=""
|
||||
requirements_internal_deps_libs_[]m4_defn([DOWN])=""
|
||||
requirements_libs_[]m4_defn([DOWN])=""
|
||||
requirements_public_libs_[]m4_defn([DOWN])=""
|
||||
requirements_cflags_[]m4_defn([DOWN])=""
|
||||
requirements_pc_[]m4_defn([DOWN])=""
|
||||
requirements_pc_deps_[]m4_defn([DOWN])=""
|
||||
|
||||
m4_defn([UP])_LIBS="${m4_defn([UP])_LIBS}"
|
||||
m4_defn([UP])_INTERNAL_LIBS="${m4_defn([UP])_INTERNAL_LIBS}"
|
||||
USE_[]m4_defn([UP])_LIBS="${USE_[]m4_defn([UP])_LIBS}"
|
||||
USE_[]m4_defn([UP])_INTERNAL_LIBS="${USE_[]m4_defn([UP])_INTERNAL_LIBS}"
|
||||
m4_defn([UP])_LDFLAGS="${m4_defn([UP])_LDFLAGS}"
|
||||
m4_defn([UP])_CFLAGS="${m4_defn([UP])_CFLAGS}"
|
||||
|
||||
AC_SUBST([requirements_libs_]m4_defn([DOWN]))dnl
|
||||
AC_SUBST([requirements_public_libs_]m4_defn([DOWN]))dnl
|
||||
AC_SUBST([requirements_cflags_]m4_defn([DOWN]))dnl
|
||||
AC_SUBST([requirements_pc_]m4_defn([DOWN]))dnl
|
||||
AC_SUBST(m4_defn([UP])[_LIBS])dnl
|
||||
AC_SUBST(m4_defn([UP])[_INTERNAL_LIBS])dnl
|
||||
AC_SUBST([USE_]m4_defn([UP])[_LIBS])dnl
|
||||
AC_SUBST([USE_]m4_defn([UP])[_INTERNAL_LIBS])dnl
|
||||
AC_SUBST(m4_defn([UP])[_LDFLAGS])dnl
|
||||
AC_SUBST(m4_defn([UP])[_CFLAGS])dnl
|
||||
AC_MSG_NOTICE([Start $1 checks])dnl
|
||||
m4_popdef([UP])dnl
|
||||
m4_popdef([DOWN])dnl
|
||||
])
|
||||
|
||||
dnl EFL_LIB_END(PKG)
|
||||
dnl finishes the setup of an EFL library
|
||||
AC_DEFUN([EFL_LIB_END],
|
||||
[dnl
|
||||
m4_pushdef([DOWN], m4_translit([$1], [-A-Z], [_a-z]))dnl
|
||||
m4_pushdef([UP], m4_translit([$1], [-a-z], [_A-Z]))dnl
|
||||
|
||||
libdirname="m4_defn([DOWN])"
|
||||
libname="m4_defn([DOWN])"
|
||||
|
||||
m4_defn([UP])_LDFLAGS="${EFLALL_COV_LDFLAGS} ${EFLALL_LDFLAGS} ${m4_defn([UP])_LDFLAGS}"
|
||||
m4_defn([UP])_LIBS=" ${m4_defn([UP])_LDFLAGS} ${EFLALL_COV_LIBS} ${EFLALL_LIBS} ${m4_defn([UP])_LIBS} ${requirements_internal_libs_[]m4_defn([DOWN])} ${requirements_internal_deps_libs_[]m4_defn([DOWN])} ${requirements_public_libs_[]m4_defn([DOWN])} ${requirements_libs_[]m4_defn([DOWN])} ${requirements_libs_eflall} "
|
||||
m4_defn([UP])_INTERNAL_LIBS="${m4_defn([UP])_INTERNAL_LIBS} ${requirements_internal_libs_[]m4_defn([DOWN])}"
|
||||
USE_[]m4_defn([UP])_LIBS="${m4_defn([UP])_LIBS} lib/${libdirname}/lib${libname}.la"
|
||||
USE_[]m4_defn([UP])_INTERNAL_LIBS="${m4_defn([UP])_INTERNAL_LIBS} lib/${libdirname}/lib${libname}.la"
|
||||
m4_defn([UP])_CFLAGS="${EFLALL_COV_CFLAGS} ${EFLALL_CFLAGS} ${m4_defn([UP])_CFLAGS} -I\$(top_srcdir)/src/lib/${libdirname} -I\$(top_builddir)/src/lib/${libdirname} -I\$(top_srcdir)/src/bindings/${libdirname} -I\$(top_builddir)/src/bindings/${libdirname} ${requirements_cflags_[]m4_defn([DOWN])} ${requirements_cflags_eflall} -DEFL_[]m4_defn([UP])_BUILD=1"
|
||||
requirements_pc_[]m4_defn([DOWN])="${requirements_pc_[]m4_defn([DOWN])} ${requirements_pc_eflall}"
|
||||
requirements_pc_deps_[]m4_defn([DOWN])="${requirements_pc_deps_[]m4_defn([DOWN])} ${requirements_pc_deps_eflall}"
|
||||
|
||||
AC_MSG_NOTICE([Finished $1 checks])dnl
|
||||
m4_popdef([UP])dnl
|
||||
m4_popdef([DOWN])dnl
|
||||
])
|
||||
|
||||
dnl EFL_LIB_START_OPTIONAL(PKG, TEST)
|
||||
dnl test if library should be build and then EFL_LIB_START()
|
||||
dnl must call EFL_LIB_END_OPTIONAL() to close it.
|
||||
AC_DEFUN([EFL_LIB_START_OPTIONAL],
|
||||
[dnl
|
||||
m4_pushdef([DOWN], m4_translit([$1], [-A-Z], [_a-z]))dnl
|
||||
m4_pushdef([UP], m4_translit([$1], [-a-z], [_A-Z]))dnl
|
||||
|
||||
if $2; then
|
||||
efl_lib_optional_[]m4_defn([DOWN])="yes"
|
||||
else
|
||||
efl_lib_optional_[]m4_defn([DOWN])="no"
|
||||
AC_MSG_NOTICE([Skipping $1 checks (disabled)])
|
||||
fi
|
||||
|
||||
if test "$efl_lib_optional_[]m4_defn([DOWN])" = "yes"; then
|
||||
EFL_LIB_START([$1])
|
||||
AC_DEFINE([HAVE_]m4_defn([UP]), [1], [optional EFL $1 is enabled])
|
||||
dnl closed at EFL_LIB_END_OPTIONAL()
|
||||
m4_popdef([UP])dnl
|
||||
m4_popdef([DOWN])dnl
|
||||
])
|
||||
|
||||
dnl EFL_LIB_END_OPTIONAL(PKG)
|
||||
dnl closes block started by EFL_LIB_START_OPTIONAL() and then
|
||||
dnl defines AM_CONDITIONAL([HAVE_PKG]) and AC_DEFINE([HAVE_PKG])
|
||||
AC_DEFUN([EFL_LIB_END_OPTIONAL],
|
||||
[dnl
|
||||
m4_pushdef([DOWN], m4_translit([$1], [-A-Z], [_a-z]))dnl
|
||||
m4_pushdef([UP], m4_translit([$1], [-a-z], [_A-Z]))dnl
|
||||
|
||||
dnl close if started at EFL_LIB_START_OPTIONAL()
|
||||
EFL_LIB_END([$1])
|
||||
fi
|
||||
|
||||
AM_CONDITIONAL([HAVE_]m4_defn([UP]), [test "$efl_lib_optional_[]m4_defn([DOWN])" = "yes"])dnl
|
||||
m4_popdef([UP])dnl
|
||||
m4_popdef([DOWN])dnl
|
||||
])
|
||||
|
||||
dnl EFL_ADD_FEATURE(PKG, NAME, [VALUE])
|
||||
dnl if VALUE is not specified, will use ${have_name} instead.
|
||||
dnl
|
||||
dnl Defined Variables:
|
||||
dnl features_pkg
|
||||
AC_DEFUN([EFL_ADD_FEATURE],
|
||||
[dnl
|
||||
m4_pushdef([DOWNPKG], m4_translit([$1], [-A-Z], [_a-z]))dnl
|
||||
m4_pushdef([DOWNNAME], m4_translit([$2], [-A-Z], [_a-z]))dnl
|
||||
|
||||
value="m4_if($3, , [${have_]m4_defn([DOWNNAME])[:-${want_]m4_defn([DOWNNAME])[}}], [$3])"
|
||||
case "${value}" in
|
||||
yes)
|
||||
tmp="${COLOR_YES}+$2${COLOR_RESET}"
|
||||
;;
|
||||
no)
|
||||
tmp="${COLOR_NO}-$2${COLOR_RESET}"
|
||||
;;
|
||||
*)
|
||||
tmp="${COLOR_OTHER}$2=${value}${COLOR_RESET}"
|
||||
;;
|
||||
esac
|
||||
if test -z "${features_[]m4_defn([DOWNPKG])}"; then
|
||||
features_[]m4_defn([DOWNPKG])="${tmp}"
|
||||
else
|
||||
features_[]m4_defn([DOWNPKG])="${features_[]m4_defn([DOWNPKG])} ${tmp}"
|
||||
fi
|
||||
m4_popdef([DOWNNAME])dnl
|
||||
m4_popdef([DOWNPKG])dnl
|
||||
])
|
|
@ -0,0 +1,98 @@
|
|||
dnl Copyright (C) 2012 Vincent Torri <vincent dot torri at gmail dot com>
|
||||
dnl This code is public domain and can be freely used or copied.
|
||||
|
||||
dnl Macro that check if compiler of linker flags are available
|
||||
|
||||
|
||||
dnl Macro that checks for a compiler flag availability
|
||||
dnl
|
||||
dnl EFL_CHECK_COMPILER_FLAG(EFL, FLAG[, ACTION-IF-FOUND[ ,ACTION-IF-NOT-FOUND]])
|
||||
dnl AC_SUBST : EFL_CFLAGS (EFL being replaced by its value)
|
||||
|
||||
AC_DEFUN([EFL_CHECK_COMPILER_FLAG],
|
||||
[
|
||||
m4_pushdef([UPEFL], m4_translit([[$1]], [-a-z], [_A-Z]))
|
||||
m4_pushdef([UP], m4_translit([[$2]], [-a-z], [_A-Z]))
|
||||
|
||||
dnl store in options -Wfoo if -Wno-foo is passed
|
||||
option=m4_bpatsubst([[$2]], [-Wno-], [-W])
|
||||
|
||||
CFLAGS_save="${CFLAGS}"
|
||||
CFLAGS="${CFLAGS} ${option}"
|
||||
|
||||
AC_LANG_PUSH([C])
|
||||
AC_MSG_CHECKING([whether the compiler supports $2])
|
||||
|
||||
AC_COMPILE_IFELSE(
|
||||
[AC_LANG_PROGRAM([[]])],
|
||||
[have_flag="yes"],
|
||||
[have_flag="no"])
|
||||
AC_MSG_RESULT([${have_flag}])
|
||||
|
||||
CFLAGS="${CFLAGS_save}"
|
||||
AC_LANG_POP([C])
|
||||
|
||||
if test "x${have_flag}" = "xyes" ; then
|
||||
UPEFL[_CFLAGS]="${UPEFL[_CFLAGS]} [$2]"
|
||||
fi
|
||||
AC_ARG_VAR(UPEFL[_CFLAGS], [preprocessor flags for $2])
|
||||
AC_SUBST(UPEFL[_CFLAGS])
|
||||
|
||||
m4_popdef([UP])
|
||||
m4_popdef([UPEFL])
|
||||
])
|
||||
|
||||
dnl Macro that iterates over a sequence of white separated flags
|
||||
dnl and that call EFL_CHECK_COMPILER_FLAG() for each of these flags
|
||||
dnl
|
||||
dnl EFL_CHECK_COMPILER_FLAGS(EFL, FLAGS)
|
||||
|
||||
AC_DEFUN([EFL_CHECK_COMPILER_FLAGS],
|
||||
[
|
||||
m4_foreach_w([flag], [$2], [EFL_CHECK_COMPILER_FLAG([$1], m4_defn([flag]))])
|
||||
])
|
||||
|
||||
|
||||
dnl Macro that checks for a linker flag availability
|
||||
dnl
|
||||
dnl EFL_CHECK_LINKER_FLAG(EFL, FLAG[, ACTION-IF-FOUND[ ,ACTION-IF-NOT-FOUND]])
|
||||
dnl AC_SUBST : EFL_LDFLAGS (EFL being replaced by its value)
|
||||
|
||||
AC_DEFUN([EFL_CHECK_LINKER_FLAG],
|
||||
[
|
||||
m4_pushdef([UPEFL], m4_translit([[$1]], [-a-z], [_A-Z]))
|
||||
m4_pushdef([UP], m4_translit([[$2]], [,-a-z], [__A-Z]))
|
||||
|
||||
LDFLAGS_save="${LDFLAGS}"
|
||||
LDFLAGS="${LDFLAGS} $2"
|
||||
|
||||
AC_LANG_PUSH([C])
|
||||
AC_MSG_CHECKING([whether the linker supports $2])
|
||||
|
||||
AC_LINK_IFELSE(
|
||||
[AC_LANG_PROGRAM([[]])],
|
||||
[have_flag="yes"],
|
||||
[have_flag="no"])
|
||||
AC_MSG_RESULT([${have_flag}])
|
||||
|
||||
LDFLAGS="${LDFLAGS_save}"
|
||||
AC_LANG_POP([C])
|
||||
|
||||
if test "x${have_flag}" = "xyes" ; then
|
||||
UPEFL[_LDFLAGS]="${UPEFL[_LDFLAGS]} [$2]"
|
||||
fi
|
||||
AC_SUBST(UPEFL[_LDFLAGS])
|
||||
|
||||
m4_popdef([UP])
|
||||
m4_popdef([UPEFL])
|
||||
])
|
||||
|
||||
dnl Macro that iterates over a sequence of white separated flags
|
||||
dnl and that call EFL_CHECK_LINKER_FLAG() for each of these flags
|
||||
dnl
|
||||
dnl EFL_CHECK_LINKER_FLAGS(EFL, FLAGS)
|
||||
|
||||
AC_DEFUN([EFL_CHECK_LINKER_FLAGS],
|
||||
[
|
||||
m4_foreach_w([flag], [$2], [EFL_CHECK_LINKER_FLAG([$1], m4_defn([flag]))])
|
||||
])
|
|
@ -0,0 +1,37 @@
|
|||
dnl EMOTION_GENERIC_PLAYER(NAME, DEFAULT_STATE, [PKG_CONFIG_DEPS])
|
||||
dnl Does the following:
|
||||
dnl * AC_ARG_WITH(NAME)
|
||||
dnl * define with_name to yes or no
|
||||
dnl * PKG_CHECK_MODULES(NAME, PKG_CONFIG_DEPS)
|
||||
dnl * AC_DEFINE([HAVE_NAME])
|
||||
dnl * AM_CONDITIONAL([HAVE_NAME])
|
||||
AC_DEFUN([EMOTION_GENERIC_PLAYER],
|
||||
[dnl
|
||||
m4_pushdef([DOWN], m4_translit([$1], [-A-Z], [_a-z]))dnl
|
||||
m4_pushdef([UP], m4_translit([$1], [-a-z], [_A-Z]))dnl
|
||||
|
||||
AC_ARG_WITH([DOWN],
|
||||
[AC_HELP_STRING([--with-]m4_defn([DOWN]),
|
||||
[build generic player ]m4_defn([UP])[. @<:@default=$2@:>@])],
|
||||
[], [with_]m4_defn([DOWN])[="$2"])
|
||||
|
||||
if test "${with_[]m4_defn([DOWN])}" = "yes"; then
|
||||
m4_ifval([$3], [dnl
|
||||
PKG_CHECK_MODULES(m4_defn([UP]), [$3])
|
||||
], [dnl
|
||||
m4_defn([UP])_LIBS="${m4_defn([UP])_LIBS}"
|
||||
m4_defn([UP])_CFLAGS="${m4_defn([UP])_CFLAGS}"
|
||||
AC_SUBST(m4_defn([UP])[_LIBS])
|
||||
AC_SUBST(m4_defn([UP])[_CFLAGS])
|
||||
])
|
||||
|
||||
AC_SEARCH_LIBS([shm_open], [rt], [], [AC_MSG_ERROR([unable to find the shm_open() function])])
|
||||
if test "${ac_cv_search_shm_open}" != "none required"; then
|
||||
m4_defn([UP])_LIBS="${m4_defn([UP])_LIBS} ${ac_cv_search_shm_open}"
|
||||
fi
|
||||
fi
|
||||
AM_CONDITIONAL([HAVE_]m4_defn([UP]), [test "$with_[]m4_defn([DOWN])" = "yes"])
|
||||
|
||||
m4_popdef([UP])dnl
|
||||
m4_popdef([DOWN])dnl
|
||||
])
|
|
@ -0,0 +1,35 @@
|
|||
# Maintainer: Enlightenment Developers <enlightenment-devel@enlightenment.org>
|
||||
pkgname=emotion_generic_players
|
||||
pkgver=@VERSION@
|
||||
pkgrel=1
|
||||
pkgdesc="Emotion external binary executable players - GIT development snapshot"
|
||||
arch=('i686' 'x86_64' 'arm')
|
||||
url="http://www.enlightenment.org"
|
||||
license=('BSD')
|
||||
depends=('efl' 'vlc' 'libdvdcss' 'vcdimager' 'libcdio'
|
||||
'ttf-freefont' 'ttf-dejavu' 'libssh2')
|
||||
options=('debug')
|
||||
build() {
|
||||
cd "../.."
|
||||
export CFLAGS="$CFLAGS -fvisibility=hidden -fomit-frame-pointer"
|
||||
export CXXFLAGS="$CXXFLAGS -fvisibility=hidden -fomit-frame-pointer"
|
||||
make clean distclean
|
||||
./configure --prefix=/usr
|
||||
make
|
||||
}
|
||||
|
||||
#check() {
|
||||
# cd "../.."
|
||||
# make -k check
|
||||
#}
|
||||
|
||||
package() {
|
||||
cd "../.."
|
||||
make -j1 DESTDIR="$pkgdir/" install
|
||||
install -Dm644 README "$pkgdir/usr/share/$pkgname/README"
|
||||
install -Dm644 NEWS "$pkgdir/usr/share/$pkgname/NEWS"
|
||||
install -Dm644 ChangeLog "$pkgdir/usr/share/$pkgname/ChangeLog"
|
||||
install -Dm644 AUTHORS "$pkgdir/usr/share/$pkgname/AUTHORS"
|
||||
install -Dm644 COPYING "$pkgdir/usr/share/licenses/$pkgname/COPYING"
|
||||
ln -s "../licenses/$pkgname/COPYING" "$pkgdir/usr/share/$pkgname/COPYING"
|
||||
}
|
|
@ -0,0 +1,790 @@
|
|||
#ifdef HAVE_CONFIG_H
|
||||
# include "config.h"
|
||||
#endif
|
||||
|
||||
#include <errno.h>
|
||||
#include <limits.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <sys/mman.h>
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
#include <pthread.h>
|
||||
#include <poll.h>
|
||||
|
||||
#include <signal.h>
|
||||
|
||||
#include <vlc/vlc.h>
|
||||
|
||||
#include <Emotion_Generic_Plugin.h>
|
||||
#include <Eina.h>
|
||||
#include <Ecore.h>
|
||||
|
||||
static int _em_vlc_log_dom = -1;
|
||||
#define ERR(...) EINA_LOG_DOM_ERR(_em_vlc_log_dom, __VA_ARGS__)
|
||||
#define DBG(...) EINA_LOG_DOM_DBG(_em_vlc_log_dom, __VA_ARGS__)
|
||||
#define INF(...) EINA_LOG_DOM_INFO(_em_vlc_log_dom, __VA_ARGS__)
|
||||
#define WRN(...) EINA_LOG_DOM_WARN(_em_vlc_log_dom, __VA_ARGS__)
|
||||
#define CRIT(...) EINA_LOG_DOM_CRIT(_em_vlc_log_dom, __VA_ARGS__)
|
||||
|
||||
|
||||
typedef struct _App App;
|
||||
struct _App {
|
||||
Emotion_Generic_Video_Shared *vs;
|
||||
Emotion_Generic_Video_Frame vf;
|
||||
|
||||
libvlc_instance_t *libvlc;
|
||||
libvlc_media_t *m;
|
||||
libvlc_media_player_t *mp;
|
||||
libvlc_event_manager_t *event_mgr;
|
||||
|
||||
Ecore_Pipe *fd_read; // read commands from emotion here
|
||||
Ecore_Pipe *fd_write; // write commands for emotion here
|
||||
Eina_Lock cmd_mutex;// lock used to send just one command at a time
|
||||
int last_order; // current command received from emotion
|
||||
|
||||
char *filename;
|
||||
char *subtitle_path;
|
||||
char *shmname;
|
||||
unsigned w, h;
|
||||
int volume;
|
||||
Eina_Bool audio_muted;
|
||||
|
||||
Eina_Bool opening;
|
||||
Eina_Bool closing;
|
||||
Eina_Bool playing;
|
||||
Eina_Bool inited;
|
||||
};
|
||||
|
||||
static void _player_setup(App *app);
|
||||
|
||||
|
||||
/* Utilities to send commands back to emotion */
|
||||
#define SEND_CMD_PARAM(app, i) \
|
||||
if ((app)->fd_write) \
|
||||
if (!ecore_pipe_write((app)->fd_write, &(i), sizeof((i)))) \
|
||||
ecore_main_loop_quit();
|
||||
|
||||
static void
|
||||
_send_cmd(App *app, int cmd)
|
||||
{
|
||||
if (!app->fd_write)
|
||||
return;
|
||||
|
||||
eina_lock_take(&app->cmd_mutex); /* LOCK HERE */
|
||||
|
||||
if (!ecore_pipe_write(app->fd_write, &cmd, sizeof(cmd)))
|
||||
ecore_main_loop_quit();
|
||||
}
|
||||
|
||||
static void
|
||||
_send_cmd_str(App *app, const char *str)
|
||||
{
|
||||
int len;
|
||||
|
||||
len = str ? strlen(str) + 1 : 0;
|
||||
if (app->fd_write)
|
||||
if (!ecore_pipe_write(app->fd_write, &len, sizeof(len)))
|
||||
ecore_main_loop_quit();
|
||||
if (app->fd_write)
|
||||
if (!ecore_pipe_write(app->fd_write, str, len))
|
||||
ecore_main_loop_quit();
|
||||
}
|
||||
|
||||
static void
|
||||
_send_cmd_finish(App *app)
|
||||
{
|
||||
eina_lock_release(&app->cmd_mutex); /* UNLOCK HERE */
|
||||
}
|
||||
|
||||
/* Commands sent to the emotion pipe */
|
||||
static void
|
||||
_send_file_closed(App *app)
|
||||
{
|
||||
_send_cmd(app, EM_RESULT_FILE_CLOSE);
|
||||
_send_cmd_finish(app);
|
||||
}
|
||||
|
||||
static void
|
||||
_send_time_changed(App *app)
|
||||
{
|
||||
float new_time;
|
||||
|
||||
if (app->vs->frame_drop > 1)
|
||||
return;
|
||||
|
||||
new_time = libvlc_media_player_get_time(app->mp);
|
||||
new_time /= 1000;
|
||||
_send_cmd(app, EM_RESULT_POSITION_CHANGED);
|
||||
SEND_CMD_PARAM(app, new_time);
|
||||
_send_cmd_finish(app);
|
||||
}
|
||||
|
||||
static void
|
||||
_send_resize(App *app, int width, int height)
|
||||
{
|
||||
_send_cmd(app, EM_RESULT_FRAME_SIZE);
|
||||
SEND_CMD_PARAM(app, width);
|
||||
SEND_CMD_PARAM(app, height);
|
||||
_send_cmd_finish(app);
|
||||
}
|
||||
|
||||
static void
|
||||
_send_track_info(App *app, int cmd, int current, int count, libvlc_track_description_t *desc)
|
||||
{
|
||||
_send_cmd(app, cmd);
|
||||
SEND_CMD_PARAM(app, current);
|
||||
SEND_CMD_PARAM(app, count);
|
||||
while (desc)
|
||||
{
|
||||
int tid = desc->i_id;
|
||||
const char *name = desc->psz_name;
|
||||
SEND_CMD_PARAM(app, tid);
|
||||
_send_cmd_str(app, name);
|
||||
desc = desc->p_next;
|
||||
}
|
||||
_send_cmd_finish(app);
|
||||
}
|
||||
|
||||
static void
|
||||
_send_all_track_info(App *app)
|
||||
{
|
||||
int track_count, current;
|
||||
libvlc_track_description_t *desc;
|
||||
|
||||
current = libvlc_audio_get_track(app->mp);
|
||||
track_count = libvlc_audio_get_track_count(app->mp);
|
||||
desc = libvlc_audio_get_track_description(app->mp);
|
||||
|
||||
_send_track_info(app, EM_RESULT_AUDIO_TRACK_INFO,
|
||||
current, track_count, desc);
|
||||
|
||||
current = libvlc_video_get_track(app->mp);
|
||||
track_count = libvlc_video_get_track_count(app->mp);
|
||||
desc = libvlc_video_get_track_description(app->mp);
|
||||
|
||||
_send_track_info(app, EM_RESULT_VIDEO_TRACK_INFO,
|
||||
current, track_count, desc);
|
||||
|
||||
current = libvlc_video_get_spu(app->mp);
|
||||
track_count = libvlc_video_get_spu_count(app->mp);
|
||||
desc = libvlc_video_get_spu_description(app->mp);
|
||||
|
||||
_send_track_info(app, EM_RESULT_SPU_TRACK_INFO,
|
||||
current, track_count, desc);
|
||||
}
|
||||
|
||||
static void
|
||||
_send_all_meta_info(App *app)
|
||||
{
|
||||
const char *meta;
|
||||
|
||||
_send_cmd(app, EM_RESULT_META_INFO);
|
||||
|
||||
/*
|
||||
* Will send in this order: title, artist, album, year,
|
||||
* genre, comments, disc id and track count.
|
||||
*/
|
||||
meta = libvlc_media_get_meta(app->m, libvlc_meta_Title);
|
||||
_send_cmd_str(app, meta);
|
||||
meta = libvlc_media_get_meta(app->m, libvlc_meta_Artist);
|
||||
_send_cmd_str(app, meta);
|
||||
meta = libvlc_media_get_meta(app->m, libvlc_meta_Album);
|
||||
_send_cmd_str(app, meta);
|
||||
meta = libvlc_media_get_meta(app->m, libvlc_meta_Date);
|
||||
_send_cmd_str(app, meta);
|
||||
meta = libvlc_media_get_meta(app->m, libvlc_meta_Genre);
|
||||
_send_cmd_str(app, meta);
|
||||
meta = NULL; // sending empty comments
|
||||
_send_cmd_str(app, meta);
|
||||
meta = NULL; // sending empty disc id
|
||||
_send_cmd_str(app, meta);
|
||||
meta = libvlc_media_get_meta(app->m, libvlc_meta_TrackNumber);
|
||||
_send_cmd_str(app, meta);
|
||||
|
||||
_send_cmd_finish(app);
|
||||
}
|
||||
|
||||
static void
|
||||
_send_length_changed(App *app)
|
||||
{
|
||||
float length = libvlc_media_player_get_length(app->mp);
|
||||
|
||||
length /= 1000;
|
||||
_send_cmd(app, EM_RESULT_LENGTH_CHANGED);
|
||||
SEND_CMD_PARAM(app, length);
|
||||
_send_cmd_finish(app);
|
||||
}
|
||||
|
||||
static void
|
||||
_send_seekable_changed(App *app, const struct libvlc_event_t *ev)
|
||||
{
|
||||
int seekable = ev->u.media_player_seekable_changed.new_seekable;
|
||||
|
||||
_send_cmd(app, EM_RESULT_SEEKABLE_CHANGED);
|
||||
SEND_CMD_PARAM(app, seekable);
|
||||
_send_cmd_finish(app);
|
||||
}
|
||||
|
||||
static void
|
||||
_send_playback_started(App *app)
|
||||
{
|
||||
_send_cmd(app, EM_RESULT_PLAYBACK_STARTED);
|
||||
_send_cmd_finish(app);
|
||||
}
|
||||
|
||||
static void
|
||||
_send_playback_stopped(App *app)
|
||||
{
|
||||
_send_cmd(app, EM_RESULT_PLAYBACK_STOPPED);
|
||||
_send_cmd_finish(app);
|
||||
}
|
||||
|
||||
static void
|
||||
_send_init(App *app)
|
||||
{
|
||||
_send_cmd(app, EM_RESULT_INIT);
|
||||
_send_cmd_finish(app);
|
||||
}
|
||||
|
||||
static void
|
||||
_send_file_set(App *app)
|
||||
{
|
||||
_send_cmd(app, EM_RESULT_FILE_SET);
|
||||
_send_cmd_finish(app);
|
||||
}
|
||||
|
||||
static void
|
||||
_send_file_set_done(App *app, int success)
|
||||
{
|
||||
_send_cmd(app, EM_RESULT_FILE_SET_DONE);
|
||||
SEND_CMD_PARAM(app, success);
|
||||
_send_cmd_finish(app);
|
||||
}
|
||||
|
||||
|
||||
/* VLC events and callbacks */
|
||||
static void
|
||||
_event_cb(const struct libvlc_event_t *ev, void *data)
|
||||
{
|
||||
App *app = data;
|
||||
|
||||
ecore_thread_main_loop_begin();
|
||||
switch (ev->type)
|
||||
{
|
||||
case libvlc_MediaPlayerTimeChanged:
|
||||
// DBG("libvlc_MediaPlayerTimeChanged");
|
||||
_send_time_changed(app);
|
||||
break;
|
||||
case libvlc_MediaPlayerLengthChanged:
|
||||
DBG("libvlc_MediaPlayerLengthChanged");
|
||||
_send_length_changed(app);
|
||||
break;
|
||||
case libvlc_MediaPlayerSeekableChanged:
|
||||
DBG("libvlc_MediaPlayerSeekableChanged");
|
||||
_send_seekable_changed(app, ev);
|
||||
break;
|
||||
case libvlc_MediaPlayerPlaying:
|
||||
DBG("libvlc_MediaPlayerPlaying");
|
||||
libvlc_audio_set_volume(app->mp, app->volume);
|
||||
libvlc_audio_set_mute(app->mp, app->audio_muted);
|
||||
_send_playback_started(app);
|
||||
break;
|
||||
case libvlc_MediaPlayerStopped:
|
||||
DBG("libvlc_MediaPlayerStopped");
|
||||
_send_playback_stopped(app);
|
||||
if (app->closing)
|
||||
{
|
||||
free(app->filename);
|
||||
app->filename = NULL;
|
||||
free(app->subtitle_path);
|
||||
app->subtitle_path = NULL;
|
||||
libvlc_media_release(app->m);
|
||||
app->m = NULL;
|
||||
libvlc_media_player_release(app->mp);
|
||||
app->mp = NULL;
|
||||
emotion_generic_shm_free(app->vs);
|
||||
app->playing = EINA_FALSE;
|
||||
app->closing = EINA_FALSE;
|
||||
_send_file_closed(app);
|
||||
}
|
||||
break;
|
||||
case libvlc_MediaPlayerEndReached:
|
||||
DBG("libvlc_MediaPlayerEndReached");
|
||||
app->playing = EINA_FALSE;
|
||||
/* vlc had released the media_playere here, we create a new one */
|
||||
app->mp = libvlc_media_player_new_from_media(app->m);
|
||||
_player_setup(app);
|
||||
_send_playback_stopped(app);
|
||||
break;
|
||||
}
|
||||
ecore_thread_main_loop_end();
|
||||
}
|
||||
|
||||
static void
|
||||
_tmp_playing_event_cb(const struct libvlc_event_t *ev, void *data)
|
||||
{
|
||||
App *app = data;
|
||||
|
||||
if (ev->type != libvlc_MediaPlayerPlaying)
|
||||
return;
|
||||
|
||||
/* pause and stop listening the temporary event */
|
||||
libvlc_event_detach(app->event_mgr,libvlc_MediaPlayerPlaying,
|
||||
_tmp_playing_event_cb, app);
|
||||
libvlc_media_player_set_pause(app->mp, 1);
|
||||
|
||||
/* sending size info */
|
||||
libvlc_video_get_size(app->mp, 0, &app->w, &app->h);
|
||||
_send_resize(app, app->w, app->h);
|
||||
|
||||
/* sending total lenght */
|
||||
_send_length_changed(app);
|
||||
|
||||
/* sending audio track info */
|
||||
_send_all_track_info(app);
|
||||
|
||||
/* sending meta info */
|
||||
_send_all_meta_info(app);
|
||||
|
||||
/* ok, we are done! Now let emotion create the shmem for us */
|
||||
_send_file_set(app);
|
||||
}
|
||||
|
||||
static void *
|
||||
_lock(void *data, void **pixels)
|
||||
{
|
||||
App *app = data;
|
||||
|
||||
if (app->playing)
|
||||
*pixels = app->vf.frames[app->vs->frame.player];
|
||||
else
|
||||
*pixels = NULL;
|
||||
|
||||
return NULL; // picture identifier, not needed here
|
||||
}
|
||||
|
||||
static void
|
||||
_unlock(void *data EINA_UNUSED, void *id EINA_UNUSED, void *const *pixels EINA_UNUSED)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
_display(void *data, void *id EINA_UNUSED)
|
||||
{
|
||||
App *app = data;
|
||||
|
||||
if (!app->playing)
|
||||
return;
|
||||
|
||||
eina_semaphore_lock(&app->vs->lock);
|
||||
app->vs->frame.last = app->vs->frame.player;
|
||||
app->vs->frame.player = app->vs->frame.next;
|
||||
app->vs->frame.next = app->vs->frame.last;
|
||||
if (!app->vs->frame_drop++)
|
||||
{
|
||||
_send_cmd(app, EM_RESULT_FRAME_NEW);
|
||||
_send_cmd_finish(app);
|
||||
}
|
||||
eina_semaphore_release(&app->vs->lock, 1);
|
||||
}
|
||||
|
||||
static void
|
||||
_player_setup(App *app)
|
||||
{
|
||||
|
||||
libvlc_video_set_format(app->mp, "RV32", app->w, app->h, app->w * 4);
|
||||
libvlc_video_set_callbacks(app->mp, _lock, _unlock, _display, app);
|
||||
|
||||
app->event_mgr = libvlc_media_player_event_manager(app->mp);
|
||||
libvlc_event_attach(app->event_mgr, libvlc_MediaPlayerPlaying,
|
||||
_event_cb, app);
|
||||
libvlc_event_attach(app->event_mgr, libvlc_MediaPlayerTimeChanged,
|
||||
_event_cb, app);
|
||||
libvlc_event_attach(app->event_mgr, libvlc_MediaPlayerLengthChanged,
|
||||
_event_cb, app);
|
||||
libvlc_event_attach(app->event_mgr, libvlc_MediaPlayerSeekableChanged,
|
||||
_event_cb, app);
|
||||
libvlc_event_attach(app->event_mgr, libvlc_MediaPlayerEndReached,
|
||||
_event_cb, app);
|
||||
libvlc_event_attach(app->event_mgr, libvlc_MediaPlayerStopped,
|
||||
_event_cb, app);
|
||||
}
|
||||
|
||||
/* Commands received from the emotion pipe */
|
||||
static void
|
||||
_file_set(App *app)
|
||||
{
|
||||
DBG("Path: %s", app->filename);
|
||||
app->m = libvlc_media_new_path(app->libvlc, app->filename);
|
||||
if (!app->m)
|
||||
{
|
||||
ERR("could not open path: \"%s\"", app->filename);
|
||||
return;
|
||||
}
|
||||
|
||||
app->mp = libvlc_media_player_new_from_media(app->m);
|
||||
if (!app->mp)
|
||||
{
|
||||
ERR("could not create new player from media.");
|
||||
return;
|
||||
}
|
||||
|
||||
app->opening = EINA_TRUE;
|
||||
|
||||
/* Here we start playing and connect a temporary callback to know when
|
||||
* the file is parsed and ready to be played for real.
|
||||
*/
|
||||
app->event_mgr = libvlc_media_player_event_manager(app->mp);
|
||||
libvlc_event_attach(app->event_mgr, libvlc_MediaPlayerPlaying,
|
||||
_tmp_playing_event_cb, app);
|
||||
|
||||
libvlc_media_player_play(app->mp);
|
||||
}
|
||||
|
||||
static void
|
||||
_file_set_done(App *app)
|
||||
{
|
||||
int r;
|
||||
|
||||
DBG("Path: %s", app->filename);
|
||||
app->opening = EINA_FALSE;
|
||||
|
||||
r = emotion_generic_shm_get(app->shmname, &app->vs, &app->vf);
|
||||
if (!r)
|
||||
{
|
||||
free(app->filename);
|
||||
libvlc_media_release(app->m);
|
||||
libvlc_media_player_release(app->mp);
|
||||
app->filename = NULL;
|
||||
app->m = NULL;
|
||||
app->mp = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
_player_setup(app);
|
||||
}
|
||||
|
||||
_send_file_set_done(app, r);
|
||||
}
|
||||
|
||||
static void
|
||||
_file_close(App *app)
|
||||
{
|
||||
DBG("closing file");
|
||||
|
||||
if (!app->mp)
|
||||
return;
|
||||
|
||||
app->closing = EINA_TRUE;
|
||||
libvlc_media_player_stop(app->mp);
|
||||
}
|
||||
|
||||
static void
|
||||
_stop(App *app)
|
||||
{
|
||||
DBG("Stop");
|
||||
if (app->mp)
|
||||
libvlc_media_player_set_pause(app->mp, 1);
|
||||
}
|
||||
|
||||
static void
|
||||
_play(App *app, float pos)
|
||||
{
|
||||
DBG("Play at %.3f", pos);
|
||||
|
||||
if (!app->mp)
|
||||
return;
|
||||
|
||||
if (app->playing)
|
||||
{
|
||||
libvlc_media_player_set_pause(app->mp, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
libvlc_time_t new_time = pos * 1000;
|
||||
libvlc_media_player_set_time(app->mp, new_time);
|
||||
libvlc_media_player_play(app->mp);
|
||||
|
||||
if (app->subtitle_path)
|
||||
libvlc_video_set_subtitle_file(app->mp, app->subtitle_path);
|
||||
|
||||
app->playing = EINA_TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
_position_set(App *app, float position)
|
||||
{
|
||||
libvlc_time_t new_time;
|
||||
|
||||
DBG("Position set %.3f", position);
|
||||
if (!app->mp)
|
||||
return;
|
||||
|
||||
new_time = position * 1000;
|
||||
libvlc_media_player_set_time(app->mp, new_time);
|
||||
|
||||
if (libvlc_media_player_get_state(app->mp) == libvlc_Paused)
|
||||
_send_time_changed(app);
|
||||
}
|
||||
|
||||
static void
|
||||
_speed_set(App *app, float rate)
|
||||
{
|
||||
DBG("Speed set %.3f", rate);
|
||||
if (!app->mp)
|
||||
return;
|
||||
|
||||
libvlc_media_player_set_rate(app->mp, rate);
|
||||
}
|
||||
|
||||
static void
|
||||
_mute_set(App *app, int mute)
|
||||
{
|
||||
DBG("Mute %d", mute);
|
||||
if (!app->mp)
|
||||
return;
|
||||
|
||||
app->audio_muted = mute;
|
||||
libvlc_audio_set_mute(app->mp, mute);
|
||||
}
|
||||
|
||||
static void
|
||||
_volume_set(App *app, float volume)
|
||||
{
|
||||
DBG("Volume set %.2f", volume);
|
||||
if (!app->mp)
|
||||
return;
|
||||
|
||||
app->volume = volume * 100;
|
||||
libvlc_audio_set_volume(app->mp, app->volume);
|
||||
}
|
||||
|
||||
static void
|
||||
_spu_track_set(App *app, int track)
|
||||
{
|
||||
DBG("SPU track %d", track);
|
||||
libvlc_video_set_spu(app->mp, track);
|
||||
}
|
||||
|
||||
static void
|
||||
_audio_track_set(App *app, int track)
|
||||
{
|
||||
DBG("Audio track %d", track);
|
||||
libvlc_audio_set_track(app->mp, track);
|
||||
}
|
||||
|
||||
static void
|
||||
_video_track_set(App *app, int track)
|
||||
{
|
||||
DBG("Video Track %d", track);
|
||||
libvlc_video_set_track(app->mp, track);
|
||||
}
|
||||
|
||||
static void
|
||||
_remote_command(void *data, void *buffer, unsigned int nbyte)
|
||||
{
|
||||
App *app = data;
|
||||
|
||||
if (nbyte == 0)
|
||||
{
|
||||
ecore_main_loop_quit();
|
||||
return ;
|
||||
}
|
||||
|
||||
if (app->last_order == EM_CMD_LAST)
|
||||
{
|
||||
if (nbyte != sizeof (int))
|
||||
{
|
||||
ERR("didn't receive a valid command from emotion (%i) !", nbyte);
|
||||
ecore_main_loop_quit();
|
||||
return ;
|
||||
}
|
||||
|
||||
app->last_order = *((int*) buffer);
|
||||
|
||||
if (!app->inited &&
|
||||
app->last_order != EM_CMD_INIT)
|
||||
{
|
||||
ERR("wrong init command!");
|
||||
ecore_main_loop_quit();
|
||||
return ;
|
||||
}
|
||||
|
||||
switch (app->last_order)
|
||||
{
|
||||
case EM_CMD_FILE_SET:
|
||||
if (app->opening)
|
||||
{
|
||||
libvlc_media_release(app->m);
|
||||
libvlc_media_player_release(app->mp);
|
||||
free(app->filename);
|
||||
app->opening = EINA_FALSE;
|
||||
}
|
||||
break;
|
||||
case EM_CMD_FILE_SET_DONE:
|
||||
_file_set_done(app);
|
||||
app->last_order = EM_CMD_LAST;
|
||||
break;
|
||||
case EM_CMD_FILE_CLOSE:
|
||||
_file_close(app);
|
||||
app->last_order = EM_CMD_LAST;
|
||||
break;
|
||||
case EM_CMD_STOP:
|
||||
_stop(app);
|
||||
app->last_order = EM_CMD_LAST;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (app->last_order)
|
||||
{
|
||||
case EM_CMD_INIT:
|
||||
app->shmname = strdup(buffer);
|
||||
app->inited = EINA_TRUE;
|
||||
_send_init(app);
|
||||
break;
|
||||
case EM_CMD_FILE_SET:
|
||||
app->filename = strdup(buffer);
|
||||
_file_set(app);
|
||||
break;
|
||||
case EM_CMD_SUBTITLE_SET:
|
||||
app->subtitle_path = strdup(buffer);
|
||||
break;
|
||||
case EM_CMD_PLAY:
|
||||
_play(app, *(float*) buffer);
|
||||
break;
|
||||
case EM_CMD_POSITION_SET:
|
||||
_position_set(app, *(float*) buffer);
|
||||
break;
|
||||
case EM_CMD_SPEED_SET:
|
||||
_speed_set(app, *(float*) buffer);
|
||||
break;
|
||||
case EM_CMD_AUDIO_MUTE_SET:
|
||||
_mute_set(app, *(int*) buffer);
|
||||
break;
|
||||
case EM_CMD_VOLUME_SET:
|
||||
_volume_set(app, *(float*) buffer);
|
||||
break;
|
||||
case EM_CMD_SPU_TRACK_SET:
|
||||
_spu_track_set(app, *(int*) buffer);
|
||||
break;
|
||||
case EM_CMD_AUDIO_TRACK_SET:
|
||||
_audio_track_set(app, *(int*) buffer);
|
||||
break;
|
||||
case EM_CMD_VIDEO_TRACK_SET:
|
||||
_video_track_set(app, *(int*) buffer);
|
||||
break;
|
||||
}
|
||||
app->last_order = EM_CMD_LAST;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
_dummy(void *data EINA_UNUSED, void *buffer EINA_UNUSED, unsigned int nbyte EINA_UNUSED)
|
||||
{
|
||||
/* This function is useless for the pipe we use to send message back
|
||||
to emotion, but still needed */
|
||||
}
|
||||
|
||||
/* Main */
|
||||
static Eina_Bool
|
||||
exit_func(void *data EINA_UNUSED, int ev_type EINA_UNUSED, void *ev EINA_UNUSED)
|
||||
{
|
||||
DBG("Quit signal received !");
|
||||
ecore_main_loop_quit();
|
||||
return EINA_TRUE;
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, const char *argv[])
|
||||
{
|
||||
App app;
|
||||
Ecore_Event_Handler *hld;
|
||||
int vlc_argc;
|
||||
|
||||
const char *vlc_argv[] =
|
||||
{
|
||||
"--quiet",
|
||||
"--intf", "dummy", /* no interface */
|
||||
"--vout", "dummy", /* we don't want video (output) */
|
||||
"--no-video-title-show", /* nor the filename displayed */
|
||||
"--no-sub-autodetect-file", /* we don't want automatic subtitles */
|
||||
"--no-stats", /* no stats */
|
||||
"--no-inhibit", /* we don't want interfaces */
|
||||
"--no-disable-screensaver", /* we don't want interfaces */
|
||||
// XXX: causes newer vlcs to segv!
|
||||
// "--codec", "avcodec",
|
||||
// XXX: disable this just in case
|
||||
// "--demux", "avformat"
|
||||
};
|
||||
vlc_argc = sizeof(vlc_argv) / sizeof(*vlc_argv);
|
||||
|
||||
memset(&app, 0, sizeof(app));
|
||||
if (!eina_init())
|
||||
{
|
||||
EINA_LOG_CRIT("Can't initialize generic vlc player, eina failed.");
|
||||
return -1;
|
||||
}
|
||||
|
||||
_em_vlc_log_dom = eina_log_domain_register("emotion_generic_vlc",
|
||||
EINA_COLOR_CYAN);
|
||||
if (_em_vlc_log_dom < 0)
|
||||
{
|
||||
EINA_LOG_CRIT("Unable to register emotion_generic_vlc log domain.");
|
||||
goto error;
|
||||
}
|
||||
|
||||
if (!eina_log_domain_level_check(_em_vlc_log_dom, EINA_LOG_LEVEL_WARN))
|
||||
eina_log_domain_level_set("emotion_generic_vlc", EINA_LOG_LEVEL_WARN);
|
||||
|
||||
if (argc < 3)
|
||||
{
|
||||
ERR("missing parameters.");
|
||||
ERR("syntax:\n\t%s <fd read> <fd write>", argv[0]);
|
||||
goto error;
|
||||
}
|
||||
|
||||
ecore_init();
|
||||
|
||||
eina_lock_new(&app.cmd_mutex);
|
||||
|
||||
app.fd_read = ecore_pipe_full_add(_remote_command, &app,
|
||||
atoi(argv[1]), -1, EINA_FALSE, EINA_FALSE);
|
||||
app.fd_write = ecore_pipe_full_add(_dummy, NULL,
|
||||
-1, atoi(argv[2]), EINA_FALSE, EINA_FALSE);
|
||||
|
||||
hld = ecore_event_handler_add(ECORE_EVENT_SIGNAL_HUP, exit_func, NULL);
|
||||
|
||||
app.libvlc = libvlc_new(vlc_argc, vlc_argv);
|
||||
app.mp = NULL;
|
||||
app.filename = NULL;
|
||||
app.subtitle_path = NULL;
|
||||
app.w = 0;
|
||||
app.h = 0;
|
||||
app.opening = EINA_FALSE;
|
||||
app.playing = EINA_FALSE;
|
||||
app.inited = EINA_FALSE;
|
||||
app.last_order = EM_CMD_LAST;
|
||||
|
||||
ecore_main_loop_begin();
|
||||
|
||||
libvlc_release(app.libvlc);
|
||||
ecore_pipe_del(app.fd_read);
|
||||
ecore_pipe_del(app.fd_write);
|
||||
ecore_event_handler_del(hld);
|
||||
eina_lock_free(&app.cmd_mutex);
|
||||
|
||||
ecore_shutdown();
|
||||
eina_shutdown();
|
||||
return 0;
|
||||
|
||||
error:
|
||||
eina_shutdown();
|
||||
return -1;
|
||||
}
|
||||
#undef SEND_CMD_PARAM
|
Loading…
Reference in New Issue