Blame gst/rtp/gstrtpmp4gdepay.c

Packit 1f69a5
/* GStreamer
Packit 1f69a5
 * Copyright (C) <2005> Wim Taymans <wim.taymans@gmail.com>
Packit 1f69a5
 *
Packit 1f69a5
 * This library is free software; you can redistribute it and/or
Packit 1f69a5
 * modify it under the terms of the GNU Library General Public
Packit 1f69a5
 * License as published by the Free Software Foundation; either
Packit 1f69a5
 * version 2 of the License, or (at your option) any later version.
Packit 1f69a5
 *
Packit 1f69a5
 * This library is distributed in the hope that it will be useful,
Packit 1f69a5
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit 1f69a5
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Packit 1f69a5
 * Library General Public License for more details.
Packit 1f69a5
 *
Packit 1f69a5
 * You should have received a copy of the GNU Library General Public
Packit 1f69a5
 * License along with this library; if not, write to the
Packit 1f69a5
 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
Packit 1f69a5
 * Boston, MA 02110-1301, USA.
Packit 1f69a5
 */
Packit 1f69a5
Packit 1f69a5
#ifdef HAVE_CONFIG_H
Packit 1f69a5
#  include "config.h"
Packit 1f69a5
#endif
Packit 1f69a5
Packit 1f69a5
#include <string.h>
Packit 1f69a5
#include <stdlib.h>
Packit 1f69a5
#include <gst/rtp/gstrtpbuffer.h>
Packit 1f69a5
Packit 1f69a5
#include "gstrtpmp4gdepay.h"
Packit 1f69a5
#include "gstrtputils.h"
Packit 1f69a5
Packit 1f69a5
GST_DEBUG_CATEGORY_STATIC (rtpmp4gdepay_debug);
Packit 1f69a5
#define GST_CAT_DEFAULT (rtpmp4gdepay_debug)
Packit 1f69a5
Packit 1f69a5
static GstStaticPadTemplate gst_rtp_mp4g_depay_src_template =
Packit 1f69a5
    GST_STATIC_PAD_TEMPLATE ("src",
Packit 1f69a5
    GST_PAD_SRC,
Packit 1f69a5
    GST_PAD_ALWAYS,
Packit 1f69a5
    GST_STATIC_CAPS ("video/mpeg,"
Packit 1f69a5
        "mpegversion=(int) 4,"
Packit 1f69a5
        "systemstream=(boolean)false;"
Packit 1f69a5
        "audio/mpeg," "mpegversion=(int) 4, " "stream-format=(string)raw")
Packit 1f69a5
    );
Packit 1f69a5
Packit 1f69a5
static GstStaticPadTemplate gst_rtp_mp4g_depay_sink_template =
Packit 1f69a5
GST_STATIC_PAD_TEMPLATE ("sink",
Packit 1f69a5
    GST_PAD_SINK,
Packit 1f69a5
    GST_PAD_ALWAYS,
Packit 1f69a5
    GST_STATIC_CAPS ("application/x-rtp, "
Packit 1f69a5
        "media = (string) { \"video\", \"audio\", \"application\" }, "
Packit 1f69a5
        "clock-rate = (int) [1, MAX ], "
Packit 1f69a5
        "encoding-name = (string) \"MPEG4-GENERIC\", "
Packit 1f69a5
        /* required string params */
Packit 1f69a5
        /* "streamtype = (string) { \"4\", \"5\" }, "  Not set by Wowza    4 = video, 5 = audio */
Packit 1f69a5
        /* "profile-level-id = (string) [1,MAX], " */
Packit 1f69a5
        /* "config = (string) [1,MAX]" */
Packit 1f69a5
        "mode = (string) { \"generic\", \"CELP-cbr\", \"CELP-vbr\", \"AAC-lbr\", \"AAC-hbr\" } "
Packit 1f69a5
        /* Optional general parameters */
Packit 1f69a5
        /* "objecttype = (string) [1,MAX], " */
Packit 1f69a5
        /* "constantsize = (string) [1,MAX], " *//* constant size of each AU */
Packit 1f69a5
        /* "constantduration = (string) [1,MAX], " *//* constant duration of each AU */
Packit 1f69a5
        /* "maxdisplacement = (string) [1,MAX], " */
Packit 1f69a5
        /* "de-interleavebuffersize = (string) [1,MAX], " */
Packit 1f69a5
        /* Optional configuration parameters */
Packit 1f69a5
        /* "sizelength = (string) [1, 32], " */
Packit 1f69a5
        /* "indexlength = (string) [1, 32], " */
Packit 1f69a5
        /* "indexdeltalength = (string) [1, 32], " */
Packit 1f69a5
        /* "ctsdeltalength = (string) [1, 32], " */
Packit 1f69a5
        /* "dtsdeltalength = (string) [1, 32], " */
Packit 1f69a5
        /* "randomaccessindication = (string) {0, 1}, " */
Packit 1f69a5
        /* "streamstateindication = (string) [0, 32], " */
Packit 1f69a5
        /* "auxiliarydatasizelength = (string) [0, 32]" */ )
Packit 1f69a5
    );
