Merge branch 'master' into 0.11
authorWim Taymans <wim.taymans@collabora.co.uk>
Thu, 13 Oct 2011 06:58:06 +0000 (08:58 +0200)
committerWim Taymans <wim.taymans@collabora.co.uk>
Thu, 13 Oct 2011 06:58:06 +0000 (08:58 +0200)
Conflicts:
ext/jpeg/gstjpegdec.c
gst/rtp/gstrtpvrawpay.c

ext/jpeg/gstjpegdec.c
gst/matroska/matroska-demux.c
gst/matroska/matroska-mux.c
gst/rtp/gstrtpg722pay.c

index 170435e..dceb7e7 100644 (file)
@@ -92,6 +92,7 @@ static void gst_jpeg_dec_get_property (GObject * object, guint prop_id,
     GValue * value, GParamSpec * pspec);
 
 static GstFlowReturn gst_jpeg_dec_chain (GstPad * pad, GstBuffer * buffer);
+static GstCaps *gst_jpeg_dec_getcaps (GstPad * pad);
 static gboolean gst_jpeg_dec_sink_event (GstPad * pad, GstEvent * event);
 static gboolean gst_jpeg_dec_src_event (GstPad * pad, GstEvent * event);
 static GstStateChangeReturn gst_jpeg_dec_change_state (GstElement * element,
@@ -356,6 +357,8 @@ gst_jpeg_dec_init (GstJpegDec * dec)
       gst_pad_new_from_static_template (&gst_jpeg_dec_sink_pad_template,
       "sink");
   gst_element_add_pad (GST_ELEMENT (dec), dec->sinkpad);
+  gst_pad_set_getcaps_function (dec->sinkpad,
+      GST_DEBUG_FUNCPTR (gst_jpeg_dec_getcaps));
   gst_pad_set_chain_function (dec->sinkpad,
       GST_DEBUG_FUNCPTR (gst_jpeg_dec_chain));
   gst_pad_set_event_function (dec->sinkpad,
@@ -717,6 +720,50 @@ gst_jpeg_dec_setcaps (GstJpegDec * dec, GstCaps * caps)
   return TRUE;
 }
 
+static GstCaps *
+gst_jpeg_dec_getcaps (GstPad * pad, GstCaps * filter)
+{
+  GstJpegDec *dec;
+  GstCaps *caps;
+  GstPad *peer;
+
+  dec = GST_JPEG_DEC (GST_OBJECT_PARENT (pad));
+
+  if (GST_PAD_CAPS (pad))
+    return gst_caps_ref (GST_PAD_CAPS (pad));
+
+  peer = gst_pad_get_peer (dec->srcpad);
+
+  if (peer) {
+    GstCaps *peer_caps;
+    const GstCaps *templ_caps;
+    GstStructure *s;
+    guint i, n;
+
+    peer_caps = gst_pad_get_caps (peer, filter);
+
+    /* Translate peercaps to image/jpeg */
+    peer_caps = gst_caps_make_writable (peer_caps);
+    n = gst_caps_get_size (peer_caps);
+    for (i = 0; i < n; i++) {
+      s = gst_caps_get_structure (peer_caps, i);
+
+      gst_structure_set_name (s, "image/jpeg");
+    }
+
+    templ_caps = gst_pad_get_pad_template_caps (pad);
+    caps = gst_caps_intersect_full (peer_caps, templ_caps,
+        GST_CAPS_INTERSECT_FIRST);
+
+    gst_object_unref (peer);
+  } else {
+    caps = gst_caps_copy (gst_pad_get_pad_template_caps (pad));
+  }
+
+  return caps;
+}
+
+
 /* yuk */
 static void
 hresamplecpy1 (guint8 * dest, const guint8 * src, guint len)
index 4eced58..eaa6dfd 100644 (file)
@@ -1962,8 +1962,8 @@ gst_matroska_demux_handle_seek_event (GstMatroskaDemux * demux,
         entry->pos + demux->common.ebml_segment_start);
   }
 
-  flush = !!(flags & GST_SEEK_FLAG_FLUSH);
-  keyunit = !!(flags & GST_SEEK_FLAG_KEY_UNIT);
+  flush = ! !(flags & GST_SEEK_FLAG_FLUSH);
+  keyunit = ! !(flags & GST_SEEK_FLAG_KEY_UNIT);
 
   if (flush) {
     GST_DEBUG_OBJECT (demux, "Starting flush");
@@ -5266,6 +5266,7 @@ gst_matroska_demux_audio_caps (GstMatroskaTrackAudioContext *
           "framed", G_TYPE_BOOLEAN, TRUE, NULL);
       gst_caps_set_simple (caps, "codec_data", GST_TYPE_BUFFER, priv, NULL);
       *codec_name = g_strdup_printf ("MPEG-%d AAC audio", mpegversion);
+      gst_buffer_unref (priv);
     }
   } else if (!strcmp (codec_id, GST_MATROSKA_CODEC_ID_AUDIO_TTA)) {
     caps = gst_caps_new_simple ("audio/x-tta",
index 2398d78..b0ff579 100644 (file)
@@ -658,12 +658,18 @@ gst_matroska_mux_handle_sink_event (GstPad * pad, GstEvent * event)
       event = NULL;
       break;
     }
-    case GST_EVENT_NEWSEGMENT:
-      /* We don't support NEWSEGMENT events */
-      ret = FALSE;
-      gst_event_unref (event);
-      event = NULL;
+    case GST_EVENT_NEWSEGMENT:{
+      GstFormat format;
+
+      gst_event_parse_new_segment (event, NULL, NULL, &format, NULL, NULL,
+          NULL);
+      if (format != GST_FORMAT_TIME) {
+        ret = FALSE;
+        gst_event_unref (event);
+        event = NULL;
+      }
       break;
+    }
     case GST_EVENT_CUSTOM_DOWNSTREAM:{
       const GstStructure *structure;
 
@@ -2491,6 +2497,10 @@ gst_matroska_mux_best_pad (GstMatroskaMux * mux, gboolean * popped)
             collect_pad->buffer = NULL;
             return NULL;
           } else {
+            GST_LOG_OBJECT (mux, "buffer ts %" GST_TIME_FORMAT " -> %"
+                GST_TIME_FORMAT " running time",
+                GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (collect_pad->buffer)),
+                GST_TIME_ARGS (time));
             collect_pad->buffer =
                 gst_buffer_make_metadata_writable (collect_pad->buffer);
             GST_BUFFER_TIMESTAMP (collect_pad->buffer) = time;
index 362e4bc..d07abfe 100644 (file)
@@ -157,9 +157,11 @@ gst_rtp_g722_pay_setcaps (GstBaseRTPPayload * basepayload, GstCaps * caps)
   rtpg722pay->rate = rate;
   rtpg722pay->channels = channels;
 
-  /* octet-per-sample is 1 * channels for G722 */
+  /* bits-per-sample is 4 * channels for G722, but as the RTP clock runs at
+   * half speed (8 instead of 16 khz), pretend it's 8 bits per sample
+   * channels. */
   gst_base_rtp_audio_payload_set_samplebits_options (basertpaudiopayload,
-      4 * rtpg722pay->channels);
+      8 * rtpg722pay->channels);
 
   return res;