[girl] Remove dependency on gst-player since it's not available on Ubuntu
- From: ole <ole src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [girl] Remove dependency on gst-player since it's not available on Ubuntu
- Date: Mon, 10 Apr 2017 17:49:34 +0000 (UTC)
commit dff07eb5872f6bc6294e98858b09fc4f732f2307
Author: Ole Aamot <oka oka no>
Date: Mon Apr 10 19:48:32 2017 +0200
Remove dependency on gst-player since it's not available on Ubuntu
configure | 69 ++++--
configure.ac | 1 -
src/GIRL-PLAYER.c | 696 -----------------------------------------------------
src/GIRL.c | 3 +-
4 files changed, 46 insertions(+), 723 deletions(-)
---
diff --git a/configure b/configure
index 97c60dd..8c32456 100755
--- a/configure
+++ b/configure
@@ -817,6 +817,7 @@ infodir
docdir
oldincludedir
includedir
+runstatedir
localstatedir
sharedstatedir
sysconfdir
@@ -918,6 +919,7 @@ datadir='${datarootdir}'
sysconfdir='${prefix}/etc'
sharedstatedir='${prefix}/com'
localstatedir='${prefix}/var'
+runstatedir='${localstatedir}/run'
includedir='${prefix}/include'
oldincludedir='/usr/include'
docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
@@ -1170,6 +1172,15 @@ do
| -silent | --silent | --silen | --sile | --sil)
silent=yes ;;
+ -runstatedir | --runstatedir | --runstatedi | --runstated \
+ | --runstate | --runstat | --runsta | --runst | --runs \
+ | --run | --ru | --r)
+ ac_prev=runstatedir ;;
+ -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \
+ | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \
+ | --run=* | --ru=* | --r=*)
+ runstatedir=$ac_optarg ;;
+
-sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
ac_prev=sbindir ;;
-sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
@@ -1307,7 +1318,7 @@ fi
for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \
datadir sysconfdir sharedstatedir localstatedir includedir \
oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
- libdir localedir mandir
+ libdir localedir mandir runstatedir
do
eval ac_val=\$$ac_var
# Remove trailing slashes.
@@ -1460,6 +1471,7 @@ Fine tuning of the installation directories:
--sysconfdir=DIR read-only single-machine data [PREFIX/etc]
--sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]
--localstatedir=DIR modifiable single-machine data [PREFIX/var]
+ --runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run]
--libdir=DIR object code libraries [EPREFIX/lib]
--includedir=DIR C header files [PREFIX/include]
--oldincludedir=DIR C header files for non-gcc [/usr/include]
@@ -5440,7 +5452,7 @@ linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*)
lt_cv_deplibs_check_method=pass_all
;;
-netbsd*)
+netbsd* | netbsdelf*-gnu)
if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then
lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$'
else
@@ -9426,6 +9438,9 @@ $as_echo_n "checking whether the $compiler linker ($LD) supports shared librarie
openbsd* | bitrig*)
with_gnu_ld=no
;;
+ linux* | k*bsd*-gnu | gnu*)
+ link_all_deplibs=no
+ ;;
esac
ld_shlibs=yes
@@ -9680,7 +9695,7 @@ _LT_EOF
fi
;;
- netbsd*)
+ netbsd* | netbsdelf*-gnu)
if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib'
wlarc=
@@ -10350,6 +10365,7 @@ $as_echo "$lt_cv_irix_exported_symbol" >&6; }
if test yes = "$lt_cv_irix_exported_symbol"; then
archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname
`test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry
$wl$output_objdir/so_locations $wl-exports_file $wl$export_symbols -o $lib'
fi
+ link_all_deplibs=no
else
archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" &&
func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib'
archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n
"$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations
-exports_file $export_symbols -o $lib'
@@ -10371,7 +10387,7 @@ $as_echo "$lt_cv_irix_exported_symbol" >&6; }
esac
;;
- netbsd*)
+ netbsd* | netbsdelf*-gnu)
if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out
else
@@ -11466,9 +11482,6 @@ fi
# before this can be enabled.
hardcode_into_libs=yes
- # Add ABI-specific directories to the system library path.
- sys_lib_dlsearch_path_spec="/lib64 /usr/lib64 /lib /usr/lib"
-
# Ideally, we could use ldconfig to report *all* directores which are
# searched for libraries, however this is still not possible. Aside from not
# being certain /sbin/ldconfig is available, command
@@ -11477,7 +11490,7 @@ fi
# appending ld.so.conf contents (and includes) to the search path.
if test -f /etc/ld.so.conf; then
lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if
(!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:,
]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '`
- sys_lib_dlsearch_path_spec="$sys_lib_dlsearch_path_spec $lt_ld_extra"
+ sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra"
fi
# We used to test for /lib/ld.so.1 and disable shared libraries on
@@ -11489,6 +11502,18 @@ fi
dynamic_linker='GNU/Linux ld.so'
;;
+netbsdelf*-gnu)
+ version_type=linux
+ 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
+ dynamic_linker='NetBSD ld.elf_so'
+ ;;
+
netbsd*)
version_type=sunos
need_lib_prefix=no
@@ -14011,7 +14036,7 @@ else
We can't simply define LARGE_OFF_T to be 9223372036854775807,
since some C++ compilers masquerading as C compilers
incorrectly reject 9223372036854775807. */
-#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
+#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31))
int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
&& LARGE_OFF_T % 2147483647 == 1)
? 1 : -1];
@@ -14057,7 +14082,7 @@ else
We can't simply define LARGE_OFF_T to be 9223372036854775807,
since some C++ compilers masquerading as C compilers
incorrectly reject 9223372036854775807. */
-#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
+#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31))
int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
&& LARGE_OFF_T % 2147483647 == 1)
? 1 : -1];
@@ -14081,7 +14106,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
We can't simply define LARGE_OFF_T to be 9223372036854775807,
since some C++ compilers masquerading as C compilers
incorrectly reject 9223372036854775807. */
-#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
+#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31))
int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
&& LARGE_OFF_T % 2147483647 == 1)
? 1 : -1];
@@ -14126,7 +14151,7 @@ else
We can't simply define LARGE_OFF_T to be 9223372036854775807,
since some C++ compilers masquerading as C compilers
incorrectly reject 9223372036854775807. */
-#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
+#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31))
int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
&& LARGE_OFF_T % 2147483647 == 1)
? 1 : -1];
@@ -14150,7 +14175,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
We can't simply define LARGE_OFF_T to be 9223372036854775807,
since some C++ compilers masquerading as C compilers
incorrectly reject 9223372036854775807. */
-#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
+#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31))
int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
&& LARGE_OFF_T % 2147483647 == 1)
? 1 : -1];
@@ -14928,7 +14953,6 @@ if test -n "$GNOME_INTERNET_RADIO_LOCATOR_CFLAGS"; then
libxml-2.0 >= 2.0 \\
gstreamer-tag-1.0 >= 1.0 \\
gstreamer-1.0 >= 1.0 \\
- gstreamer-player-1.0 >= 1.7.1.1 \\
gstreamer-video-1.0\""; } >&5
($PKG_CONFIG --exists --print-errors "gtk+-3.0 >= 3.0 \
glib-2.0 >= 2.38.0 \
@@ -14938,7 +14962,6 @@ if test -n "$GNOME_INTERNET_RADIO_LOCATOR_CFLAGS"; then
libxml-2.0 >= 2.0 \
gstreamer-tag-1.0 >= 1.0 \
gstreamer-1.0 >= 1.0 \
- gstreamer-player-1.0 >= 1.7.1.1 \
gstreamer-video-1.0") 2>&5
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
@@ -14951,7 +14974,6 @@ if test -n "$GNOME_INTERNET_RADIO_LOCATOR_CFLAGS"; then
libxml-2.0 >= 2.0 \
gstreamer-tag-1.0 >= 1.0 \
gstreamer-1.0 >= 1.0 \
- gstreamer-player-1.0 >= 1.7.1.1 \
gstreamer-video-1.0" 2>/dev/null`
test "x$?" != "x0" && pkg_failed=yes
else
@@ -14972,7 +14994,6 @@ if test -n "$GNOME_INTERNET_RADIO_LOCATOR_LIBS"; then
libxml-2.0 >= 2.0 \\
gstreamer-tag-1.0 >= 1.0 \\
gstreamer-1.0 >= 1.0 \\
- gstreamer-player-1.0 >= 1.7.1.1 \\
gstreamer-video-1.0\""; } >&5
($PKG_CONFIG --exists --print-errors "gtk+-3.0 >= 3.0 \
glib-2.0 >= 2.38.0 \
@@ -14982,7 +15003,6 @@ if test -n "$GNOME_INTERNET_RADIO_LOCATOR_LIBS"; then
libxml-2.0 >= 2.0 \
gstreamer-tag-1.0 >= 1.0 \
gstreamer-1.0 >= 1.0 \
- gstreamer-player-1.0 >= 1.7.1.1 \
gstreamer-video-1.0") 2>&5
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
@@ -14995,7 +15015,6 @@ if test -n "$GNOME_INTERNET_RADIO_LOCATOR_LIBS"; then
libxml-2.0 >= 2.0 \
gstreamer-tag-1.0 >= 1.0 \
gstreamer-1.0 >= 1.0 \
- gstreamer-player-1.0 >= 1.7.1.1 \
gstreamer-video-1.0" 2>/dev/null`
test "x$?" != "x0" && pkg_failed=yes
else
@@ -15025,7 +15044,6 @@ fi
libxml-2.0 >= 2.0 \
gstreamer-tag-1.0 >= 1.0 \
gstreamer-1.0 >= 1.0 \
- gstreamer-player-1.0 >= 1.7.1.1 \
gstreamer-video-1.0" 2>&1`
else
GNOME_INTERNET_RADIO_LOCATOR_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "gtk+-3.0
= 3.0 \
@@ -15036,7 +15054,6 @@ fi
libxml-2.0 >= 2.0 \
gstreamer-tag-1.0 >= 1.0 \
gstreamer-1.0 >= 1.0 \
- gstreamer-player-1.0 >= 1.7.1.1 \
gstreamer-video-1.0" 2>&1`
fi
# Put the nasty error message in config.log where it belongs
@@ -15050,7 +15067,6 @@ fi
libxml-2.0 >= 2.0 \
gstreamer-tag-1.0 >= 1.0 \
gstreamer-1.0 >= 1.0 \
- gstreamer-player-1.0 >= 1.7.1.1 \
gstreamer-video-1.0) were not met:
$GNOME_INTERNET_RADIO_LOCATOR_PKG_ERRORS
@@ -17193,7 +17209,13 @@ install-help: $(_HELP_LC_FILES)
elif test "x$$lc" != "xC"; then \
if test "x$(YELP_LC_MEDIA_LINKS)" != "x"; then \
echo "$(LN_S) -f $(HELP_DIR)/C/$(HELP_ID)/$$f $$helpdir$$f"; \
- $(LN_S) -f "$(HELP_DIR)/C/$(HELP_ID)/$$f" "$$helpdir$$f" || exit 1; \
+ dname="$$f"; \
+ pars="../"; \
+ while test "$$dname" != "." -a "$$dname" != "/"; do \
+ pars="../$$pars"; \
+ dname=$$(dirname "$$dname"); \
+ done; \
+ $(LN_S) -f $$pars"C/$(HELP_ID)/$$f" "$$helpdir$$f" || exit 1; \
fi; \
fi; \
done; \
@@ -19006,7 +19028,6 @@ $as_echo X"$file" |
cat <<_LT_EOF >> "$cfgfile"
#! $SHELL
# Generated automatically by $as_me ($PACKAGE) $VERSION
-# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
# NOTE: Changes made to this file will be lost: look at ltmain.sh.
# Provide generalized library-building support services.
diff --git a/configure.ac b/configure.ac
index c035f74..7a13800 100644
--- a/configure.ac
+++ b/configure.ac
@@ -84,7 +84,6 @@ PKG_CHECK_MODULES(GNOME_INTERNET_RADIO_LOCATOR,
libxml-2.0 >= 2.0 \
gstreamer-tag-1.0 >= 1.0 \
gstreamer-1.0 >= 1.0 \
- gstreamer-player-1.0 >= 1.7.1.1 \
gstreamer-video-1.0) 2>&5
GNOME_INTERNET_RADIO_LOCATOR_PKG_DEPS="gtk+-3.0 glib-2.0 gobject-2.0 pangoft2 champlain-gtk-0.12 libxml-2.0,
gstreamer-1.0 gstreamer-video-1.0"
diff --git a/src/GIRL-PLAYER.c b/src/GIRL-PLAYER.c
index 5ba0394..e69de29 100644
--- a/src/GIRL-PLAYER.c
+++ b/src/GIRL-PLAYER.c
@@ -1,696 +0,0 @@
-/* GStreamer command line playback testing utility
- *
- * Copyright (C) 2013-2014 Tim-Philipp Müller <tim centricular net>
- * Copyright (C) 2013 Collabora Ltd.
- * Copyright (C) 2014 Sebastian Dröge <sebastian centricular com>
- * Copyright (C) 2015 Brijesh Singh <brijesh ksingh gmail com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library 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
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#include <locale.h>
-
-#include <gst/gst.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <math.h>
-
-#include "GIRL-PLAYER-KB.h"
-#include <gst/player/player.h>
-
-#define VOLUME_STEPS 20
-
-GST_DEBUG_CATEGORY (play_debug);
-#define GST_CAT_DEFAULT play_debug
-
-typedef struct
-{
- gchar **uris;
- guint num_uris;
- gint cur_idx;
-
- GstPlayer *player;
- GstState desired_state;
-
- gboolean repeat;
-
- GMainLoop *loop;
-} GstPlay;
-
-static gboolean play_next (GstPlay * play);
-static gboolean play_prev (GstPlay * play);
-static void play_reset (GstPlay * play);
-static void play_set_relative_volume (GstPlay * play, gdouble volume_step);
-
-static void
-end_of_stream_cb (GstPlayer * player, GstPlay * play)
-{
- g_print ("\n");
- /* and switch to next item in list */
- if (!play_next (play)) {
- g_print ("Reached end of play list.\n");
- g_main_loop_quit (play->loop);
- }
-}
-
-static void
-error_cb (GstPlayer * player, GError * err, GstPlay * play)
-{
- g_printerr ("ERROR %s for %s\n", err->message, play->uris[play->cur_idx]);
-
- /* if looping is enabled, then disable it else will keep looping forever */
- play->repeat = FALSE;
-
- /* try next item in list then */
- if (!play_next (play)) {
- g_print ("Reached end of play list.\n");
- g_main_loop_quit (play->loop);
- }
-}
-
-static void
-position_updated_cb (GstPlayer * player, GstClockTime pos, GstPlay * play)
-{
- GstClockTime dur = -1;
- gchar status[64] = { 0, };
-
- g_object_get (play->player, "duration", &dur, NULL);
-
- memset (status, ' ', sizeof (status) - 1);
-
- if (pos != -1 && dur > 0 && dur != -1) {
- gchar dstr[32], pstr[32];
-
- /* FIXME: pretty print in nicer format */
- g_snprintf (pstr, 32, "%" GST_TIME_FORMAT, GST_TIME_ARGS (pos));
- pstr[9] = '\0';
- g_snprintf (dstr, 32, "%" GST_TIME_FORMAT, GST_TIME_ARGS (dur));
- dstr[9] = '\0';
- g_print ("%s / %s %s\r", pstr, dstr, status);
- }
-}
-
-static void
-state_changed_cb (GstPlayer * player, GstPlayerState state, GstPlay * play)
-{
- g_print ("State changed: %s\n", gst_player_state_get_name (state));
-}
-
-static void
-buffering_cb (GstPlayer * player, gint percent, GstPlay * play)
-{
- g_print ("Buffering: %d\n", percent);
-}
-
-static void
-print_one_tag (const GstTagList * list, const gchar * tag, gpointer user_data)
-{
- gint i, num;
-
- num = gst_tag_list_get_tag_size (list, tag);
- for (i = 0; i < num; ++i) {
- const GValue *val;
-
- val = gst_tag_list_get_value_index (list, tag, i);
- if (G_VALUE_HOLDS_STRING (val)) {
- g_print (" %s : %s \n", tag, g_value_get_string (val));
- } else if (G_VALUE_HOLDS_UINT (val)) {
- g_print (" %s : %u \n", tag, g_value_get_uint (val));
- } else if (G_VALUE_HOLDS_DOUBLE (val)) {
- g_print (" %s : %g \n", tag, g_value_get_double (val));
- } else if (G_VALUE_HOLDS_BOOLEAN (val)) {
- g_print (" %s : %s \n", tag,
- g_value_get_boolean (val) ? "true" : "false");
- } else if (GST_VALUE_HOLDS_DATE_TIME (val)) {
- GstDateTime *dt = g_value_get_boxed (val);
- gchar *dt_str = gst_date_time_to_iso8601_string (dt);
-
- g_print (" %s : %s \n", tag, dt_str);
- g_free (dt_str);
- } else {
- g_print (" %s : tag of type '%s' \n", tag, G_VALUE_TYPE_NAME (val));
- }
- }
-}
-
-static void
-print_video_info (GstPlayerVideoInfo * info)
-{
- gint fps_n, fps_d;
- guint par_n, par_d;
-
- if (info == NULL)
- return;
-
- g_print (" width : %d\n", gst_player_video_info_get_width (info));
- g_print (" height : %d\n", gst_player_video_info_get_height (info));
- g_print (" max_bitrate : %d\n",
- gst_player_video_info_get_max_bitrate (info));
- g_print (" bitrate : %d\n", gst_player_video_info_get_bitrate (info));
- gst_player_video_info_get_framerate (info, &fps_n, &fps_d);
- g_print (" framerate : %.2f\n", (gdouble) fps_n / fps_d);
- gst_player_video_info_get_pixel_aspect_ratio (info, &par_n, &par_d);
- g_print (" pixel-aspect-ratio %u:%u\n", par_n, par_d);
-}
-
-static void
-print_audio_info (GstPlayerAudioInfo * info)
-{
- if (info == NULL)
- return;
-
- g_print (" sample rate : %d\n",
- gst_player_audio_info_get_sample_rate (info));
- g_print (" channels : %d\n", gst_player_audio_info_get_channels (info));
- g_print (" max_bitrate : %d\n",
- gst_player_audio_info_get_max_bitrate (info));
- g_print (" bitrate : %d\n", gst_player_audio_info_get_bitrate (info));
- g_print (" language : %s\n", gst_player_audio_info_get_language (info));
-}
-
-static void
-print_subtitle_info (GstPlayerSubtitleInfo * info)
-{
- if (info == NULL)
- return;
-
- g_print (" language : %s\n", gst_player_subtitle_info_get_language (info));
-}
-
-static void
-print_all_stream_info (GstPlayerMediaInfo * media_info)
-{
- guint count = 0;
- GList *list, *l;
-
- g_print ("URI : %s\n", gst_player_media_info_get_uri (media_info));
- g_print ("Duration: %" GST_TIME_FORMAT "\n",
- GST_TIME_ARGS (gst_player_media_info_get_duration (media_info)));
- g_print ("Global taglist:\n");
- if (gst_player_media_info_get_tags (media_info))
- gst_tag_list_foreach (gst_player_media_info_get_tags (media_info),
- print_one_tag, NULL);
- else
- g_print (" (nil) \n");
-
- list = gst_player_media_info_get_stream_list (media_info);
- if (!list)
- return;
-
- g_print ("All Stream information\n");
- for (l = list; l != NULL; l = l->next) {
- GstTagList *tags = NULL;
- GstPlayerStreamInfo *stream = (GstPlayerStreamInfo *) l->data;
-
- g_print (" Stream # %u \n", count++);
- g_print (" type : %s_%u\n",
- gst_player_stream_info_get_stream_type (stream),
- gst_player_stream_info_get_index (stream));
- tags = gst_player_stream_info_get_tags (stream);
- g_print (" taglist : \n");
- if (tags) {
- gst_tag_list_foreach (tags, print_one_tag, NULL);
- }
-
- if (GST_IS_PLAYER_VIDEO_INFO (stream))
- print_video_info ((GstPlayerVideoInfo *) stream);
- else if (GST_IS_PLAYER_AUDIO_INFO (stream))
- print_audio_info ((GstPlayerAudioInfo *) stream);
- else
- print_subtitle_info ((GstPlayerSubtitleInfo *) stream);
- }
-}
-
-static void
-print_all_video_stream (GstPlayerMediaInfo * media_info)
-{
- GList *list, *l;
-
- list = gst_player_get_video_streams (media_info);
- if (!list)
- return;
-
- g_print ("All video streams\n");
- for (l = list; l != NULL; l = l->next) {
- GstPlayerVideoInfo *info = (GstPlayerVideoInfo *) l->data;
- GstPlayerStreamInfo *sinfo = (GstPlayerStreamInfo *) info;
- g_print (" %s_%d #\n", gst_player_stream_info_get_stream_type (sinfo),
- gst_player_stream_info_get_index (sinfo));
- print_video_info (info);
- }
-}
-
-static void
-print_all_subtitle_stream (GstPlayerMediaInfo * media_info)
-{
- GList *list, *l;
-
- list = gst_player_get_subtitle_streams (media_info);
- if (!list)
- return;
-
- g_print ("All subtitle streams:\n");
- for (l = list; l != NULL; l = l->next) {
- GstPlayerSubtitleInfo *info = (GstPlayerSubtitleInfo *) l->data;
- GstPlayerStreamInfo *sinfo = (GstPlayerStreamInfo *) info;
- g_print (" %s_%d #\n", gst_player_stream_info_get_stream_type (sinfo),
- gst_player_stream_info_get_index (sinfo));
- print_subtitle_info (info);
- }
-}
-
-static void
-print_all_audio_stream (GstPlayerMediaInfo * media_info)
-{
- GList *list, *l;
-
- list = gst_player_get_audio_streams (media_info);
- if (!list)
- return;
-
- g_print ("All audio streams: \n");
- for (l = list; l != NULL; l = l->next) {
- GstPlayerAudioInfo *info = (GstPlayerAudioInfo *) l->data;
- GstPlayerStreamInfo *sinfo = (GstPlayerStreamInfo *) info;
- g_print (" %s_%d #\n", gst_player_stream_info_get_stream_type (sinfo),
- gst_player_stream_info_get_index (sinfo));
- print_audio_info (info);
- }
-}
-
-static void
-print_current_tracks (GstPlay * play)
-{
- GstPlayerAudioInfo *audio = NULL;
- GstPlayerVideoInfo *video = NULL;
- GstPlayerSubtitleInfo *subtitle = NULL;
-
- g_print ("Current video track: \n");
- video = gst_player_get_current_video_track (play->player);
- print_video_info (video);
-
- g_print ("Current audio track: \n");
- audio = gst_player_get_current_audio_track (play->player);
- print_audio_info (audio);
-
- g_print ("Current subtitle track: \n");
- subtitle = gst_player_get_current_subtitle_track (play->player);
- print_subtitle_info (subtitle);
-
- if (audio)
- g_object_unref (audio);
-
- if (video)
- g_object_unref (video);
-
- if (subtitle)
- g_object_unref (subtitle);
-}
-
-static void
-print_media_info (GstPlayerMediaInfo * media_info)
-{
- print_all_stream_info (media_info);
- g_print ("\n");
- print_all_video_stream (media_info);
- g_print ("\n");
- print_all_audio_stream (media_info);
- g_print ("\n");
- print_all_subtitle_stream (media_info);
-}
-
-static void
-media_info_cb (GstPlayer * player, GstPlayerMediaInfo * info, GstPlay * play)
-{
- static int once = 0;
-
- if (!once) {
- print_media_info (info);
- print_current_tracks (play);
- once = 1;
- }
-}
-
-static GstPlay *
-play_new (gchar ** uris, gdouble initial_volume)
-{
- GstPlay *play;
-
- play = g_new0 (GstPlay, 1);
-
- play->uris = uris;
- play->num_uris = g_strv_length (uris);
- play->cur_idx = -1;
-
- play->player =
- gst_player_new (NULL, gst_player_g_main_context_signal_dispatcher_new
- (NULL));
-
- g_signal_connect (play->player, "position-updated",
- G_CALLBACK (position_updated_cb), play);
- g_signal_connect (play->player, "state-changed",
- G_CALLBACK (state_changed_cb), play);
- g_signal_connect (play->player, "buffering", G_CALLBACK (buffering_cb), play);
- g_signal_connect (play->player, "end-of-stream",
- G_CALLBACK (end_of_stream_cb), play);
- g_signal_connect (play->player, "error", G_CALLBACK (error_cb), play);
-
- g_signal_connect (play->player, "media-info-updated",
- G_CALLBACK (media_info_cb), play);
-
- play->loop = g_main_loop_new (NULL, FALSE);
- play->desired_state = GST_STATE_PLAYING;
-
- play_set_relative_volume (play, initial_volume - 1.0);
-
- return play;
-}
-
-static void
-play_free (GstPlay * play)
-{
- play_reset (play);
-
- gst_object_unref (play->player);
-
- g_main_loop_unref (play->loop);
-
- g_strfreev (play->uris);
- g_free (play);
-}
-
-/* reset for new file/stream */
-static void
-play_reset (GstPlay * play)
-{
-}
-
-static void
-play_set_relative_volume (GstPlay * play, gdouble volume_step)
-{
- gdouble volume;
-
- g_object_get (play->player, "volume", &volume, NULL);
- volume = round ((volume + volume_step) * VOLUME_STEPS) / VOLUME_STEPS;
- volume = CLAMP (volume, 0.0, 10.0);
-
- g_object_set (play->player, "volume", volume, NULL);
-
- g_print ("Volume: %.0f%% \n", volume * 100);
-}
-
-static gchar *
-play_uri_get_display_name (GstPlay * play, const gchar * uri)
-{
- gchar *loc;
-
- if (gst_uri_has_protocol (uri, "file")) {
- loc = g_filename_from_uri (uri, NULL, NULL);
- } else if (gst_uri_has_protocol (uri, "pushfile")) {
- loc = g_filename_from_uri (uri + 4, NULL, NULL);
- } else {
- loc = g_strdup (uri);
- }
-
- /* Maybe additionally use glib's filename to display name function */
- return loc;
-}
-
-static void
-play_uri (GstPlay * play, const gchar * next_uri)
-{
- gchar *loc;
-
- play_reset (play);
-
- loc = play_uri_get_display_name (play, next_uri);
- g_print ("Now playing %s\n", loc);
- g_free (loc);
-
- g_object_set (play->player, "uri", next_uri, NULL);
- gst_player_play (play->player);
-}
-
-/* returns FALSE if we have reached the end of the playlist */
-static gboolean
-play_next (GstPlay * play)
-{
- if ((play->cur_idx + 1) >= play->num_uris) {
- if (play->repeat) {
- g_print ("Looping playlist \n");
- play->cur_idx = -1;
- } else
- return FALSE;
- }
-
- play_uri (play, play->uris[++play->cur_idx]);
- return TRUE;
-}
-
-/* returns FALSE if we have reached the beginning of the playlist */
-static gboolean
-play_prev (GstPlay * play)
-{
- if (play->cur_idx == 0 || play->num_uris <= 1)
- return FALSE;
-
- play_uri (play, play->uris[--play->cur_idx]);
- return TRUE;
-}
-
-static void
-do_play (GstPlay * play)
-{
- gint i;
-
- /* dump playlist */
- for (i = 0; i < play->num_uris; ++i)
- GST_INFO ("%4u : %s", i, play->uris[i]);
-
- if (!play_next (play))
- return;
-
- g_main_loop_run (play->loop);
-}
-
-static void
-add_to_playlist (GPtrArray * playlist, const gchar * filename)
-{
- GDir *dir;
- gchar *uri;
-
- if (gst_uri_is_valid (filename)) {
- g_ptr_array_add (playlist, g_strdup (filename));
- return;
- }
-
- if ((dir = g_dir_open (filename, 0, NULL))) {
- const gchar *entry;
-
- /* FIXME: sort entries for each directory? */
- while ((entry = g_dir_read_name (dir))) {
- gchar *path;
-
- path = g_strconcat (filename, G_DIR_SEPARATOR_S, entry, NULL);
- add_to_playlist (playlist, path);
- g_free (path);
- }
-
- g_dir_close (dir);
- return;
- }
-
- uri = gst_filename_to_uri (filename, NULL);
- if (uri != NULL)
- g_ptr_array_add (playlist, uri);
- else
- g_warning ("Could not make URI out of filename '%s'", filename);
-}
-
-static void
-shuffle_uris (gchar ** uris, guint num)
-{
- gchar *tmp;
- guint i, j;
-
- if (num < 2)
- return;
-
- for (i = 0; i < num; i++) {
- /* gets equally distributed random number in 0..num-1 [0;num[ */
- j = g_random_int_range (0, num);
- tmp = uris[j];
- uris[j] = uris[i];
- uris[i] = tmp;
- }
-}
-
-static void
-restore_terminal (void)
-{
- gst_play_kb_set_key_handler (NULL, NULL);
-}
-
-static void
-toggle_paused (GstPlay * play)
-{
- if (play->desired_state == GST_STATE_PLAYING) {
- play->desired_state = GST_STATE_PAUSED;
- gst_player_pause (play->player);
- } else {
- play->desired_state = GST_STATE_PLAYING;
- gst_player_play (play->player);
- }
-}
-
-static void
-relative_seek (GstPlay * play, gdouble percent)
-{
- gint64 dur = -1, pos = -1;
-
- g_return_if_fail (percent >= -1.0 && percent <= 1.0);
-
- g_object_get (play->player, "position", &pos, "duration", &dur, NULL);
-
- if (dur <= 0) {
- g_print ("\nCould not seek.\n");
- return;
- }
-
- pos = pos + dur * percent;
- if (pos < 0)
- pos = 0;
- gst_player_seek (play->player, pos);
-}
-
-static void
-keyboard_cb (const gchar * key_input, gpointer user_data)
-{
- GstPlay *play = (GstPlay *) user_data;
-
- switch (g_ascii_tolower (key_input[0])) {
- case 'i':
- {
- GstPlayerMediaInfo *media_info = gst_player_get_media_info (play->player);
- if (media_info) {
- print_media_info (media_info);
- g_object_unref (media_info);
- print_current_tracks (play);
- }
- break;
- }
- case ' ':
- toggle_paused (play);
- break;
- case 'q':
- case 'Q':
- g_main_loop_quit (play->loop);
- break;
- case '>':
- if (!play_next (play)) {
- g_print ("\nReached end of play list.\n");
- g_main_loop_quit (play->loop);
- }
- break;
- case '<':
- play_prev (play);
- break;
- case 27: /* ESC */
- if (key_input[1] == '\0') {
- g_main_loop_quit (play->loop);
- break;
- }
- /* fall through */
- default:
- if (strcmp (key_input, GST_PLAY_KB_ARROW_RIGHT) == 0) {
- relative_seek (play, +0.08);
- } else if (strcmp (key_input, GST_PLAY_KB_ARROW_LEFT) == 0) {
- relative_seek (play, -0.01);
- } else if (strcmp (key_input, GST_PLAY_KB_ARROW_UP) == 0) {
- play_set_relative_volume (play, +1.0 / VOLUME_STEPS);
- } else if (strcmp (key_input, GST_PLAY_KB_ARROW_DOWN) == 0) {
- play_set_relative_volume (play, -1.0 / VOLUME_STEPS);
- } else {
- GST_INFO ("keyboard input:");
- for (; *key_input != '\0'; ++key_input)
- GST_INFO (" code %3d", *key_input);
- }
- break;
- }
-}
-
-int
-girl_player_main (char *uri)
-{
- GstPlay *play;
- GPtrArray *playlist;
- gboolean print_version = FALSE;
- gboolean interactive = FALSE; /* FIXME: maybe enable by default? */
- gboolean shuffle = FALSE;
- gboolean repeat = FALSE;
- gdouble volume = 1.0;
- gchar **filenames = NULL;
- gchar **uris;
- guint num, i;
- GError *err = NULL;
- GOptionContext *ctx;
- gchar *playlist_file = NULL;
-
- GST_DEBUG_CATEGORY_INIT (play_debug, "play", 0, "gst-play");
-
- playlist = g_ptr_array_new ();
-
- /* fill playlist */
- if (filenames != NULL && *filenames != NULL) {
- num = g_strv_length (filenames);
- for (i = 0; i < num; ++i) {
- GST_LOG ("command line argument: %s", filenames[i]);
- add_to_playlist (playlist, uri);
- }
- g_strfreev (filenames);
- }
-
- num = playlist->len;
- g_ptr_array_add (playlist, NULL);
-
- uris = (gchar **) g_ptr_array_free (playlist, FALSE);
-
- if (shuffle)
- shuffle_uris (uris, num);
-
- /* prepare */
- play = play_new (uris, volume);
- play->repeat = repeat;
-
- if (interactive) {
- if (gst_play_kb_set_key_handler (keyboard_cb, play)) {
- atexit (restore_terminal);
- } else {
- g_print ("Interactive keyboard handling in terminal not available.\n");
- }
- }
-
- /* play */
- do_play (play);
-
- /* clean up */
- play_free (play);
-
- g_print ("\n");
- gst_deinit ();
- return 0;
-}
diff --git a/src/GIRL.c b/src/GIRL.c
index 2cc76a7..804e4ce 100644
--- a/src/GIRL.c
+++ b/src/GIRL.c
@@ -68,8 +68,7 @@ search_station(GSimpleAction *simple, GVariant *parameter, gpointer user_data) {
static void
listen_station(GSimpleAction *simple, GVariant *parameter, gpointer user_data) {
-
- girl_player_main (")http://bbcwssc.ic.llnwd.net/stream/bbcwssc_mp1_ws-eieuk");
+ /* girl_player_main (")http://bbcwssc.ic.llnwd.net/stream/bbcwssc_mp1_ws-eieuk"); */
g_print("Listening to BBC World Service\n");
return;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]