Packit 1f69a5
Packit 1f69a5
/* simple bitstream parser */
Packit 1f69a5
typedef struct
Packit 1f69a5
{
Packit 1f69a5
  const guint8 *data;
Packit 1f69a5
  const guint8 *end;
Packit 1f69a5
  gint head;                    /* bitpos in the cache of next bit */
Packit 1f69a5
  guint64 cache;                /* cached bytes */
Packit 1f69a5
} GstBsParse;
Packit 1f69a5
Packit 1f69a5
static void
Packit 1f69a5
gst_bs_parse_init (GstBsParse * bs, const guint8 * data, guint size)
Packit 1f69a5
{
Packit 1f69a5
  bs->data = data;
Packit 1f69a5
  bs->end = data + size;
Packit 1f69a5
  bs->head = 0;
Packit 1f69a5
  bs->cache = 0xffffffff;
Packit 1f69a5
}
Packit 1f69a5
Packit 1f69a5
static guint32
Packit 1f69a5
gst_bs_parse_read (GstBsParse * bs, guint n)
Packit 1f69a5
{
Packit 1f69a5
  guint32 res = 0;
Packit 1f69a5
  gint shift;
Packit 1f69a5
Packit 1f69a5
  if (n == 0)
Packit 1f69a5
    return res;
Packit 1f69a5
Packit 1f69a5
  /* fill up the cache if we need to */
Packit 1f69a5
  while (bs->head < n) {
Packit 1f69a5
    if (bs->data >= bs->end) {
Packit 1f69a5
      /* we're at the end, can't produce more than head number of bits */
Packit 1f69a5
      n = bs->head;
Packit 1f69a5
      break;
Packit 1f69a5
    }
Packit 1f69a5
    /* shift bytes in cache, moving the head bits of the cache left */
Packit 1f69a5
    bs->cache = (bs->cache << 8) | *bs->data++;
Packit 1f69a5
    bs->head += 8;
Packit 1f69a5
  }
Packit 1f69a5
Packit 1f69a5
  /* bring the required bits down and truncate */
Packit 1f69a5
  if ((shift = bs->head - n) > 0)
Packit 1f69a5
    res = bs->cache >> shift;
Packit 1f69a5
  else
Packit 1f69a5
    res = bs->cache;
Packit 1f69a5
Packit 1f69a5
  /* mask out required bits */
Packit 1f69a5
  if (n < 32)
Packit 1f69a5
    res &= (1 << n) - 1;
Packit 1f69a5
Packit 1f69a5
  bs->head = shift;
Packit 1f69a5
Packit 1f69a5
  return res;
Packit 1f69a5
}
Packit 1f69a5
Packit 1f69a5
Packit 1f69a5
#define gst_rtp_mp4g_depay_parent_class parent_class
Packit 1f69a5
G_DEFINE_TYPE (GstRtpMP4GDepay, gst_rtp_mp4g_depay,
Packit 1f69a5
    GST_TYPE_RTP_BASE_DEPAYLOAD);
Packit 1f69a5
Packit 1f69a5
static void gst_rtp_mp4g_depay_finalize (GObject * object);
Packit 1f69a5
Packit 1f69a5
static gboolean gst_rtp_mp4g_depay_setcaps (GstRTPBaseDepayload * depayload,
Packit 1f69a5
    GstCaps * caps);
Packit 1f69a5
static GstBuffer *gst_rtp_mp4g_depay_process (GstRTPBaseDepayload * depayload,
Packit 1f69a5
    GstRTPBuffer * rtp);
Packit 1f69a5
static gboolean gst_rtp_mp4g_depay_handle_event (GstRTPBaseDepayload * filter,
Packit 1f69a5
    GstEvent * event);
Packit 1f69a5
Packit 1f69a5
static GstStateChangeReturn gst_rtp_mp4g_depay_change_state (GstElement *
Packit 1f69a5
    element, GstStateChange transition);
Packit 1f69a5
Packit 1f69a5
Packit 1f69a5
static void
Packit 1f69a5
gst_rtp_mp4g_depay_class_init (GstRtpMP4GDepayClass * klass)
Packit 1f69a5
{
Packit 1f69a5
  GObjectClass *gobject_class;
Packit 1f69a5
  GstElementClass *gstelement_class;
Packit 1f69a5
  GstRTPBaseDepayloadClass *gstrtpbasedepayload_class;
Packit 1f69a5
Packit 1f69a5
  gobject_class = (GObjectClass *) klass;
Packit 1f69a5
  gstelement_class = (GstElementClass *) klass;
Packit 1f69a5
  gstrtpbasedepayload_class = (GstRTPBaseDepayloadClass *) klass;
Packit 1f69a5
Packit 1f69a5
  gobject_class->finalize = gst_rtp_mp4g_depay_finalize;
Packit 1f69a5
Packit 1f69a5
  gstelement_class->change_state = gst_rtp_mp4g_depay_change_state;
Packit 1f69a5
Packit 1f69a5
  gstrtpbasedepayload_class->process_rtp_packet = gst_rtp_mp4g_depay_process;
Packit 1f69a5
  gstrtpbasedepayload_class->set_caps = gst_rtp_mp4g_depay_setcaps;
Packit 1f69a5
  gstrtpbasedepayload_class->handle_event = gst_rtp_mp4g_depay_handle_event;
Packit 1f69a5
Packit 1f69a5
  gst_element_class_add_static_pad_template (gstelement_class,
Packit 1f69a5
      &gst_rtp_mp4g_depay_src_template);
Packit 1f69a5
  gst_element_class_add_static_pad_template (gstelement_class,
Packit 1f69a5
      &gst_rtp_mp4g_depay_sink_template);
Packit 1f69a5
Packit 1f69a5
  gst_element_class_set_static_metadata (gstelement_class,
Packit 1f69a5
      "RTP MPEG4 ES depayloader", "Codec/Depayloader/Network/RTP",
Packit 1f69a5
      "Extracts MPEG4 elementary streams from RTP packets (RFC 3640)",
Packit 1f69a5
      "Wim Taymans <wim.taymans@gmail.com>");
Packit 1f69a5
Packit 1f69a5
  GST_DEBUG_CATEGORY_INIT (rtpmp4gdepay_debug, "rtpmp4gdepay", 0,
Packit 1f69a5
      "MP4-generic RTP Depayloader");
Packit 1f69a5
}
Packit 1f69a5
Packit 1f69a5
static void
Packit 1f69a5
gst_rtp_mp4g_depay_init (GstRtpMP4GDepay * rtpmp4gdepay)
Packit 1f69a5
{
Packit 1f69a5
  rtpmp4gdepay->adapter = gst_adapter_new ();
Packit 1f69a5
  rtpmp4gdepay->packets = g_queue_new ();
Packit 1f69a5
}
Packit 1f69a5
Packit 1f69a5
static void
Packit 1f69a5
gst_rtp_mp4g_depay_finalize (GObject * object)
Packit 1f69a5
{
Packit 1f69a5
  GstRtpMP4GDepay *rtpmp4gdepay;
Packit 1f69a5
Packit 1f69a5
  rtpmp4gdepay = GST_RTP_MP4G_DEPAY (object);
Packit 1f69a5
Packit 1f69a5
  g_object_unref (rtpmp4gdepay->adapter);
Packit 1f69a5
  rtpmp4gdepay->adapter = NULL;
Packit 1f69a5
  g_queue_free (rtpmp4gdepay->packets);
Packit 1f69a5
  rtpmp4gdepay->packets = NULL;
Packit 1f69a5
Packit 1f69a5
  G_OBJECT_CLASS (parent_class)->finalize (object);
Packit 1f69a5
}
Packit 1f69a5
Packit 1f69a5
static gint
Packit 1f69a5
gst_rtp_mp4g_depay_parse_int (GstStructure * structure, const gchar * field,
Packit 1f69a5
    gint def)
