Imported Upstream version 0.11.94
diff --git a/gst/asfdemux/gstasfdemux.c b/gst/asfdemux/gstasfdemux.c
index eb41a50..caa4d3c 100644
--- a/gst/asfdemux/gstasfdemux.c
+++ b/gst/asfdemux/gstasfdemux.c
@@ -300,7 +300,8 @@
     goto activate_push;
   }
 
-  pull_mode = gst_query_has_scheduling_mode (query, GST_PAD_MODE_PULL);
+  pull_mode = gst_query_has_scheduling_mode_with_flags (query,
+      GST_PAD_MODE_PULL, GST_SCHEDULING_FLAG_SEEKABLE);
   gst_query_unref (query);
 
   if (!pull_mode)
diff --git a/gst/dvdsub/gstdvdsubdec.c b/gst/dvdsub/gstdvdsubdec.c
index 90543b1..a097e99 100644
--- a/gst/dvdsub/gstdvdsubdec.c
+++ b/gst/dvdsub/gstdvdsubdec.c
@@ -60,7 +60,7 @@
 static GstStaticPadTemplate subtitle_template = GST_STATIC_PAD_TEMPLATE ("sink",
     GST_PAD_SINK,
     GST_PAD_ALWAYS,
-    GST_STATIC_CAPS ("video/x-dvd-subpicture")
+    GST_STATIC_CAPS ("subpicture/x-dvd")
     );
 
 GST_DEBUG_CATEGORY_STATIC (gst_dvd_sub_dec_debug);
@@ -664,16 +664,11 @@
 gst_send_empty_fill (GstDvdSubDec * dec, GstClockTime ts)
 {
   if (dec->next_ts < ts) {
-    GstSegment seg;
-
-    GST_LOG_OBJECT (dec, "Sending newsegment update to advance time to %"
+    GST_LOG_OBJECT (dec, "Sending GAP event update to advance time to %"
         GST_TIME_FORMAT, GST_TIME_ARGS (ts));
 
-    gst_segment_init (&seg, GST_FORMAT_TIME);
-    seg.start = ts;
-    seg.time = ts;
-
-    gst_pad_push_event (dec->srcpad, gst_event_new_segment (&seg));
+    gst_pad_push_event (dec->srcpad,
+        gst_event_new_gap (dec->next_ts, ts - dec->next_ts));
   }
   dec->next_ts = ts;
 }
@@ -686,7 +681,7 @@
   GstVideoFrame frame;
   guint8 *data;
   gint x, y;
-  static GstAllocationParams params = { 0, 0, 0, 3, };
+  static GstAllocationParams params = { 0, 3, 0, 0, };
 
   g_assert (dec->have_title);
   g_assert (dec->next_ts <= end_ts);
@@ -971,34 +966,41 @@
       ret = gst_pad_event_default (pad, parent, event);
       break;
     }
