diff -ruN --exclude-from=freeciv-1.99+2.0.0beta7+gstreamer/diff_ignore freeciv-1.99+2.0.0beta7.orig/client/audio.c freeciv-1.99+2.0.0beta7+gstreamer/client/audio.c
--- freeciv-1.99+2.0.0beta7.orig/client/audio.c	2005-02-03 18:30:00.000000000 +0000
+++ freeciv-1.99+2.0.0beta7+gstreamer/client/audio.c	2005-02-04 06:50:11.000000000 +0000
@@ -44,10 +44,13 @@
 #ifdef ALSA
 #include "audio_alsa.h"
 #endif
+#ifdef GSTREAMER
+#include "audio_gstreamer.h"
+#endif
 
 #include "audio.h"
 
-#define MAX_NUM_PLUGINS		4
+#define MAX_NUM_PLUGINS		5
 #define SNDSPEC_SUFFIX		".soundspec"
 
 /* keep it open throughout */
@@ -169,6 +172,9 @@
 #ifdef AMIGA
   audio_amiga_init();
 #endif
+#ifdef GSTREAMER
+  audio_gstreamer_init();
+#endif
 }
 
 /**************************************************************************
@@ -291,6 +297,9 @@
 #ifdef AMIGA
   if (audio_select_plugin("amiga")) return;
 #endif
+#ifdef GSTREAMER
+  if (audio_select_plugin("gstreamer")) return;
+#endif
   freelog(LOG_ERROR,
     _("No real audio subsystem managed to initialize!"));
   freelog(LOG_ERROR,
diff -ruN --exclude-from=freeciv-1.99+2.0.0beta7+gstreamer/diff_ignore freeciv-1.99+2.0.0beta7.orig/client/audio_gstreamer.c freeciv-1.99+2.0.0beta7+gstreamer/client/audio_gstreamer.c
--- freeciv-1.99+2.0.0beta7.orig/client/audio_gstreamer.c	1970-01-01 01:00:00.000000000 +0100
+++ freeciv-1.99+2.0.0beta7+gstreamer/client/audio_gstreamer.c	2005-02-04 10:37:17.000000000 +0000
@@ -0,0 +1,139 @@
+/********************************************************************** 
+ Freeciv - Copyright (C) 1996 - A Kjeldberg, L Gregersen, P Unold
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+***********************************************************************/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <stdio.h>
+#include <gst/gst.h>
+#include <gst/gconf/gconf.h>
+
+#include "log.h"
+#include "support.h"
+
+#include "audio.h"
+
+#include "audio_gstreamer.h"
+
+bool loop;
+GstElement *thread, *play;
+gchar uri[PATH_MAX];
+
+static void my_stop()
+{
+  if (gst_element_set_state (thread, GST_STATE_NULL) != GST_STATE_SUCCESS) {
+    freelog(LOG_ERROR, "Failed to stop.");
+  }
+  gst_object_unref (GST_OBJECT (thread));
+  /* leak? should we unref sink and play here as well? */
+}
+
+static void my_wait()
+{
+  /* not implemented */
+}
+
+static void my_shutdown()
+{
+}
+
+/* End of stream callback */
+static void eos_cb(GstElement *play, gpointer data)
+{
+  freelog(LOG_NORMAL, "End of stream.");
+
+  if (loop) {
+	if (! gst_element_seek (thread, GST_SEEK_METHOD_SET | GST_FORMAT_TIME | GST_SEEK_FLAG_FLUSH, 1)) {
+	  freelog(LOG_ERROR,"Failed to seek to start of sound.");
+	}
+  } else {
+    my_stop();
+  }
+}
+
+/* Error callback */
+static void error_cb(GstElement *play, GstElement *src, GError *err, gchar *debug, gpointer data)
+{
+	freelog(LOG_ERROR, "%s", err->message);
+	my_stop();
+}
+
+/* Play a sound */
+static bool my_play(const char *const tag, const char *const fullpath,
+		    bool repeat)
+{
+  if (fullpath == NULL) {
+    return FALSE;
+  }
+
+  //if (repeat) freelog(LOG_NORMAL, "Unable to play sound repeating");
+  loop = repeat;
+
+  //char *uri = "file:///home/sam/.freeciv/stdsounds/gong10.wav";
+  //char *uri = gst_uri_construct ("file", fullpath);
+  snprintf(uri, PATH_MAX-1, "file://%s", fullpath);
+
+  freelog(LOG_NORMAL, "Playing %s...\n", uri);
+
+  /* create a pipeline */
+  
+  play = gst_element_factory_make ("playbin", "play");
+  g_object_set (G_OBJECT (play), "audio-sink", gst_gconf_get_default_audio_sink(), NULL);
+  g_object_set (G_OBJECT (play), "uri", uri, NULL);
+  
+  thread = gst_thread_new ("mythread");
+  g_signal_connect (thread, "eos", G_CALLBACK (eos_cb), NULL);
+  g_signal_connect (thread, "error", G_CALLBACK (error_cb), NULL);
+  gst_bin_add (GST_BIN (thread), play);
+
+  if (gst_element_set_state (thread, GST_STATE_PLAYING) != GST_STATE_SUCCESS) {
+    freelog(LOG_NORMAL, "Failed to play.");
+  }
+  
+  //g_free (uri);
+
+  return TRUE;
+}
+
+static bool my_init(void)
+{
+  int i;
+
+  for (i=0; i<PATH_MAX; i++)
+    uri[i] = 0;
+
+  gst_init(NULL, NULL);
+
+  return TRUE;
+}
+
+
+/**************************************************************************
+  Initialize. Note that this function is called very early at the
+  client startup. So for example logging isn't available.
+**************************************************************************/
+void audio_gstreamer_init(void)
+{
+  struct audio_plugin self;
+
+  sz_strlcpy(self.name, "gstreamer");
+  sz_strlcpy(self.descr, "GStreamer plugin");
+  self.shutdown = my_stop;
+  self.init = my_init;
+  self.shutdown = my_shutdown;
+  self.stop = my_stop;
+  self.wait = my_wait;
+  self.play = my_play;
+  audio_add_plugin(&self);
+}
diff -ruN --exclude-from=freeciv-1.99+2.0.0beta7+gstreamer/diff_ignore freeciv-1.99+2.0.0beta7.orig/client/audio_gstreamer.h freeciv-1.99+2.0.0beta7+gstreamer/client/audio_gstreamer.h
--- freeciv-1.99+2.0.0beta7.orig/client/audio_gstreamer.h	1970-01-01 01:00:00.000000000 +0100
+++ freeciv-1.99+2.0.0beta7+gstreamer/client/audio_gstreamer.h	2005-02-03 18:31:55.000000000 +0000
@@ -0,0 +1,18 @@
+/********************************************************************** 
+ Freeciv - Copyright (C) 1996 - A Kjeldberg, L Gregersen, P Unold
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+***********************************************************************/
+#ifndef FC__AUDIO_GSTREAMER_H
+#define FC__AUDIO_GSTREAMER_H
+
+void audio_gstreamer_init(void);
+
+#endif                          /* FC__AUDIO_GSTREAMER_H */
diff -ruN --exclude-from=freeciv-1.99+2.0.0beta7+gstreamer/diff_ignore freeciv-1.99+2.0.0beta7.orig/client/Makefile.am freeciv-1.99+2.0.0beta7+gstreamer/client/Makefile.am
--- freeciv-1.99+2.0.0beta7.orig/client/Makefile.am	2005-02-03 18:30:00.000000000 +0000
+++ freeciv-1.99+2.0.0beta7+gstreamer/client/Makefile.am	2005-02-04 04:23:32.000000000 +0000
@@ -35,6 +35,7 @@
 ALL_ALSA_FILES=audio_alsa.c audio_alsa.h
 ALL_WINMM_FILES=audio_winmm.c audio_winmm.h
 ALL_AMIGA_FILES=audio_amiga.c audio_amiga.h
