rpms/gstreamer-plugins-bad/F-8 gst-plugins-bad-0.10.5-faad2.patch, NONE, 1.1 gst-plugins-bad-0.10.5-flv.patch, NONE, 1.1 gst-plugins-bad-0.10.5-mms-connections-speed.patch, NONE, 1.1 gst-plugins-bad-0.10.5-mms-seek.patch, NONE, 1.1 gstreamer-plugins-bad-0.10.5-mjpegtools.patch, NONE, 1.1 gstreamer-plugins-bad-0.10.5-mod-mimetypes.patch, NONE, 1.1 gstreamer-plugins-bad-0.10.5-real-search.patch, NONE, 1.1 gstreamer-plugins-bad-0.10.5-sys-modplug.patch, NONE, 1.1 gstreamer-plugins-bad-0.10.5-wildmidi-cfg.patch, NONE, 1.1 gstreamer-plugins-bad-gmyth.patch, NONE, 1.1 gstreamer-plugins-bad.spec, NONE, 1.1 .cvsignore, 1.1, 1.2 sources, 1.1, 1.2

Hans de Goede jwrdegoede at rpmfusion.org
Thu Jul 24 11:27:42 CEST 2008


Author: jwrdegoede

Update of /cvs/free/rpms/gstreamer-plugins-bad/F-8
In directory se02.es.rpmfusion.net:/tmp/cvs-serv30565

Modified Files:
	.cvsignore sources 
Added Files:
	gst-plugins-bad-0.10.5-faad2.patch 
	gst-plugins-bad-0.10.5-flv.patch 
	gst-plugins-bad-0.10.5-mms-connections-speed.patch 
	gst-plugins-bad-0.10.5-mms-seek.patch 
	gstreamer-plugins-bad-0.10.5-mjpegtools.patch 
	gstreamer-plugins-bad-0.10.5-mod-mimetypes.patch 
	gstreamer-plugins-bad-0.10.5-real-search.patch 
	gstreamer-plugins-bad-0.10.5-sys-modplug.patch 
	gstreamer-plugins-bad-0.10.5-wildmidi-cfg.patch 
	gstreamer-plugins-bad-gmyth.patch gstreamer-plugins-bad.spec 
Log Message:
* Tue Feb  5 2008  Hans de Goede <j.w.r.degoede at hhs.nl> 0.10.5-14
- Add flv demuxer from CVS (livna bug 1846)


gst-plugins-bad-0.10.5-faad2.patch:

--- NEW FILE gst-plugins-bad-0.10.5-faad2.patch ---
diff -Naupr gst-plugins-bad-0.10.5.orig/ext/faad/gstfaad.c gst-plugins-bad-0.10.5/ext/faad/gstfaad.c
--- gst-plugins-bad-0.10.5.orig/ext/faad/gstfaad.c	2007-06-13 11:20:43.000000000 +0200
+++ gst-plugins-bad-0.10.5/ext/faad/gstfaad.c	2007-08-21 11:10:09.000000000 +0200
@@ -58,8 +58,8 @@
 #undef faacDecInit2
 #endif
 