+    case GST_EVENT_GAP:
+    {
+      GstClockTime start, duration;
+
+      gst_event_parse_gap (event, &start, &duration);
+      if (GST_CLOCK_TIME_IS_VALID (start)) {
+        if (GST_CLOCK_TIME_IS_VALID (duration))
+          start += duration;
+        /* we do not expect another buffer until after gap,
+         * so that is our position now */
+        GST_DEBUG_OBJECT (dec, "Got GAP event, advancing time from %"
+            GST_TIME_FORMAT " to %" GST_TIME_FORMAT,
+            GST_TIME_ARGS (dec->next_ts), GST_TIME_ARGS (start));
+
+        gst_dvd_sub_dec_advance_time (dec, start);
+      } else {
+        GST_WARNING_OBJECT (dec, "Got GAP event with invalid position");
+      }
+
+      gst_event_unref (event);
+      ret = TRUE;
+      break;
+    }
     case GST_EVENT_SEGMENT:
     {
       GstSegment seg;
 
       gst_event_copy_segment (event, &seg);
 
-#if 0
-      if (update) {
-        /* update ... advance time */
-        if (GST_CLOCK_TIME_IS_VALID (pos)) {
-          GST_DEBUG_OBJECT (dec, "Got segment update, advancing time from %"
-              GST_TIME_FORMAT " to %" GST_TIME_FORMAT,
-              GST_TIME_ARGS (dec->next_ts), GST_TIME_ARGS (pos));
-
-          gst_dvd_sub_dec_advance_time (dec, pos);
-        } else {
-          GST_WARNING_OBJECT (dec, "Got segment update with invalid position");
-        }
-        gst_event_unref (event);
-        ret = TRUE;
-      } else
-#endif
       {
-        /* not just an update ... */
-
+#if 0
         /* Turn off forced highlight display */
-        // dec->forced_display = 0;
-        // dec->current_button = 0;
+        dec->forced_display = 0;
+        dec->current_button = 0;
+#endif
         if (dec->partialbuf) {
           gst_buffer_unmap (dec->partialbuf, &dec->partialmap);
           gst_buffer_unref (dec->partialbuf);
diff --git a/gst/dvdsub/gstdvdsubparse.c b/gst/dvdsub/gstdvdsubparse.c
index 942bce6..44e2aa1 100644
--- a/gst/dvdsub/gstdvdsubparse.c
+++ b/gst/dvdsub/gstdvdsubparse.c
@@ -31,13 +31,13 @@
 static GstStaticPadTemplate src_template = GST_STATIC_PAD_TEMPLATE ("src",
     GST_PAD_SRC,
     GST_PAD_ALWAYS,
-    GST_STATIC_CAPS ("video/x-dvd-subpicture, parsed=(boolean)true")
+    GST_STATIC_CAPS ("subpicture/x-dvd, parsed=(boolean)true")
     );
 
 static GstStaticPadTemplate sink_template = GST_STATIC_PAD_TEMPLATE ("sink",
     GST_PAD_SINK,
     GST_PAD_ALWAYS,
-    GST_STATIC_CAPS ("video/x-dvd-subpicture")
+    GST_STATIC_CAPS ("subpicture/x-dvd")
     );
 
 static void gst_dvd_sub_parse_finalize (GObject * object);
diff --git a/gst/realmedia/rademux.c b/gst/realmedia/rademux.c
index 91fbc08..95ec6ed 100644
--- a/gst/realmedia/rademux.c
+++ b/gst/realmedia/rademux.c
@@ -189,7 +189,8 @@
     goto activate_push;
   }
 
-  pull_mode = gst_query_has_scheduling_mode (query, GST_PAD_MODE_PULL);
+  pull_mode = gst_query_has_scheduling_mode_with_flags (query,
+      GST_PAD_MODE_PULL, GST_SCHEDULING_FLAG_SEEKABLE);
   gst_query_unref (query);
 
   if (!pull_mode)
@@ -365,7 +366,8 @@
       demux->fourcc = GST_READ_UINT32_LE (data + 56);
       demux->pending_tags = gst_rm_utils_read_tags (data + 63,
           demux->data_offset - 63, gst_rm_utils_read_string8);
-      gst_tag_list_set_scope (demux->pending_tags, GST_TAG_SCOPE_GLOBAL);
+      if (demux->pending_tags)
+        gst_tag_list_set_scope (demux->pending_tags, GST_TAG_SCOPE_GLOBAL);
       break;
     default:
       g_assert_not_reached ();
diff --git a/gst/realmedia/rmdemux.c b/gst/realmedia/rmdemux.c
index 8624339..4252940 100644
--- a/gst/realmedia/rmdemux.c
+++ b/gst/realmedia/rmdemux.c
@@ -753,7 +753,8 @@
     goto activate_push;
   }
 
-  pull_mode = gst_query_has_scheduling_mode (query, GST_PAD_MODE_PULL);
+  pull_mode = gst_query_has_scheduling_mode_with_flags (query,
+      GST_PAD_MODE_PULL, GST_SCHEDULING_FLAG_SEEKABLE);
   gst_query_unref (query);
 
   if (!pull_mode)
@@ -962,7 +963,11 @@
   GstRMDemux *rmdemux = GST_RMDEMUX (parent);
 
   if (rmdemux->base_ts == -1) {
-    rmdemux->base_ts = GST_BUFFER_TIMESTAMP (buffer);
+    if (GST_BUFFER_DTS_IS_VALID (buffer))
+      rmdemux->base_ts = GST_BUFFER_DTS (buffer);
+    else
+      rmdemux->base_ts = GST_BUFFER_PTS (buffer);
+
     GST_LOG_OBJECT (rmdemux, "base_ts %" GST_TIME_FORMAT,
         GST_TIME_ARGS (rmdemux->base_ts));
   }
@@ -1946,8 +1951,10 @@
 
     gst_buffer_map (b, &map, GST_MAP_READ);
 
-    if (p == 0)
-      GST_BUFFER_TIMESTAMP (outbuf) = GST_BUFFER_TIMESTAMP (b);
+    if (p == 0) {
+      GST_BUFFER_PTS (outbuf) = GST_BUFFER_PTS (b);
+      GST_BUFFER_DTS (outbuf) = GST_BUFFER_DTS (b);
+    }
 
     for (x = 0; x < packet_size / leaf_size; ++x) {
       guint idx;
@@ -1970,8 +1977,9 @@
         gst_buffer_copy_region (outbuf, GST_BUFFER_COPY_ALL, p * packet_size,
         packet_size);
 
-    GST_LOG_OBJECT (rmdemux, "pushing buffer timestamp %" GST_TIME_FORMAT,
-        GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (subbuf)));
+    GST_LOG_OBJECT (rmdemux, "pushing buffer dts %" GST_TIME_FORMAT ", pts %"
+        GST_TIME_FORMAT, GST_TIME_ARGS (GST_BUFFER_DTS (subbuf)),
+        GST_TIME_ARGS (GST_BUFFER_PTS (subbuf)));
 
     if (stream->discont) {
       GST_BUFFER_FLAG_SET (subbuf, GST_BUFFER_FLAG_DISCONT);
@@ -2026,7 +2034,7 @@
   g_ptr_array_set_size (stream->subpackets, 0);
 
   gst_buffer_map (buf, &map, GST_MAP_READ);
-  timestamp = GST_BUFFER_TIMESTAMP (buf);
+  timestamp = GST_BUFFER_PTS (buf);
 
   frames = (map.data[1] & 0xf0) >> 4;
   index = 2 * frames + 2;
@@ -2035,8 +2043,10 @@
     guint len = (map.data[i * 2 + 2] << 8) | map.data[i * 2 + 3];
 
     outbuf = gst_buffer_copy_region (buf, GST_BUFFER_COPY_ALL, index, len);
-    if (i == 0)
-      GST_BUFFER_TIMESTAMP (outbuf) = timestamp;
+    if (i == 0) {
+      GST_BUFFER_PTS (outbuf) = timestamp;
+      GST_BUFFER_DTS (outbuf) = timestamp;
+    }
 
     index += len;
 
@@ -2075,15 +2085,18 @@
   for (p = 0; p < height; ++p) {
     GstBuffer *b = g_ptr_array_index (stream->subpackets, p);
 
-    if (p == 0)
-      GST_BUFFER_TIMESTAMP (outbuf) = GST_BUFFER_TIMESTAMP (b);
+    if (p == 0) {
+      GST_BUFFER_DTS (outbuf) = GST_BUFFER_DTS (b);
+      GST_BUFFER_PTS (outbuf) = GST_BUFFER_PTS (b);
+    }
 
     gst_buffer_extract (b, 0, outmap.data + packet_size * p, packet_size);
   }
   gst_buffer_unmap (outbuf, &outmap);
 
-  GST_LOG_OBJECT (rmdemux, "pushing buffer timestamp %" GST_TIME_FORMAT,
-      GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (outbuf)));
+  GST_LOG_OBJECT (rmdemux, "pushing buffer dts %" GST_TIME_FORMAT ", pts %"
+      GST_TIME_FORMAT, GST_TIME_ARGS (GST_BUFFER_DTS (outbuf)),
+      GST_TIME_ARGS (GST_BUFFER_PTS (outbuf)));
 
   if (stream->discont) {
     GST_BUFFER_FLAG_SET (outbuf, GST_BUFFER_FLAG_DISCONT);
@@ -2146,136 +2159,6 @@
   return ret;
 }
 
-static GstClockTime
-gst_rmdemux_fix_timestamp (GstRMDemux * rmdemux, GstRMDemuxStream * stream,
-    guint8 * data, GstClockTime timestamp)
-{
-  guint8 frame_type;
-  guint16 seq;
-  GstClockTime ts = timestamp;
-
-  if (timestamp == GST_CLOCK_TIME_NONE)
-    goto done;
-
-  /* only adjust when we have a stream with B frames */
-  if (stream->format < 0x20200002)
-    goto done;
-
-  /* Fix timestamp. */
-  switch (stream->fourcc) {
-    case GST_RM_VDO_RV10:
-      goto done;
-    case GST_RM_VDO_RV20:
-    {
-      /*
-       * Bit  1- 2: frame type
-       * Bit  3- 9: ?
-       * Bit 10-22: sequence number
-       * Bit 23-32: ?
-       */
-      frame_type = (data[0] >> 6) & 0x03;
-      seq = ((data[1] & 0x7f) << 6) + ((data[2] & 0xfc) >> 2);
-      break;
-    }
-    case GST_RM_VDO_RV30:
-    {
-      /*
-       * Bit  1- 2: ?
-       * Bit     3: skip packet if 1
-       * Bit  4- 5: frame type
-       * Bit  6-12: ?
-       * Bit 13-25: sequence number
-       * Bit 26-32: ?
-       */
-      frame_type = (data[0] >> 3) & 0x03;
-      seq = ((data[1] & 0x0f) << 9) + (data[2] << 1) + ((data[3] & 0x80) >> 7);
-      break;
-    }
-    case GST_RM_VDO_RV40:
-    {
-      /*
-       * Bit     1: skip packet if 1
-       * Bit  2- 3: frame type
-       * Bit  4-13: ?
-       * Bit 14-26: sequence number
-       * Bit 27-32: ?
-       */
-      frame_type = (data[0] >> 5) & 0x03;
-      seq = ((data[1] & 0x07) << 10) + (data[2] << 2) + ((data[3] & 0xc0) >> 6);
-      break;
-    }
-    default:
-      goto unknown_version;
-  }
-
-  switch (frame_type) {
-    case 0:
-    case 1:
-    {
-      GST_LOG_OBJECT (rmdemux, "I frame %d", frame_type);
-      /* I frame */
-      if (stream->next_ts == -1)
-        stream->next_ts = timestamp;
-      else
-        timestamp = stream->next_ts;
-      stream->last_ts = stream->next_ts;
-      stream->next_ts = ts;
-      stream->last_seq = stream->next_seq;
-      stream->next_seq = seq;
-      break;
-    }
-    case 2:
-    {
-      GST_LOG_OBJECT (rmdemux, "P frame");
-      /* P frame */
-      timestamp = stream->last_ts = stream->next_ts;
-      if (seq < stream->next_seq)
-        stream->next_ts += (seq + 0x2000 - stream->next_seq) * GST_MSECOND;
-      else
-        stream->next_ts += (seq - stream->next_seq) * GST_MSECOND;
-      stream->last_seq = stream->next_seq;
-      stream->next_seq = seq;
-      break;
-    }
-    case 3:
-    {
-      GST_LOG_OBJECT (rmdemux, "B frame");
-      /* B frame */
-      if (seq < stream->last_seq) {
-        timestamp =
-            (seq + 0x2000 - stream->last_seq) * GST_MSECOND + stream->last_ts;
-      } else {
-        timestamp = (seq - stream->last_seq) * GST_MSECOND + stream->last_ts;
-      }
-      break;
-    }
-    default:
-      goto unknown_frame_type;
-  }
-
-done:
-  GST_LOG_OBJECT (rmdemux,
-      "timestamp %" GST_TIME_FORMAT " -> %" GST_TIME_FORMAT, GST_TIME_ARGS (ts),
-      GST_TIME_ARGS (timestamp));
-
-  return timestamp;
-
-  /* Errors */
-unknown_version:
-  {
-    GST_ELEMENT_ERROR (rmdemux, STREAM, DECODE,
-        ("Unknown version: %i.", stream->version), (NULL));
-    return GST_FLOW_ERROR;
-  }
-
-unknown_frame_type:
-  {
-    GST_ELEMENT_ERROR (rmdemux, STREAM, DECODE, ("Unknown frame type %d.",
-            frame_type), (NULL));
-    return GST_FLOW_ERROR;
-  }
-}
-
 #define PARSE_NUMBER(data, size, number, label) \
 G_STMT_START {                                  \
   if (size < 2)                                 \
@@ -2458,12 +2341,11 @@
         if (rmdemux->base_ts != -1)
           timestamp += rmdemux->base_ts;
       }
-      timestamp =
-          gst_rmdemux_fix_timestamp (rmdemux, stream, outdata, timestamp);
-
       gst_buffer_unmap (out, &outmap);
 
-      GST_BUFFER_TIMESTAMP (out) = timestamp;
+      /* video has DTS */
+      GST_BUFFER_DTS (out) = timestamp;
+      GST_BUFFER_PTS (out) = GST_CLOCK_TIME_NONE;
 
       GST_LOG_OBJECT (rmdemux, "pushing timestamp %" GST_TIME_FORMAT,
           GST_TIME_ARGS (timestamp));
@@ -2531,7 +2413,8 @@
   if (rmdemux->base_ts != -1)
     timestamp += rmdemux->base_ts;
 
-  GST_BUFFER_TIMESTAMP (buffer) = timestamp;
+  GST_BUFFER_PTS (buffer) = timestamp;
+  GST_BUFFER_DTS (buffer) = timestamp;
 
   if (stream->needs_descrambling) {
     GST_LOG_OBJECT (rmdemux, "descramble timestamp %" GST_TIME_FORMAT,
diff --git a/gst/xingmux/gstxingmux.c b/gst/xingmux/gstxingmux.c
index 8e7ff58..a05b075 100644
--- a/gst/xingmux/gstxingmux.c
+++ b/gst/xingmux/gstxingmux.c
@@ -285,8 +285,6 @@
   }
 
   xing_header = gst_buffer_new_and_alloc (size);
-  // TODO set caps
-//  gst_buffer_set_caps (xing_header, GST_PAD_CAPS (xing->srcpad));
 
   gst_buffer_map (xing_header, &map, GST_MAP_WRITE);
   data = map.data;