Merge branch 'master' into 0.11
authorSebastian Dröge <sebastian.droege@collabora.co.uk>
Fri, 27 Jan 2012 14:09:35 +0000 (15:09 +0100)
committerSebastian Dröge <sebastian.droege@collabora.co.uk>
Fri, 27 Jan 2012 14:09:35 +0000 (15:09 +0100)
Conflicts:
libs/gst/base/gstcollectpads2.c
libs/gst/base/gstcollectpads2.h

1  2 
gst/gstplugin.c
libs/gst/base/gstcollectpads2.c
libs/gst/base/gstcollectpads2.h

diff --cc gst/gstplugin.c
Simple merge
@@@ -98,12 -101,51 +98,53 @@@ GST_DEBUG_CATEGORY_STATIC (collect_pads
  #define parent_class gst_collect_pads2_parent_class
  G_DEFINE_TYPE (GstCollectPads2, gst_collect_pads2, GST_TYPE_OBJECT);
  
 -  GMutex *evt_lock;             /* these make up sort of poor man's event signaling */
 -  GCond *evt_cond;
+ struct _GstCollectData2Private
+ {
+   /* refcounting for struct, and destroy callback */
+   GstCollectData2DestroyNotify destroy_notify;
+   gint refcount;
+ };
+ struct _GstCollectPads2Private
+ {
+   /* with LOCK and/or STREAM_LOCK */
+   gboolean started;
+   /* with STREAM_LOCK */
+   guint32 cookie;               /* @data list cookie */
+   guint numpads;                /* number of pads in @data */
+   guint queuedpads;             /* number of pads with a buffer */
+   guint eospads;                /* number of pads that are EOS */
+   GstClockTime earliest_time;   /* Current earliest time */
+   GstCollectData2 *earliest_data;       /* Pad data for current earliest time */
+   /* with LOCK */
+   GSList *pad_list;             /* updated pad list */
+   guint32 pad_cookie;           /* updated cookie */
+   GstCollectPads2Function func; /* function and user_data for callback */
+   gpointer user_data;
+   GstCollectPads2BufferFunction buffer_func;    /* function and user_data for buffer callback */
+   gpointer buffer_user_data;
+   GstCollectPads2CompareFunction compare_func;
+   gpointer compare_user_data;
+   GstCollectPads2EventFunction event_func;      /* function and data for event callback */
+   gpointer event_user_data;
+   GstCollectPads2ClipFunction clip_func;
+   gpointer clip_user_data;
+   /* no other lock needed */
++  GMutex evt_lock;              /* these make up sort of poor man's event signaling */
++  GCond evt_cond;
+   guint32 evt_cookie;
+ };
  static void gst_collect_pads2_clear (GstCollectPads2 * pads,
      GstCollectData2 * data);
 -static GstFlowReturn gst_collect_pads2_chain (GstPad * pad, GstBuffer * buffer);
 -static gboolean gst_collect_pads2_event (GstPad * pad, GstEvent * event);
 +static GstFlowReturn gst_collect_pads2_chain (GstPad * pad, GstObject * parent,
 +    GstBuffer * buffer);
 +static gboolean gst_collect_pads2_event (GstPad * pad, GstObject * parent,
 +    GstEvent * event);
  static void gst_collect_pads2_finalize (GObject * object);
  static GstFlowReturn gst_collect_pads2_default_collected (GstCollectPads2 *
      pads, gpointer user_data);
@@@ -120,8 -162,8 +161,8 @@@ static void unref_data (GstCollectData
   * Alternative implementations are possible, e.g. some low-level re-implementing
   * of the 2 above locks to drop both of them atomically when going into _WAIT.
   */
- #define GST_COLLECT_PADS2_GET_EVT_COND(pads) (&((GstCollectPads2 *)pads)->evt_cond)
- #define GST_COLLECT_PADS2_GET_EVT_LOCK(pads) (&((GstCollectPads2 *)pads)->evt_lock)
 -#define GST_COLLECT_PADS2_GET_EVT_COND(pads) (((GstCollectPads2 *)pads)->priv->evt_cond)
 -#define GST_COLLECT_PADS2_GET_EVT_LOCK(pads) (((GstCollectPads2 *)pads)->priv->evt_lock)
++#define GST_COLLECT_PADS2_GET_EVT_COND(pads) (&((GstCollectPads2 *)pads)->priv->evt_cond)
++#define GST_COLLECT_PADS2_GET_EVT_LOCK(pads) (&((GstCollectPads2 *)pads)->priv->evt_lock)
  #define GST_COLLECT_PADS2_EVT_WAIT(pads, cookie) G_STMT_START {    \
    g_mutex_lock (GST_COLLECT_PADS2_GET_EVT_LOCK (pads));            \
    /* should work unless a lot of event'ing and thread starvation */\
@@@ -172,36 -216,40 +215,40 @@@ gst_collect_pads2_class_init (GstCollec
  static void
  gst_collect_pads2_init (GstCollectPads2 * pads)
  {
+   pads->priv =
+       G_TYPE_INSTANCE_GET_PRIVATE (pads, GST_TYPE_COLLECT_PADS2,
+       GstCollectPads2Private);
    pads->data = NULL;
-   pads->cookie = 0;
-   pads->numpads = 0;
-   pads->queuedpads = 0;
-   pads->eospads = 0;
-   pads->started = FALSE;
+   pads->priv->cookie = 0;
+   pads->priv->numpads = 0;
+   pads->priv->queuedpads = 0;
+   pads->priv->eospads = 0;
+   pads->priv->started = FALSE;
  
 -  g_static_rec_mutex_init (&pads->stream_lock);
 +  g_rec_mutex_init (&pads->stream_lock);
  
-   pads->func = gst_collect_pads2_default_collected;
-   pads->user_data = NULL;
-   pads->event_func = NULL;
-   pads->event_user_data = NULL;
+   pads->priv->func = gst_collect_pads2_default_collected;
+   pads->priv->user_data = NULL;
+   pads->priv->event_func = NULL;
+   pads->priv->event_user_data = NULL;
  
    /* members for default muxing */
-   pads->buffer_func = NULL;
-   pads->buffer_user_data = NULL;
-   pads->compare_func = gst_collect_pads2_default_compare_func;
-   pads->compare_user_data = NULL;
-   pads->earliest_data = NULL;
-   pads->earliest_time = GST_CLOCK_TIME_NONE;
+   pads->priv->buffer_func = NULL;
+   pads->priv->buffer_user_data = NULL;
+   pads->priv->compare_func = gst_collect_pads2_default_compare_func;
+   pads->priv->compare_user_data = NULL;
+   pads->priv->earliest_data = NULL;
+   pads->priv->earliest_time = GST_CLOCK_TIME_NONE;
  
    /* members to manage the pad list */
-   pads->pad_cookie = 0;
-   pads->pad_list = NULL;
+   pads->priv->pad_cookie = 0;
+   pads->priv->pad_list = NULL;
  
    /* members for event */
-   g_mutex_init (&pads->evt_lock);
-   g_cond_init (&pads->evt_cond);
-   pads->evt_cookie = 0;
 -  pads->priv->evt_lock = g_mutex_new ();
 -  pads->priv->evt_cond = g_cond_new ();
++  g_mutex_init (&pads->priv->evt_lock);
++  g_cond_init (&pads->priv->evt_cond);
+   pads->priv->evt_cookie = 0;
  }
  
  static void
@@@ -211,16 -259,16 +258,16 @@@ gst_collect_pads2_finalize (GObject * o
  
    GST_DEBUG_OBJECT (object, "finalize");
  
 -  g_static_rec_mutex_free (&pads->stream_lock);
 +  g_rec_mutex_clear (&pads->stream_lock);
  
-   g_cond_clear (&pads->evt_cond);
-   g_mutex_clear (&pads->evt_lock);
 -  g_cond_free (pads->priv->evt_cond);
 -  g_mutex_free (pads->priv->evt_lock);
++  g_cond_clear (&pads->priv->evt_cond);
++  g_mutex_clear (&pads->priv->evt_lock);
  
    /* Remove pads and free pads list */
-   g_slist_foreach (pads->pad_list, (GFunc) unref_data, NULL);
+   g_slist_foreach (pads->priv->pad_list, (GFunc) unref_data, NULL);
    g_slist_foreach (pads->data, (GFunc) unref_data, NULL);
    g_slist_free (pads->data);
-   g_slist_free (pads->pad_list);
+   g_slist_free (pads->priv->pad_list);
  
    G_OBJECT_CLASS (parent_class)->finalize (object);
  }
@@@ -1729,8 -1831,10 +1782,10 @@@ gst_collect_pads2_event (GstPad * pad, 
        }
  
        /* Check if the waiting state of the pad should change. */
-       cmp_res = pads->compare_func (pads, data, seg.start, pads->earliest_data,
-           pads->earliest_time, pads->compare_user_data);
+       cmp_res =
 -          pads->priv->compare_func (pads, data, start,
++          pads->priv->compare_func (pads, data, seg.start,
+           pads->priv->earliest_data, pads->priv->earliest_time,
+           pads->priv->compare_user_data);
  
        if (cmp_res > 0)
          /* Stop waiting */
@@@ -1830,12 -1930,14 +1885,14 @@@ gst_collect_pads2_chain (GstPad * pad, 
    /* pad was EOS, we can refuse this data */
    if (G_UNLIKELY (GST_COLLECT_PADS2_STATE_IS_SET (data,
                GST_COLLECT_PADS2_STATE_EOS)))
 -    goto unexpected;
 +    goto eos;
  
    /* see if we need to clip */
-   if (pads->clip_func) {
+   if (pads->priv->clip_func) {
      GstBuffer *outbuf = NULL;
-     ret = pads->clip_func (pads, data, buffer, &outbuf, pads->clip_user_data);
+     ret =
+         pads->priv->clip_func (pads, data, buffer, &outbuf,
+         pads->priv->clip_user_data);
      buffer = outbuf;
  
      if (G_UNLIKELY (outbuf == NULL))
@@@ -288,42 -283,15 +288,14 @@@ struct _GstCollectPads2 
    GstObject      object;
  
    /*< public >*/ /* with LOCK and/or STREAM_LOCK */
 -  GSList      *data;                  /* list of CollectData items */
 +  GSList        *data;                  /* list of CollectData items */
  
    /*< private >*/
 -  GStaticRecMutex stream_lock;                /* used to serialize collection among several streams */
 +  GRecMutex      stream_lock;          /* used to serialize collection among several streams */
-   /* with LOCK and/or STREAM_LOCK*/
-   gboolean       started;
  
-   /* with STREAM_LOCK */
-   guint32        cookie;                /* @data list cookie */
-   guint          numpads;               /* number of pads in @data */
-   guint          queuedpads;            /* number of pads with a buffer */
-   guint          eospads;               /* number of pads that are EOS */
-   GstClockTime   earliest_time;         /* Current earliest time */
-   GstCollectData2 *earliest_data;       /* Pad data for current earliest time */
-   /* with LOCK */
-   GSList        *pad_list;              /* updated pad list */
-   guint32        pad_cookie;            /* updated cookie */
-   GstCollectPads2Function func;         /* function and user_data for callback */
-   gpointer       user_data;
-   GstCollectPads2BufferFunction buffer_func;    /* function and user_data for buffer callback */
-   gpointer       buffer_user_data;
-   GstCollectPads2CompareFunction compare_func;
-   gpointer       compare_user_data;
-   GstCollectPads2EventFunction event_func; /* function and data for event callback */
-   gpointer       event_user_data;
-   GstCollectPads2ClipFunction clip_func;
-   gpointer       clip_user_data;
-   /* no other lock needed */
-   GMutex         evt_lock;              /* these make up sort of poor man's event signaling */
-   GCond          evt_cond;
-   guint32        evt_cookie;
+   GstCollectPads2Private *priv;
  
    gpointer _gst_reserved[GST_PADDING];
 -
  };
  
  struct _GstCollectPads2Class {