Packit 1f69a5
{
Packit 1f69a5
  const gchar *str;
Packit 1f69a5
  gint res;
Packit 1f69a5
Packit 1f69a5
  if ((str = gst_structure_get_string (structure, field)))
Packit 1f69a5
    return atoi (str);
Packit 1f69a5
Packit 1f69a5
  if (gst_structure_get_int (structure, field, &res))
Packit 1f69a5
    return res;
Packit 1f69a5
Packit 1f69a5
  return def;
Packit 1f69a5
}
Packit 1f69a5
Packit 1f69a5
static gboolean
Packit 1f69a5
gst_rtp_mp4g_depay_setcaps (GstRTPBaseDepayload * depayload, GstCaps * caps)
Packit 1f69a5
{
Packit 1f69a5
  GstStructure *structure;
Packit 1f69a5
  GstRtpMP4GDepay *rtpmp4gdepay;
Packit 1f69a5
  GstCaps *srccaps = NULL;
Packit 1f69a5
  const gchar *str;
Packit 1f69a5
  gint clock_rate;
Packit 1f69a5
  gint someint;
Packit 1f69a5
  gboolean res;
Packit 1f69a5
Packit 1f69a5
  rtpmp4gdepay = GST_RTP_MP4G_DEPAY (depayload);
Packit 1f69a5
Packit 1f69a5
  structure = gst_caps_get_structure (caps, 0);
Packit 1f69a5
Packit 1f69a5
  if (!gst_structure_get_int (structure, "clock-rate", &clock_rate))
Packit 1f69a5
    clock_rate = 90000;         /* default */
Packit 1f69a5
  depayload->clock_rate = clock_rate;
Packit 1f69a5
Packit 1f69a5
  if ((str = gst_structure_get_string (structure, "media"))) {
Packit 1f69a5
    if (strcmp (str, "audio") == 0) {
Packit 1f69a5
      srccaps = gst_caps_new_simple ("audio/mpeg",
Packit 1f69a5
          "mpegversion", G_TYPE_INT, 4, "stream-format", G_TYPE_STRING, "raw",
Packit 1f69a5
          NULL);
Packit 1f69a5
    } else if (strcmp (str, "video") == 0) {
Packit 1f69a5
      srccaps = gst_caps_new_simple ("video/mpeg",
Packit 1f69a5
          "mpegversion", G_TYPE_INT, 4,
Packit 1f69a5
          "systemstream", G_TYPE_BOOLEAN, FALSE, NULL);
Packit 1f69a5
    }
Packit 1f69a5
  }
Packit 1f69a5
  if (srccaps == NULL)
Packit 1f69a5
    goto unknown_media;
Packit 1f69a5
Packit 1f69a5
  /* these values are optional and have a default value of 0 (no header) */
Packit 1f69a5
  rtpmp4gdepay->sizelength =
Packit 1f69a5
      gst_rtp_mp4g_depay_parse_int (structure, "sizelength", 0);
Packit 1f69a5
  rtpmp4gdepay->indexlength =
Packit 1f69a5
      gst_rtp_mp4g_depay_parse_int (structure, "indexlength", 0);
Packit 1f69a5
  rtpmp4gdepay->indexdeltalength =
Packit 1f69a5
      gst_rtp_mp4g_depay_parse_int (structure, "indexdeltalength", 0);
Packit 1f69a5
  rtpmp4gdepay->ctsdeltalength =
Packit 1f69a5
      gst_rtp_mp4g_depay_parse_int (structure, "ctsdeltalength", 0);
Packit 1f69a5
  rtpmp4gdepay->dtsdeltalength =
Packit 1f69a5
      gst_rtp_mp4g_depay_parse_int (structure, "dtsdeltalength", 0);
Packit 1f69a5
  someint =
Packit 1f69a5
      gst_rtp_mp4g_depay_parse_int (structure, "randomaccessindication", 0);
Packit 1f69a5
  rtpmp4gdepay->randomaccessindication = someint > 0 ? 1 : 0;
Packit 1f69a5
  rtpmp4gdepay->streamstateindication =
Packit 1f69a5
      gst_rtp_mp4g_depay_parse_int (structure, "streamstateindication", 0);
Packit 1f69a5
  rtpmp4gdepay->auxiliarydatasizelength =
Packit 1f69a5
      gst_rtp_mp4g_depay_parse_int (structure, "auxiliarydatasizelength", 0);
Packit 1f69a5
  rtpmp4gdepay->constantSize =
Packit 1f69a5
      gst_rtp_mp4g_depay_parse_int (structure, "constantsize", 0);
Packit 1f69a5
  rtpmp4gdepay->constantDuration =
Packit 1f69a5
      gst_rtp_mp4g_depay_parse_int (structure, "constantduration", 0);
Packit 1f69a5
  rtpmp4gdepay->maxDisplacement =
Packit 1f69a5
      gst_rtp_mp4g_depay_parse_int (structure, "maxdisplacement", 0);
Packit 1f69a5
Packit 1f69a5
Packit 1f69a5
  /* get config string */
Packit 1f69a5
  if ((str = gst_structure_get_string (structure, "config"))) {
Packit 1f69a5
    GValue v = { 0 };
Packit 1f69a5
Packit 1f69a5
    g_value_init (&v, GST_TYPE_BUFFER);
Packit 1f69a5
    if (gst_value_deserialize (&v, str)) {
Packit 1f69a5
      GstBuffer *buffer;
Packit 1f69a5
Packit 1f69a5
      buffer = gst_value_get_buffer (&v);
Packit 1f69a5
      gst_caps_set_simple (srccaps,
Packit 1f69a5
          "codec_data", GST_TYPE_BUFFER, buffer, NULL);
Packit 1f69a5
      g_value_unset (&v);
Packit 1f69a5
    } else {
Packit 1f69a5
      g_warning ("cannot convert config to buffer");
Packit 1f69a5
    }
Packit 1f69a5
  }
Packit 1f69a5
Packit 1f69a5
  res = gst_pad_set_caps (depayload->srcpad, srccaps);
Packit 1f69a5
  gst_caps_unref (srccaps);
Packit 1f69a5
Packit 1f69a5
  return res;
Packit 1f69a5
Packit 1f69a5
  /* ERRORS */
Packit 1f69a5
unknown_media:
Packit 1f69a5
  {
Packit 1f69a5
    GST_DEBUG_OBJECT (rtpmp4gdepay, "Unknown media type");
Packit 1f69a5
    return FALSE;
Packit 1f69a5
  }
Packit 1f69a5
}
Packit 1f69a5
Packit 1f69a5
static void
Packit 1f69a5
gst_rtp_mp4g_depay_clear_queue (GstRtpMP4GDepay * rtpmp4gdepay)
Packit 1f69a5
{
Packit 1f69a5
  GstBuffer *outbuf;
Packit 1f69a5
Packit 1f69a5
  while ((outbuf = g_queue_pop_head (rtpmp4gdepay->packets)))
Packit 1f69a5
    gst_buffer_unref (outbuf);
Packit 1f69a5
}
Packit 1f69a5
Packit 1f69a5
static void
Packit 1f69a5
gst_rtp_mp4g_depay_reset (GstRtpMP4GDepay * rtpmp4gdepay)
Packit 1f69a5
{
Packit 1f69a5
  gst_adapter_clear (rtpmp4gdepay->adapter);
Packit 1f69a5
  rtpmp4gdepay->max_AU_index = -1;
Packit 1f69a5
  rtpmp4gdepay->next_AU_index = -1;
Packit 1f69a5
  rtpmp4gdepay->prev_AU_index = -1;
Packit 1f69a5
  rtpmp4gdepay->prev_rtptime = -1;
Packit 1f69a5
  rtpmp4gdepay->last_AU_index = -1;
Packit 1f69a5
  gst_rtp_mp4g_depay_clear_queue (rtpmp4gdepay);
Packit 1f69a5
}
Packit 1f69a5
Packit 1f69a5
static void
Packit 1f69a5
gst_rtp_mp4g_depay_flush_queue (GstRtpMP4GDepay * rtpmp4gdepay)
Packit 1f69a5
{
Packit 1f69a5
  GstBuffer *outbuf;
Packit 1f69a5
  gboolean discont = FALSE;
Packit 1f69a5
  guint AU_index;
Packit 1f69a5
Packit 1f69a5
  while ((outbuf = g_queue_pop_head (rtpmp4gdepay->packets))) {
Packit 1f69a5
    AU_index = GST_BUFFER_OFFSET (outbuf);
Packit 1f69a5
Packit 1f69a5
    GST_DEBUG_OBJECT (rtpmp4gdepay, "next available AU_index %u", AU_index);
Packit 1f69a5
Packit 1f69a5
    if (rtpmp4gdepay->next_AU_index != AU_index) {
Packit 1f69a5
      GST_DEBUG_OBJECT (rtpmp4gdepay, "discont, expected AU_index %u",
Packit 1f69a5
          rtpmp4gdepay->next_AU_index);
Packit 1f69a5
      discont = TRUE;
Packit 1f69a5
    }
Packit 1f69a5
Packit 1f69a5
    if (discont) {
Packit 1f69a5
      GST_BUFFER_FLAG_SET (outbuf, GST_BUFFER_FLAG_DISCONT);
Packit 1f69a5
      discont = FALSE;
Packit 1f69a5
    }
Packit 1f69a5
Packit 1f69a5
    GST_DEBUG_OBJECT (rtpmp4gdepay, "pushing AU_index %u", AU_index);
Packit 1f69a5
    gst_rtp_drop_meta (GST_ELEMENT_CAST (rtpmp4gdepay), outbuf, 0);
Packit 1f69a5
    gst_rtp_base_depayload_push (GST_RTP_BASE_DEPAYLOAD (rtpmp4gdepay), outbuf);
Packit 1f69a5
    rtpmp4gdepay->next_AU_index = AU_index + 1;
Packit 1f69a5
  }
Packit 1f69a5
}
Packit 1f69a5
Packit 1f69a5
static void
Packit 1f69a5
gst_rtp_mp4g_depay_queue (GstRtpMP4GDepay * rtpmp4gdepay, GstBuffer * outbuf)
Packit 1f69a5
{
Packit 1f69a5
  guint AU_index = GST_BUFFER_OFFSET (outbuf);
Packit 1f69a5
Packit 1f69a5
  if (rtpmp4gdepay->next_AU_index == -1) {
Packit 1f69a5
    GST_DEBUG_OBJECT (rtpmp4gdepay, "Init AU counter %u", AU_index);
Packit 1f69a5
    rtpmp4gdepay->next_AU_index = AU_index;
Packit 1f69a5
  }
Packit 1f69a5
Packit 1f69a5
  if (rtpmp4gdepay->next_AU_index == AU_index) {
Packit 1f69a5
    GST_DEBUG_OBJECT (rtpmp4gdepay, "pushing expected AU_index %u", AU_index);
Packit 1f69a5
Packit 1f69a5
    /* we received the expected packet, push it and flush as much as we can from
Packit 1f69a5
     * the queue */
Packit 1f69a5
    gst_rtp_drop_meta (GST_ELEMENT_CAST (rtpmp4gdepay), outbuf, 0);
Packit 1f69a5
    gst_rtp_base_depayload_push (GST_RTP_BASE_DEPAYLOAD (rtpmp4gdepay), outbuf);
Packit 1f69a5
    rtpmp4gdepay->next_AU_index++;
Packit 1f69a5
Packit 1f69a5
    while ((outbuf = g_queue_peek_head (rtpmp4gdepay->packets))) {
Packit 1f69a5
      AU_index = GST_BUFFER_OFFSET (outbuf);
Packit 1f69a5
Packit 1f69a5
      GST_DEBUG_OBJECT (rtpmp4gdepay, "next available AU_index %u", AU_index);
Packit 1f69a5
Packit 1f69a5
      if (rtpmp4gdepay->next_AU_index == AU_index) {
Packit 1f69a5
        GST_DEBUG_OBJECT (rtpmp4gdepay, "pushing expected AU_index %u",
Packit 1f69a5
            AU_index);
Packit 1f69a5
        outbuf = g_queue_pop_head (rtpmp4gdepay->packets);
Packit 1f69a5
        gst_rtp_drop_meta (GST_ELEMENT_CAST (rtpmp4gdepay), outbuf, 0);
Packit 1f69a5
        gst_rtp_base_depayload_push (GST_RTP_BASE_DEPAYLOAD (rtpmp4gdepay),
Packit 1f69a5
            outbuf);
Packit 1f69a5
        rtpmp4gdepay->next_AU_index++;
Packit 1f69a5
      } else {
Packit 1f69a5
        GST_DEBUG_OBJECT (rtpmp4gdepay, "waiting for next AU_index %u",
Packit 1f69a5
            rtpmp4gdepay->next_AU_index);
Packit 1f69a5
        break;
Packit 1f69a5
      }
Packit 1f69a5
    }
Packit 1f69a5
  } else {
Packit 1f69a5
    GList *list;
Packit 1f69a5
Packit 1f69a5
    GST_DEBUG_OBJECT (rtpmp4gdepay, "queueing AU_index %u", AU_index);
Packit 1f69a5
Packit 1f69a5
    /* loop the list to skip strictly smaller AU_index buffers */
Packit 1f69a5
    for (list = rtpmp4gdepay->packets->head; list; list = g_list_next (list)) {
Packit 1f69a5
      guint idx;
Packit 1f69a5
      gint gap;
Packit 1f69a5
Packit 1f69a5
      idx = GST_BUFFER_OFFSET (GST_BUFFER_CAST (list->data));
Packit 1f69a5
Packit 1f69a5
      /* compare the new seqnum to the one in the buffer */
Packit 1f69a5
      gap = (gint) (idx - AU_index);
Packit 1f69a5
Packit 1f69a5
      GST_DEBUG_OBJECT (rtpmp4gdepay, "compare with AU_index %u, gap %d", idx,
Packit 1f69a5
          gap);
Packit 1f69a5
Packit 1f69a5
      /* AU_index <= idx, we can stop looking */
Packit 1f69a5
      if (G_LIKELY (gap > 0))
Packit 1f69a5
        break;
Packit 1f69a5
    }
Packit 1f69a5
    if (G_LIKELY (list))
Packit 1f69a5
      g_queue_insert_before (rtpmp4gdepay->packets, list, outbuf);
Packit 1f69a5
    else
Packit 1f69a5
      g_queue_push_tail (rtpmp4gdepay->packets, outbuf);
Packit 1f69a5
  }
Packit 1f69a5
}
Packit 1f69a5
Packit 1f69a5
static GstBuffer *
Packit 1f69a5
gst_rtp_mp4g_depay_process (GstRTPBaseDepayload * depayload, GstRTPBuffer * rtp)
Packit 1f69a5
{
Packit 1f69a5
  GstRtpMP4GDepay *rtpmp4gdepay;
Packit 1f69a5
  GstBuffer *outbuf = NULL;
Packit 1f69a5
  GstClockTime timestamp;
Packit 1f69a5
Packit 1f69a5
  rtpmp4gdepay = GST_RTP_MP4G_DEPAY (depayload);
Packit 1f69a5
Packit 1f69a5
  /* flush remaining data on discont */
Packit 1f69a5
  if (GST_BUFFER_IS_DISCONT (rtp->buffer)) {
Packit 1f69a5
    GST_DEBUG_OBJECT (rtpmp4gdepay, "received DISCONT");
Packit 1f69a5
    gst_adapter_clear (rtpmp4gdepay->adapter);
Packit 1f69a5
  }
Packit 1f69a5
Packit 1f69a5
  timestamp = GST_BUFFER_PTS (rtp->buffer);
Packit 1f69a5
Packit 1f69a5
  {
Packit 1f69a5
    gint payload_len, payload_AU;
Packit 1f69a5
    guint8 *payload;
Packit 1f69a5
    guint32 rtptime;
Packit 1f69a5
    guint AU_headers_len;
Packit 1f69a5
    guint AU_size, AU_index, AU_index_delta, payload_AU_size;
Packit 1f69a5
    gboolean M;
Packit 1f69a5
Packit 1f69a5
    payload_len = gst_rtp_buffer_get_payload_len (rtp);
Packit 1f69a5
    payload = gst_rtp_buffer_get_payload (rtp);
Packit 1f69a5
Packit 1f69a5
    GST_DEBUG_OBJECT (rtpmp4gdepay, "received payload of %d", payload_len);
Packit 1f69a5
Packit 1f69a5
    rtptime = gst_rtp_buffer_get_timestamp (rtp);
Packit 1f69a5
    M = gst_rtp_buffer_get_marker (rtp);
Packit 1f69a5
Packit 1f69a5
    if (rtpmp4gdepay->sizelength > 0) {
Packit 1f69a5
      gint num_AU_headers, AU_headers_bytes, i;
Packit 1f69a5
      GstBsParse bs;
Packit 1f69a5
Packit 1f69a5
      if (payload_len < 2)
Packit 1f69a5
        goto short_payload;
Packit 1f69a5
Packit 1f69a5
      /* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- .. -+-+-+-+-+-+-+-+-+-+
Packit 1f69a5
       * |AU-headers-length|AU-header|AU-header|      |AU-header|padding|
Packit 1f69a5
       * |                 |   (1)   |   (2)   |      |   (n) * | bits  |
Packit 1f69a5
       * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- .. -+-+-+-+-+-+-+-+-+-+
Packit 1f69a5
       *
Packit 1f69a5
       * The length is 2 bytes and contains the length of the following
Packit 1f69a5
       * AU-headers in bits.
Packit 1f69a5
       */
Packit 1f69a5
      AU_headers_len = (payload[0] << 8) | payload[1];
Packit 1f69a5
      AU_headers_bytes = (AU_headers_len + 7) / 8;
Packit 1f69a5
      num_AU_headers = AU_headers_len / 16;
Packit 1f69a5
Packit 1f69a5
      GST_DEBUG_OBJECT (rtpmp4gdepay, "AU headers len %d, bytes %d, num %d",
Packit 1f69a5
          AU_headers_len, AU_headers_bytes, num_AU_headers);
Packit 1f69a5
Packit 1f69a5
      /* skip header */
Packit 1f69a5
      payload += 2;
Packit 1f69a5
      payload_len -= 2;
Packit 1f69a5
Packit 1f69a5
      if (payload_len < AU_headers_bytes)
Packit 1f69a5
        goto short_payload;
Packit 1f69a5
Packit 1f69a5
      /* skip special headers, point to first payload AU */
Packit 1f69a5
      payload_AU = 2 + AU_headers_bytes;
Packit 1f69a5
      payload_AU_size = payload_len - AU_headers_bytes;
Packit 1f69a5
Packit 1f69a5
      if (G_UNLIKELY (rtpmp4gdepay->auxiliarydatasizelength)) {
Packit 1f69a5
        gint aux_size;
Packit 1f69a5
Packit 1f69a5
        /* point the bitstream parser to the first auxiliary data bit */
Packit 1f69a5
        gst_bs_parse_init (&bs, payload + AU_headers_bytes,
Packit 1f69a5
            payload_len - AU_headers_bytes);
Packit 1f69a5
        aux_size =
Packit 1f69a5
            gst_bs_parse_read (&bs, rtpmp4gdepay->auxiliarydatasizelength);
Packit 1f69a5
        /* convert to bytes */
Packit 1f69a5
        aux_size = (aux_size + 7) / 8;
Packit 1f69a5
        /* AU data then follows auxiliary data */
Packit 1f69a5
        if (payload_AU_size < aux_size)
Packit 1f69a5
          goto short_payload;
Packit 1f69a5
        payload_AU += aux_size;
Packit 1f69a5
        payload_AU_size -= aux_size;
Packit 1f69a5
      }
Packit 1f69a5
Packit 1f69a5
      /* point the bitstream parser to the first AU header bit */
Packit 1f69a5
      gst_bs_parse_init (&bs, payload, payload_len);
Packit 1f69a5
      AU_index = AU_index_delta = 0;
Packit 1f69a5
Packit 1f69a5
      for (i = 0; i < num_AU_headers && payload_AU_size > 0; i++) {
Packit 1f69a5
        /* parse AU header
Packit 1f69a5
         *  +---------------------------------------+
Packit 1f69a5
         *  |     AU-size                           |
Packit 1f69a5
         *  +---------------------------------------+
Packit 1f69a5
         *  |     AU-Index / AU-Index-delta         |
Packit 1f69a5
         *  +---------------------------------------+
Packit 1f69a5
         *  |     CTS-flag                          |
Packit 1f69a5
         *  +---------------------------------------+
Packit 1f69a5
         *  |     CTS-delta                         |
Packit 1f69a5
         *  +---------------------------------------+
Packit 1f69a5
         *  |     DTS-flag                          |
Packit 1f69a5
         *  +---------------------------------------+
Packit 1f69a5
         *  |     DTS-delta                         |
Packit 1f69a5
         *  +---------------------------------------+
Packit 1f69a5
         *  |     RAP-flag                          |
Packit 1f69a5
         *  +---------------------------------------+
Packit 1f69a5
         *  |     Stream-state                      |
Packit 1f69a5
         *  +---------------------------------------+
Packit 1f69a5
         */
Packit 1f69a5
        AU_size = gst_bs_parse_read (&bs, rtpmp4gdepay->sizelength);
Packit 1f69a5
Packit 1f69a5
        /* calculate the AU_index, which is only on the first AU of the packet
Packit 1f69a5
         * and the AU_index_delta on the other AUs. This will be used to
Packit 1f69a5
         * reconstruct the AU ordering when interleaving. */
Packit 1f69a5
        if (i == 0) {
Packit 1f69a5
          AU_index = gst_bs_parse_read (&bs, rtpmp4gdepay->indexlength);
Packit 1f69a5
Packit 1f69a5
          GST_DEBUG_OBJECT (rtpmp4gdepay, "AU index %u", AU_index);
Packit 1f69a5
Packit 1f69a5
          if (AU_index == 0 && rtpmp4gdepay->prev_AU_index == 0) {
Packit 1f69a5
            gint diff;
Packit 1f69a5
            gint cd;
Packit 1f69a5
Packit 1f69a5
            /* if we see two consecutive packets with AU_index of 0, we can
Packit 1f69a5
             * assume we have constantDuration packets. Since we don't have
Packit 1f69a5
             * the index we must use the AU duration to calculate the
Packit 1f69a5
             * index. Get the diff between the timestamps first, this can be
Packit 1f69a5
             * positive or negative. */
Packit 1f69a5
            if (rtpmp4gdepay->prev_rtptime <= rtptime)
Packit 1f69a5
              diff = rtptime - rtpmp4gdepay->prev_rtptime;
Packit 1f69a5
            else
Packit 1f69a5
              diff = -(rtpmp4gdepay->prev_rtptime - rtptime);
Packit 1f69a5
Packit 1f69a5
            /* if no constantDuration was given, make one */
Packit 1f69a5
            if (rtpmp4gdepay->constantDuration != 0) {
Packit 1f69a5
              cd = rtpmp4gdepay->constantDuration;
Packit 1f69a5
              GST_DEBUG_OBJECT (depayload, "using constantDuration %d", cd);
Packit 1f69a5
            } else if (rtpmp4gdepay->prev_AU_num > 0) {
Packit 1f69a5
              /* use number of packets and of previous frame */
Packit 1f69a5
              cd = diff / rtpmp4gdepay->prev_AU_num;
Packit 1f69a5
              GST_DEBUG_OBJECT (depayload, "guessing constantDuration %d", cd);
Packit 1f69a5
              if (!GST_BUFFER_IS_DISCONT (rtp->buffer)) {
Packit 1f69a5
                /* rfc3640 - 3.2.3.2
Packit 1f69a5
                 * if we see two consecutive packets with AU_index of 0 and
Packit 1f69a5
                 * there has been no discontinuity, we must conclude that this
Packit 1f69a5
                 * value of constantDuration is correct from now on. */
Packit 1f69a5
                GST_DEBUG_OBJECT (depayload,
Packit 1f69a5
                    "constantDuration of %d detected", cd);
Packit 1f69a5
                rtpmp4gdepay->constantDuration = cd;
Packit 1f69a5
              }
Packit 1f69a5
            } else {
Packit 1f69a5
              /* assume this frame has the same number of packets as the
Packit 1f69a5
               * previous one */
Packit 1f69a5
              cd = diff / num_AU_headers;
Packit 1f69a5
              GST_DEBUG_OBJECT (depayload, "guessing constantDuration %d", cd);
Packit 1f69a5
            }
Packit 1f69a5
Packit 1f69a5
            if (cd > 0) {
Packit 1f69a5
              /* get the number of packets by dividing with the duration */
Packit 1f69a5
              diff /= cd;
Packit 1f69a5
            } else {
Packit 1f69a5
              diff = 0;
Packit 1f69a5
            }
Packit 1f69a5
Packit 1f69a5
            rtpmp4gdepay->last_AU_index += diff;
Packit 1f69a5
            rtpmp4gdepay->prev_AU_index = AU_index;
Packit 1f69a5
Packit 1f69a5
            AU_index = rtpmp4gdepay->last_AU_index;
Packit 1f69a5
Packit 1f69a5
            GST_DEBUG_OBJECT (rtpmp4gdepay, "diff %d, AU index %u", diff,
Packit 1f69a5
                AU_index);
Packit 1f69a5
          } else {
Packit 1f69a5
            rtpmp4gdepay->prev_AU_index = AU_index;
Packit 1f69a5
            rtpmp4gdepay->last_AU_index = AU_index;
Packit 1f69a5
          }
Packit 1f69a5
Packit 1f69a5
          /* keep track of the higest AU_index */
Packit 1f69a5
          if (rtpmp4gdepay->max_AU_index != -1
Packit 1f69a5
              && rtpmp4gdepay->max_AU_index <= AU_index) {
Packit 1f69a5
            GST_DEBUG_OBJECT (rtpmp4gdepay, "new interleave group, flushing");
Packit 1f69a5
            /* a new interleave group started, flush */
Packit 1f69a5
            gst_rtp_mp4g_depay_flush_queue (rtpmp4gdepay);
Packit 1f69a5
          }
Packit 1f69a5
          if (G_UNLIKELY (!rtpmp4gdepay->maxDisplacement &&
Packit 1f69a5
                  rtpmp4gdepay->max_AU_index != -1
Packit 1f69a5
                  && rtpmp4gdepay->max_AU_index >= AU_index)) {
Packit 1f69a5
            GstBuffer *outbuf;
Packit 1f69a5
Packit 1f69a5
            /* some broken non-interleaved streams have AU-index jumping around
Packit 1f69a5
             * all over the place, apparently assuming receiver disregards */
Packit 1f69a5
            GST_DEBUG_OBJECT (rtpmp4gdepay, "non-interleaved broken AU indices;"
Packit 1f69a5
                " forcing continuous flush");
Packit 1f69a5
            /* reset AU to avoid repeated DISCONT in such case */
Packit 1f69a5
            outbuf = g_queue_peek_head (rtpmp4gdepay->packets);
Packit 1f69a5
            if (G_LIKELY (outbuf)) {
Packit 1f69a5
              rtpmp4gdepay->next_AU_index = GST_BUFFER_OFFSET (outbuf);
Packit 1f69a5
              gst_rtp_mp4g_depay_flush_queue (rtpmp4gdepay);
Packit 1f69a5
            }
Packit 1f69a5
            /* rebase next_AU_index to current rtp's first AU_index */
Packit 1f69a5
            rtpmp4gdepay->next_AU_index = AU_index;
Packit 1f69a5
          }
Packit 1f69a5
          rtpmp4gdepay->prev_rtptime = rtptime;
Packit 1f69a5
          rtpmp4gdepay->prev_AU_num = num_AU_headers;
Packit 1f69a5
        } else {
Packit 1f69a5
          AU_index_delta =
Packit 1f69a5
              gst_bs_parse_read (&bs, rtpmp4gdepay->indexdeltalength);
Packit 1f69a5
          AU_index += AU_index_delta + 1;
Packit 1f69a5
        }
Packit 1f69a5
        /* keep track of highest AU_index */
Packit 1f69a5
        if (rtpmp4gdepay->max_AU_index == -1
Packit 1f69a5
            || AU_index > rtpmp4gdepay->max_AU_index)
Packit 1f69a5
          rtpmp4gdepay->max_AU_index = AU_index;
Packit 1f69a5
Packit 1f69a5
        /* the presentation time offset, a 2s-complement value, we need this to
Packit 1f69a5
         * calculate the timestamp on the output packet. */
Packit 1f69a5
        if (rtpmp4gdepay->ctsdeltalength > 0) {
Packit 1f69a5
          if (gst_bs_parse_read (&bs, 1))
Packit 1f69a5
            gst_bs_parse_read (&bs, rtpmp4gdepay->ctsdeltalength);
Packit 1f69a5
        }
Packit 1f69a5
        /* the decoding time offset, a 2s-complement value */
Packit 1f69a5
        if (rtpmp4gdepay->dtsdeltalength > 0) {
Packit 1f69a5
          if (gst_bs_parse_read (&bs, 1))
Packit 1f69a5
            gst_bs_parse_read (&bs, rtpmp4gdepay->dtsdeltalength);
Packit 1f69a5
        }
Packit 1f69a5
        /* RAP-flag to indicate that the AU contains a keyframe */
Packit 1f69a5
        if (rtpmp4gdepay->randomaccessindication)
Packit 1f69a5
          gst_bs_parse_read (&bs, 1);
Packit 1f69a5
        /* stream-state */
Packit 1f69a5
        if (rtpmp4gdepay->streamstateindication > 0)
Packit 1f69a5
          gst_bs_parse_read (&bs, rtpmp4gdepay->streamstateindication);
Packit 1f69a5
Packit 1f69a5
        GST_DEBUG_OBJECT (rtpmp4gdepay, "size %d, index %d, delta %d", AU_size,
Packit 1f69a5
            AU_index, AU_index_delta);
Packit 1f69a5
Packit 1f69a5
        /* fragmented pakets have the AU_size set to the size of the
Packit 1f69a5
         * unfragmented AU. */
Packit 1f69a5
        if (AU_size > payload_AU_size)
Packit 1f69a5
          AU_size = payload_AU_size;
Packit 1f69a5
Packit 1f69a5
        /* collect stuff in the adapter, strip header from payload and push in
Packit 1f69a5
         * the adapter */
Packit 1f69a5
        outbuf =
Packit 1f69a5
            gst_rtp_buffer_get_payload_subbuffer (rtp, payload_AU, AU_size);
Packit 1f69a5
        gst_adapter_push (rtpmp4gdepay->adapter, outbuf);
Packit 1f69a5
Packit 1f69a5
        if (M) {
Packit 1f69a5
          guint avail;
Packit 1f69a5
Packit 1f69a5
          /* packet is complete, flush */
Packit 1f69a5
          avail = gst_adapter_available (rtpmp4gdepay->adapter);
Packit 1f69a5
Packit 1f69a5
          outbuf = gst_adapter_take_buffer (rtpmp4gdepay->adapter, avail);
Packit 1f69a5
Packit 1f69a5
          /* copy some of the fields we calculated above on the buffer. We also
Packit 1f69a5
           * copy the AU_index so that we can sort the packets in our queue. */
Packit 1f69a5
          GST_BUFFER_PTS (outbuf) = timestamp;
Packit 1f69a5
          GST_BUFFER_OFFSET (outbuf) = AU_index;
Packit 1f69a5
Packit 1f69a5
          if (rtpmp4gdepay->constantDuration != 0) {
Packit 1f69a5
            /* if we have constantDuration, calculate timestamp for next AU
Packit 1f69a5
             * in this RTP packet. */
Packit 1f69a5
            timestamp += (rtpmp4gdepay->constantDuration * GST_SECOND) /
Packit 1f69a5
                depayload->clock_rate;
Packit 1f69a5
          } else {
Packit 1f69a5
            /* otherwise, make sure we don't use the timestamp again for other
Packit 1f69a5
             * AUs. */
Packit 1f69a5
            timestamp = GST_CLOCK_TIME_NONE;
Packit 1f69a5
          }
Packit 1f69a5
Packit 1f69a5
          GST_DEBUG_OBJECT (depayload,
Packit 1f69a5
              "pushing buffer of size %" G_GSIZE_FORMAT,
Packit 1f69a5
              gst_buffer_get_size (outbuf));
Packit 1f69a5
Packit 1f69a5
          gst_rtp_mp4g_depay_queue (rtpmp4gdepay, outbuf);
Packit 1f69a5
Packit 1f69a5
        }
Packit 1f69a5
        payload_AU += AU_size;
Packit 1f69a5
        payload_AU_size -= AU_size;
Packit 1f69a5
      }
Packit 1f69a5
    } else {
Packit 1f69a5
      /* push complete buffer in adapter */
Packit 1f69a5
      outbuf = gst_rtp_buffer_get_payload_subbuffer (rtp, 0, payload_len);
Packit 1f69a5
      gst_adapter_push (rtpmp4gdepay->adapter, outbuf);
Packit 1f69a5
Packit 1f69a5
      /* if this was the last packet of the VOP, create and push a buffer */
Packit 1f69a5
      if (M) {
Packit 1f69a5
        guint avail;
Packit 1f69a5
Packit 1f69a5
        avail = gst_adapter_available (rtpmp4gdepay->adapter);
Packit 1f69a5
Packit 1f69a5
        outbuf = gst_adapter_take_buffer (rtpmp4gdepay->adapter, avail);
Packit 1f69a5
Packit 1f69a5
        GST_DEBUG ("gst_rtp_mp4g_depay_chain: pushing buffer of size %"
Packit 1f69a5
            G_GSIZE_FORMAT, gst_buffer_get_size (outbuf));
Packit 1f69a5
Packit 1f69a5
        return outbuf;
Packit 1f69a5
      }
Packit 1f69a5
    }
Packit 1f69a5
  }
Packit 1f69a5
Packit 1f69a5
  return NULL;
Packit 1f69a5
Packit 1f69a5
  /* ERRORS */
Packit 1f69a5
short_payload:
Packit 1f69a5
  {
Packit 1f69a5
    GST_ELEMENT_WARNING (rtpmp4gdepay, STREAM, DECODE,
Packit 1f69a5
        ("Packet payload was too short."), (NULL));
Packit 1f69a5
    return NULL;
Packit 1f69a5
  }
Packit 1f69a5
}
Packit 1f69a5
Packit 1f69a5
static gboolean
Packit 1f69a5
gst_rtp_mp4g_depay_handle_event (GstRTPBaseDepayload * filter, GstEvent * event)
Packit 1f69a5
{
Packit 1f69a5
  gboolean ret;
Packit 1f69a5
  GstRtpMP4GDepay *rtpmp4gdepay;
Packit 1f69a5
Packit 1f69a5
  rtpmp4gdepay = GST_RTP_MP4G_DEPAY (filter);
Packit 1f69a5
Packit 1f69a5
  switch (GST_EVENT_TYPE (event)) {
Packit 1f69a5
    case GST_EVENT_FLUSH_STOP:
Packit 1f69a5
      gst_rtp_mp4g_depay_reset (rtpmp4gdepay);
Packit 1f69a5
      break;
Packit 1f69a5
    default:
Packit 1f69a5
      break;
Packit 1f69a5
  }
Packit 1f69a5
Packit 1f69a5
  ret =
Packit 1f69a5
      GST_RTP_BASE_DEPAYLOAD_CLASS (parent_class)->handle_event (filter, event);
Packit 1f69a5
Packit 1f69a5
  return ret;
Packit 1f69a5
}
Packit 1f69a5
Packit 1f69a5
static GstStateChangeReturn
Packit 1f69a5
gst_rtp_mp4g_depay_change_state (GstElement * element,
Packit 1f69a5
    GstStateChange transition)