-extern long faacDecInit (faacDecHandle, guint8 *, guint32, guint32 *, guint8 *);
-extern int8_t faacDecInit2 (faacDecHandle, guint8 *, guint32,
+extern long NeAACDecInit (NeAACDecHandle, guint8 *, guint32, guint32 *, guint8 *);
+extern int8_t NeAACDecInit2 (NeAACDecHandle, guint8 *, guint32,
     guint32 *, guint8 *);
 
 GST_DEBUG_CATEGORY_STATIC (faad_debug);
@@ -319,7 +319,7 @@ gst_faad_setcaps (GstPad * pad, GstCaps 
       goto wrong_length;
 
     /* someone forgot that char can be unsigned when writing the API */
-    if ((gint8) faacDecInit2 (faad->handle, cdata, csize, &samplerate,
+    if ((gint8) NeAACDecInit2 (faad->handle, cdata, csize, &samplerate,
             &channels) < 0)
       goto init_failed;
 
@@ -379,7 +379,7 @@ wrong_length:
   }
 init_failed:
   {
-    GST_DEBUG_OBJECT (faad, "faacDecInit2() failed");
+    GST_DEBUG_OBJECT (faad, "NeAACDecInit2() failed");
     return FALSE;
   }
 }
@@ -719,11 +719,11 @@ gst_faad_srcconnect (GstPad * pad, const
   }
 
   if (fmt != -1) {
-    faacDecConfiguration *conf;
+    NeAACDecConfiguration *conf;
 
-    conf = faacDecGetCurrentConfiguration (faad->handle);
+    conf = NeAACDecGetCurrentConfiguration (faad->handle);
     conf->outputFormat = fmt;
-    if (faacDecSetConfiguration (faad->handle, conf) == 0)
+    if (NeAACDecSetConfiguration (faad->handle, conf) == 0)
       return GST_PAD_LINK_REFUSED;
 
     // FIXME: handle return value, how? 
@@ -1007,7 +1007,7 @@ gst_faad_src_query (GstPad * pad, GstQue
 
 
 static gboolean
-gst_faad_update_caps (GstFaad * faad, faacDecFrameInfo * info)
+gst_faad_update_caps (GstFaad * faad, NeAACDecFrameInfo * info)
 {
   GstAudioChannelPosition *pos;
   gboolean ret;
@@ -1191,7 +1191,7 @@ gst_faad_chain (GstPad * pad, GstBuffer 
   guchar *input_data;
   GstFaad *faad;
   GstBuffer *outbuf;
-  faacDecFrameInfo info;
+  NeAACDecFrameInfo info;
   void *out;
   gboolean run_loop = TRUE;
   guint sync_off;
@@ -1242,17 +1242,17 @@ gst_faad_chain (GstPad * pad, GstBuffer 
      * appropriate initialisation info... if not, we use our fake_codec_data
      */
     if (looks_like_valid_header (input_data, input_size) || !faad->packetised) {
-      if (faacDecInit (faad->handle, input_data, input_size, &rate, &ch) < 0)
+      if (NeAACDecInit (faad->handle, input_data, input_size, &rate, &ch) < 0)
         goto init_failed;
 
-      GST_DEBUG_OBJECT (faad, "faacDecInit() ok: rate=%u,channels=%u", rate,
+      GST_DEBUG_OBJECT (faad, "NeAACDecInit() ok: rate=%u,channels=%u", rate,
           ch);
     } else {
-      if ((gint8) faacDecInit2 (faad->handle, faad->fake_codec_data, 2,
+      if ((gint8) NeAACDecInit2 (faad->handle, faad->fake_codec_data, 2,
               &rate, &ch) < 0) {
         goto init2_failed;
       }
-      GST_DEBUG_OBJECT (faad, "faacDecInit2() ok: rate=%u,channels=%u", rate,
+      GST_DEBUG_OBJECT (faad, "NeAACDecInit2() ok: rate=%u,channels=%u", rate,
           ch);
     }
 
@@ -1285,7 +1285,7 @@ gst_faad_chain (GstPad * pad, GstBuffer 
       }
     }
 
-    out = faacDecDecode (faad->handle, &info, input_data + skip_bytes,
+    out = NeAACDecDecode (faad->handle, &info, input_data + skip_bytes,
         input_size - skip_bytes);
 
     if (info.error > 0) {
@@ -1293,30 +1293,30 @@ gst_faad_chain (GstPad * pad, GstBuffer 
       guint8 ch;
 
       GST_DEBUG_OBJECT (faad, "decoding error: %s",
-          faacDecGetErrorMessage (info.error));
+          NeAACDecGetErrorMessage (info.error));
 
       goto out;
 
       if (!faad->packetised)
         goto decode_error;
 
-      /* decode error? try again using faacDecInit2 
+      /* decode error? try again using NeAACDecInit2 
        * fabricated private codec data from sink caps */
       gst_faad_close_decoder (faad);
       if (!gst_faad_open_decoder (faad))
         goto init2_failed;
 
-      GST_DEBUG_OBJECT (faad, "decoding error, reopening with faacDecInit2()");
-      if ((gint8) faacDecInit2 (faad->handle, faad->fake_codec_data, 2,
+      GST_DEBUG_OBJECT (faad, "decoding error, reopening with NeAACDecInit2()");
+      if ((gint8) NeAACDecInit2 (faad->handle, faad->fake_codec_data, 2,
               &rate, &ch) < 0) {
         goto init2_failed;
       }
 
-      GST_DEBUG_OBJECT (faad, "faacDecInit2(): rate=%d,channels=%d", rate, ch);
+      GST_DEBUG_OBJECT (faad, "NeAACDecInit2(): rate=%d,channels=%d", rate, ch);
 
       /* let's try again */
       info.error = 0;
-      out = faacDecDecode (faad->handle, &info, input_data + skip_bytes,
+      out = NeAACDecDecode (faad->handle, &info, input_data + skip_bytes,
           input_size - skip_bytes);
 
       if (info.error) {
@@ -1325,7 +1325,7 @@ gst_faad_chain (GstPad * pad, GstBuffer 
           goto decode_error;
         GST_DEBUG_OBJECT (faad,
             "Failed to decode buffer: %s, count = %d, trying to resync",
-            faacDecGetErrorMessage (info.error), faad->error_count);
+            NeAACDecGetErrorMessage (info.error), faad->error_count);
         continue;
       }
 
@@ -1434,14 +1434,14 @@ init_failed:
 init2_failed:
   {
     GST_ELEMENT_ERROR (faad, STREAM, DECODE, (NULL),
-        ("%s() failed", (faad->handle) ? "faacDecInit2" : "faacDecOpen"));
+        ("%s() failed", (faad->handle) ? "NeAACDecInit2" : "NeAACDecOpen"));
     ret = GST_FLOW_ERROR;
     goto out;
   }
 decode_error:
   {
     GST_ELEMENT_ERROR (faad, STREAM, DECODE, (NULL),
-        ("Failed to decode buffer: %s", faacDecGetErrorMessage (info.error)));
+        ("Failed to decode buffer: %s", NeAACDecGetErrorMessage (info.error)));
     ret = GST_FLOW_ERROR;
     goto out;
   }
@@ -1450,22 +1450,22 @@ decode_error:
 static gboolean
 gst_faad_open_decoder (GstFaad * faad)
 {
-  faacDecConfiguration *conf;
+  NeAACDecConfiguration *conf;
 
-  faad->handle = faacDecOpen ();
+  faad->handle = NeAACDecOpen ();
 
   if (faad->handle == NULL) {
-    GST_WARNING_OBJECT (faad, "faacDecOpen() failed");
+    GST_WARNING_OBJECT (faad, "NeAACDecOpen() failed");
     return FALSE;
   }
 
-  conf = faacDecGetCurrentConfiguration (faad->handle);
+  conf = NeAACDecGetCurrentConfiguration (faad->handle);
   conf->defObjectType = LC;
   conf->dontUpSampleImplicitSBR = 1;
   conf->outputFormat = FAAD_FMT_16BIT;
 
-  if (faacDecSetConfiguration (faad->handle, conf) == 0) {
-    GST_WARNING_OBJECT (faad, "faacDecSetConfiguration() failed");
+  if (NeAACDecSetConfiguration (faad->handle, conf) == 0) {
+    GST_WARNING_OBJECT (faad, "NeAACDecSetConfiguration() failed");
     return FALSE;
   }
 
@@ -1476,7 +1476,7 @@ static void
 gst_faad_close_decoder (GstFaad * faad)
 {
   if (faad->handle) {
-    faacDecClose (faad->handle);
+    NeAACDecClose (faad->handle);
     faad->handle = NULL;
   }
 }
diff -Naupr gst-plugins-bad-0.10.5.orig/ext/faad/gstfaad.h gst-plugins-bad-0.10.5/ext/faad/gstfaad.h
--- gst-plugins-bad-0.10.5.orig/ext/faad/gstfaad.h	2006-05-31 21:26:24.000000000 +0200
+++ gst-plugins-bad-0.10.5/ext/faad/gstfaad.h	2007-08-21 10:55:57.000000000 +0200
@@ -51,7 +51,7 @@ typedef struct _GstFaad {
   GstBuffer *tempbuf;    /* used to keep input leftovers          */
 
   /* FAAD object */
-  faacDecHandle handle;
+  NeAACDecHandle handle;
   gboolean init;
 
   /* FAAD channel setup */

gst-plugins-bad-0.10.5-flv.patch:

--- NEW FILE gst-plugins-bad-0.10.5-flv.patch ---
diff -up /dev/null gst-plugins-bad-0.10.5/gst/flv/gstflvdemux.c
--- /dev/null	2008-02-05 09:36:22.221546318 +0100
+++ gst-plugins-bad-0.10.5/gst/flv/gstflvdemux.c	2008-02-05 10:33:21.000000000 +0100
@@ -0,0 +1,1200 @@
+/* GStreamer
+ * Copyright (C) <2007> Julien Moutte <julien at moutte.net>
+ *
+ * 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., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "gstflvdemux.h"
+#include "gstflvparse.h"
+
+#include <string.h>
+
+static GstStaticPadTemplate flv_sink_template = GST_STATIC_PAD_TEMPLATE ("sink",
+    GST_PAD_SINK,
+    GST_PAD_ALWAYS,
+    GST_STATIC_CAPS ("video/x-flv")
+    );
+
+static GstStaticPadTemplate audio_src_template =
+GST_STATIC_PAD_TEMPLATE ("audio",
+    GST_PAD_SRC,
+    GST_PAD_SOMETIMES,
+    GST_STATIC_CAPS_ANY);
+
+static GstStaticPadTemplate video_src_template =
+GST_STATIC_PAD_TEMPLATE ("video",
+    GST_PAD_SRC,
+    GST_PAD_SOMETIMES,
+    GST_STATIC_CAPS_ANY);
+
+static GstElementDetails flv_demux_details = {
+  "FLV Demuxer",
+  "Codec/Demuxer",
+  "Demux FLV feeds into digital streams",
+  "Julien Moutte <julien at moutte.net>"
+};
+
+GST_DEBUG_CATEGORY (flvdemux_debug);
+#define GST_CAT_DEFAULT flvdemux_debug
+
+GST_BOILERPLATE (GstFLVDemux, gst_flv_demux, GstElement, GST_TYPE_ELEMENT);
+
+#define FLV_HEADER_SIZE 13
+#define FLV_TAG_TYPE_SIZE 4
+
+static void
+gst_flv_demux_flush (GstFLVDemux * demux, gboolean discont)
+{
+  GST_DEBUG_OBJECT (demux, "flushing queued data in the FLV demuxer");
+
+  gst_adapter_clear (demux->adapter);
+
+  demux->audio_need_discont = TRUE;
+  demux->video_need_discont = TRUE;
+
+  demux->flushing = FALSE;
+
+  /* Only in push mode */
+  if (!demux->random_access) {
+    /* After a flush we expect a tag_type */
+    demux->state = FLV_STATE_TAG_TYPE;
+    /* We reset the offset and will get one from first push */
+    demux->offset = 0;
+  }
+}
+
+static void
+gst_flv_demux_cleanup (GstFLVDemux * demux)
+{
+  GST_DEBUG_OBJECT (demux, "cleaning up FLV demuxer");
+
+  demux->state = FLV_STATE_HEADER;
+
+  demux->flushing = FALSE;
+  demux->need_header = TRUE;
+  demux->audio_need_segment = TRUE;
+  demux->video_need_segment = TRUE;
+  demux->audio_need_discont = TRUE;
+  demux->video_need_discont = TRUE;
+
+  /* By default we consider them as linked */
+  demux->audio_linked = TRUE;
+  demux->video_linked = TRUE;
+
+  demux->has_audio = FALSE;
+  demux->has_video = FALSE;
+  demux->push_tags = FALSE;
+  demux->got_par = FALSE;
+
+  demux->w = demux->h = 0;
+  demux->par_x = demux->par_y = 1;
+  demux->video_offset = 0;
+  demux->audio_offset = 0;
+  demux->offset = demux->cur_tag_offset = 0;
+  demux->tag_size = demux->tag_data_size = 0;
+  demux->duration = GST_CLOCK_TIME_NONE;
+
+  if (demux->new_seg_event) {
+    gst_event_unref (demux->new_seg_event);
+    demux->new_seg_event = NULL;
+  }
+
+  gst_adapter_clear (demux->adapter);
+
+  if (demux->audio_pad) {
+    gst_element_remove_pad (GST_ELEMENT (demux), demux->audio_pad);
+    gst_object_unref (demux->audio_pad);
+    demux->audio_pad = NULL;
+  }
+
+  if (demux->video_pad) {
+    gst_element_remove_pad (GST_ELEMENT (demux), demux->video_pad);
+    gst_object_unref (demux->video_pad);
+    demux->video_pad = NULL;
+  }
+
+  if (demux->times) {
+    g_array_free (demux->times, TRUE);
+    demux->times = NULL;
+  }
+
+  if (demux->filepositions) {
+    g_array_free (demux->filepositions, TRUE);
+    demux->filepositions = NULL;
+  }
+}
+
+static void
+gst_flv_demux_adapter_flush (GstFLVDemux * demux, guint64 bytes)
+{
+  demux->offset += bytes;
+
+  gst_adapter_flush (demux->adapter, bytes);
+}
+
+static GstFlowReturn
+gst_flv_demux_chain (GstPad * pad, GstBuffer * buffer)
+{
+  GstFlowReturn ret = GST_FLOW_OK;
+  GstFLVDemux *demux = NULL;
+
+  demux = GST_FLV_DEMUX (gst_pad_get_parent (pad));
+
+  GST_LOG_OBJECT (demux, "received buffer of %d bytes at offset %"
+      G_GUINT64_FORMAT, GST_BUFFER_SIZE (buffer), GST_BUFFER_OFFSET (buffer));
+
+  if (G_UNLIKELY (GST_BUFFER_OFFSET (buffer) == 0)) {
+    GST_DEBUG_OBJECT (demux, "beginning of file, expect header");
+    demux->state = FLV_STATE_HEADER;
+    demux->offset = 0;
+  }
+
+  if (G_UNLIKELY (demux->offset == 0)) {
+    GST_DEBUG_OBJECT (demux, "offset was zero, synchronizing with buffer's");
+    demux->offset = GST_BUFFER_OFFSET (buffer);
+  }
+
+  gst_adapter_push (demux->adapter, buffer);
+
+parse:
+  if (G_UNLIKELY (demux->flushing)) {
+    GST_DEBUG_OBJECT (demux, "we are now flushing, exiting parser loop");
+    ret = GST_FLOW_WRONG_STATE;
+    goto beach;
+  }
+  switch (demux->state) {
+    case FLV_STATE_HEADER:
+    {
+      if (gst_adapter_available (demux->adapter) >= FLV_HEADER_SIZE) {
+        const guint8 *data;
+
+        data = gst_adapter_peek (demux->adapter, FLV_HEADER_SIZE);
+
+        ret = gst_flv_parse_header (demux, data, FLV_HEADER_SIZE);
+
+        gst_flv_demux_adapter_flush (demux, FLV_HEADER_SIZE);
+
+        demux->state = FLV_STATE_TAG_TYPE;
+        goto parse;
[...2789 lines suppressed...]
+	test -z "$(CTAGS_ARGS)$$tags$$unique" \
+	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+	     $$tags $$unique
+
+GTAGS:
+	here=`$(am__cd) $(top_builddir) && pwd` \
+	  && cd $(top_srcdir) \
+	  && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+	@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+	list='$(DISTFILES)'; \
+	  dist_files=`for file in $$list; do echo $$file; done | \
+	  sed -e "s|^$$srcdirstrip/||;t" \
+	      -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+	case $$dist_files in \
+	  */*) $(MKDIR_P) `echo "$$dist_files" | \
+			   sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+			   sort -u` ;; \
+	esac; \
+	for file in $$dist_files; do \
+	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+	  if test -d $$d/$$file; then \
+	    dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+	      cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+	    fi; \
+	    cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+	  else \
+	    test -f $(distdir)/$$file \
+	    || cp -p $$d/$$file $(distdir)/$$file \
+	    || exit 1; \
+	  fi; \
+	done
+check-am: all-am
+check: check-am
+all-am: Makefile $(LTLIBRARIES) $(HEADERS)
+installdirs:
+	for dir in "$(DESTDIR)$(plugindir)"; do \
+	  test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+	done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	  `test -z '$(STRIP)' || \
+	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+	@echo "This command is intended for maintainers to use"
+	@echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool clean-pluginLTLIBRARIES \
+	mostlyclean-am
+
+distclean: distclean-am
+	-rm -rf ./$(DEPDIR)
+	-rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+	distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am: install-pluginLTLIBRARIES
+
+install-dvi: install-dvi-am
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-info: install-info-am
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-ps: install-ps-am
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+	-rm -rf ./$(DEPDIR)
+	-rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+	mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-pluginLTLIBRARIES
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+	clean-libtool clean-pluginLTLIBRARIES ctags distclean \
+	distclean-compile distclean-generic distclean-libtool \
+	distclean-tags distdir dvi dvi-am html html-am info info-am \
+	install install-am install-data install-data-am install-dvi \
+	install-dvi-am install-exec install-exec-am install-html \
+	install-html-am install-info install-info-am install-man \
+	install-pdf install-pdf-am install-pluginLTLIBRARIES \
+	install-ps install-ps-am install-strip installcheck \
+	installcheck-am installdirs maintainer-clean \
+	maintainer-clean-generic mostlyclean mostlyclean-compile \
+	mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+	tags uninstall uninstall-am uninstall-pluginLTLIBRARIES
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff -up gst-plugins-bad-0.10.5/gst/Makefile.am.flv gst-plugins-bad-0.10.5/gst/Makefile.am
--- gst-plugins-bad-0.10.5/gst/Makefile.am.flv	2007-06-13 11:20:44.000000000 +0200
+++ gst-plugins-bad-0.10.5/gst/Makefile.am	2008-02-05 10:33:21.000000000 +0100
@@ -1,2 +1,2 @@
-SUBDIRS = $(GST_PLUGINS_SELECTED)
-DIST_SUBDIRS = $(GST_PLUGINS_ALL)
+SUBDIRS = $(GST_PLUGINS_SELECTED) flv
+DIST_SUBDIRS = $(GST_PLUGINS_ALL) flv
diff -up gst-plugins-bad-0.10.5/gst/Makefile.in.flv gst-plugins-bad-0.10.5/gst/Makefile.in
--- gst-plugins-bad-0.10.5/gst/Makefile.in.flv	2007-06-19 10:44:26.000000000 +0200
+++ gst-plugins-bad-0.10.5/gst/Makefile.in	2008-02-05 10:33:21.000000000 +0100
@@ -461,8 +461,8 @@ sbindir = @sbindir@
 sharedstatedir = @sharedstatedir@
 sysconfdir = @sysconfdir@
 target_alias = @target_alias@
-SUBDIRS = $(GST_PLUGINS_SELECTED)
-DIST_SUBDIRS = $(GST_PLUGINS_ALL)
+SUBDIRS = $(GST_PLUGINS_SELECTED) flv
+DIST_SUBDIRS = $(GST_PLUGINS_ALL) flv
 all: all-recursive
 
 .SUFFIXES:
diff -up gst-plugins-bad-0.10.5/configure.ac.flv gst-plugins-bad-0.10.5/configure.ac
--- gst-plugins-bad-0.10.5/configure.ac.flv	2008-02-05 10:34:31.000000000 +0100
+++ gst-plugins-bad-0.10.5/configure.ac	2008-02-05 10:35:50.000000000 +0100
@@ -970,6 +970,7 @@ gst/cdxaparse/Makefile
 gst/deinterlace/Makefile
 gst/equalizer/Makefile
 gst/filter/Makefile
+gst/flv/Makefile
 gst/freeze/Makefile
 gst/h264parse/Makefile
 gst/interleave/Makefile
diff -up gst-plugins-bad-0.10.5/configure.flv gst-plugins-bad-0.10.5/configure
--- gst-plugins-bad-0.10.5/configure.flv	2008-02-05 10:34:40.000000000 +0100
+++ gst-plugins-bad-0.10.5/configure	2008-02-05 10:35:48.000000000 +0100
@@ -42403,7 +42403,7 @@ GST_PLUGIN_LDFLAGS="-module -avoid-versi
 
 
 
-ac_config_files="$ac_config_files Makefile gst-plugins-bad.spec gst/Makefile gst/app/Makefile gst/bayer/Makefile gst/cdxaparse/Makefile gst/deinterlace/Makefile gst/equalizer/Makefile gst/filter/Makefile gst/freeze/Makefile gst/h264parse/Makefile gst/interleave/Makefile gst/librfb/Makefile gst/modplug/Makefile gst/modplug/libmodplug/Makefile gst/mpegvideoparse/Makefile gst/multifile/Makefile gst/mve/Makefile gst/nsf/Makefile gst/nuvdemux/Makefile gst/replaygain/Makefile gst/rtpmanager/Makefile gst/spectrum/Makefile gst/speed/Makefile gst/switch/Makefile gst/tta/Makefile gst/videoparse/Makefile gst/videosignal/Makefile gst/vmnc/Makefile gst/xingheader/Makefile gst/real/Makefile gst/y4m/Makefile gst-libs/Makefile gst-libs/gst/Makefile gst-libs/gst/app/Makefile sys/Makefile sys/glsink/Makefile sys/dvb/Makefile sys/vcd/Makefile examples/Makefile examples/app/Makefile examples/directfb/Makefile examples/switch/Makefile ext/amrwb/Makefile ext/alsaspdif/Makefile ext/bz2/Makefile ex
 t/cdaudio/Makefile ext/directfb/Makefile ext/divx/Makefile ext/dts/Makefile ext/faac/Makefile ext/faad/Makefile ext/gsm/Makefile ext/ivorbis/Makefile ext/jack/Makefile ext/ladspa/Makefile ext/libmms/Makefile ext/Makefile ext/nas/Makefile ext/mpeg2enc/Makefile ext/musepack/Makefile ext/musicbrainz/Makefile ext/mythtv/Makefile ext/neon/Makefile ext/sdl/Makefile ext/sndfile/Makefile ext/soundtouch/Makefile ext/spc/Makefile ext/swfdec/Makefile ext/theora/Makefile ext/timidity/Makefile ext/x264/Makefile ext/xvid/Makefile po/Makefile.in docs/Makefile docs/plugins/Makefile docs/version.entities common/Makefile common/m4/Makefile m4/Makefile tests/Makefile tests/check/Makefile tests/icles/Makefile"
+ac_config_files="$ac_config_files Makefile gst-plugins-bad.spec gst/Makefile gst/app/Makefile gst/bayer/Makefile gst/cdxaparse/Makefile gst/deinterlace/Makefile gst/equalizer/Makefile gst/filter/Makefile gst/flv/Makefile gst/freeze/Makefile gst/h264parse/Makefile gst/interleave/Makefile gst/librfb/Makefile gst/modplug/Makefile gst/modplug/libmodplug/Makefile gst/mpegvideoparse/Makefile gst/multifile/Makefile gst/mve/Makefile gst/nsf/Makefile gst/nuvdemux/Makefile gst/replaygain/Makefile gst/rtpmanager/Makefile gst/spectrum/Makefile gst/speed/Makefile gst/switch/Makefile gst/tta/Makefile gst/videoparse/Makefile gst/videosignal/Makefile gst/vmnc/Makefile gst/xingheader/Makefile gst/real/Makefile gst/y4m/Makefile gst-libs/Makefile gst-libs/gst/Makefile gst-libs/gst/app/Makefile sys/Makefile sys/glsink/Makefile sys/dvb/Makefile sys/vcd/Makefile examples/Makefile examples/app/Makefile examples/directfb/Makefile examples/switch/Makefile ext/amrwb/Makefile ext/alsaspdif/Makefile ex
 t/bz2/Makefile ext/cdaudio/Makefile ext/directfb/Makefile ext/divx/Makefile ext/dts/Makefile ext/faac/Makefile ext/faad/Makefile ext/gsm/Makefile ext/ivorbis/Makefile ext/jack/Makefile ext/ladspa/Makefile ext/libmms/Makefile ext/Makefile ext/nas/Makefile ext/mpeg2enc/Makefile ext/musepack/Makefile ext/musicbrainz/Makefile ext/mythtv/Makefile ext/neon/Makefile ext/sdl/Makefile ext/sndfile/Makefile ext/soundtouch/Makefile ext/spc/Makefile ext/swfdec/Makefile ext/theora/Makefile ext/timidity/Makefile ext/x264/Makefile ext/xvid/Makefile po/Makefile.in docs/Makefile docs/plugins/Makefile docs/version.entities common/Makefile common/m4/Makefile m4/Makefile tests/Makefile tests/check/Makefile tests/icles/Makefile"
 
 cat >confcache <<\_ACEOF
 # This file is a shell script that caches the results of configure
@@ -43712,6 +43712,7 @@ do
     "gst/deinterlace/Makefile") CONFIG_FILES="$CONFIG_FILES gst/deinterlace/Makefile" ;;
     "gst/equalizer/Makefile") CONFIG_FILES="$CONFIG_FILES gst/equalizer/Makefile" ;;
     "gst/filter/Makefile") CONFIG_FILES="$CONFIG_FILES gst/filter/Makefile" ;;
+    "gst/flv/Makefile") CONFIG_FILES="$CONFIG_FILES gst/flv/Makefile" ;;
     "gst/freeze/Makefile") CONFIG_FILES="$CONFIG_FILES gst/freeze/Makefile" ;;
     "gst/h264parse/Makefile") CONFIG_FILES="$CONFIG_FILES gst/h264parse/Makefile" ;;
     "gst/interleave/Makefile") CONFIG_FILES="$CONFIG_FILES gst/interleave/Makefile" ;;

gst-plugins-bad-0.10.5-mms-connections-speed.patch:

--- NEW FILE gst-plugins-bad-0.10.5-mms-connections-speed.patch ---
--- gst-plugins-bad-0.10.5/ext/libmms/gstmms.c	2006/12/15 09:34:31	1.17
+++ gst-plugins-bad-0.10.5/ext/libmms/gstmms.c	2007/08/08 15:15:56	1.18
@@ -27,10 +27,13 @@
 #include <string.h>
 #include "gstmms.h"
 
+#define DEFAULT_CONNECTION_SPEED    0
+
 enum
 {
   ARG_0,
-  ARG_LOCATION
+  ARG_LOCATION,
+  ARG_CONNECTION_SPEED
 };
 
 
@@ -113,6 +116,12 @@
           "Host URL to connect to. Accepted are mms://, mmsu://, mmst:// URL types",
           NULL, G_PARAM_READWRITE));
 
+  g_object_class_install_property (gobject_class, ARG_CONNECTION_SPEED,
+      g_param_spec_uint ("connection-speed", "Connection Speed",
+          "Network connection speed in kbps (0 = unknown)",
+          0, G_MAXINT / 1000, DEFAULT_CONNECTION_SPEED, G_PARAM_READWRITE));
+  /* Note: connection-speed is intentionaly limited to G_MAXINT as libmms use int for it */
+
   gstbasesrc_class->start = GST_DEBUG_FUNCPTR (gst_mms_start);
   gstbasesrc_class->stop = GST_DEBUG_FUNCPTR (gst_mms_stop);
 
@@ -136,6 +145,7 @@
   mmssrc->uri_name = NULL;
   mmssrc->connection = NULL;
   mmssrc->connection_h = NULL;
+  mmssrc->connection_speed = DEFAULT_CONNECTION_SPEED;
   GST_BASE_SRC (mmssrc)->blocksize = 2048;
 }
 
@@ -279,20 +289,30 @@
 gst_mms_start (GstBaseSrc * bsrc)
 {
   GstMMS *mms;
+  guint bandwidth_avail;
 
   mms = GST_MMS (bsrc);
 
   if (!mms->uri_name || *mms->uri_name == '\0')
     goto no_uri;
 
+  if (mms->connection_speed)
+    bandwidth_avail = mms->connection_speed;
+  else
+    bandwidth_avail = G_MAXINT;
+
   /* FIXME: pass some sane arguments here */
-  GST_DEBUG_OBJECT (mms, "Trying mms_connect (%s)", mms->uri_name);
-  mms->connection = mms_connect (NULL, NULL, mms->uri_name, 128 * 1024);
+  GST_DEBUG_OBJECT (mms,
+      "Trying mms_connect (%s) with bandwidth constraint of %d bps",
+      mms->uri_name, bandwidth_avail);
+  mms->connection = mms_connect (NULL, NULL, mms->uri_name, bandwidth_avail);
   if (mms->connection)
     goto success;
 
-  GST_DEBUG_OBJECT (mms, "Trying mmsh_connect (%s)", mms->uri_name);
-  mms->connection_h = mmsh_connect (NULL, NULL, mms->uri_name, 128 * 1024);
+  GST_DEBUG_OBJECT (mms,
+      "Trying mmsh_connect (%s) with bandwidth constraint of %d bps",
+      mms->uri_name, bandwidth_avail);
+  mms->connection_h = mmsh_connect (NULL, NULL, mms->uri_name, bandwidth_avail);
   if (!mms->connection_h)
     goto no_connect;
 
@@ -353,6 +373,9 @@
       }
       mmssrc->uri_name = g_value_dup_string (value);
       break;
+    case ARG_CONNECTION_SPEED:
+      mmssrc->connection_speed = g_value_get_uint (value) * 1000;
+      break;
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
       break;
@@ -374,6 +397,9 @@
       if (mmssrc->uri_name)
         g_value_set_string (value, mmssrc->uri_name);
       break;
+    case ARG_CONNECTION_SPEED:
+      g_value_set_uint (value, mmssrc->connection_speed / 1000);
+      break;
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
       break;
--- gst-plugins-bad-0.10.5/ext/libmms/gstmms.h	2007/05/31 19:12:36	1.5
+++ gst-plugins-bad-0.10.5/ext/libmms/gstmms.h	2007/08/08 15:15:56	1.6
@@ -32,6 +32,8 @@
   GstPushSrc parent;
 
   gchar  *uri_name;
+  guint  connection_speed;
+  
   mms_t  *connection;
   mmsh_t *connection_h;
 };

gst-plugins-bad-0.10.5-mms-seek.patch:

--- NEW FILE gst-plugins-bad-0.10.5-mms-seek.patch ---
diff -ur gst-plugins-bad-0.10.5/ext/libmms/gstmms.c gst-plugins-bad-0.10.5.new/ext/libmms/gstmms.c
--- gst-plugins-bad-0.10.5/ext/libmms/gstmms.c	2007-12-09 09:45:53.000000000 +0100
+++ gst-plugins-bad-0.10.5.new/ext/libmms/gstmms.c	2007-12-09 09:50:14.000000000 +0100
@@ -65,7 +65,13 @@
 
 static gboolean gst_mms_start (GstBaseSrc * bsrc);
 static gboolean gst_mms_stop (GstBaseSrc * bsrc);
-static GstFlowReturn gst_mms_create (GstPushSrc * psrc, GstBuffer ** buf);
+static gboolean gst_mms_unlock (GstBaseSrc * bsrc);
+static gboolean gst_mms_unlock_stop (GstBaseSrc * bsrc);
+static gboolean gst_mms_is_seekable (GstBaseSrc *src);
+static gboolean gst_mms_get_size (GstBaseSrc *src, guint64 *size);
+
+static GstFlowReturn gst_mms_create (GstBaseSrc * psrc, guint64 offset,
+  guint size, GstBuffer ** buf);
 
 static void
 gst_mms_urihandler_init (GType mms_type)
@@ -80,7 +86,7 @@
       &urihandler_info);
 }
 
-GST_BOILERPLATE_FULL (GstMMS, gst_mms, GstPushSrc, GST_TYPE_PUSH_SRC,
+GST_BOILERPLATE_FULL (GstMMS, gst_mms, GstBaseSrc, GST_TYPE_BASE_SRC,
     gst_mms_urihandler_init);
 
 static void
@@ -101,11 +107,9 @@
 {
   GObjectClass *gobject_class;
   GstBaseSrcClass *gstbasesrc_class;
-  GstPushSrcClass *gstpushsrc_class;
 
   gobject_class = (GObjectClass *) klass;
   gstbasesrc_class = (GstBaseSrcClass *) klass;
-  gstpushsrc_class = (GstPushSrcClass *) klass;
 
   gobject_class->set_property = gst_mms_set_property;
   gobject_class->get_property = gst_mms_get_property;
@@ -124,9 +128,11 @@
 
   gstbasesrc_class->start = GST_DEBUG_FUNCPTR (gst_mms_start);
   gstbasesrc_class->stop = GST_DEBUG_FUNCPTR (gst_mms_stop);
-
-  gstpushsrc_class->create = GST_DEBUG_FUNCPTR (gst_mms_create);
-
+  gstbasesrc_class->unlock = GST_DEBUG_FUNCPTR (gst_mms_unlock);
+  gstbasesrc_class->unlock_stop = GST_DEBUG_FUNCPTR (gst_mms_unlock_stop);
+  gstbasesrc_class->is_seekable = GST_DEBUG_FUNCPTR (gst_mms_is_seekable);
+  gstbasesrc_class->get_size = GST_DEBUG_FUNCPTR (gst_mms_get_size);
+  gstbasesrc_class->create = GST_DEBUG_FUNCPTR (gst_mms_create);
 }
 
 /* initialize the new element
@@ -143,9 +149,12 @@
       GST_DEBUG_FUNCPTR (gst_mms_get_query_types));
 
   mmssrc->uri_name = NULL;
+  mmssrc->current_connection_uri_name = NULL;
   mmssrc->connection = NULL;
-  mmssrc->connection_h = NULL;
   mmssrc->connection_speed = DEFAULT_CONNECTION_SPEED;
+  g_static_mutex_init (&mmssrc->stop_lock);
+  mmssrc->stop_count = 0;
+
   GST_BASE_SRC (mmssrc)->blocksize = 2048;
 }
 
@@ -153,6 +162,18 @@
 gst_mms_finalize (GObject * gobject)
 {
   GstMMS *mmssrc = GST_MMS (gobject);
+  
+  /* We may still have a connection open, as we preserve unused / pristine
+     open connections in stop to reuse them in start. */
+  if (mmssrc->connection) {
+    mmsx_close (mmssrc->connection);
+    mmssrc->connection = NULL;
+  }
+
+  if (mmssrc->current_connection_uri_name) {
+    g_free (mmssrc->current_connection_uri_name);
+    mmssrc->current_connection_uri_name = NULL;
+  }
 
   if (mmssrc->uri_name) {
     g_free (mmssrc->uri_name);
@@ -174,6 +195,7 @@
   static const GstQueryType types[] = {
     GST_QUERY_POSITION,
     GST_QUERY_DURATION,
+    GST_QUERY_CONVERT,
     0
   };
 
@@ -196,26 +218,54 @@
         res = FALSE;
         break;
       }
-      if (mmssrc->connection) {
-        value = (gint64) mms_get_current_pos (mmssrc->connection);
-      } else {
-        value = (gint64) mmsh_get_current_pos (mmssrc->connection_h);
-      }
+      value = (gint64) mmsx_get_current_pos (mmssrc->connection);
       gst_query_set_position (query, format, value);
       break;
     case GST_QUERY_DURATION:
+      if (!mmsx_get_seekable(mmssrc->connection)) {
+        res = FALSE;
+        break;
+      }
       gst_query_parse_duration (query, &format, &value);
-      if (format != GST_FORMAT_BYTES) {
+      switch (format) {
+        case GST_FORMAT_BYTES:
+          value = (gint64) mmsx_get_length (mmssrc->connection);
+          gst_query_set_duration (query, format, value);
+          break;
+        case GST_FORMAT_TIME:
+          value = mmsx_get_time_length (mmssrc->connection) * GST_SECOND;
+          gst_query_set_duration (query, format, value);
+          break;
+        default:
+          res = FALSE;
+      }
+      break;
+    case GST_QUERY_CONVERT:
+    {
+      GstFormat src_fmt, dest_fmt;
+      gint64 src_val, dest_val;
+
+      gst_query_parse_convert (query, &src_fmt, &src_val, &dest_fmt, &dest_val);
+      if (src_fmt != GST_FORMAT_TIME || dest_fmt != GST_FORMAT_BYTES) {
         res = FALSE;
         break;
       }
-      if (mmssrc->connection) {
-        value = (gint64) mms_get_length (mmssrc->connection);
-      } else {
-        value = (gint64) mmsh_get_length (mmssrc->connection_h);
+      /* In order to get the offset into the stream to seek to in bytes, we
+         need to do a time_seek, this may seem expensive, but normally this is
+         not an issue, as normally we are queried for a conversion to determine
+         the offset for the next pull when seeking. So the seek needs to be
+         done, one way or the other anyway, and thus this is fine. */
+      if (!mmsx_time_seek(NULL, mmssrc->connection,
+            (double)src_val/GST_SECOND)) {
+        res = FALSE;
+        break;
       }
-      gst_query_set_duration (query, format, value);
+      dest_val = mmsx_get_current_pos (mmssrc->connection);
+      gst_query_set_convert (query, src_fmt, src_val, dest_fmt, dest_val);
+      GST_LOG_OBJECT (pad, "sought to %f sec due to convert query, offset after seek: %lld\n",
+        (double)src_val/GST_SECOND, dest_val);
       break;
+    }
     default:
       res = FALSE;
       break;
@@ -226,47 +276,151 @@
 
 }
 
+
+static gboolean
+gst_mms_unlock (GstBaseSrc * src)
+{
+  GstMMS *mmssrc = GST_MMS (src);
+
+  GST_LOG_OBJECT (mmssrc, "sending unlock command");
+
+  g_static_mutex_lock(&mmssrc->stop_lock);
+  mmssrc->stop_count++;
+  g_static_mutex_unlock(&mmssrc->stop_lock);
+
+  return TRUE;
+}
+ 
+static gboolean
+gst_mms_unlock_stop (GstBaseSrc * src)
+{
+  GstMMS *mmssrc = GST_MMS (src);
+
+  GST_LOG_OBJECT (mmssrc, "clearing unlock queue");
+
+  g_static_mutex_lock(&mmssrc->stop_lock);
+  mmssrc->stop_count = 0;
+  g_static_mutex_unlock(&mmssrc->stop_lock);
+     
+  return TRUE;
+}
+
+
 /* get function
  * this function generates new data when needed
  */
 
 
 static GstFlowReturn
-gst_mms_create (GstPushSrc * psrc, GstBuffer ** buf)
+gst_mms_create (GstBaseSrc * psrc, guint64 offset, guint size,
+  GstBuffer ** buf)
 {
   GstMMS *mmssrc;
   guint8 *data;
   guint blocksize;
   gint result;
+  gboolean stopped = FALSE;
+  mms_off_t offset_before_seek;
+
+  *buf = NULL;
 
   mmssrc = GST_MMS (psrc);
 
-  GST_OBJECT_LOCK (mmssrc);
-  blocksize = GST_BASE_SRC (mmssrc)->blocksize;
-  GST_OBJECT_UNLOCK (mmssrc);
+  offset_before_seek = mmsx_get_current_pos(mmssrc->connection);
+  
+  /* Check if a query call perhaps has wrecked our connection */
+  if (offset_before_seek == -1) 
+  {
+    GST_DEBUG_OBJECT (mmssrc, "connection broken (probably an error during mmsx_seek_time during a convert query) returning FLOW_ERROR");
+    return GST_FLOW_ERROR;
+  }
+  
+  if (mmsx_get_seekable(mmssrc->connection)) {
+    uint32_t asf_header_len = mmsx_get_asf_header_len(mmssrc->connection);
+    uint64_t asf_packet_len = mmsx_get_asf_packet_len(mmssrc->connection);
+
+    /* Do not allow completely random access, only allow random access by
+       elements which know what they are doing (IOW disallow random access to
+       typefinders). This is done because mms is an internet protocol and
+       seeking is thus very expensive. As an exception random access to the
+       libmms cached asf header is allowed, this is as good as free because
+       its cached, and this is necessary for basic typefinding and asfdemuxer
+       peeking to work. */
+    if ( (offset + size) > asf_header_len &&
+         ( offset < asf_header_len ||
+           ((offset - asf_header_len) % asf_packet_len) ||
+           size != asf_packet_len ) )
+    {
+      GST_DEBUG_OBJECT (mmssrc, "Disallowing non asf-packet aligned get_range (returning unexpected)");
+      return GST_FLOW_UNEXPECTED;
+    }
+
+    if (offset_before_seek != offset) {
+      mms_off_t offset_after_seek;
+      uint64_t asf_total_len  = mmsx_get_length(mmssrc->connection);
+      
+      /* Do not allow seek-reading to the last packet, as this will cause
+         the connection to close */
+      if ((offset + size) > (asf_total_len - asf_packet_len))
+      {
+        GST_DEBUG_OBJECT (mmssrc, "Disallowing seek-reading to the last packet (returning unexpected)");
+        return GST_FLOW_UNEXPECTED;
+      }
+
+      offset_after_seek = mmsx_seek(NULL, mmssrc->connection, offset, SEEK_SET);
+      GST_DEBUG_OBJECT (mmssrc, "sought to: %llu bytes, result: %llu",
+        offset, (guint64)offset_after_seek);
+      
+      /* mmsx_seek will close and reopen the connection when seeking with the
+         mmsh protocol, if the reopening fails this is indicated with -1 */
+      if (offset_after_seek == -1) {
+        GST_DEBUG_OBJECT (mmssrc, "connection broken during seek returning FLOW_ERROR");
+        return GST_FLOW_ERROR;
+      }
+      
+      offset = offset_after_seek;
+    }
+
+    /* Once the asf header has been read set blocksize to the asf packet len
+       for correct push mode operation. */
+    if ( (offset + size) == asf_header_len ) {
+      GST_OBJECT_LOCK (mmssrc);
+      GST_BASE_SRC (mmssrc)->blocksize = asf_packet_len;
+      GST_OBJECT_UNLOCK (mmssrc);
+    }
+
+    blocksize = size;
+  } else { 
+    offset = offset_before_seek;
+
+    GST_OBJECT_LOCK (mmssrc);
+    blocksize = GST_BASE_SRC (mmssrc)->blocksize;
+    GST_OBJECT_UNLOCK (mmssrc);
+  }
 
   *buf = gst_buffer_new_and_alloc (blocksize);
 
   data = GST_BUFFER_DATA (*buf);
   GST_BUFFER_SIZE (*buf) = 0;
   GST_LOG_OBJECT (mmssrc, "reading %d bytes", blocksize);
-  if (mmssrc->connection) {
-    result = mms_read (NULL, mmssrc->connection, (char *) data, blocksize);
-  } else {
-    result = mmsh_read (NULL, mmssrc->connection_h, (char *) data, blocksize);
+  result = mmsx_read (NULL, mmssrc->connection, (char *) data, blocksize);
+
+  /* Stopped / unblocked? */
+  g_static_mutex_lock(&mmssrc->stop_lock);
+  if (mmssrc->stop_count) {
+    stopped = TRUE;
+    mmssrc->stop_count--;
   }
+  g_static_mutex_unlock(&mmssrc->stop_lock);
+
+  if (stopped)
+    goto stopped;
 
   /* EOS? */
   if (result == 0)
     goto eos;
 
-  if (mmssrc->connection) {
-    GST_BUFFER_OFFSET (*buf) =
-        mms_get_current_pos (mmssrc->connection) - result;
-  } else {
-    GST_BUFFER_OFFSET (*buf) =
-        mmsh_get_current_pos (mmssrc->connection_h) - result;
-  }
+  GST_BUFFER_OFFSET (*buf) = offset;
   GST_BUFFER_SIZE (*buf) = result;
 
   GST_LOG_OBJECT (mmssrc, "Returning buffer with offset %" G_GINT64_FORMAT
@@ -283,6 +437,33 @@
     *buf = NULL;
     return GST_FLOW_UNEXPECTED;
   }
+stopped:
+  {
+    GST_DEBUG_OBJECT (mmssrc, "Stopped");
+    gst_buffer_unref (*buf);
+    *buf = NULL;
+    return GST_FLOW_WRONG_STATE;
+  }
+}
+
+static gboolean gst_mms_is_seekable (GstBaseSrc *src)
+{
+  GstMMS *mmssrc = GST_MMS (src);
+
+  return mmsx_get_seekable(mmssrc->connection);
+}
+
+static gboolean gst_mms_get_size (GstBaseSrc *src, guint64 *size)
+{
+  GstMMS *mmssrc = GST_MMS (src);
+
+  /* non seekable usually means live streams, and get_length() returns,
+     erm, interesting values for live streams */
+  if (!mmsx_get_seekable(mmssrc->connection))
+    return FALSE;
+
+  *size = mmsx_get_length (mmssrc->connection);
+  return TRUE;
 }
 
 static gboolean
@@ -301,40 +482,52 @@
   else
     bandwidth_avail = G_MAXINT;
 
+  /* If we already have a connection, and the uri isn't changed, reuse it,
+     as connecting is expensive. */
+  if (mms->connection) {
+    if (!strcmp(mms->uri_name, mms->current_connection_uri_name)) {
+      GST_DEBUG_OBJECT(mms, "Reusing existing connection for %s",
+        mms->uri_name);
+      goto success;
+    } else {
+      mmsx_close (mms->connection);
+      g_free (mms->current_connection_uri_name);
+      mms->current_connection_uri_name = NULL;
+    }
+  }
+
   /* FIXME: pass some sane arguments here */
   GST_DEBUG_OBJECT (mms,
       "Trying mms_connect (%s) with bandwidth constraint of %d bps",
       mms->uri_name, bandwidth_avail);
-  mms->connection = mms_connect (NULL, NULL, mms->uri_name, bandwidth_avail);
+  mms->connection = mmsx_connect (NULL, NULL, mms->uri_name, bandwidth_avail);
   if (mms->connection)
-    goto success;
-
-  GST_DEBUG_OBJECT (mms,
-      "Trying mmsh_connect (%s) with bandwidth constraint of %d bps",
-      mms->uri_name, bandwidth_avail);
-  mms->connection_h = mmsh_connect (NULL, NULL, mms->uri_name, bandwidth_avail);
-  if (!mms->connection_h)
-    goto no_connect;
+  {
+    /* Save the uri name so that it can be checked for connection reusing,
+       see above. */
+    mms->current_connection_uri_name = g_strdup(mms->uri_name);
 
-  /* fall through */
+    GST_DEBUG_OBJECT (mms, "Connect successful");
 
 success:
-  {
-    GST_DEBUG_OBJECT (mms, "Connect successful");
+    /* When seekable blocksize MUST be set to the asf header len for correct
+       push mode operation. */
+    if (mmsx_get_seekable(mms->connection))
+      GST_BASE_SRC (mms)->blocksize = mmsx_get_asf_header_len(mms->connection);
+
     return TRUE;
   }
-
-no_uri:
+  else
   {
     GST_ELEMENT_ERROR (mms, RESOURCE, OPEN_READ,
-        ("No URI to open specified"), (NULL));
+        ("Could not connect to this stream"), (NULL));
     return FALSE;
   }
 
-no_connect:
+no_uri:
   {
     GST_ELEMENT_ERROR (mms, RESOURCE, OPEN_READ,
-        ("Could not connect to this stream"), (NULL));
+        ("No URI to open specified"), (NULL));
     return FALSE;
   }
 }
@@ -346,12 +539,17 @@
 
   mms = GST_MMS (bsrc);
   if (mms->connection != NULL) {
-    mms_close (mms->connection);
-    mms->connection = NULL;
-  }
-  if (mms->connection_h != NULL) {
-    mmsh_close (mms->connection_h);
-    mms->connection_h = NULL;
+    /* Check if the connection is still pristine, that is if no more then
+       just the mmslib cached asf header has been read. If it is still pristine
+       preserve it as we often are re-started with the same URL and connecting
+       is expensive */
+    if (mmsx_get_current_pos(mms->connection) >
+        mmsx_get_asf_header_len(mms->connection)) {
+      mmsx_close (mms->connection);
+      mms->connection = NULL;
+      g_free (mms->current_connection_uri_name);
+      mms->current_connection_uri_name = NULL;
+    }
   }
   return TRUE;
 }
diff -ur gst-plugins-bad-0.10.5/ext/libmms/gstmms.h gst-plugins-bad-0.10.5.new/ext/libmms/gstmms.h
--- gst-plugins-bad-0.10.5/ext/libmms/gstmms.h	2007-12-09 09:45:53.000000000 +0100
+++ gst-plugins-bad-0.10.5.new/ext/libmms/gstmms.h	2007-12-08 17:22:04.000000000 +0100
@@ -6,9 +6,8 @@
 #define __GST_MMS_H__
 
 #include <gst/gst.h>
-#include <libmms/mms.h>
-#include <libmms/mmsh.h>
-#include <gst/base/gstpushsrc.h>
+#include <libmms/mmsx.h>
+#include <gst/base/gstbasesrc.h>
 
 G_BEGIN_DECLS
 
@@ -29,18 +28,21 @@
 
 struct _GstMMS
 {
-  GstPushSrc parent;
+  GstBaseSrc parent;
 
   gchar  *uri_name;
+  gchar  *current_connection_uri_name;
   guint  connection_speed;
   
-  mms_t  *connection;
-  mmsh_t *connection_h;
+  mmsx_t *connection;
+
+  GStaticMutex stop_lock;
+  gint stop_count;
 };
 
 struct _GstMMSClass 
 {
-  GstPushSrcClass parent_class;
+  GstBaseSrcClass parent_class;
 };
 
 GType gst_mms_get_type (void);

gstreamer-plugins-bad-0.10.5-mjpegtools.patch:

--- NEW FILE gstreamer-plugins-bad-0.10.5-mjpegtools.patch ---
diff -ur gst-plugins-bad-0.10.5/ext/mpeg2enc/gstmpeg2encoder.cc gst-plugins-bad-0.10.5.new/ext/mpeg2enc/gstmpeg2encoder.cc
--- gst-plugins-bad-0.10.5/ext/mpeg2enc/gstmpeg2encoder.cc	2006-07-13 13:06:45.000000000 +0200
+++ gst-plugins-bad-0.10.5.new/ext/mpeg2enc/gstmpeg2encoder.cc	2007-06-29 15:19:18.000000000 +0200
@@ -26,7 +26,7 @@
 
 #include <mpegconsts.h>
 #include <quantize.hh>
-#include <ratectl.hh>
+#include <ontheflyratectl.hh>
 #include <seqencoder.hh>
 #include <mpeg2coder.hh>
 
@@ -65,10 +65,6 @@
   /* I/O */
   reader = new GstMpeg2EncPictureReader (element, caps, &parms);
   reader->StreamPictureParams (strm);
-#ifdef GST_MJPEGTOOLS_18x
-  /* chain thread caters for reading, do not need another thread for this */
-  options.allow_parallel_read = FALSE;
-#endif
   if (options.SetFormatPresets (strm)) {
     return FALSE;
   }
@@ -76,11 +72,12 @@
 
   /* encoding internals */
   quantizer = new Quantizer (parms);
-  bitrate_controller = new OnTheFlyRateCtl (parms);
+  pass1ratectl = new OnTheFlyPass1 (parms);
+  pass2ratectl = new OnTheFlyPass2 (parms);
 #ifdef GST_MJPEGTOOLS_18x
   /* sequencer */
   seqencoder = new SeqEncoder (parms, *reader, *quantizer,
-      *writer, *bitrate_controller);
+      *writer, *pass1ratectl, *pass2ratectl);
 #else
   coder = new MPEG2Coder (parms, *writer);
   /* sequencer */
Only in gst-plugins-bad-0.10.5.new/ext/mpeg2enc: gstmpeg2encoder.cc~
diff -ur gst-plugins-bad-0.10.5/ext/mpeg2enc/gstmpeg2encpicturereader.cc gst-plugins-bad-0.10.5.new/ext/mpeg2enc/gstmpeg2encpicturereader.cc
--- gst-plugins-bad-0.10.5/ext/mpeg2enc/gstmpeg2encpicturereader.cc	2006-07-13 13:06:45.000000000 +0200
+++ gst-plugins-bad-0.10.5.new/ext/mpeg2enc/gstmpeg2encpicturereader.cc	2007-06-29 15:20:44.000000000 +0200
@@ -24,7 +24,7 @@
 #endif
 
 #include <encoderparams.hh>
-
+#include <imageplanes.hh>
 #include "gstmpeg2enc.hh"
 #include "gstmpeg2encpicturereader.hh"
 
@@ -79,9 +79,9 @@
  */
 
 bool
-GstMpeg2EncPictureReader::LoadFrame ()
+GstMpeg2EncPictureReader::LoadFrame (ImagePlanes &image)
 {
-  gint i, x, y, n;
+  gint i, x, y;
   guint8 *frame;
   GstMpeg2enc *enc;
 
@@ -100,23 +100,21 @@
   }
 
   frame = GST_BUFFER_DATA (enc->buffer);
-  n = frames_read % input_imgs_buf_size;
   x = encparams.horizontal_size;
   y = encparams.vertical_size;
 
   for (i = 0; i < y; i++) {
-    memcpy (input_imgs_buf[n][0] + i * encparams.phy_width, frame, x);
+    memcpy (image.Plane(0) + i * encparams.phy_width, frame, x);
     frame += x;
   }
-  lum_mean[n] = LumMean (input_imgs_buf[n][0]);
   x >>= 1;
   y >>= 1;
   for (i = 0; i < y; i++) {
-    memcpy (input_imgs_buf[n][1] + i * encparams.phy_chrom_width, frame, x);
+    memcpy (image.Plane(1) + i * encparams.phy_chrom_width, frame, x);
     frame += x;
   }
   for (i = 0; i < y; i++) {
-    memcpy (input_imgs_buf[n][2] + i * encparams.phy_chrom_width, frame, x);
+    memcpy (image.Plane(2) + i * encparams.phy_chrom_width, frame, x);
     frame += x;
   }
   gst_buffer_unref (enc->buffer);
diff -ur gst-plugins-bad-0.10.5/ext/mpeg2enc/gstmpeg2encpicturereader.hh gst-plugins-bad-0.10.5.new/ext/mpeg2enc/gstmpeg2encpicturereader.hh
--- gst-plugins-bad-0.10.5/ext/mpeg2enc/gstmpeg2encpicturereader.hh	2006-07-13 13:06:45.000000000 +0200
+++ gst-plugins-bad-0.10.5.new/ext/mpeg2enc/gstmpeg2encpicturereader.hh	2007-06-29 15:07:19.000000000 +0200
@@ -37,7 +37,7 @@
 
 protected:
   /* read a frame */
-  bool LoadFrame ();
+  bool LoadFrame (ImagePlanes &image);
 
 private:
   GstElement *element;

gstreamer-plugins-bad-0.10.5-mod-mimetypes.patch:

--- NEW FILE gstreamer-plugins-bad-0.10.5-mod-mimetypes.patch ---
diff -up gst-plugins-bad-0.10.5/gst/modplug/gstmodplug.cc~ gst-plugins-bad-0.10.5/gst/modplug/gstmodplug.cc
--- gst-plugins-bad-0.10.5/gst/modplug/gstmodplug.cc~	2007-07-14 18:23:21.000000000 +0200
+++ gst-plugins-bad-0.10.5/gst/modplug/gstmodplug.cc	2007-07-14 18:23:21.000000000 +0200
@@ -119,7 +119,8 @@ static GstStaticPadTemplate modplug_sink
 GST_STATIC_PAD_TEMPLATE ("sink",
     GST_PAD_SINK,
     GST_PAD_ALWAYS,
-    GST_STATIC_CAPS ("audio/x-mod"));
+    GST_STATIC_CAPS ("audio/x-mod; audio/x-xm; audio/x-it; audio/x-s3m; "
+    "audio/x-stm"));
 
 static void gst_modplug_dispose (GObject * object);
 static void gst_modplug_set_property (GObject * object,

gstreamer-plugins-bad-0.10.5-real-search.patch:

--- NEW FILE gstreamer-plugins-bad-0.10.5-real-search.patch ---
diff -urN gst-plugins-bad-0.10.5.orig/gst/real/gstreal.h gst-plugins-bad-0.10.5/gst/real/gstreal.h
--- gst-plugins-bad-0.10.5.orig/gst/real/gstreal.h	1970-01-01 01:00:00.000000000 +0100
+++ gst-plugins-bad-0.10.5/gst/real/gstreal.h	2007-06-30 17:27:08.000000000 +0200
@@ -0,0 +1,35 @@
+/* GStreamer
+ *
+ * Copyright (C) 2007 Hans de Goede <j.w.r.degoede at hhs.nl>
+ *
+ * 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., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __GST_REAL_H__
+#define __GST_REAL_H__
+
+#ifdef HAVE_CPU_I386
+#define DEFAULT_REAL_CODECS_PATH \
+  "/usr/lib/win32:/usr/lib/codecs:/usr/local/RealPlayer/codecs:" \
+  "/usr/local/lib/win32:/usr/local/lib/codecs"
+#endif
+#ifdef HAVE_CPU_X86_64
+#define DEFAULT_REAL_CODECS_PATH \
+  "/usr/lib64/win32:/usr/lib64/codecs:" \
+  "/usr/local/lib64/win32:/usr/local/lib64/codecs"
+#endif
+
+#endif /* __GST_REAL_H__ */
diff -urN gst-plugins-bad-0.10.5.orig/gst/real/gstrealaudiodec.c gst-plugins-bad-0.10.5/gst/real/gstrealaudiodec.c
--- gst-plugins-bad-0.10.5.orig/gst/real/gstrealaudiodec.c	2007-05-16 19:14:43.000000000 +0200
+++ gst-plugins-bad-0.10.5/gst/real/gstrealaudiodec.c	2007-06-30 17:27:04.000000000 +0200
@@ -23,6 +23,7 @@
 #include "config.h"
 #endif
 
+#include "gstreal.h"
 #include "gstrealaudiodec.h"
 
 #include <string.h>
@@ -45,28 +46,22 @@
         "depth = (int) [ 1, MAX ], "
         "rate = (int) [ 1, MAX ], " "channels = (int) [ 1, MAX ]"));
 
-#ifdef HAVE_CPU_I386
-#define DEFAULT_PATH "/usr/lib/win32/"
-#endif
-#ifdef HAVE_CPU_X86_64
-#define DEFAULT_PATH "/usr/lib/"
-#endif
-
-#define DEFAULT_PATH_RACOOK DEFAULT_PATH "cook.so.6.0"
-#define DEFAULT_PATH_RAATRK DEFAULT_PATH "atrk.so.6.0"
-#define DEFAULT_PATH_RA14_4 DEFAULT_PATH "14_4.so.6.0"
-#define DEFAULT_PATH_RA28_8 DEFAULT_PATH "28_8.so.6.0"
-#define DEFAULT_PATH_RASIPR DEFAULT_PATH "sipr.so.6.0"
+#define DEFAULT_RACOOK_NAMES "cook.so:cook.so.6.0"
+#define DEFAULT_RAATRK_NAMES "atrc.so:atrc.so.6.0"
+#define DEFAULT_RA14_4_NAMES "14_4.so.6.0"
+#define DEFAULT_RA28_8_NAMES "28_8.so.6.0"
+#define DEFAULT_RASIPR_NAMES "sipr.so:sipr.so.6.0"
 #define DEFAULT_PWD "Ardubancel Quazanga"
 
 enum
 {
   PROP_0,
-  PROP_PATH_RACOOK,
-  PROP_PATH_RAATRK,
-  PROP_PATH_RA14_4,
-  PROP_PATH_RA28_8,
-  PROP_PATH_RASIPR,
+  PROP_REAL_CODECS_PATH,
+  PROP_RACOOK_NAMES,
+  PROP_RAATRK_NAMES,
+  PROP_RA14_4_NAMES,
+  PROP_RA28_8_NAMES,
+  PROP_RASIPR_NAMES,
   PROP_PASSWORD
 };
 
@@ -121,7 +116,8 @@
   gpointer context;
 
   /* Properties */
-  gchar *path_racook, *path_raatrk, *path_ra14_4, *path_ra28_8, *path_rasipr;
+  gchar *real_codecs_path, *racook_names, *raatrk_names, *ra14_4_names,
+    *ra28_8_names, *rasipr_names;
   gchar *pwd;
 };
 
@@ -196,7 +192,8 @@
   gpointer ra_close_codec, ra_decode, ra_free_decoder;
   gpointer ra_open_codec2, ra_init_decoder, ra_set_flavor;
   gpointer set_dll_access_path = NULL, ra_set_pwd = NULL;
-  gchar *path;
+  gchar *path, *names;
+  gchar **split_names, **split_path;
   gint version, flavor, channels, rate, leaf_size, packet_size, width, height;
   guint16 res;
   RAInit data;
@@ -204,9 +201,10 @@
   const GValue *v;
   GstBuffer *buf = NULL;
   const gchar *name = gst_structure_get_name (s);
-  GModule *module;
+  GModule *module = NULL;
   gpointer context = NULL;
   RealFunctions funcs = { NULL, };
+  int i,j;
 
   if (!strcmp (name, "audio/x-sipro"))
     version = GST_REAL_AUDIO_DEC_VERSION_SIPR;
@@ -226,28 +224,46 @@
 
   if ((v = gst_structure_get_value (s, "codec_data")))
     buf = g_value_peek_pointer (v);
-
+  
+  path = dec->real_codecs_path ? dec->real_codecs_path :
+          DEFAULT_REAL_CODECS_PATH;
+  
   switch (version) {
     case GST_REAL_AUDIO_DEC_VERSION_COOK:
-      path = dec->path_racook ? dec->path_racook : DEFAULT_PATH_RACOOK;
+      names = dec->racook_names ? dec->racook_names : DEFAULT_RACOOK_NAMES;
       break;
     case GST_REAL_AUDIO_DEC_VERSION_ATRK:
-      path = dec->path_raatrk ? dec->path_raatrk : DEFAULT_PATH_RAATRK;
+      names = dec->raatrk_names ? dec->raatrk_names : DEFAULT_RAATRK_NAMES;
       break;
     case GST_REAL_AUDIO_DEC_VERSION_14_4:
-      path = dec->path_ra14_4 ? dec->path_ra14_4 : DEFAULT_PATH_RA14_4;
+      names = dec->ra14_4_names ? dec->ra14_4_names : DEFAULT_RA14_4_NAMES;
       break;
     case GST_REAL_AUDIO_DEC_VERSION_28_8:
-      path = dec->path_ra28_8 ? dec->path_ra28_8 : DEFAULT_PATH_RA28_8;
+      names = dec->ra28_8_names ? dec->ra28_8_names : DEFAULT_RA28_8_NAMES;
       break;
     case GST_REAL_AUDIO_DEC_VERSION_SIPR:
-      path = dec->path_rasipr ? dec->path_rasipr : DEFAULT_PATH_RASIPR;
+      names = dec->rasipr_names ? dec->rasipr_names : DEFAULT_RASIPR_NAMES;
       break;
     default:
       goto unknown_version;
   }
-
-  module = g_module_open (path, G_MODULE_BIND_LAZY);
+  
+  split_path = g_strsplit (path, ":", 0);
+  split_names = g_strsplit (names, ":", 0);
+  
+  for (i = 0; split_path[i]; i++) {
+    for (j = 0; split_names[j]; j++) {
+      gchar *codec = g_strconcat (split_path[i], "/", split_names[j], NULL);
+      module = g_module_open (codec, G_MODULE_BIND_LAZY);
+      g_free (codec);
+      if (module)
+        goto codec_search_done;
+    }
+  }
+
+codec_search_done:
+  /* we keep the path for a while to set the dll access path */
+  g_strfreev (split_names);
 
   if (module == NULL)
     goto could_not_open;
@@ -262,10 +278,8 @@
   }
 
   g_module_symbol (module, "RASetPwd", &ra_set_pwd);
-
-  if (g_module_symbol (module, "SetDLLAccessPath", &set_dll_access_path))
-    funcs.SetDLLAccessPath (DEFAULT_PATH);
-
+  g_module_symbol (module, "SetDLLAccessPath", &set_dll_access_path);
+  
   funcs.RACloseCodec = ra_close_codec;
   funcs.RADecode = ra_decode;
   funcs.RAFreeDecoder = ra_free_decoder;
@@ -275,6 +289,12 @@
   funcs.RASetPwd = ra_set_pwd;
   funcs.SetDLLAccessPath = set_dll_access_path;
 
+  if (funcs.SetDLLAccessPath)
+    funcs.SetDLLAccessPath (split_path[i]);
+  
+  /* now we are done with the split paths, so free them */
+  g_strfreev (split_path);
+  
   if ((res = funcs.RAOpenCodec2 (&context, NULL))) {
     GST_DEBUG_OBJECT (dec, "RAOpenCodec2() failed");
     goto could_not_initialize;
@@ -336,11 +356,12 @@
   GST_DEBUG_OBJECT (dec, "Cannot handle version %i.", version);
   return FALSE;
 could_not_open:
-  GST_DEBUG_OBJECT (dec, "Could not open library '%s': %s", path,
-      g_module_error ());
+  g_strfreev (split_path);
+  GST_DEBUG_OBJECT (dec, "Could not find library '%s' in '%s'", names, path);
   return FALSE;
 could_not_load:
   g_module_close (module);
+  g_strfreev (split_path);
   GST_DEBUG_OBJECT (dec, "Could not load all symbols: %s", g_module_error ());
   return FALSE;
 could_not_initialize:
@@ -421,25 +442,29 @@
     dec->module = NULL;
   }
 
-  if (dec->path_racook) {
-    g_free (dec->path_racook);
-    dec->path_racook = NULL;
-  }
-  if (dec->path_raatrk) {
-    g_free (dec->path_raatrk);
-    dec->path_raatrk = NULL;
-  }
-  if (dec->path_ra14_4) {
-    g_free (dec->path_ra14_4);
-    dec->path_ra14_4 = NULL;
-  }
-  if (dec->path_ra28_8) {
-    g_free (dec->path_ra28_8);
-    dec->path_ra28_8 = NULL;
-  }
-  if (dec->path_rasipr) {
-    g_free (dec->path_rasipr);
-    dec->path_rasipr = NULL;
+  if (dec->real_codecs_path) {
+    g_free (dec->real_codecs_path);
+    dec->real_codecs_path = NULL;
+  }
+  if (dec->racook_names) {
+    g_free (dec->racook_names);
+    dec->racook_names = NULL;
+  }
+  if (dec->raatrk_names) {
+    g_free (dec->raatrk_names);
+    dec->raatrk_names = NULL;
+  }
+  if (dec->ra14_4_names) {
+    g_free (dec->ra14_4_names);
+    dec->ra14_4_names = NULL;
+  }
+  if (dec->ra28_8_names) {
+    g_free (dec->ra28_8_names);
+    dec->ra28_8_names = NULL;
+  }
+  if (dec->rasipr_names) {
+    g_free (dec->rasipr_names);
+    dec->rasipr_names = NULL;
   }
 
   G_OBJECT_CLASS (parent_class)->finalize (object);
@@ -452,30 +477,35 @@
   GstRealAudioDec *dec = GST_REAL_AUDIO_DEC (object);
 
   switch (prop_id) {
-    case PROP_PATH_RACOOK:
-      if (dec->path_racook)
-        g_free (dec->path_racook);
-      dec->path_racook = g_value_dup_string (value);
-      break;
-    case PROP_PATH_RAATRK:
-      if (dec->path_raatrk)
-        g_free (dec->path_raatrk);
-      dec->path_raatrk = g_value_dup_string (value);
-      break;
-    case PROP_PATH_RA14_4:
-      if (dec->path_ra14_4)
-        g_free (dec->path_ra14_4);
-      dec->path_ra14_4 = g_value_dup_string (value);
-      break;
-    case PROP_PATH_RA28_8:
-      if (dec->path_ra28_8)
-        g_free (dec->path_ra28_8);
-      dec->path_ra28_8 = g_value_dup_string (value);
-      break;
-    case PROP_PATH_RASIPR:
-      if (dec->path_rasipr)
-        g_free (dec->path_rasipr);
-      dec->path_rasipr = g_value_dup_string (value);
+    case PROP_REAL_CODECS_PATH:
+      if (dec->real_codecs_path)
+        g_free (dec->real_codecs_path);
+      dec->real_codecs_path = g_value_dup_string (value);
+      break;
+    case PROP_RACOOK_NAMES:
+      if (dec->racook_names)
+        g_free (dec->racook_names);
+      dec->racook_names = g_value_dup_string (value);
+      break;
+    case PROP_RAATRK_NAMES:
+      if (dec->raatrk_names)
+        g_free (dec->raatrk_names);
+      dec->raatrk_names = g_value_dup_string (value);
+      break;
+    case PROP_RA14_4_NAMES:
+      if (dec->ra14_4_names)
+        g_free (dec->ra14_4_names);
+      dec->ra14_4_names = g_value_dup_string (value);
+      break;
+    case PROP_RA28_8_NAMES:
+      if (dec->ra28_8_names)
+        g_free (dec->ra28_8_names);
+      dec->ra28_8_names = g_value_dup_string (value);
+      break;
+    case PROP_RASIPR_NAMES:
+      if (dec->rasipr_names)
+        g_free (dec->rasipr_names);
+      dec->rasipr_names = g_value_dup_string (value);
       break;
     case PROP_PASSWORD:
       if (dec->pwd)
@@ -495,25 +525,29 @@
   GstRealAudioDec *dec = GST_REAL_AUDIO_DEC (object);
 
   switch (prop_id) {
-    case PROP_PATH_RACOOK:
-      g_value_set_string (value, dec->path_racook ? dec->path_racook :
-          DEFAULT_PATH_RACOOK);
-      break;
-    case PROP_PATH_RAATRK:
-      g_value_set_string (value, dec->path_raatrk ? dec->path_raatrk :
-          DEFAULT_PATH_RAATRK);
-      break;
-    case PROP_PATH_RA14_4:
-      g_value_set_string (value, dec->path_ra14_4 ? dec->path_ra14_4 :
-          DEFAULT_PATH_RA14_4);
-      break;
-    case PROP_PATH_RA28_8:
-      g_value_set_string (value, dec->path_ra28_8 ? dec->path_ra28_8 :
-          DEFAULT_PATH_RA28_8);
-      break;
-    case PROP_PATH_RASIPR:
-      g_value_set_string (value, dec->path_rasipr ? dec->path_rasipr :
-          DEFAULT_PATH_RASIPR);
+    case PROP_REAL_CODECS_PATH:
+      g_value_set_string (value, dec->real_codecs_path ? dec->real_codecs_path
+          : DEFAULT_REAL_CODECS_PATH);
+      break;
+    case PROP_RACOOK_NAMES:
+      g_value_set_string (value, dec->racook_names ? dec->racook_names :
+          DEFAULT_RACOOK_NAMES);
+      break;
+    case PROP_RAATRK_NAMES:
+      g_value_set_string (value, dec->raatrk_names ? dec->raatrk_names :
+          DEFAULT_RAATRK_NAMES);
+      break;
+    case PROP_RA14_4_NAMES:
+      g_value_set_string (value, dec->ra14_4_names ? dec->ra14_4_names :
+          DEFAULT_RA14_4_NAMES);
+      break;
+    case PROP_RA28_8_NAMES:
+      g_value_set_string (value, dec->ra28_8_names ? dec->ra28_8_names :
+          DEFAULT_RA28_8_NAMES);
+      break;
+    case PROP_RASIPR_NAMES:
+      g_value_set_string (value, dec->rasipr_names ? dec->rasipr_names :
+          DEFAULT_RASIPR_NAMES);
       break;
     case PROP_PASSWORD:
       g_value_set_string (value, dec->pwd ? dec->pwd : DEFAULT_PWD);
@@ -536,21 +570,26 @@
 
   element_class->change_state = gst_real_audio_dec_change_state;
 
-  g_object_class_install_property (object_class, PROP_PATH_RACOOK,
-      g_param_spec_string ("path_racook", "Path to cook driver",
-          "Path to cook driver", DEFAULT_PATH_RACOOK, G_PARAM_READWRITE));
-  g_object_class_install_property (object_class, PROP_PATH_RAATRK,
-      g_param_spec_string ("path_raatrk", "Path to atrk driver",
-          "Path to atrk driver", DEFAULT_PATH_RAATRK, G_PARAM_READWRITE));
-  g_object_class_install_property (object_class, PROP_PATH_RA14_4,
-      g_param_spec_string ("path_ra14_4", "Path to 14_4 driver",
-          "Path to 14_4 driver", DEFAULT_PATH_RA14_4, G_PARAM_READWRITE));
-  g_object_class_install_property (object_class, PROP_PATH_RA28_8,
-      g_param_spec_string ("path_ra28_8", "Path to 28_8 driver",
-          "Path to 28_8 driver", DEFAULT_PATH_RA28_8, G_PARAM_READWRITE));
-  g_object_class_install_property (object_class, PROP_PATH_RASIPR,
-      g_param_spec_string ("path_rasipr", "Path to sipr driver",
-          "Path to sipr driver", DEFAULT_PATH_RASIPR, G_PARAM_READWRITE));
+  g_object_class_install_property (object_class, PROP_REAL_CODECS_PATH,
+      g_param_spec_string ("real_codecs_path",
+          "Path where to search for RealPlayer codecs",
+          "Path where to search for RealPlayer codecs",
+          DEFAULT_REAL_CODECS_PATH, G_PARAM_READWRITE));
+  g_object_class_install_property (object_class, PROP_RACOOK_NAMES,
+      g_param_spec_string ("racook_names", "Names of cook driver",
+          "Names of cook driver", DEFAULT_RACOOK_NAMES, G_PARAM_READWRITE));
+  g_object_class_install_property (object_class, PROP_RAATRK_NAMES,
+      g_param_spec_string ("raatrk_names", "Names of atrk driver",
+          "Names of atrk driver", DEFAULT_RAATRK_NAMES, G_PARAM_READWRITE));
+  g_object_class_install_property (object_class, PROP_RA14_4_NAMES,
+      g_param_spec_string ("ra14_4_names", "Names of 14_4 driver",
+          "Names of 14_4 driver", DEFAULT_RA14_4_NAMES, G_PARAM_READWRITE));
+  g_object_class_install_property (object_class, PROP_RA28_8_NAMES,
+      g_param_spec_string ("ra28_8_names", "Names of 28_8 driver",
+          "Names of 28_8 driver", DEFAULT_RA28_8_NAMES, G_PARAM_READWRITE));
+  g_object_class_install_property (object_class, PROP_RASIPR_NAMES,
+      g_param_spec_string ("rasipr_names", "Names of sipr driver",
+          "Names of sipr driver", DEFAULT_RASIPR_NAMES, G_PARAM_READWRITE));
   g_object_class_install_property (object_class, PROP_PASSWORD,
       g_param_spec_string ("password", "Password",
           "Password", DEFAULT_PWD, G_PARAM_READWRITE));
diff -urN gst-plugins-bad-0.10.5.orig/gst/real/gstrealvideodec.c gst-plugins-bad-0.10.5/gst/real/gstrealvideodec.c
--- gst-plugins-bad-0.10.5.orig/gst/real/gstrealvideodec.c	2007-06-06 11:11:31.000000000 +0200
+++ gst-plugins-bad-0.10.5/gst/real/gstrealvideodec.c	2007-06-30 17:27:04.000000000 +0200
@@ -23,6 +23,7 @@
 #include "config.h"
 #endif
 
+#include "gstreal.h"
 #include "gstrealvideodec.h"
 
 #include <string.h>
@@ -45,23 +46,17 @@
         "framerate = (fraction) [0/1, MAX], "
         "width = (int) [ 16, 4096 ], " "height = (int) [ 16, 4096 ] "));
 
-#ifdef HAVE_CPU_I386
-#define DEFAULT_PATH_RV20 "/usr/lib/win32/drv2.so.6.0"
-#define DEFAULT_PATH_RV30 "/usr/lib/win32/drv3.so.6.0"
-#define DEFAULT_PATH_RV40 "/usr/lib/win32/drv4.so.6.0"
-#endif
-#ifdef HAVE_CPU_X86_64
-#define DEFAULT_PATH_RV20 "/usr/lib/drvc.so"
-#define DEFAULT_PATH_RV30 "/usr/lib/drvc.so"
-#define DEFAULT_PATH_RV40 "/usr/lib/drvc.so"
-#endif
+#define DEFAULT_RV20_NAMES "drv2.so:drv2.so.6.0"
+#define DEFAULT_RV30_NAMES "drvc.so:drv3.so.6.0"
+#define DEFAULT_RV40_NAMES "drvc.so:drv4.so.6.0"
 
 enum
 {
   PROP_0,
-  PROP_PATH_RV20,
-  PROP_PATH_RV30,
-  PROP_PATH_RV40
+  PROP_REAL_CODECS_PATH,
+  PROP_RV20_NAMES,
+  PROP_RV30_NAMES,
+  PROP_RV40_NAMES
 };
 
 
@@ -637,65 +632,50 @@
     GstRealVideoDecVersion version)
 {
   gpointer rv_custom_msg, rv_free, rv_init, rv_transform;
-  GModule *module;
-  gchar *path = NULL;
+  GModule *module = NULL;
+  gchar *path, *names;
+  gchar **split_names, **split_path;
+  int i, j;
 
   GST_DEBUG_OBJECT (dec,
       "Attempting to open shared library for real video version %d", version);
 
-  /* FIXME : Search for the correct library in various places if dec->path_rv20
-   *  isn't set explicitely !
-   * Library names can also be different (ex : drv30.so vs drvc.so)
-   */
-
+  path = dec->real_codecs_path ? dec->real_codecs_path :
+          DEFAULT_REAL_CODECS_PATH;
+  
   switch (version) {
     case GST_REAL_VIDEO_DEC_VERSION_2:
-    {
-      if (dec->path_rv20)
-        path = dec->path_rv20;
-      else if (g_file_test (DEFAULT_PATH_RV20, G_FILE_TEST_EXISTS))
-        path = DEFAULT_PATH_RV20;
-      else if (g_file_test ("/usr/lib/drv2.so.6.0", G_FILE_TEST_EXISTS))
-        path = "/usr/lib/drv2.so.6.0";
-      else
-        goto no_known_libraries;
+      names = dec->rv20_names ? dec->rv20_names : DEFAULT_RV20_NAMES;
       break;
-    }
     case GST_REAL_VIDEO_DEC_VERSION_3:
-    {
-      if (dec->path_rv30)
-        path = dec->path_rv30;
-      else if (g_file_test (DEFAULT_PATH_RV30, G_FILE_TEST_EXISTS))
-        path = DEFAULT_PATH_RV30;
-      else if (g_file_test ("/usr/lib/drv3.so.6.0", G_FILE_TEST_EXISTS))
-        path = "/usr/lib/drv3.so.6.0";
-      else
-        goto no_known_libraries;
+      names = dec->rv30_names ? dec->rv30_names : DEFAULT_RV30_NAMES;
       break;
-    }
     case GST_REAL_VIDEO_DEC_VERSION_4:
-    {
-      if (dec->path_rv40)
-        path = dec->path_rv40;
-      else if (g_file_test (DEFAULT_PATH_RV40, G_FILE_TEST_EXISTS))
-        path = DEFAULT_PATH_RV40;
-      else if (g_file_test ("/usr/lib/drv4.so.6.0", G_FILE_TEST_EXISTS))
-        path = "/usr/lib/drv4.so.6.0";
-      else
-        goto no_known_libraries;
+      names = dec->rv40_names ? dec->rv40_names : DEFAULT_RV40_NAMES;
       break;
-    }
     default:
       goto unknown_version;
   }
 
-  GST_LOG_OBJECT (dec, "Trying to open '%s'", path);
-  hooks->module = g_module_open (path, G_MODULE_BIND_LAZY);
+  split_path = g_strsplit (path, ":", 0);
+  split_names = g_strsplit (names, ":", 0);
+  
+  for (i = 0; split_path[i]; i++) {
+    for (j = 0; split_names[j]; j++) {
+      gchar *codec = g_strconcat (split_path[i], "/", split_names[j], NULL);
+      module = g_module_open (codec, G_MODULE_BIND_LAZY);
+      g_free (codec);
+      if (module)
+        goto codec_search_done;
+    }
+  }
 
-  if (hooks->module == NULL)
-    goto could_not_open;
+codec_search_done:
+  g_strfreev (split_path);
+  g_strfreev (split_names);
 
-  module = hooks->module;
+  if (module == NULL)
+    goto could_not_open;
 
   /* First try opening legacy symbols, if that fails try loading new symbols */
   if (g_module_symbol (module, "RV20toYUV420Init", &rv_init) &&
@@ -716,17 +696,10 @@
   hooks->free = rv_free;
   hooks->transform = rv_transform;
   hooks->custom_message = rv_custom_msg;
+  hooks->module = module;
 
   return TRUE;
 
-no_known_libraries:
-  {
-    GST_ELEMENT_ERROR (dec, LIBRARY, INIT,
-        ("Couldn't find a realvideo shared library for version %d",
-            version), (NULL));
-    return FALSE;
-  }
-
 unknown_version:
   {
     GST_ERROR_OBJECT (dec, "Cannot handle version %i.", version);
@@ -735,8 +708,7 @@
 
 could_not_open:
   {
-    GST_ERROR_OBJECT (dec, "Could not open library '%s':%s", path,
-        g_module_error ());
+    GST_ERROR_OBJECT (dec, "Could not find library '%s' in '%s'", names, path);
     return FALSE;
   }
 
@@ -802,17 +774,21 @@
   close_library (dec->hooks);
   memset (&dec->hooks, 0, sizeof (dec->hooks));
 
-  if (dec->path_rv20) {
-    g_free (dec->path_rv20);
-    dec->path_rv20 = NULL;
-  }
-  if (dec->path_rv30) {
-    g_free (dec->path_rv30);
-    dec->path_rv30 = NULL;
-  }
-  if (dec->path_rv40) {
-    g_free (dec->path_rv40);
-    dec->path_rv40 = NULL;
+  if (dec->real_codecs_path) {
+    g_free (dec->real_codecs_path);
+    dec->real_codecs_path = NULL;
+  }
+  if (dec->rv20_names) {
+    g_free (dec->rv20_names);
+    dec->rv20_names = NULL;
+  }
+  if (dec->rv30_names) {
+    g_free (dec->rv30_names);
+    dec->rv30_names = NULL;
+  }
+  if (dec->rv40_names) {
+    g_free (dec->rv40_names);
+    dec->rv40_names = NULL;
   }
 
   G_OBJECT_CLASS (parent_class)->finalize (object);
@@ -829,20 +805,25 @@
    */
 
   switch (prop_id) {
-    case PROP_PATH_RV20:
-      if (dec->path_rv20)
-        g_free (dec->path_rv20);
-      dec->path_rv20 = g_value_dup_string (value);
-      break;
-    case PROP_PATH_RV30:
-      if (dec->path_rv30)
-        g_free (dec->path_rv30);
-      dec->path_rv30 = g_value_dup_string (value);
-      break;
-    case PROP_PATH_RV40:
-      if (dec->path_rv40)
-        g_free (dec->path_rv40);
-      dec->path_rv40 = g_value_dup_string (value);
+    case PROP_REAL_CODECS_PATH:
+      if (dec->real_codecs_path)
+        g_free (dec->real_codecs_path);
+      dec->real_codecs_path = g_value_dup_string (value);
+      break;
+    case PROP_RV20_NAMES:
+      if (dec->rv20_names)
+        g_free (dec->rv20_names);
+      dec->rv20_names = g_value_dup_string (value);
+      break;
+    case PROP_RV30_NAMES:
+      if (dec->rv30_names)
+        g_free (dec->rv30_names);
+      dec->rv30_names = g_value_dup_string (value);
+      break;
+    case PROP_RV40_NAMES:
+      if (dec->rv40_names)
+        g_free (dec->rv40_names);
+      dec->rv40_names = g_value_dup_string (value);
       break;
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@@ -857,17 +838,21 @@
   GstRealVideoDec *dec = GST_REAL_VIDEO_DEC (object);
 
   switch (prop_id) {
-    case PROP_PATH_RV20:
-      g_value_set_string (value, dec->path_rv20 ? dec->path_rv20 :
-          DEFAULT_PATH_RV20);
-      break;
-    case PROP_PATH_RV30:
-      g_value_set_string (value, dec->path_rv30 ? dec->path_rv30 :
-          DEFAULT_PATH_RV30);
-      break;
-    case PROP_PATH_RV40:
-      g_value_set_string (value, dec->path_rv40 ? dec->path_rv40 :
-          DEFAULT_PATH_RV40);
+    case PROP_REAL_CODECS_PATH:
+      g_value_set_string (value, dec->real_codecs_path ? dec->real_codecs_path
+          : DEFAULT_REAL_CODECS_PATH);
+      break;
+    case PROP_RV20_NAMES:
+      g_value_set_string (value, dec->rv20_names ? dec->rv20_names :
+          DEFAULT_RV20_NAMES);
+      break;
+    case PROP_RV30_NAMES:
+      g_value_set_string (value, dec->rv30_names ? dec->rv30_names :
+          DEFAULT_RV30_NAMES);
+      break;
+    case PROP_RV40_NAMES:
+      g_value_set_string (value, dec->rv40_names ? dec->rv40_names :
+          DEFAULT_RV40_NAMES);
       break;
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@@ -884,15 +869,20 @@
   object_class->get_property = gst_real_video_dec_get_property;
   object_class->finalize = gst_real_video_dec_finalize;
 
-  g_object_class_install_property (object_class, PROP_PATH_RV20,
-      g_param_spec_string ("path_rv20", "Path to rv20 driver",
-          "Path to rv20 driver", DEFAULT_PATH_RV20, G_PARAM_READWRITE));
-  g_object_class_install_property (object_class, PROP_PATH_RV30,
-      g_param_spec_string ("path_rv30", "Path to rv30 driver",
-          "Path to rv30 driver", DEFAULT_PATH_RV30, G_PARAM_READWRITE));
-  g_object_class_install_property (object_class, PROP_PATH_RV40,
-      g_param_spec_string ("path_rv40", "Path to rv40 driver",
-          "Path to rv40 driver", DEFAULT_PATH_RV40, G_PARAM_READWRITE));
+  g_object_class_install_property (object_class, PROP_REAL_CODECS_PATH,
+      g_param_spec_string ("real_codecs_path",
+          "Path where to search for RealPlayer codecs",
+          "Path where to search for RealPlayer codecs",
+          DEFAULT_REAL_CODECS_PATH, G_PARAM_READWRITE));
+  g_object_class_install_property (object_class, PROP_RV20_NAMES,
+      g_param_spec_string ("rv20_names", "Names of rv20 driver",
+          "Names of rv20 driver", DEFAULT_RV20_NAMES, G_PARAM_READWRITE));
+  g_object_class_install_property (object_class, PROP_RV30_NAMES,
+      g_param_spec_string ("rv30_names", "Names of rv30 driver",
+          "Names of rv30 driver", DEFAULT_RV30_NAMES, G_PARAM_READWRITE));
+  g_object_class_install_property (object_class, PROP_RV40_NAMES,
+      g_param_spec_string ("rv40_names", "Names of rv40 driver",
+          "Names of rv40 driver", DEFAULT_RV40_NAMES, G_PARAM_READWRITE));
 
   GST_DEBUG_CATEGORY_INIT (realvideode_debug, "realvideodec", 0,
       "RealVideo decoder");
diff -urN gst-plugins-bad-0.10.5.orig/gst/real/gstrealvideodec.h gst-plugins-bad-0.10.5/gst/real/gstrealvideodec.h
--- gst-plugins-bad-0.10.5.orig/gst/real/gstrealvideodec.h	2007-05-06 17:25:05.000000000 +0200
+++ gst-plugins-bad-0.10.5/gst/real/gstrealvideodec.h	2007-06-30 17:27:08.000000000 +0200
@@ -80,7 +80,7 @@
   guint32 fragments[256];
 
   /* Properties */
-  gchar *path_rv20, *path_rv30, *path_rv40;
+  gchar *real_codecs_path, *rv20_names, *rv30_names, *rv40_names;
 };
 
 struct _GstRealVideoDecClass

gstreamer-plugins-bad-0.10.5-sys-modplug.patch:

--- NEW FILE gstreamer-plugins-bad-0.10.5-sys-modplug.patch ---
diff -up gst-plugins-bad-0.10.5/gst/modplug/Makefile.in~ gst-plugins-bad-0.10.5/gst/modplug/Makefile.in
--- gst-plugins-bad-0.10.5/gst/modplug/Makefile.in~	2007-07-14 18:28:46.000000000 +0200
+++ gst-plugins-bad-0.10.5/gst/modplug/Makefile.in	2007-07-14 18:32:50.000000000 +0200
@@ -82,7 +82,6 @@ pluginLTLIBRARIES_INSTALL = $(INSTALL)
 LTLIBRARIES = $(plugin_LTLIBRARIES)
 am__DEPENDENCIES_1 =
 libgstmodplug_la_DEPENDENCIES =  \
-	$(top_builddir)/gst/modplug/libmodplug/libmodplug.la \
 	$(am__DEPENDENCIES_1)
 am_libgstmodplug_la_OBJECTS = libgstmodplug_la-gstmodplug.lo
 libgstmodplug_la_OBJECTS = $(am_libgstmodplug_la_OBJECTS)
@@ -492,11 +491,11 @@ sbindir = @sbindir@
 sharedstatedir = @sharedstatedir@
 sysconfdir = @sysconfdir@
 target_alias = @target_alias@
-SUBDIRS = libmodplug .
+SUBDIRS = .
 plugin_LTLIBRARIES = libgstmodplug.la
 libgstmodplug_la_SOURCES = gstmodplug.cc
 libgstmodplug_la_CXXFLAGS = $(GST_CFLAGS) $(GST_PLUGINS_BASE_CFLAGS)
-libgstmodplug_la_LIBADD = $(top_builddir)/gst/modplug/libmodplug/libmodplug.la $(GST_PLUGINS_BASE_LIBS) -lstdc++
+libgstmodplug_la_LIBADD = $(GST_PLUGINS_BASE_LIBS) -lstdc++ -lmodplug
 libgstmodplug_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
 noinst_HEADERS = gstmodplug.h
 all: all-recursive
diff -up gst-plugins-bad-0.10.5/gst/modplug/gstmodplug.cc~ gst-plugins-bad-0.10.5/gst/modplug/gstmodplug.cc
--- gst-plugins-bad-0.10.5/gst/modplug/gstmodplug.cc~	2007-07-14 18:33:26.000000000 +0200
+++ gst-plugins-bad-0.10.5/gst/modplug/gstmodplug.cc	2007-07-14 18:33:26.000000000 +0200
@@ -44,8 +44,8 @@
 #include "config.h"
 #endif
 
-#include "libmodplug/stdafx.h"
-#include "libmodplug/sndfile.h"
+#include <libmodplug/stdafx.h>
+#include <libmodplug/sndfile.h>
 
 #include "gstmodplug.h"
 
diff -up gst-plugins-bad-0.10.5/gst/modplug/Makefile.am~ gst-plugins-bad-0.10.5/gst/modplug/Makefile.am
--- gst-plugins-bad-0.10.5/gst/modplug/Makefile.am~	2007-07-14 18:24:51.000000000 +0200
+++ gst-plugins-bad-0.10.5/gst/modplug/Makefile.am	2007-07-14 18:32:13.000000000 +0200
@@ -1,10 +1,8 @@
-SUBDIRS=libmodplug .
-
 plugin_LTLIBRARIES = libgstmodplug.la
 
 libgstmodplug_la_SOURCES = gstmodplug.cc
 libgstmodplug_la_CXXFLAGS = $(GST_CFLAGS) $(GST_PLUGINS_BASE_CFLAGS)
-libgstmodplug_la_LIBADD = $(top_builddir)/gst/modplug/libmodplug/libmodplug.la $(GST_PLUGINS_BASE_LIBS) -lstdc++
+libgstmodplug_la_LIBADD = $(GST_PLUGINS_BASE_LIBS) -lstdc++ -lmodplug
 libgstmodplug_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
 
 noinst_HEADERS = gstmodplug.h

gstreamer-plugins-bad-0.10.5-wildmidi-cfg.patch:

--- NEW FILE gstreamer-plugins-bad-0.10.5-wildmidi-cfg.patch ---
diff -up gst-plugins-bad-0.10.5/ext/timidity/gstwildmidi.c~ gst-plugins-bad-0.10.5/ext/timidity/gstwildmidi.c
--- gst-plugins-bad-0.10.5/ext/timidity/gstwildmidi.c~	2007-07-14 16:48:25.000000000 +0200
+++ gst-plugins-bad-0.10.5/ext/timidity/gstwildmidi.c	2007-07-14 16:48:25.000000000 +0200
@@ -837,6 +837,15 @@ wildmidi_open_config ()
   }
 
   if (path == NULL) {
+    path = g_build_path (G_DIR_SEPARATOR_S, "/etc", "timidity.cfg", NULL);
+    GST_DEBUG ("trying %s", path);
+    if (path && (g_access (path, R_OK) == -1)) {
+      g_free (path);
+      path = NULL;
+    }
+  }
+
+  if (path == NULL) {
     /* I've created a symlink to get it playing
      * ln -s /usr/share/timidity/timidity.cfg /etc/wildmidi.cfg
      * we could make it use : TIMIDITY_CFG

gstreamer-plugins-bad-gmyth.patch:

--- NEW FILE gstreamer-plugins-bad-gmyth.patch ---
diff -up gst-plugins-bad-0.10.5/ext/mythtv/gstmythtvsrc.c.cvs gst-plugins-bad-0.10.5/ext/mythtv/gstmythtvsrc.c
--- gst-plugins-bad-0.10.5/ext/mythtv/gstmythtvsrc.c.cvs	2007-05-31 21:12:37.000000000 +0200
+++ gst-plugins-bad-0.10.5/ext/mythtv/gstmythtvsrc.c	2007-09-29 09:30:10.000000000 +0200
@@ -1,30 +1,71 @@
-/* GStreamer MythTV Plug-in
+/*
+ * GStreamer MythTV Plug-in 
  * Copyright (C) <2006> Rosfran Borges <rosfran.borges at indt.org.br>
+ * Copyright (C) <2007> Renato Filho <renato.filho at indt.org.br>  
+ * 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., 59 Temple Place - Suite 
+ * 330, Boston, MA 02111-1307, USA. 
+ */
+
+/**
+ * SECTION:element-mythtvsrc
  *
- * 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.
+ * <refsect2>
+ * <para>
+ * MythTVSrc allows to access a remote MythTV backend streaming Video/Audio server,
+ * and to render audio and video content through a TCP/IP connection to a specific
+ * port on this server, and based on a known MythTV protocol that is based on 
+ * some message passing, such as REQUEST_BLOCK on a specified number of bytes, to get
+ * some chunk of remote file data.
+ * You should pass the information aboute the remote MythTV backend server 
+ * through the <link linkend="GstMythTVSrc--location">location</link> property.
+ * </para>
+ * <title>Examples</title>
+ * <para>
+ * If you want to get the LiveTV content (set channel, TV tuner, RemoteEncoder, 
+ * Recorder),
+ * put the following URI:
+ * 
+ * <programlisting> 
+ *  myth://xxx.xxx.xxx.xxx:6543/livetv?channel=BBC
+ * </programlisting>
  *
- * 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.
+ * This URI will say to the gmyth library to configure the Recorder instance (used to
+ * change the channel, start the TV multimedia content transmition, etc.), using
+ * the IP address (xxx.xxx.xxx.xxx) and port number (6543) of the MythTV backend 
+ * server, and setting the channel name to "BBC". 
+ * 
+ * To get a already recorded the MythTV NUV file, put the following URI:
+ * 
+ * <programlisting>
+ *  myth://xxx.xxx.xxx.xxx:6543/filename.nuv
+ * </programlisting>
  *
- * 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-/*
- * When using the LiveTV content, put the location URI in the following
- * format:
+ * This URI will say to the gmyth library to configure the Recorder instance (used to
+ * change the channel, start the TV multimedia content transmition, etc.), using
+ * the IP address (xxx.xxx.xxx.xxx) and port number (6543) of the MythTV backend 
+ * server, and setting the channel name to "BBC".
  * 
- * 	myth://mythtv:mythtv@xxx.xxx.xxx.xxx:6543/?mythconverg
+ * Another possible way to use the LiveTV content, and just in the case you want to 
+ * use the mysql database, put the location URI in the following format:
+ * 
+ * <programlisting> 
+ *  myth://mythtv:mythtv@xxx.xxx.xxx.xxx:6543/?mythconverg&channel=9
+ * </programlisting>
  * 
  * Where the first field is the protocol (myth), the second and third are user 
  * name (mythtv) and password (mythtv), then backend host name and port number, 
  * and the last field is the database name (mythconverg).
+ * </para>
+ * </refsect2>
  */
 
 #ifdef HAVE_CONFIG_H
@@ -32,7 +73,9 @@
 #endif
 
 #include "gstmythtvsrc.h"
+#include <gmyth/gmyth_file.h>
 #include <gmyth/gmyth_file_transfer.h>
+#include <gmyth/gmyth_file_local.h>
 #include <gmyth/gmyth_livetv.h>
 
 #include <gmyth/gmyth_socket.h>
@@ -42,47 +85,32 @@
 #include <unistd.h>
 
 GST_DEBUG_CATEGORY_STATIC (mythtvsrc_debug);
-#define GST_CAT_DEFAULT mythtvsrc_debug
-
-#define GST_GMYTHTV_ID_NUM			            1
-
-#define GST_GMYTHTV_CHANNEL_DEFAULT_NUM		(-1)
-
-#define GMYTHTV_VERSION_DEFAULT			        30
-
-#define GMYTHTV_TRANSFER_MAX_WAITS		     100
-
-#define GMYTHTV_TRANSFER_MAX_RESENDS	       2
-
-#define GMYTHTV_TRANSFER_MAX_BUFFER		(128*1024)
-
-#define MAX_READ_SIZE              		(4*1024)
-
-#define GST_FLOW_ERROR_NO_DATA  			(-101)
-
-#define REQUEST_MAX_SIZE							(64*1024)
-
-#define INTERNAL_BUFFER_SIZE					(90*1024)
+#define GST_GMYTHTV_ID_NUM                  1
+#define GST_GMYTHTV_CHANNEL_DEFAULT_NUM     (-1)
+#define GMYTHTV_VERSION_DEFAULT		    30
+#define GMYTHTV_TRANSFER_MAX_WAITS          100
+#define GMYTHTV_TRANSFER_MAX_RESENDS        2
+#define GMYTHTV_TRANSFER_MAX_BUFFER         (128*1024)
+#define READ_SIZE                           (14*1024)
+#define READ_SIZE_LIVETV                    (80*1024)
+#define GST_FLOW_ERROR_NO_DATA              (-101)
 
 static const GstElementDetails gst_mythtv_src_details =
 GST_ELEMENT_DETAILS ("MythTV client source",
     "Source/Network",
     "Control and receive data as a client over the network "
     "via raw socket connections using the MythTV protocol",
-    "Rosfran Borges <rosfran.borges at indt.org.br>");
+    "Rosfran Borges <rosfran.borges at indt.org.br>,"
+    "Renato Filho <renato.filho at indt.org.br>");
 
 static GstStaticPadTemplate srctemplate = GST_STATIC_PAD_TEMPLATE ("src",
     GST_PAD_SRC,
     GST_PAD_ALWAYS,
-    GST_STATIC_CAPS ("video/x-nuv"));
-
+    GST_STATIC_CAPS_ANY);
 enum
 {
   PROP_0,
   PROP_LOCATION,
-#ifndef GST_DISABLE_GST_DEBUG
-  PROP_GMYTHTV_DBG,
-#endif
   PROP_GMYTHTV_VERSION,
   PROP_GMYTHTV_LIVE,
   PROP_GMYTHTV_LIVEID,
@@ -91,6 +119,8 @@ enum
   PROP_GMYTHTV_CHANNEL_NUM
 };
 
+static void gst_mythtv_src_clear (GstMythtvSrc * mythtv_src);
+
 static void gst_mythtv_src_finalize (GObject * gobject);
 
 static GstFlowReturn gst_mythtv_src_create (GstPushSrc * psrc,
@@ -104,15 +134,13 @@ static gboolean gst_mythtv_src_is_seekab
 static gboolean gst_mythtv_src_do_seek (GstBaseSrc * base,
     GstSegment * segment);
 
-static gboolean gst_mythtv_src_next_program_chain (GstMythtvSrc * src);
-
 static GstStateChangeReturn
 gst_mythtv_src_change_state (GstElement * element, GstStateChange transition);
 
-static void gst_mythtv_src_set_property (GObject * object, guint prop_id,
-    const GValue * value, GParamSpec * pspec);
-static void gst_mythtv_src_get_property (GObject * object, guint prop_id,
-    GValue * value, GParamSpec * pspec);
+static void gst_mythtv_src_set_property (GObject * object,
+    guint prop_id, const GValue * value, GParamSpec * pspec);
+static void gst_mythtv_src_get_property (GObject * object,
+    guint prop_id, GValue * value, GParamSpec * pspec);
 
 static void gst_mythtv_src_uri_handler_init (gpointer g_iface,
     gpointer iface_data);
@@ -121,8 +149,8 @@ static gboolean gst_mythtv_src_handle_qu
 
 static gboolean gst_mythtv_src_handle_event (GstPad * pad, GstEvent * event);
 
-static gint do_read_request_response (GstMythtvSrc * src, guint size,
-    GByteArray * data_ptr);
+static GMythFileReadResult do_read_request_response (GstMythtvSrc * src,
+    guint size, GByteArray * data_ptr);
 
 static void
 _urihandler_init (GType type)
@@ -140,7 +168,6 @@ _urihandler_init (GType type)
 
 GST_BOILERPLATE_FULL (GstMythtvSrc, gst_mythtv_src, GstPushSrc,
     GST_TYPE_PUSH_SRC, _urihandler_init)
-
      static void gst_mythtv_src_base_init (gpointer g_class)
 {
   GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
@@ -203,27 +230,18 @@ gst_mythtv_src_class_init (GstMythtvSrcC
       (gobject_class, PROP_GMYTHTV_ENABLE_TIMING_POSITION,
       g_param_spec_boolean ("mythtv-enable-timing-position",
           "mythtv-enable-timing-position",
-          "Enable MythTV Live TV content size continuous updating", FALSE,
-          G_PARAM_READWRITE));
+          "Enable MythTV Live TV content size continuous updating",
+          FALSE, G_PARAM_READWRITE));
 
   g_object_class_install_property
       (gobject_class, PROP_GMYTHTV_CHANNEL_NUM,
-      g_param_spec_int ("mythtv-channel", "mythtv-channel",
-          "Change MythTV channel number",
-          -1, 99999, GST_GMYTHTV_CHANNEL_DEFAULT_NUM, G_PARAM_READWRITE));
-
-#ifndef GST_DISABLE_GST_DEBUG
-  g_object_class_install_property
-      (gobject_class, PROP_GMYTHTV_DBG,
-      g_param_spec_boolean ("mythtv-debug", "mythtv-debug",
-          "Enable MythTV debug messages", FALSE, G_PARAM_READWRITE));
-#endif
+      g_param_spec_string ("mythtv-channel", "mythtv-channel",
+          "Change MythTV channel number", "", G_PARAM_READWRITE));
 
   gstbasesrc_class->start = gst_mythtv_src_start;
   gstbasesrc_class->stop = gst_mythtv_src_stop;
   gstbasesrc_class->get_size = gst_mythtv_src_get_size;
   gstbasesrc_class->is_seekable = gst_mythtv_src_is_seekable;
-
   gstbasesrc_class->do_seek = gst_mythtv_src_do_seek;
   gstpushsrc_class->create = gst_mythtv_src_create;
 
@@ -234,42 +252,25 @@ gst_mythtv_src_class_init (GstMythtvSrcC
 static void
 gst_mythtv_src_init (GstMythtvSrc * this, GstMythtvSrcClass * g_class)
 {
-  this->file_transfer = NULL;
-
+  this->file = NULL;
   this->unique_setup = FALSE;
-
   this->mythtv_version = GMYTHTV_VERSION_DEFAULT;
-
   this->state = GST_MYTHTV_SRC_FILE_TRANSFER;
-
   this->bytes_read = 0;
-
   this->prev_content_size = 0;
-
   this->content_size = 0;
   this->read_offset = 0;
-
   this->content_size_last = 0;
-
   this->live_tv = FALSE;
-
   this->enable_timing_position = FALSE;
   this->update_prog_chain = FALSE;
-
   this->user_agent = g_strdup ("mythtvsrc");
-  this->mythtv_caps = NULL;
   this->update_prog_chain = FALSE;
-
-  this->channel_num = GST_GMYTHTV_CHANNEL_DEFAULT_NUM;
-
+  this->channel_name = NULL;
   this->eos = FALSE;
-
-  this->bytes_queue = NULL;
-
   this->wait_to_transfer = 0;
-
+  this->spawn_livetv = NULL;
   gst_base_src_set_format (GST_BASE_SRC (this), GST_FORMAT_BYTES);
-
   gst_pad_set_event_function (GST_BASE_SRC_PAD (GST_BASE_SRC (this)),
       gst_mythtv_src_handle_event);
   gst_pad_set_query_function (GST_BASE_SRC_PAD (GST_BASE_SRC (this)),
@@ -278,101 +279,105 @@ gst_mythtv_src_init (GstMythtvSrc * this
 }
 
 static void
-gst_mythtv_src_finalize (GObject * gobject)
+gst_mythtv_src_clear (GstMythtvSrc * mythtv_src)
 {
-  GstMythtvSrc *this = GST_MYTHTV_SRC (gobject);
+  mythtv_src->unique_setup = FALSE;
 
-  if (this->mythtv_caps) {
-    gst_caps_unref (this->mythtv_caps);
-    this->mythtv_caps = NULL;
+  if (mythtv_src->spawn_livetv) {
+    g_object_unref (mythtv_src->spawn_livetv);
+    mythtv_src->spawn_livetv = NULL;
   }
 
-  if (this->file_transfer) {
-    g_object_unref (this->file_transfer);
-    this->file_transfer = NULL;
+  if (mythtv_src->file) {
+    g_object_unref (mythtv_src->file);
+    mythtv_src->file = NULL;
   }
 
-  if (this->spawn_livetv) {
-    g_object_unref (this->spawn_livetv);
-    this->spawn_livetv = NULL;
+  if (mythtv_src->backend_info) {
+    g_object_unref (mythtv_src->backend_info);
+    mythtv_src->backend_info = NULL;
   }
+}
 
-  if (this->backend_info) {
-    g_object_unref (this->backend_info);
-    this->backend_info = NULL;
-  }
+static void
+gst_mythtv_src_finalize (GObject * gobject)
+{
+  GstMythtvSrc *this = GST_MYTHTV_SRC (gobject);
+
+  gst_mythtv_src_clear (this);
 
   if (this->uri_name) {
     g_free (this->uri_name);
+    this->uri_name = NULL;
   }
 
   if (this->user_agent) {
     g_free (this->user_agent);
-  }
-
-  if (this->bytes_queue) {
-    g_byte_array_free (this->bytes_queue, TRUE);
-    this->bytes_queue = NULL;
+    this->user_agent = NULL;
   }
 
   G_OBJECT_CLASS (parent_class)->finalize (gobject);
 }
 
-static gint
+static GMythFileReadResult
 do_read_request_response (GstMythtvSrc * src, guint size, GByteArray * data_ptr)
 {
   gint read = 0;
   guint sizetoread = size;
   gint max_iters = GMYTHTV_TRANSFER_MAX_RESENDS;
+  GMythFileReadResult result;
 
   GST_LOG_OBJECT (src, "Starting: Reading %d bytes...", sizetoread);
 
-  /* Loop sending the Myth File Transfer request:
-   * Retry whilst authentication fails and we supply it. */
-  gint len = 0;
+  result = GMYTH_FILE_READ_OK;
+  /*
+   * Loop sending the Myth File Transfer request: Retry whilst
+   * authentication fails and we supply it. 
+   */
 
   while (sizetoread == size && --max_iters > 0) {
-
-    len = gmyth_file_transfer_read (src->file_transfer,
-        data_ptr, sizetoread, TRUE);
-
-    if (len > 0) {
-      read += len;
-      sizetoread -= len;
-    } else if (len < 0) {
-
+    /*
+     * if ( gmyth_backend_info_is_local_file(src->backend_info) ) 
+     */
+    if (IS_GMYTH_FILE_LOCAL (src->file))
+      result = gmyth_file_local_read (GMYTH_FILE_LOCAL (src->file),
+          data_ptr, sizetoread, src->live_tv);
+    else if (IS_GMYTH_FILE_TRANSFER (src->file))
+      result = gmyth_file_transfer_read (GMYTH_FILE_TRANSFER (src->file),
+          data_ptr, sizetoread, src->live_tv);
+
+    if (data_ptr->len > 0) {
+      read += data_ptr->len;
+      sizetoread -= data_ptr->len;
+    } else if (data_ptr->len <= 0) {
       if (src->live_tv == FALSE) {
-        read = -1;
+        result = GMYTH_FILE_READ_EOF;
         goto eos;
       } else {
-        if (len == GMYTHTV_FILE_TRANSFER_READ_ERROR) {  /* -314 */
+        if (result == GMYTH_FILE_READ_ERROR) {  /* -314 */
           GST_INFO_OBJECT (src, "[LiveTV] FileTransfer READ_ERROR!");
-          goto done;
-        } else if (len == GMYTHTV_FILE_TRANSFER_NEXT_PROG_CHAIN) {      /* -315 */
-          GST_INFO_OBJECT (src,
-              "[LiveTV] FileTransfer - Go to the next program chain!");
-          continue;
         }
         goto done;
       }
-
-    } else if (len == 0)
-      goto done;
-
+    }
+    /*
+     * else if (data_ptr->len == 0) goto done; 
+     */
     if (read == sizetoread)
       goto done;
   }
 
-  if ((read < 0 && !src->live_tv) || max_iters == 0)
+  if ((read < 0 && !src->live_tv) || max_iters == 0) {
+    result = GMYTH_FILE_READ_EOF;
     goto eos;
-
+  }
   goto done;
 
 eos:
   src->eos = TRUE;
 
 done:
-  return read;
+  return result;
 }
 
 static GstFlowReturn
@@ -380,162 +385,65 @@ gst_mythtv_src_create (GstPushSrc * psrc
 {
   GstMythtvSrc *src;
   GstFlowReturn ret = GST_FLOW_OK;
-  gint read = -1;
+  GByteArray *buffer;
+  GMythFileReadResult result = GMYTH_FILE_READ_OK;
 
   src = GST_MYTHTV_SRC (psrc);
 
-  /* The caller should know the number of bytes and not read beyond EOS. */
-  if (G_UNLIKELY (src->eos))
-    goto eos;
-  if (G_UNLIKELY (src->update_prog_chain))
-    goto change_progchain;
-
-  GST_DEBUG_OBJECT (src, "offset = %" G_GUINT64_FORMAT ", size = %d...",
-      src->read_offset, MAX_READ_SIZE);
-
-  GST_DEBUG_OBJECT (src, "Create: buffer_remain: %d, buffer_size = %d.",
-      (gint) src->buffer_remain, src->bytes_queue->len);
-
-  /* just get from the byte array, no network effort... */
-  if ((src->buffer_remain = src->bytes_queue->len) < MAX_READ_SIZE) {
-    GByteArray *buffer = NULL;
-    guint buffer_size_inter = (INTERNAL_BUFFER_SIZE - src->buffer_remain);
-
-    if (buffer_size_inter > REQUEST_MAX_SIZE)
-      buffer_size_inter = REQUEST_MAX_SIZE;
-
-    buffer = g_byte_array_new ();
-
-    read = do_read_request_response (src, buffer_size_inter, buffer);
-
-    if (G_UNLIKELY (read < 0)) {
-      if (src->live_tv)
-        goto change_progchain;
-      else
-        goto read_error;
-    } else if (G_UNLIKELY (read == 0)) {
-      if (!src->live_tv)
-        goto eos;
-      else
-        goto done;
-    }
-
-    if (G_UNLIKELY (src->update_prog_chain))
-      goto change_progchain;
-
-    src->bytes_queue =
-        g_byte_array_append (src->bytes_queue, buffer->data, read);
-    if (read > buffer_size_inter)
-      GST_WARNING_OBJECT (src,
-          "INCREASED buffer size! Backend sent more than we ask him... (%d)",
-          abs (read - buffer_size_inter));
-
-    src->buffer_remain += read;
-
-    if (buffer != NULL) {
-      g_byte_array_free (buffer, TRUE);
-      buffer = NULL;
-    }
-
-    GST_DEBUG_OBJECT (src,
-        "BYTES READ (actual) = %d, BYTES READ (cumulative) = %llu, "
-        "OFFSET = %llu, CONTENT SIZE = %llu.", read,
-        src->bytes_read, src->read_offset, src->content_size);
+  buffer = g_byte_array_new ();
+  if (src->live_tv)
+    result = do_read_request_response (src, READ_SIZE_LIVETV, buffer);
+  else
+    result = do_read_request_response (src, READ_SIZE, buffer);
 
-  }
+  if (result == GMYTH_FILE_READ_ERROR)
+    goto read_error;
 
-  guint buffer_size =
-      (src->buffer_remain < MAX_READ_SIZE) ? src->buffer_remain : MAX_READ_SIZE;
 
   *outbuf = gst_buffer_new ();
-
-  /* gets the first buffer_size bytes from the byte array buffer variable */
-  /* guint8 *buf = g_memdup( src->bytes_queue->data, buffer_size ); */
-
-  GST_DEBUG_OBJECT (src, "read from network? %s!, buffer_remain = %d",
-      (read ==
-          -1) ? "NO, got from buffer" : "YES, go see the backend's log file",
-      src->buffer_remain);
-
-  GST_BUFFER_SIZE (*outbuf) = buffer_size;
+  GST_BUFFER_SIZE (*outbuf) = buffer->len;
   GST_BUFFER_MALLOCDATA (*outbuf) = g_malloc0 (GST_BUFFER_SIZE (*outbuf));
   GST_BUFFER_DATA (*outbuf) = GST_BUFFER_MALLOCDATA (*outbuf);
-  g_memmove (GST_BUFFER_DATA ((*outbuf)), src->bytes_queue->data,
+  g_memmove (GST_BUFFER_DATA ((*outbuf)), buffer->data,
       GST_BUFFER_SIZE (*outbuf));
   GST_BUFFER_OFFSET (*outbuf) = src->read_offset;
   GST_BUFFER_OFFSET_END (*outbuf) =
       src->read_offset + GST_BUFFER_SIZE (*outbuf);
 
-  src->buffer_remain -= GST_BUFFER_SIZE (*outbuf);
-
   src->read_offset += GST_BUFFER_SIZE (*outbuf);
   src->bytes_read += GST_BUFFER_SIZE (*outbuf);
-  GST_DEBUG_OBJECT (src, "Buffer output with size: %d",
-      GST_BUFFER_SIZE (*outbuf));
-
-  /* flushs the newly buffer got from byte array */
-  src->bytes_queue =
-      g_byte_array_remove_range (src->bytes_queue, 0, buffer_size);
-
-  GST_DEBUG_OBJECT (src, "Got buffer: BUFFER --->SIZE = %d, OFFSET = %llu, "
-      "OFFSET_END = %llu.", GST_BUFFER_SIZE (*outbuf),
-      GST_BUFFER_OFFSET (*outbuf), GST_BUFFER_OFFSET_END (*outbuf));
-
-  GST_DEBUG_OBJECT (src, "CONTENT_SIZE = %llu, BYTES_READ = %llu.",
-      src->content_size, src->bytes_read);
 
-  if (G_UNLIKELY (src->eos) || (!src->live_tv
-          && (src->bytes_read >= src->content_size)))
-    goto eos;
+  g_byte_array_free (buffer, TRUE);
 
-done:
-  {
-    const gchar *reason = gst_flow_get_name (ret);
+  if (result == GMYTH_FILE_READ_NEXT_PROG_CHAIN) {
+    GstPad *peer;
 
-    GST_DEBUG_OBJECT (src, "DONE task, reason %s", reason);
-    return ret;
-  }
-eos:
-  {
-    const gchar *reason = gst_flow_get_name (ret);
+    peer = gst_pad_get_peer (GST_BASE_SRC_PAD (GST_BASE_SRC (psrc)));
+    gst_pad_send_event (peer,
+        gst_event_new_new_segment (FALSE, 1.0, GST_FORMAT_BYTES, 0, -1, 0));
 
-    GST_DEBUG_OBJECT (src, "pausing task, reason %s", reason);
-    return GST_FLOW_UNEXPECTED;
+    gst_object_unref (peer);
   }
-  /* ERRORS */
-read_error:
-  {
-    GST_ELEMENT_ERROR (src, RESOURCE, READ,
-        (NULL), ("Could not read any bytes (%i, %s)", read, src->uri_name));
-    return GST_FLOW_ERROR;
-  }
-change_progchain:
-  {
-    GST_ELEMENT_ERROR (src, RESOURCE, READ,
-        (NULL), ("Seek failed, go to the next program info... (%i, %s)", read,
-            src->uri_name));
-
-    gst_pad_push_event (GST_BASE_SRC_PAD (GST_BASE_SRC (psrc)),
-        gst_event_new_new_segment (TRUE, 1.0, GST_FORMAT_TIME, 0, -1, 0));
-    /* go to the next program chain */
-    src->unique_setup = FALSE;
-    src->update_prog_chain = TRUE;
 
-    gst_mythtv_src_next_program_chain (src);
+  if (src->eos || (!src->live_tv && (src->bytes_read >= src->content_size)))
+    ret = GST_FLOW_UNEXPECTED;
 
-    return GST_FLOW_ERROR_NO_DATA;
-  }
+  return ret;
 
+read_error:
+  GST_ELEMENT_ERROR (src, RESOURCE, READ,
+      (NULL), ("Could not read any bytes (%i, %s)", read, src->uri_name));
+  return GST_FLOW_ERROR;
 }
 
 gint64
 gst_mythtv_src_get_position (GstMythtvSrc * src)
 {
-
   gint64 size_tmp = 0;
   guint max_tries = 2;
 
-  if (src->live_tv == TRUE && (abs (src->content_size - src->bytes_read) <
+  if (src->live_tv == TRUE &&
+      (abs (src->content_size - src->bytes_read) <
           GMYTHTV_TRANSFER_MAX_BUFFER)) {
 
   get_file_pos:
@@ -546,12 +454,12 @@ gst_mythtv_src_get_position (GstMythtvSr
     else if (size_tmp > 0 && --max_tries > 0)
       goto get_file_pos;
     GST_LOG_OBJECT (src, "GET_POSITION: file_position = %lld", size_tmp);
-    /* sets the last content size amount before it can be updated */
+    /*
+     * sets the last content size amount before it can be updated 
+     */
     src->prev_content_size = src->content_size;
   }
-
   return src->content_size;
-
 }
 
 static gboolean
@@ -570,20 +478,19 @@ gst_mythtv_src_do_seek (GstBaseSrc * bas
   GST_LOG_OBJECT (src,
       "Trying to seek at the value (actual_seek = %lld, read_offset = %lld)",
       actual_seek, src->read_offset);
-  /* verify if it needs to seek */
+  /*
+   * verify if it needs to seek 
+   */
   if (src->read_offset != actual_seek) {
-
-    new_offset =
-        gmyth_file_transfer_seek (src->file_transfer, segment->start, SEEK_SET);
-
-    GST_LOG_OBJECT (src,
-        "Segment offset start = %lld, SRC Offset = %lld, NEW actual backend SEEK Offset = %lld.",
-        segment->start, src->read_offset, new_offset);
+    if (IS_GMYTH_FILE_LOCAL (src->file))
+      new_offset = gmyth_file_local_seek (GMYTH_FILE_LOCAL (src->file),
+          segment->start, G_SEEK_SET);
+    else if (IS_GMYTH_FILE_TRANSFER (src->file))
+      new_offset = gmyth_file_transfer_seek (GMYTH_FILE_TRANSFER (src->file),
+          segment->start, SEEK_SET);
     if (G_UNLIKELY (new_offset < 0)) {
       ret = FALSE;
-      if (src->live_tv)
-        goto change_progchain;
-      else
+      if (!src->live_tv)
         goto eos;
     }
 
@@ -592,38 +499,19 @@ gst_mythtv_src_do_seek (GstBaseSrc * bas
     if (ret == FALSE) {
       GST_INFO_OBJECT (src, "Failed to set the SEEK on segment!");
     }
-
   }
 
 done:
   return ret;
 
 eos:
-  {
-
-    GST_DEBUG_OBJECT (src, "EOS found on seeking!!!");
-    return FALSE;
-  }
-change_progchain:
-  {
-    GST_ELEMENT_ERROR (src, RESOURCE, READ,
-        (NULL), ("Seek failed, go to the next program info... (%i, %s)", read,
-            src->uri_name));
-
-    gst_pad_push_event (GST_BASE_SRC_PAD (base),
-        gst_event_new_new_segment (TRUE, 1.0, GST_FORMAT_TIME, 0, -1, 0));
-    /* go to the next program chain */
-    src->unique_setup = FALSE;
-    src->update_prog_chain = TRUE;
-
-    gst_mythtv_src_next_program_chain (src);
-
-    return TRUE;
-  }
-
+  GST_DEBUG_OBJECT (src, "EOS found on seeking!!!");
+  return FALSE;
 }
 
-/* create a socket for connecting to remote server */
+/*
+ * create a socket for connecting to remote server 
+ */
 static gboolean
 gst_mythtv_src_start (GstBaseSrc * bsrc)
 {
@@ -632,9 +520,7 @@ gst_mythtv_src_start (GstBaseSrc * bsrc)
   GString *chain_id_local = NULL;
   GMythURI *gmyth_uri = NULL;
   gboolean ret = TRUE;
-
-  if (G_UNLIKELY (src->update_prog_chain))
-    goto change_progchain;
+  GstMessage *msg;
 
   if (src->unique_setup == FALSE) {
     src->unique_setup = TRUE;
@@ -643,86 +529,112 @@ gst_mythtv_src_start (GstBaseSrc * bsrc)
   }
 
   gmyth_uri = gmyth_uri_new_with_value (src->uri_name);
-
   src->backend_info = gmyth_backend_info_new_with_uri (src->uri_name);
-  /* testing UPnP... */
-  /* gmyth_backend_info_set_hostname( src->backend_info, NULL ); */
-  if (src->live_tv || gmyth_uri_is_livetv (gmyth_uri)) {
-    gint ch;
-
-    src->spawn_livetv = gmyth_livetv_new ();
-
-    ch = gmyth_uri_get_channel_num (gmyth_uri);
-    if (ch != -1)
-      src->channel_num = ch;
-
-    if (src->channel_num != GST_GMYTHTV_CHANNEL_DEFAULT_NUM) {
-      if (gmyth_livetv_channel_setup (src->spawn_livetv, src->channel_num,
-              src->backend_info) == FALSE) {
+  src->live_tv = gmyth_uri_is_livetv (gmyth_uri);
+
+  if (src->live_tv) {
+    src->spawn_livetv = gmyth_livetv_new (src->backend_info);
+    gchar *ch = gmyth_uri_get_channel_name (gmyth_uri);
+
+    if (ch != NULL)
+      src->channel_name = ch;
+
+    if (src->channel_name != NULL) {
+      gboolean result;
+
+      result = gmyth_livetv_channel_name_setup (src->spawn_livetv,
+          src->channel_name);
+      if (result == FALSE) {
         GST_INFO_OBJECT (src, "LiveTV setup felt down on error");
         ret = FALSE;
         goto init_failed;
       }
     } else {
-      if (gmyth_livetv_setup (src->spawn_livetv, src->backend_info) == FALSE) {
+      if (gmyth_livetv_setup (src->spawn_livetv) == FALSE) {
         GST_INFO_OBJECT (src, "LiveTV setup felt down on error");
         ret = FALSE;
         goto init_failed;
       }
     }
 
-    src->file_transfer = gmyth_livetv_create_file_transfer (src->spawn_livetv);
-
-    if (NULL == src->file_transfer) {
+    src->file =
+        GMYTH_FILE (gmyth_livetv_create_file_transfer (src->spawn_livetv));
+    if (NULL == src->file) {
       GST_INFO_OBJECT (src, "[LiveTV] FileTransfer equals to NULL");
       ret = FALSE;
       goto init_failed;
     }
-  } else {
-
-    src->file_transfer = gmyth_file_transfer_new (src->backend_info);
 
-    ret = gmyth_file_transfer_open (src->file_transfer, src->uri_name);
+    /*
+     * Check if the file is local to this specific client renderer 
+     */
+    if (gmyth_uri_is_local_file (gmyth_uri))
+      ret = gmyth_file_local_open (GMYTH_FILE_LOCAL (src->file));
+    else
+      ret = gmyth_file_transfer_open (GMYTH_FILE_TRANSFER (src->file),
+          (src->spawn_livetv->uri != NULL ?
+              gmyth_uri_get_path (src->spawn_livetv->uri) :
+              src->spawn_livetv->proginfo->pathname->str));
+    /*
+     * sets the mythtvsrc "location" property 
+     */
+    g_object_set (src, "location", gmyth_file_get_uri (src->file), NULL);
 
+    if (!ret) {
+      GST_INFO_OBJECT (src,
+          "Error: couldn't open the FileTransfer from LiveTV source!");
+      g_object_unref (src->file);
+      src->file = NULL;
+      goto init_failed;
+    }
+  } /* If live-tv */
+  else {
+    /*
+     * Check if the file is local to this specific client renderer,
+     * and tries to open a local connection 
+     */
+    if (gmyth_uri_is_local_file (gmyth_uri)) {
+      src->file = GMYTH_FILE (gmyth_file_local_new (src->backend_info));
+      ret = gmyth_file_local_open (GMYTH_FILE_LOCAL (src->file));
+    } else {
+      src->file = GMYTH_FILE (gmyth_file_transfer_new (src->backend_info));
+      ret =
+          gmyth_file_transfer_open (GMYTH_FILE_TRANSFER (src->file),
+          src->uri_name);
+    }
   }
 
-  if (NULL == src->file_transfer) {
+  if (NULL == src->file) {
     GST_INFO_OBJECT (src, "FileTransfer is NULL");
     goto init_failed;
   }
-  /*GST_INFO_OBJECT( src, "uri = %s", src->spawn_livetv->file_transfer); */
 
   if (ret == FALSE) {
-#ifndef GST_DISABLE_GST_DEBUG
-    if (src->mythtv_msgs_dbg)
-      GST_INFO_OBJECT (src,
-          "MythTV FileTransfer request failed when setting up socket connection!");
-#endif
+    GST_INFO_OBJECT (src,
+        "MythTV FileTransfer request failed when setting up socket connection!");
     goto begin_req_failed;
   }
 
   GST_INFO_OBJECT (src,
       "MythTV FileTransfer filesize = %lld, content_size = %lld!",
-      src->file_transfer->filesize, src->content_size);
+      gmyth_file_get_filesize (src->file), src->content_size);
 
-  src->content_size = src->file_transfer->filesize;
+  src->content_size = gmyth_file_get_filesize (src->file);
 
-  src->do_start = FALSE;
+  msg = gst_message_new_duration (GST_OBJECT (src), GST_FORMAT_BYTES,
+      src->content_size);
+  gst_element_post_message (GST_ELEMENT (src), msg);
 
-  /* this is used for the buffer cache */
-  src->bytes_queue = g_byte_array_sized_new (INTERNAL_BUFFER_SIZE);
-  src->buffer_remain = 0;
+  src->do_start = FALSE;
 
   gst_pad_push_event (GST_BASE_SRC_PAD (GST_BASE_SRC (src)),
-      gst_event_new_new_segment (TRUE, 1.0, GST_FORMAT_TIME, 0,
-          src->content_size, 0));
-
+      gst_event_new_new_segment (TRUE, 1.0,
+          GST_FORMAT_TIME, 0, src->content_size, 0));
 done:
-  /*if ( gmyth_uri != NULL )
-     {
-     g_object_unref( gmyth_uri );
-     gmyth_uri = NULL;
-     } */
+  if (gmyth_uri != NULL) {
+    g_object_unref (gmyth_uri);
+    gmyth_uri = NULL;
+  }
 
   if (chain_id_local != NULL) {
     g_string_free (chain_id_local, TRUE);
@@ -731,156 +643,39 @@ done:
 
   return TRUE;
 
-  /* ERRORS */
+  /*
+   * ERRORS
+   */
 init_failed:
-  {
-    if (src->spawn_livetv != NULL)
-      g_object_unref (src->spawn_livetv);
-
-    GST_ELEMENT_ERROR (src, LIBRARY, INIT,
-        (NULL), ("Could not initialize MythTV library (%i, %s)", ret,
-            src->uri_name));
-    return FALSE;
-  }
-begin_req_failed:
-  {
-    GST_ELEMENT_ERROR (src, LIBRARY, INIT,
-        (NULL), ("Could not begin request sent to MythTV server (%i, %s)", ret,
-            src->uri_name));
-    return FALSE;
-  }
-change_progchain:
-  {
-    GST_ELEMENT_ERROR (src, RESOURCE, READ,
-        (NULL), ("Seek failed, go to the next program info... (%s)",
-            src->uri_name));
-
-    gst_pad_push_event (GST_BASE_SRC_PAD (GST_BASE_SRC (src)),
-        gst_event_new_new_segment (TRUE, 1.0, GST_FORMAT_TIME, 0, -1, 0));
-
-    /* go to the next program chain */
-    src->unique_setup = FALSE;
-    src->update_prog_chain = TRUE;
-
-    gst_mythtv_src_next_program_chain (src);
-
-    return TRUE;
-  }
-}
-
-/* create a new socket for connecting to the next program chain */
-static gboolean
-gst_mythtv_src_next_program_chain (GstMythtvSrc * src)
-{
-  GString *chain_id_local = NULL;
-
-  gboolean ret = TRUE;
-
-  if (!src->live_tv)
-    goto init_failed;
-
-  if (src->unique_setup == FALSE) {
-    src->unique_setup = TRUE;
-  } else {
-    goto done;
-  }
-
-  GST_PAD_STREAM_LOCK (GST_BASE_SRC_PAD (GST_BASE_SRC (src)));
-
-  if (src->file_transfer) {
-    g_object_unref (src->file_transfer);
-    src->file_transfer = NULL;
-  }
-
-  if (src->uri_name) {
-    g_free (src->uri_name);
-  }
-
-  if (src->backend_info == NULL)
-    src->backend_info = gmyth_backend_info_new_with_uri (src->uri_name);
-
-  if (src->live_tv) {
-    if (gmyth_livetv_next_program_chain (src->spawn_livetv) == FALSE) {
-      GST_INFO_OBJECT (src, "Failed to go to the next program chain!");
-      ret = FALSE;
-      goto init_failed;
-    }
-    /* set up the uri variable */
-    src->uri_name = g_strdup (src->spawn_livetv->proginfo->pathname->str);
-    chain_id_local = gmyth_tvchain_get_id (src->spawn_livetv->tvchain);
-    if (chain_id_local != NULL) {
-      src->live_chain_id = g_strdup (chain_id_local->str);
-      GST_DEBUG_OBJECT (src, "Local chain ID = %s", src->live_chain_id);
-    }
-    src->live_tv_id = src->spawn_livetv->recorder->recorder_num;
-    GST_LOG_OBJECT (src, "LiveTV id = %d, URI path = %s",
-        src->live_tv_id, src->uri_name);
-  }
-
-  src->file_transfer = gmyth_file_transfer_new (src->backend_info);
-
-  if (src->file_transfer == NULL) {
-    goto init_failed;
+  if (gmyth_uri != NULL) {
+    g_object_unref (gmyth_uri);
+    gmyth_uri = NULL;
   }
 
-  ret = gmyth_file_transfer_open (src->file_transfer, src->uri_name);
-
-  /* sets the Playback monitor connection */
-
-  /* sets the FileTransfer instance connection (video/audio download) */
-
-  if (ret == FALSE) {
-#ifndef GST_DISABLE_GST_DEBUG
-    if (src->mythtv_msgs_dbg)
-      GST_ERROR_OBJECT (src,
-          "MythTV FileTransfer request failed when setting up socket connection!");
-#endif
-    goto begin_req_failed;
-  }
-  src->content_size_last = src->content_size;
-
-  src->content_size = src->file_transfer->filesize;
-  if (src->live_tv) {
-    src->wait_to_transfer = 0;
-    while (src->wait_to_transfer++ < GMYTHTV_TRANSFER_MAX_WAITS &&
-        src->content_size < GMYTHTV_TRANSFER_MAX_BUFFER)
-      src->content_size = gst_mythtv_src_get_position (src);
-  }
-
-  src->read_offset = 0;
-
-  if (src->bytes_queue != NULL) {
-    g_byte_array_free (src->bytes_queue, TRUE);
+  if (src->spawn_livetv != NULL) {
+    g_object_unref (src->spawn_livetv);
+    src->spawn_livetv = NULL;
   }
 
-  src->bytes_queue = g_byte_array_sized_new (INTERNAL_BUFFER_SIZE);
+  GST_ELEMENT_ERROR (src, LIBRARY, INIT,
+      (NULL),
+      ("Could not initialize MythTV library (%i, %s)", ret, src->uri_name));
 
-done:
-  src->update_prog_chain = FALSE;
-
-  GST_PAD_STREAM_UNLOCK (GST_BASE_SRC_PAD (GST_BASE_SRC (src)));
 
-  return TRUE;
+  gst_mythtv_src_clear (src);
 
-  /* ERRORS */
-init_failed:
-  {
-    if (src->spawn_livetv != NULL)
-      g_object_unref (src->spawn_livetv);
-
-    GST_ELEMENT_ERROR (src, LIBRARY, INIT,
-        (NULL), ("Could not initialize MythTV library (%i, %s)", ret,
-            src->uri_name));
-    return FALSE;
-  }
+  return FALSE;
 begin_req_failed:
-  {
-    GST_ELEMENT_ERROR (src, LIBRARY, INIT,
-        (NULL), ("Could not begin request sent to MythTV server (%i, %s)", ret,
-            src->uri_name));
-    return FALSE;
+  if (gmyth_uri != NULL) {
+    g_object_unref (gmyth_uri);
+    gmyth_uri = NULL;
   }
 
+  GST_ELEMENT_ERROR (src, LIBRARY, INIT,
+      (NULL),
+      ("Could not begin request sent to MythTV server (%i, %s)",
+          ret, src->uri_name));
+  return FALSE;
 }
 
 static gboolean
@@ -889,7 +684,8 @@ gst_mythtv_src_get_size (GstBaseSrc * bs
   GstMythtvSrc *src = GST_MYTHTV_SRC (bsrc);
   gboolean ret = TRUE;
 
-  GST_LOG_OBJECT (src, "Differs from previous content size: %d (max.: %d)",
+  GST_LOG_OBJECT (src,
+      "Differs from previous content size: %d (max.: %d)",
       abs (src->content_size - src->prev_content_size),
       GMYTHTV_TRANSFER_MAX_BUFFER);
 
@@ -898,45 +694,31 @@ gst_mythtv_src_get_size (GstBaseSrc * bs
   } else if (src->live_tv && src->enable_timing_position
       && (abs (src->content_size - src->bytes_read) <
           GMYTHTV_TRANSFER_MAX_BUFFER)) {
+    gint64 new_offset;
 
-    gint64 new_offset =
-        gmyth_recorder_get_file_position (src->spawn_livetv->recorder);
+    new_offset = gmyth_recorder_get_file_position (src->spawn_livetv->recorder);
     if (new_offset > 0 && new_offset > src->content_size) {
       src->content_size = new_offset;
     } else if (new_offset < src->content_size) {
       src->update_prog_chain = TRUE;
     }
-
   }
 
   *size = src->content_size;
   GST_LOG_OBJECT (src, "Content size = %lld", src->content_size);
-
   return ret;
-
 }
 
-/* close the socket and associated resources
- * used both to recover from errors and go to NULL state */
+/*
+ * close the socket and associated resources used both to recover from
+ * errors and go to NULL state 
+ */
 static gboolean
 gst_mythtv_src_stop (GstBaseSrc * bsrc)
 {
-  GstMythtvSrc *src;
-
-  src = GST_MYTHTV_SRC (bsrc);
-
-  if (src->uri_name) {
-    g_free (src->uri_name);
-    src->uri_name = NULL;
-  }
-
-  if (src->mythtv_caps) {
-    gst_caps_unref (src->mythtv_caps);
-    src->mythtv_caps = NULL;
-  }
-
-  src->eos = FALSE;
+  GstMythtvSrc *src = GST_MYTHTV_SRC (bsrc);
 
+  gst_mythtv_src_clear (src);
   return TRUE;
 }
 
@@ -945,12 +727,10 @@ gst_mythtv_src_handle_event (GstPad * pa
 {
   GstMythtvSrc *src = GST_MYTHTV_SRC (GST_PAD_PARENT (pad));
   gint64 cont_size = 0;
-  gboolean ret = FALSE;
+  gboolean ret = TRUE;
 
   switch (GST_EVENT_TYPE (event)) {
     case GST_EVENT_EOS:
-      GST_WARNING_OBJECT (src, "Got EOS event");
-
       if (src->live_tv) {
         cont_size = gst_mythtv_src_get_position (src);
         if (cont_size > src->content_size) {
@@ -966,7 +746,7 @@ gst_mythtv_src_handle_event (GstPad * pa
     default:
       ret = gst_pad_event_default (pad, event);
   }
-
+  GST_DEBUG_OBJECT (src, "HANDLE EVENT %d", ret);
   return ret;
 }
 
@@ -983,9 +763,9 @@ gst_mythtv_src_handle_query (GstPad * pa
   GstMythtvSrc *myth = GST_MYTHTV_SRC (gst_pad_get_parent (pad));
   GstFormat formt;
 
+
   switch (GST_QUERY_TYPE (query)) {
     case GST_QUERY_POSITION:
-    {
       gst_query_parse_position (query, &formt, NULL);
       if (formt == GST_FORMAT_BYTES) {
         gst_query_set_position (query, formt, myth->read_offset);
@@ -995,35 +775,21 @@ gst_mythtv_src_handle_query (GstPad * pa
         res = gst_pad_query_default (pad, query);
       }
       break;
-    }
     case GST_QUERY_DURATION:
-    {
-#if 0
-      if (myth->duration != 0) {
-        gint64 total;
-        gint64 fps;
-
-        fps = nuv->h->i_fpsn / nuv->h->i_fpsd;
-        total =
-            gst_util_uint64_scale_int (GST_SECOND, nuv->h->i_video_blocks, fps);
-      }
-#endif
-
       gst_query_parse_duration (query, &formt, NULL);
       if (formt == GST_FORMAT_BYTES) {
-        gst_query_set_duration (query, formt, myth->content_size);
-        GST_DEBUG_OBJECT (myth, "SIZE %" G_GINT64_FORMAT, myth->content_size);
+        gint64 size = myth->content_size;
+
+        gst_query_set_duration (query, GST_FORMAT_BYTES, 10);
+        GST_DEBUG_OBJECT (myth, "SIZE %" G_GINT64_FORMAT, size);
         res = TRUE;
       } else if (formt == GST_FORMAT_TIME) {
         res = gst_pad_query_default (pad, query);
       }
       break;
-    }
     default:
-    {
       res = gst_pad_query_default (pad, query);
       break;
-    }
   }
 
   gst_object_unref (myth);
@@ -1041,11 +807,15 @@ gst_mythtv_src_change_state (GstElement 
     case GST_STATE_CHANGE_NULL_TO_READY:
       break;
     case GST_STATE_CHANGE_READY_TO_PAUSED:
+      if (!src->uri_name) {
+        GST_WARNING_OBJECT (src, "Invalid location");
+        return ret;
+      }
       break;
     case GST_STATE_CHANGE_PAUSED_TO_PLAYING:
       if (src->live_tv) {
-        if (!gmyth_recorder_send_frontend_ready_command (src->spawn_livetv->
-                recorder))
+        if (!gmyth_recorder_send_frontend_ready_command
+            (src->spawn_livetv->recorder))
           GST_WARNING_OBJECT (src,
               "Couldn't send the FRONTEND_READY message to the backend!");
         else
@@ -1057,22 +827,16 @@ gst_mythtv_src_change_state (GstElement 
   }
 
   ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
-  if (ret == GST_STATE_CHANGE_FAILURE)
+  if (ret == GST_STATE_CHANGE_FAILURE) {
     return ret;
+  }
 
   switch (transition) {
     case GST_STATE_CHANGE_READY_TO_NULL:
+      gst_mythtv_src_clear (src);
       break;
     case GST_STATE_CHANGE_PLAYING_TO_PAUSED:
     case GST_STATE_CHANGE_PAUSED_TO_READY:
-      if (src->live_tv) {
-        if (!gmyth_recorder_send_frontend_ready_command (src->spawn_livetv->
-                recorder))
-          GST_WARNING_OBJECT (src,
-              "Couldn't send the FRONTEND_READY message to the backend!");
-        else
-          GST_DEBUG_OBJECT (src, "FRONTEND_READY was sent to the backend");
-      }
       break;
     default:
       break;
@@ -1090,7 +854,6 @@ gst_mythtv_src_set_property (GObject * o
   GST_OBJECT_LOCK (mythtvsrc);
   switch (prop_id) {
     case PROP_LOCATION:
-    {
       if (!g_value_get_string (value)) {
         GST_WARNING ("location property cannot be NULL");
         break;
@@ -1101,40 +864,23 @@ gst_mythtv_src_set_property (GObject * o
         mythtvsrc->uri_name = NULL;
       }
       mythtvsrc->uri_name = g_value_dup_string (value);
-
-      break;
-    }
-#ifndef GST_DISABLE_GST_DEBUG
-    case PROP_GMYTHTV_DBG:
-    {
-      mythtvsrc->mythtv_msgs_dbg = g_value_get_boolean (value);
       break;
-    }
-#endif
     case PROP_GMYTHTV_VERSION:
-    {
       mythtvsrc->mythtv_version = g_value_get_int (value);
       break;
-    }
     case PROP_GMYTHTV_LIVEID:
-    {
       mythtvsrc->live_tv_id = g_value_get_int (value);
       break;
-    }
     case PROP_GMYTHTV_LIVE:
-    {
       mythtvsrc->live_tv = g_value_get_boolean (value);
       break;
-    }
     case PROP_GMYTHTV_ENABLE_TIMING_POSITION:
-    {
       mythtvsrc->enable_timing_position = g_value_get_boolean (value);
       break;
-    }
     case PROP_GMYTHTV_LIVE_CHAINID:
-    {
       if (!g_value_get_string (value)) {
-        GST_WARNING ("MythTV Live chainid property cannot be NULL");
+        GST_WARNING_OBJECT (object,
+            "MythTV Live chainid property cannot be NULL");
         break;
       }
 
@@ -1144,12 +890,9 @@ gst_mythtv_src_set_property (GObject * o
       }
       mythtvsrc->live_chain_id = g_value_dup_string (value);
       break;
-    }
     case PROP_GMYTHTV_CHANNEL_NUM:
-    {
-      mythtvsrc->channel_num = g_value_get_int (value);
+      mythtvsrc->channel_name = g_value_dup_string (value);
       break;
-    }
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
       break;
@@ -1167,33 +910,14 @@ gst_mythtv_src_get_property (GObject * o
   GST_OBJECT_LOCK (mythtvsrc);
   switch (prop_id) {
     case PROP_LOCATION:
-    {
-      gchar *str = g_strdup ("");
-
-      if (mythtvsrc->uri_name == NULL) {
-        g_free (mythtvsrc->uri_name);
-        mythtvsrc->uri_name = NULL;
-      } else {
-        str = g_strdup (mythtvsrc->uri_name);
-      }
-      g_value_set_string (value, str);
+      g_value_set_string (value, mythtvsrc->uri_name);
       break;
-    }
-#ifndef GST_DISABLE_GST_DEBUG
-    case PROP_GMYTHTV_DBG:
-      g_value_set_boolean (value, mythtvsrc->mythtv_msgs_dbg);
-      break;
-#endif
     case PROP_GMYTHTV_VERSION:
-    {
       g_value_set_int (value, mythtvsrc->mythtv_version);
       break;
-    }
     case PROP_GMYTHTV_LIVEID:
-    {
       g_value_set_int (value, mythtvsrc->live_tv_id);
       break;
-    }
     case PROP_GMYTHTV_LIVE:
       g_value_set_boolean (value, mythtvsrc->live_tv);
       break;
@@ -1201,23 +925,11 @@ gst_mythtv_src_get_property (GObject * o
       g_value_set_boolean (value, mythtvsrc->enable_timing_position);
       break;
     case PROP_GMYTHTV_LIVE_CHAINID:
-    {
-      gchar *str = g_strdup ("");
-
-      if (mythtvsrc->live_chain_id == NULL) {
-        g_free (mythtvsrc->live_chain_id);
-        mythtvsrc->live_chain_id = NULL;
-      } else {
-        str = g_strdup (mythtvsrc->live_chain_id);
-      }
-      g_value_set_string (value, str);
+      g_value_set_string (value, mythtvsrc->live_chain_id);
       break;
-    }
     case PROP_GMYTHTV_CHANNEL_NUM:
-    {
-      g_value_set_int (value, mythtvsrc->channel_num);
+      g_value_set_string (value, mythtvsrc->channel_name);
       break;
-    }
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
       break;
@@ -1270,7 +982,8 @@ gst_mythtv_src_uri_set_uri (GstURIHandle
   gchar *protocol;
 
   protocol = gst_uri_get_protocol (uri);
-  if ((strcmp (protocol, "myth") != 0) && (strcmp (protocol, "myths") != 0)) {
+  if ((strcmp (protocol, "myth") != 0)
+      && (strcmp (protocol, "myths") != 0)) {
     g_free (protocol);
     return FALSE;
   }
diff -up gst-plugins-bad-0.10.5/ext/mythtv/gstmythtvsrc.h.cvs gst-plugins-bad-0.10.5/ext/mythtv/gstmythtvsrc.h
--- gst-plugins-bad-0.10.5/ext/mythtv/gstmythtvsrc.h.cvs	2007-01-12 20:02:37.000000000 +0100
+++ gst-plugins-bad-0.10.5/ext/mythtv/gstmythtvsrc.h	2007-09-29 09:30:03.000000000 +0200
@@ -1,20 +1,19 @@
-/* GStreamer
- * Copyright (C) <2006> Rosfran Borges <rosfran.borges at indt.org.br>
+/*
+ * GStreamer
+ * Copyright (C) <2006> INdT - Rosfran Borges <rosfran.borges at indt.org.br>
+ * Copyright (C) <2007> INdT - Rentao Filho <renato.filho at indt.org.br>
  *
- * 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
+ * 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., 59 Temple Place - Suite
+ * 330, Boston, MA 02111-1307, USA.
  */
 
 #ifndef __GST_MYTHTV_SRC_H__
@@ -26,12 +25,13 @@
 #include <stdio.h>
 
 #include <gmyth/gmyth_socket.h>
+#include <gmyth/gmyth_file.h>
 #include <gmyth/gmyth_file_transfer.h>
+#include <gmyth/gmyth_file_local.h>
 #include <gmyth/gmyth_livetv.h>
 #include <gmyth/gmyth_backendinfo.h>
 
 G_BEGIN_DECLS
-
 #define GST_TYPE_MYTHTV_SRC \
   (gst_mythtv_src_get_type())
 #define GST_MYTHTV_SRC(obj) \
@@ -42,90 +42,60 @@ G_BEGIN_DECLS
   (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_MYTHTV_SRC))
 #define GST_IS_MYTHTV_SRC_CLASS(klass) \
   (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_MYTHTV_SRC))
-
 typedef struct _GstMythtvSrc GstMythtvSrc;
 typedef struct _GstMythtvSrcClass GstMythtvSrcClass;
 
-typedef enum { 
+typedef enum {
   GST_MYTHTV_SRC_FILE_TRANSFER,
   GST_MYTHTV_SRC_NEXT_PROGRAM_CHAIN,
   GST_MYTHTV_SRC_INVALID_DATA
 } GstMythtvState;
 
 struct _GstMythtvSrc {
-  GstPushSrc element;
+  GstPushSrc      element;
 
-  /* MythFileTransfer */
-  GMythFileTransfer *file_transfer;
-
-  GMythLiveTV *spawn_livetv;
-  
+  /*
+   * MythFileTransfer 
+   */
+  GMythFile      *file;
+  GMythLiveTV    *spawn_livetv;
   GMythBackendInfo *backend_info;
-
-  GstMythtvState state;
-
-  gchar *uri_name;
-  gchar *user_agent;
-
-  gchar *live_chain_id;
-
-  gint mythtv_version;
-
-  gint64 content_size;
-
-  gint64 prev_content_size;
-
-  gint64 content_size_last;
-
-  guint64 bytes_read;
-
-  gint64 read_offset;
-
-  gint buffer_remain;
-
-  gboolean eos;
-
-  gboolean do_start;
-
-  gboolean unique_setup;
-
-  gboolean live_tv;
-
-  gboolean enable_timing_position;
-
-  gint live_tv_id;
-
-  gint channel_num;  
-
-  guint mode;
-
-  /* MythTV capabilities */
-  GstCaps *mythtv_caps;
-
-  GstPad *sinkpad;
-
-  GStaticRecMutex *th_mutex;
-
-  GByteArray *bytes_queue;
-
-#ifndef GST_DISABLE_GST_DEBUG
-  /* enable Myth TV debug messages */
-  gboolean mythtv_msgs_dbg;
-#endif
-
-  gboolean update_prog_chain;
-
-	/* stablish a maximum iteration value to the IS_RECORDING message */
-	guint wait_to_transfer;
-
+  GstMythtvState  state;
+  gchar          *uri_name;
+  gchar          *user_agent;
+  gchar          *live_chain_id;
+  gint            mythtv_version;
+  gint64          content_size;
+  gint64          prev_content_size;
+  gint64          content_size_last;
+  guint64         bytes_read;
+  gint64          read_offset;
+  gboolean        eos;
+  gboolean        do_start;
+  gboolean        unique_setup;
+  gboolean        live_tv;
+  gboolean        enable_timing_position;
+  gint            live_tv_id;
+  gchar          *channel_name;
+  guint           mode;
+
+  /*
+   * MythTV capabilities 
+   */
+  GstCaps        *mythtv_caps;
+  gboolean        update_prog_chain;
+
+  /*
+   * stablish a maximum iteration value to the IS_RECORDING message 
+   */
+  guint           wait_to_transfer;
 };
 
 struct _GstMythtvSrcClass {
   GstPushSrcClass parent_class;
 };
 
-GType gst_mythtv_src_get_type (void);
+GType           gst_mythtv_src_get_type(void);
 
 G_END_DECLS
-
 #endif /* __GST_MYTHTV_SRC_H__ */


***** Error reading new file: [Errno 2] No such file or directory: 'gstreamer-plugins-bad.spec'

Index: .cvsignore
===================================================================
RCS file: /cvs/free/rpms/gstreamer-plugins-bad/F-8/.cvsignore,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- .cvsignore	22 Jul 2008 16:51:12 -0000	1.1
+++ .cvsignore	24 Jul 2008 09:27:42 -0000	1.2
@@ -0,0 +1 @@
+gst-plugins-bad-0.10.5.tar.bz2


Index: sources
===================================================================
RCS file: /cvs/free/rpms/gstreamer-plugins-bad/F-8/sources,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- sources	22 Jul 2008 16:51:12 -0000	1.1
+++ sources	24 Jul 2008 09:27:42 -0000	1.2
@@ -0,0 +1 @@
+395f3ed705928e77e5620cccf11a8cff  gst-plugins-bad-0.10.5.tar.bz2



More information about the rpmfusion-commits mailing list