+ALL_GSTREAMER_FILES=audio_gstreamer.c audio_gstreamer.h
 
 if ESD
 ESD_FILES=$(ALL_ESD_FILES)
@@ -48,6 +49,9 @@
 if WINMM
 WINMM_FILES=$(ALL_WINMM_FILES)
 endif
+if GSTREAMER
+GSTREAMER_FILES=$(ALL_GSTREAMER_FILES)
+endif
 
 EXTRA_DIST= 	gui-mui/autogroupclass.c         \
 		gui-mui/autogroupclass.h         \
@@ -120,6 +124,7 @@
 		$(ALL_ESD_FILES)                 \
 		$(ALL_SDL_FILES)                 \
 		$(ALL_ALSA_FILES)                \
+		$(ALL_GSTREAMER_FILES)           \
 		$(ALL_WINMM_FILES)		 \
 		$(ALL_AMIGA_FILES)
 
@@ -142,7 +147,7 @@
 
 ## Above, note -I../intl instead of -I$(top_srdir/intl) is deliberate.
 
-civclient_SOURCES = $(ESD_FILES) $(SDL_FILES) $(ALSA_FILES) $(WINMM_FILES) \
+civclient_SOURCES = $(ESD_FILES) $(SDL_FILES) $(ALSA_FILES) $(WINMM_FILES) $(GSTREAMER_FILES) \
 	attribute.h	\
 	attribute.c	\
 	citydlg_common.c \
