Merge branch 'master' into 0.11
authorWim Taymans <wim.taymans@collabora.co.uk>
Mon, 3 Oct 2011 08:11:19 +0000 (10:11 +0200)
committerWim Taymans <wim.taymans@collabora.co.uk>
Mon, 3 Oct 2011 08:11:19 +0000 (10:11 +0200)
Conflicts:
ext/pango/gsttextoverlay.c
gst/encoding/gstencodebin.c

1  2 
gst/encoding/gstencodebin.c

@@@ -230,8 -230,11 +230,8 @@@ struct _StreamGrou
  #define DEFAULT_FLAGS              0
  
  #define DEFAULT_RAW_CAPS                      \
 -  "video/x-raw-yuv; "                         \
 -  "video/x-raw-rgb; "                         \
 -  "video/x-raw-gray; "                                \
 -  "audio/x-raw-int; "                         \
 -  "audio/x-raw-float; "                               \
 +  "video/x-raw; "                             \
 +  "audio/x-raw; "                             \
    "text/plain; "                              \
    "text/x-pango-markup; "                     \
    "video/x-dvd-subpicture; "                  \
@@@ -341,7 -344,7 +341,7 @@@ gst_encode_bin_class_init (GstEncodeBin
     * to %GST_STATE_PAUSED or higher.
     */
    g_object_class_install_property (gobject_klass, PROP_PROFILE,
 -      gst_param_spec_mini_object ("profile", "Profile",
 +      g_param_spec_object ("profile", "Profile",
            "The GstEncodingProfile to use", GST_TYPE_ENCODING_PROFILE,
            G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
  
  
    gstelement_klass->change_state =
        GST_DEBUG_FUNCPTR (gst_encode_bin_change_state);
 -  gstelement_klass->request_new_pad_full =
 +  gstelement_klass->request_new_pad =
        GST_DEBUG_FUNCPTR (gst_encode_bin_request_new_pad);
    gstelement_klass->release_pad =
        GST_DEBUG_FUNCPTR (gst_encode_bin_release_pad);
@@@ -480,8 -483,10 +480,8 @@@ gst_encode_bin_init (GstEncodeBin * enc
        gst_element_factory_list_get_elements (GST_ELEMENT_FACTORY_TYPE_PARSER,
        GST_RANK_MARGINAL);
  
 -  encode_bin->raw_video_caps =
 -      gst_caps_from_string ("video/x-raw-yuv;video/x-raw-rgb;video/x-raw-gray");
 -  encode_bin->raw_audio_caps =
 -      gst_caps_from_string ("audio/x-raw-int;audio/x-raw-float");
 +  encode_bin->raw_video_caps = gst_caps_from_string ("video/x-raw");
 +  encode_bin->raw_audio_caps = gst_caps_from_string ("audio/x-raw");
    /* encode_bin->raw_text_caps = */
    /*     gst_caps_from_string ("text/plain;text/x-pango-markup"); */
  
@@@ -507,7 -512,7 +507,7 @@@ gst_encode_bin_set_property (GObject * 
    switch (prop_id) {
      case PROP_PROFILE:
        gst_encode_bin_set_profile (ebin,
 -          (GstEncodingProfile *) gst_value_get_mini_object (value));
 +          (GstEncodingProfile *) g_value_get_object (value));
        break;
      case PROP_QUEUE_BUFFERS_MAX:
        ebin->queue_buffers_max = g_value_get_uint (value);
@@@ -541,7 -546,7 +541,7 @@@ gst_encode_bin_get_property (GObject * 
  
    switch (prop_id) {
      case PROP_PROFILE:
 -      gst_value_set_mini_object (value, (GstMiniObject *) ebin->profile);
 +      g_value_set_object (value, (GObject *) ebin->profile);
        break;
      case PROP_QUEUE_BUFFERS_MAX:
        g_value_set_uint (value, ebin->queue_buffers_max);
@@@ -818,12 -823,13 +818,12 @@@ _create_element_and_set_preset (GstElem
  {
    GstElement *res = NULL;
  
 -  GST_DEBUG ("Creating element from factory %s",
 -      GST_PLUGIN_FEATURE_NAME (factory));
 +  GST_DEBUG ("Creating element from factory %s", GST_OBJECT_NAME (factory));
    res = gst_element_factory_create (factory, name);
    if (preset && GST_IS_PRESET (res) &&
        !gst_preset_load_preset (GST_PRESET (res), preset)) {
      GST_WARNING ("Couldn't set preset [%s] on element [%s]",
 -        preset, GST_PLUGIN_FEATURE_NAME (factory));
 +        preset, GST_OBJECT_NAME (factory));
      gst_object_unref (res);
      res = NULL;
    }
@@@ -876,7 -882,7 +876,7 @@@ beach
  
  static GstPad *
  local_element_request_pad (GstElement * element, GstPadTemplate * templ,
 -    const gchar * name)
 +    const gchar * name, const GstCaps * caps)
  {
    GstPad *newpad = NULL;
    GstElementClass *oclass;
    oclass = GST_ELEMENT_GET_CLASS (element);
  
    if (oclass->request_new_pad)
 -    newpad = (oclass->request_new_pad) (element, templ, name);
 +    newpad = (oclass->request_new_pad) (element, templ, name, caps);
  
    if (newpad)
      gst_object_ref (newpad);
@@@ -925,7 -931,7 +925,7 @@@ gst_element_get_pad_from_template (GstE
  /* FIXME : Improve algorithm for finding compatible muxer sink pad */
  static inline GstPad *
  get_compatible_muxer_sink_pad (GstEncodeBin * ebin, GstElement * encoder,
 -    const GstCaps * sinkcaps)
 +    GstCaps * sinkcaps)
  {
    GstPad *sinkpad;
    GstPadTemplate *srctempl = NULL;
  
      gst_object_unref (srcpad);
      sinktempl = gst_element_get_compatible_pad_template (ebin->muxer, srctempl);
 +    gst_object_unref (srctempl);
    } else {
      srctempl =
          gst_pad_template_new ("whatever", GST_PAD_SRC, GST_PAD_ALWAYS,
 -        gst_caps_copy (sinkcaps));
 +        sinkcaps);
      g_assert (srctempl != NULL);
      sinktempl = gst_element_get_compatible_pad_template (ebin->muxer, srctempl);
      g_object_unref (srctempl);
@@@ -971,12 -976,10 +971,12 @@@ static gboolea
  _has_class (GstElement * element, const gchar * classname)
  {
    GstElementClass *klass;
 +  const gchar *value;
  
    klass = GST_ELEMENT_GET_CLASS (element);
 +  value = gst_element_class_get_metadata (klass, GST_ELEMENT_METADATA_KLASS);
  
 -  return strstr (klass->details.klass, classname) != NULL;
 +  return strstr (value, classname) != NULL;
  }
  
  /* FIXME : Add handling of streams that don't need encoding  */
@@@ -995,7 -998,8 +995,7 @@@ _create_stream_group (GstEncodeBin * eb
    /* Element we will link to the encoder */
    GstElement *last = NULL;
    GList *tmp, *tosync = NULL;
 -  const GstCaps *format;
 -  const GstCaps *restriction;
 +  GstCaps *format, *restriction;
    const gchar *missing_element_name;
  
    format = gst_encoding_profile_get_format (sprof);
     * If we have no muxer or
     * if the muxer isn't a formatter and doesn't implement the tagsetter interface
     */
 -  if (!ebin->muxer
 -      || (!gst_element_implements_interface (ebin->muxer, GST_TYPE_TAG_SETTER)
 +  if (!ebin->muxer || (!GST_IS_TAG_SETTER (ebin->muxer)
-           || !_has_class (ebin->muxer, "Formatter"))) {
+           && !_has_class (ebin->muxer, "Formatter"))) {
      sgroup->formatter = _get_formatter (ebin, sprof);
      if (sgroup->formatter) {
        GST_DEBUG ("Adding formatter for %" GST_PTR_FORMAT, format);
  
    /* Path 1 : Already-encoded data */
    sinkpad =
 -      local_element_request_pad (sgroup->combiner, NULL, "passthroughsink");
 +      local_element_request_pad (sgroup->combiner, NULL, "passthroughsink",
 +      NULL);
    if (G_UNLIKELY (sinkpad == NULL))
      goto no_combiner_sinkpad;
  
  
      /* Check if stream format is compatible */
      srcpad = gst_element_get_static_pad (sgroup->smartencoder, "src");
 -    tmpcaps = gst_pad_get_caps_reffed (srcpad);
 +    tmpcaps = gst_pad_get_caps (srcpad, NULL);
      if (!gst_caps_can_intersect (tmpcaps, format)) {
        GST_DEBUG ("We don't have a smart encoder for the stream format");
        gst_object_unref (sgroup->smartencoder);
      g_object_unref (srcpad);
    }
  
 -  srcpad = local_element_request_pad (sgroup->splitter, NULL, "passthroughsrc");
 +  srcpad =
 +      local_element_request_pad (sgroup->splitter, NULL, "passthroughsrc",
 +      NULL);
    if (G_UNLIKELY (srcpad == NULL))
      goto no_splitter_srcpad;
  
    gst_bin_add ((GstBin *) ebin, sgroup->encoder);
    tosync = g_list_append (tosync, sgroup->encoder);
  
 -  sinkpad = local_element_request_pad (sgroup->combiner, NULL, "encodingsink");
 +  sinkpad =
 +      local_element_request_pad (sgroup->combiner, NULL, "encodingsink", NULL);
    if (G_UNLIKELY (sinkpad == NULL))
      goto no_combiner_sinkpad;
    srcpad = gst_element_get_static_pad (sgroup->encoder, "src");
    /* FIXME : Once we have properties for specific converters, use those */
    if (GST_IS_ENCODING_VIDEO_PROFILE (sprof)) {
      const gboolean native_video =
-         !!(ebin->flags & GST_ENC_FLAG_NO_VIDEO_CONVERSION);
+         ! !(ebin->flags & GST_ENC_FLAG_NO_VIDEO_CONVERSION);
      GstElement *cspace = NULL, *scale, *vrate, *cspace2 = NULL;
  
      GST_LOG ("Adding conversion elements for video stream");
  
      if (!native_video) {
 -      cspace = gst_element_factory_make ("ffmpegcolorspace", NULL);
 +      cspace = gst_element_factory_make ("videoconvert", NULL);
        scale = gst_element_factory_make ("videoscale", NULL);
        if (!scale) {
          missing_element_name = "videoscale";
        }
        /* 4-tap scaling and black borders */
        g_object_set (scale, "method", 2, "add-borders", TRUE, NULL);
 -      cspace2 = gst_element_factory_make ("ffmpegcolorspace", NULL);
 +      cspace2 = gst_element_factory_make ("videoconvert", NULL);
  
        if (!cspace || !cspace2) {
 -        missing_element_name = "ffmpegcolorspace";
 +        missing_element_name = "videoconvert";
          goto missing_element;
        }
  
  
    /* Link to stream splitter */
    sinkpad = gst_element_get_static_pad (last, "sink");
 -  srcpad = local_element_request_pad (sgroup->splitter, NULL, "encodingsrc");
 +  srcpad =
 +      local_element_request_pad (sgroup->splitter, NULL, "encodingsrc", NULL);
    if (G_UNLIKELY (srcpad == NULL))
      goto no_splitter_srcpad;
    if (G_UNLIKELY (fast_pad_link (srcpad, sinkpad) != GST_PAD_LINK_OK))
  
    ebin->streams = g_list_prepend (ebin->streams, sgroup);
  
 +  if (format)
 +    gst_caps_unref (format);
 +  if (restriction)
 +    gst_caps_unref (restriction);
 +
    return sgroup;
  
  splitter_encoding_failure:
@@@ -1479,10 -1474,6 +1479,10 @@@ converter_link_failure
  
  cleanup:
    /* FIXME : Actually properly cleanup everything */
 +  if (format)
 +    gst_caps_unref (format);
 +  if (restriction)
 +    gst_caps_unref (restriction);
    g_slice_free (StreamGroup, sgroup);
    return NULL;
  }
@@@ -1578,7 -1569,7 +1578,7 @@@ _get_formatter (GstEncodeBin * ebin, Gs
      formatterfact = (GstElementFactory *) tmpfmtr->data;
  
      GST_DEBUG_OBJECT (ebin, "Trying formatter %s",
 -        GST_PLUGIN_FEATURE_NAME (formatterfact));
 +        GST_OBJECT_NAME (formatterfact));
  
      if ((formatter =
              _create_element_and_set_preset (formatterfact, preset, NULL)))
@@@ -1656,7 -1647,7 +1656,7 @@@ _get_muxer (GstEncodeBin * ebin
  
      muxerfact = (GstElementFactory *) tmpmux->data;
  
 -    GST_DEBUG ("Trying muxer %s", GST_PLUGIN_FEATURE_NAME (muxerfact));
 +    GST_DEBUG ("Trying muxer %s", GST_OBJECT_NAME (muxerfact));
  
      /* See if the muxer can sink all of our stream profile caps */
      for (tmp = profiles; tmp; tmp = tmp->next) {
@@@ -1783,9 -1774,8 +1783,9 @@@ stream_error
  }
  
  static void
 -release_pads (GstPad * pad, GstElement * elt)
 +release_pads (const GValue * item, GstElement * elt)
  {
 +  GstPad *pad = g_value_get_object (item);
    GstPad *peer = NULL;
  
    GST_DEBUG_OBJECT (elt, "Releasing pad %s:%s", GST_DEBUG_PAD_NAME (pad));
  
    /* Release it from the object */
    gst_element_release_request_pad (elt, pad);
 -
 -  /* And remove the reference added by the iterator */
 -  gst_object_unref (pad);
  }
  
  static void inline
@@@ -1882,9 -1875,7 +1882,9 @@@ stream_group_free (GstEncodeBin * ebin
      GstIteratorResult itret = GST_ITERATOR_OK;
  
      while (itret == GST_ITERATOR_OK || itret == GST_ITERATOR_RESYNC) {
 -      itret = gst_iterator_foreach (it, (GFunc) release_pads, sgroup->combiner);
 +      itret =
 +          gst_iterator_foreach (it, (GstIteratorForeachFunction) release_pads,
 +          sgroup->combiner);
        gst_iterator_resync (it);
      }
      gst_iterator_free (it);
      GstIterator *it = gst_element_iterate_src_pads (sgroup->splitter);
      GstIteratorResult itret = GST_ITERATOR_OK;
      while (itret == GST_ITERATOR_OK || itret == GST_ITERATOR_RESYNC) {
 -      itret = gst_iterator_foreach (it, (GFunc) release_pads, sgroup->splitter);
 +      itret =
 +          gst_iterator_foreach (it, (GstIteratorForeachFunction) release_pads,
 +          sgroup->splitter);
        gst_iterator_resync (it);
      }
      gst_iterator_free (it);