ext/faad/gstfaad.c: Set DURATION even if source buffer didn't. Also use increasing timestamps.

Original commit message from CVS:
* ext/faad/gstfaad.c: (gst_faad_chanpos_from_gst),
(gst_faad_chanpos_to_gst), (gst_faad_chain):
Set DURATION even if source buffer didn't. Also use increasing
timestamps.
* gst-libs/gst/riff/riff-media.c:
(gst_riff_create_audio_caps_with_data):
Block_align can have larger values than 8192.
diff --git a/ChangeLog b/ChangeLog
index 8b45a97..332e9f2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2004-12-03  Ronald S. Bultje  <rbultje@ronald.bitfreak.net>
+
+	* ext/faad/gstfaad.c: (gst_faad_chanpos_from_gst),
+	(gst_faad_chanpos_to_gst), (gst_faad_chain):
+	  Set DURATION even if source buffer didn't. Also use increasing
+	  timestamps.
+	* gst-libs/gst/riff/riff-media.c:
+	(gst_riff_create_audio_caps_with_data):
+	  Block_align can have larger values than 8192.
+
 2004-12-02  Ronald S. Bultje  <rbultje@ronald.bitfreak.net>
 
 	* gst/law/alaw-decode.c: (alawdec_getcaps), (alawdec_link):
diff --git a/ext/faad/gstfaad.c b/ext/faad/gstfaad.c
index aa03a4e..c5b900c 100644
--- a/ext/faad/gstfaad.c
+++ b/ext/faad/gstfaad.c
@@ -192,6 +192,7 @@
         fpos[n] = FRONT_CHANNEL_RIGHT;
         break;
       case GST_AUDIO_CHANNEL_POSITION_FRONT_CENTER:
+      case GST_AUDIO_CHANNEL_POSITION_FRONT_MONO:
         fpos[n] = FRONT_CHANNEL_CENTER;
         break;
       case GST_AUDIO_CHANNEL_POSITION_SIDE_LEFT:
@@ -238,7 +239,11 @@
         pos[n] = GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT;
         break;
       case FRONT_CHANNEL_CENTER:
-        pos[n] = GST_AUDIO_CHANNEL_POSITION_FRONT_CENTER;
+        /* argh, mono = center */
+        if (num == 1)
+          pos[n] = GST_AUDIO_CHANNEL_POSITION_FRONT_MONO;
+        else
+          pos[n] = GST_AUDIO_CHANNEL_POSITION_FRONT_CENTER;
         break;
       case SIDE_CHANNEL_LEFT:
         pos[n] = GST_AUDIO_CHANNEL_POSITION_SIDE_LEFT;
@@ -539,6 +544,7 @@
   GstFaad *faad = GST_FAAD (gst_pad_get_parent (pad));
   GstBuffer *buf, *outbuf;
   faacDecFrameInfo *info;
+  guint64 next_ts;
   void *out;
 
   if (GST_IS_EVENT (data)) {
@@ -563,6 +569,7 @@
 
   /* buffer + remaining data */
   buf = GST_BUFFER (data);
+  next_ts = GST_BUFFER_TIMESTAMP (buf);
   if (faad->tempbuf) {
     buf = gst_buffer_join (faad->tempbuf, buf);
     faad->tempbuf = NULL;
@@ -644,9 +651,10 @@
         outbuf = gst_buffer_new_and_alloc (info->samples * faad->bps);
         /* ugh */
         memcpy (GST_BUFFER_DATA (outbuf), out, GST_BUFFER_SIZE (outbuf));
-        GST_BUFFER_TIMESTAMP (outbuf) = GST_BUFFER_TIMESTAMP (buf);
-        GST_BUFFER_DURATION (outbuf) = GST_BUFFER_DURATION (buf);
-
+        GST_BUFFER_TIMESTAMP (outbuf) = next_ts;
+        GST_BUFFER_DURATION (outbuf) =
+            (guint64) GST_SECOND *info->samples / faad->samplerate;
+        next_ts += GST_BUFFER_DURATION (outbuf);
         gst_pad_push (faad->srcpad, GST_DATA (outbuf));
       }
     }
diff --git a/gst-libs/gst/riff/riff-media.c b/gst-libs/gst/riff/riff-media.c
index 99aa9a0..4e4e22d 100644
--- a/gst-libs/gst/riff/riff-media.c
+++ b/gst-libs/gst/riff/riff-media.c
@@ -514,7 +514,7 @@
     }
     if (block_align) {
       gst_caps_set_simple (caps,
-          "block_align", GST_TYPE_INT_RANGE, 1, 8192, NULL);
+          "block_align", GST_TYPE_INT_RANGE, 1, G_MAXINT, NULL);
     }
   }