diff --git a/livesupport/modules/gstreamerElements/bin/play.sh b/livesupport/modules/gstreamerElements/bin/play.sh new file mode 100755 index 000000000..529b08904 --- /dev/null +++ b/livesupport/modules/gstreamerElements/bin/play.sh @@ -0,0 +1,64 @@ +#!/bin/sh +#------------------------------------------------------------------------------- +# Copyright (c) 2004 Media Development Loan Fund +# +# This file is part of the LiveSupport project. +# http://livesupport.campware.org/ +# To report bugs, send an e-mail to bugs@campware.org +# +# LiveSupport is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# LiveSupport is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with LiveSupport; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# +# Author : $Author: maroy $ +# Version : $Revision: 1.1 $ +# Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/gstreamerElements/bin/play.sh,v $ +#------------------------------------------------------------------------------- + +#------------------------------------------------------------------------------- +# Play an audio file by using gstreamer and autoplugging. +#------------------------------------------------------------------------------- + +# assume we're in $basedir/bin +reldir=`dirname $0`/.. +basedir=`cd $reldir; pwd;` +test -z "$basedir" && basedir=. +usrdir=`cd $basedir/../../usr; pwd;` + +bindir=$basedir/bin +etcdir=$basedir/etc +libdir=$basedir/lib +tmpdir=$basedir/tmp + +play=$tmpdir/play + + +export CPPFLAGS="-I$usrdir/include" +export LDFLAGS="-L$usrdir/lib" +export PKG_CONFIG_PATH="$usrdir/lib/pkgconfig" +export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$usrdir/lib" +export GST_PLUGIN_PATH="$libdir" + + +if [ ! -f $play ]; then + echo "first build the play executable by issuing the following command:"; + echo ""; + echo "make all"; + + exit -1; +fi + + +$play "$*" + diff --git a/livesupport/modules/gstreamerElements/etc/Makefile.in b/livesupport/modules/gstreamerElements/etc/Makefile.in index da2547349..16b3288b6 100644 --- a/livesupport/modules/gstreamerElements/etc/Makefile.in +++ b/livesupport/modules/gstreamerElements/etc/Makefile.in @@ -21,7 +21,7 @@ # # # Author : $Author: maroy $ -# Version : $Revision: 1.7 $ +# Version : $Revision: 1.8 $ # Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/gstreamerElements/etc/Makefile.in,v $ # # @configure_input@ @@ -92,6 +92,7 @@ SWITCHER_LIB = livesupport_switcher SWITCHER_LIB_FILE = ${LIB_DIR}/lib${SWITCHER_LIB}.so TEST_RUNNER = ${TMP_DIR}/testRunner +PLAY = ${TMP_DIR}/play DOXYGEN_CONFIG = ${ETC_DIR}/doxygen.config @@ -154,6 +155,10 @@ TEST_RUNNER_OBJS = ${TMP_DIR}/TestRunner.o \ TEST_RUNNER_LIBS = -l${GSTREAMER_ELEMENTS_LIB} -l${CORE_LIB} \ -lcppunit -ldl -lxmlrpc++ +PLAY_OBJS = ${TMP_DIR}/play.o + +PLAY_LIBS = -l${GSTREAMER_ELEMENTS_LIB} -l${CORE_LIB} + #------------------------------------------------------------------------------- # Targets @@ -165,6 +170,7 @@ all: dir_setup ${GSTREAMER_ELEMENTS_LIB_FILE} \ ${MINIMAL_AUDIO_SMIL_LIB_FILE} \ ${PARTIAL_PLAY_LIB_FILE} \ ${SWITCHER_LIB_FILE} \ + ${PLAY} \ gst_register dir_setup: ${TMP_DIR} ${DOXYGEN_DIR} @@ -183,6 +189,7 @@ clean: ${RM} ${PARTIAL_PLAY_LIB_OBJS} ${PARTIAL_PLAY_LIB_FILE} ${RM} ${SWITCHER_LIB_OBJS} ${SWITCHER_LIB_FILE} ${RM} ${TEST_RUNNER_OBJS} ${TEST_RUNNER_RES} ${TEST_RUNNER} + ${RM} ${PLAY_OBJS} ${PLAY} ${RM} ${TMP_DIR}/*.bb ${TMP_DIR}/*.bbg ${TMP_DIR}/*.da ${TMP_DIR}/*.info docclean: @@ -231,6 +238,9 @@ ${TEST_RUNNER}: ${CORE_LIB_FILE} ${GSTREAMER_ELEMENTS_LIB_FILE} \ ${TEST_RUNNER_OBJS} ${CXX} ${LDFLAGS} -o $@ ${TEST_RUNNER_OBJS} ${TEST_RUNNER_LIBS} +${PLAY}: ${CORE_LIB_FILE} ${GSTREAMER_ELEMENTS_LIB_FILE} ${PLAY_OBJS} + ${CXX} ${LDFLAGS} -o $@ ${PLAY_OBJS} ${PLAY_LIBS} + ${CORE_LIB_FILE}: ${MAKE} -C ${CORE_DIR} diff --git a/livesupport/modules/gstreamerElements/src/play.c b/livesupport/modules/gstreamerElements/src/play.c new file mode 100644 index 000000000..d4c737ae9 --- /dev/null +++ b/livesupport/modules/gstreamerElements/src/play.c @@ -0,0 +1,126 @@ +/*------------------------------------------------------------------------------ + + Copyright (c) 2004 Media Development Loan Fund + + This file is part of the LiveSupport project. + http://livesupport.campware.org/ + To report bugs, send an e-mail to bugs@campware.org + + LiveSupport is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + LiveSupport is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with LiveSupport; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + + Author : $Author: maroy $ + Version : $Revision: 1.1 $ + Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/gstreamerElements/src/play.c,v $ + +------------------------------------------------------------------------------*/ + +/* ============================================================ include files */ + +#ifdef HAVE_CONFIG_H +#include "configure.h" +#endif + +#include + +#include "LiveSupport/GstreamerElements/autoplug.h" + + +/* =================================================== local data structures */ + + +/* ================================================ local constants & macros */ + + +/* =============================================== local function prototypes */ + +/** + * Program entry point. + * + * @param argc the number of command line arguments. + * @param argv the command line argument array. + * @return 0 on success, non-0 on failure. + */ +int +main(int argc, + char ** argv); + + +/* ============================================================= module code */ + +/*------------------------------------------------------------------------------ + * Program entry point. + *----------------------------------------------------------------------------*/ +int +main(int argc, + char ** argv) +{ + GstElement * pipeline; + GstElement * source; + GstElement * decoder; + GstElement * sink; + GstFormat format; + gint64 timePlayed; + + /* initialize GStreamer */ + gst_init(&argc, &argv); + + if (argc != 2) { + g_print("Usage: %s