diff -ruN --exclude-from=freeciv-1.99+2.0.0beta7+gstreamer/diff_ignore freeciv-1.99+2.0.0beta7.orig/configure.ac freeciv-1.99+2.0.0beta7+gstreamer/configure.ac
--- freeciv-1.99+2.0.0beta7.orig/configure.ac	2005-02-03 18:29:54.000000000 +0000
+++ freeciv-1.99+2.0.0beta7+gstreamer/configure.ac	2005-02-04 03:55:20.000000000 +0000
@@ -424,6 +424,7 @@
 AM_CONDITIONAL(ESD, test "x$ESD" = "xyes")
 AM_CONDITIONAL(SDL, test "x$SDL_mixer" = "xyes")
 AM_CONDITIONAL(ALSA, test "x$ALSA" = "xyes")
+AM_CONDITIONAL(GSTREAMER, test "x$GSTREAMER" = "xyes")
 AM_CONDITIONAL(WINMM, test "x$WINMM" = "xyes")
 AM_CONDITIONAL(CLIENT_GUI_SDL, test "$gui_sources" = "gui-sdl")
 AM_CONDITIONAL(CLIENT_GUI_GTK, test "$gui_sources" = "gui-gtk")
diff -ruN --exclude-from=freeciv-1.99+2.0.0beta7+gstreamer/diff_ignore freeciv-1.99+2.0.0beta7.orig/configure.in freeciv-1.99+2.0.0beta7+gstreamer/configure.in
--- freeciv-1.99+2.0.0beta7.orig/configure.in	2005-02-03 18:29:55.000000000 +0000
+++ freeciv-1.99+2.0.0beta7+gstreamer/configure.in	2005-02-04 01:59:36.000000000 +0000
@@ -413,6 +413,7 @@
 AC_SUBST(VERSION_WITHOUT_LABEL)
 AM_CONDITIONAL(ESD, test x"$ESD" = "xyes")
 AM_CONDITIONAL(ALSA, test "x$ALSA" = "xyes")
+AM_CONDITIONAL(GSTREAMER, test "x$GSTREAMER" = "xyes")
 AM_CONDITIONAL(SDL, test x"$SDL_mixer" = "xyes")
 AM_CONDITIONAL(WINMM, test x"$WINMM" = "xyes")
 AM_CONDITIONAL(CLIENT_GUI_SDL, test "$gui_sources" = "gui-sdl")
diff -ruN --exclude-from=freeciv-1.99+2.0.0beta7+gstreamer/diff_ignore freeciv-1.99+2.0.0beta7.orig/m4/sound.m4 freeciv-1.99+2.0.0beta7+gstreamer/m4/sound.m4
--- freeciv-1.99+2.0.0beta7.orig/m4/sound.m4	2005-02-03 18:29:52.000000000 +0000
+++ freeciv-1.99+2.0.0beta7+gstreamer/m4/sound.m4	2005-02-04 09:55:56.000000000 +0000
@@ -15,6 +15,10 @@
    [  --disable-winmm         Do not try to use WinMM for sound],
    USE_SOUND=no, USE_SOUND_WINMM=yes)
 
+ AC_ARG_ENABLE(gstreamer,
+   [  --disable-gstreamer     Do not try to use GStreamer for sound],
+   USE_SOUND=no, USE_SOUND_GSTREAMER=yes)
+ 
  if test "x$USE_SOUND_ESD" = "xyes"; then
   dnl Add esound support to client
   ESD_VERSION=0.0.20
@@ -72,4 +76,15 @@
     WINMM="yes"
   fi
  fi
+
+ if test "x$USE_SOUND_GSTREAMER" = "xyes"; then
+  dnl AM_PATH_GSTREAMER(0.8, GSTREAMER=yes, GSTREAMER=no)
+  PKG_CHECK_MODULES(GSTREAMER, gstreamer-0.8 >= 0.8.8 gstreamer-gconf-0.8, GSTREAMER=yes, GSTREAMER=no)
+  if test x"$GSTREAMER" = xyes ; then
+   dnl GST_ELEMENT_CHECK on playbin ?
+   SOUND_CFLAGS="$SOUND_CFLAGS $GSTREAMER_CFLAGS"
+   SOUND_LIBS="$SOUND_LIBS $GSTREAMER_LIBS"
+   AC_DEFINE(GSTREAMER, 1, [GStreamer sound support])
+  fi
+ fi
 ])