Packit 1f69a5
{
Packit 1f69a5
  GstRtpMP4GDepay *rtpmp4gdepay;
Packit 1f69a5
  GstStateChangeReturn ret;
Packit 1f69a5
Packit 1f69a5
  rtpmp4gdepay = GST_RTP_MP4G_DEPAY (element);
Packit 1f69a5
Packit 1f69a5
  switch (transition) {
Packit 1f69a5
    case GST_STATE_CHANGE_READY_TO_PAUSED:
Packit 1f69a5
      gst_rtp_mp4g_depay_reset (rtpmp4gdepay);
Packit 1f69a5
      break;
Packit 1f69a5
    default:
Packit 1f69a5
      break;
Packit 1f69a5
  }
Packit 1f69a5
Packit 1f69a5
  ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
Packit 1f69a5
Packit 1f69a5
  switch (transition) {
Packit 1f69a5
    case GST_STATE_CHANGE_PAUSED_TO_READY:
Packit 1f69a5
      gst_rtp_mp4g_depay_reset (rtpmp4gdepay);
Packit 1f69a5
      break;
Packit 1f69a5
    default:
Packit 1f69a5
      break;
Packit 1f69a5
  }
Packit 1f69a5
  return ret;
Packit 1f69a5
}
Packit 1f69a5
Packit 1f69a5
gboolean
Packit 1f69a5
gst_rtp_mp4g_depay_plugin_init (GstPlugin * plugin)
Packit 1f69a5
{
Packit 1f69a5
  return gst_element_register (plugin, "rtpmp4gdepay",
Packit 1f69a5
      GST_RANK_SECONDARY, GST_TYPE_RTP_MP4G_DEPAY);
Packit 1f69a5
}