Esempio n. 1
0
static GstStateChangeReturn
gst_rtp_ac3_depay_change_state (GstElement * element, GstStateChange transition)
{
  GstRtpAC3Depay *rtpac3depay;
  GstStateChangeReturn ret;

  rtpac3depay = GST_RTP_AC3_DEPAY (element);

  /*
     switch (transition) {
     case GST_STATE_CHANGE_NULL_TO_READY:
     break;
     default:
     break;
     }
   */

  ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);

  /*
     switch (transition) {
     case GST_STATE_CHANGE_READY_TO_NULL:
     break;
     default:
     break;
     }
   */
  return ret;
}
Esempio n. 2
0
static GstBuffer *
gst_rtp_ac3_depay_process (GstBaseRTPDepayload * depayload, GstBuffer * buf)
{
  GstRtpAC3Depay *rtpac3depay;
  GstBuffer *outbuf;

  rtpac3depay = GST_RTP_AC3_DEPAY (depayload);

  {
    guint8 *payload;
    guint16 FT, NF;

    if (gst_rtp_buffer_get_payload_len (buf) < 2)
      goto empty_packet;

    payload = gst_rtp_buffer_get_payload (buf);

    /* strip off header
     *
     *  0                   1
     *  0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5
     * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
     * |    MBZ    | FT|       NF      |
     * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
     */
    FT = payload[0] & 0x3;
    NF = payload[1];

    GST_DEBUG_OBJECT (rtpac3depay, "FT: %d, NF: %d", FT, NF);

    /* We don't bother with fragmented packets yet */
    outbuf = gst_rtp_buffer_get_payload_subbuffer (buf, 2, -1);

    GST_DEBUG_OBJECT (rtpac3depay, "pushing buffer of size %d",
        GST_BUFFER_SIZE (outbuf));

    return outbuf;
  }

  return NULL;

  /* ERRORS */
empty_packet:
  {
    GST_ELEMENT_WARNING (rtpac3depay, STREAM, DECODE,
        ("Empty Payload."), (NULL));
    return NULL;
  }
}
Esempio n. 3
0
static gboolean
gst_rtp_ac3_depay_setcaps (GstBaseRTPDepayload * depayload, GstCaps * caps)
{
  GstStructure *structure;
  GstRtpAC3Depay *rtpac3depay;
  gint clock_rate = 90000;      /* default */

  rtpac3depay = GST_RTP_AC3_DEPAY (depayload);

  structure = gst_caps_get_structure (caps, 0);

  gst_structure_get_int (structure, "clock-rate", &clock_rate);
  depayload->clock_rate = clock_rate;

  return TRUE;
}
Esempio n. 4
0
static GstBuffer *
gst_rtp_ac3_depay_process (GstBaseRTPDepayload * depayload, GstBuffer * buf)
{
  GstRtpAC3Depay *rtpac3depay;
  GstBuffer *outbuf;

  rtpac3depay = GST_RTP_AC3_DEPAY (depayload);

  if (!gst_rtp_buffer_validate (buf))
    goto bad_packet;

  {
    gint payload_len;
    guint8 *payload;
    guint16 FT, NF;

    payload_len = gst_rtp_buffer_get_payload_len (buf);
    payload = gst_rtp_buffer_get_payload (buf);

    if (payload_len <= 2)
      goto empty_packet;

    /* strip off header
     *
     *  0                   1
     *  0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5
     * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
     * |    MBZ    | FT|       NF      |
     * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
     */
    FT = payload[0] & 0x3;
    NF = payload[1];

    GST_DEBUG_OBJECT (rtpac3depay, "FT: %d, NF: %d", FT, NF);

    payload_len -= 2;
    payload += 2;

    /* We don't bother with fragmented packets yet */
    outbuf = gst_rtp_buffer_get_payload_subbuffer (buf, 2, -1);

    GST_DEBUG_OBJECT (rtpac3depay, "pushing buffer of size %d",
        GST_BUFFER_SIZE (outbuf));

    return outbuf;
  }

  return NULL;

bad_packet:
  {
    GST_ELEMENT_WARNING (rtpac3depay, STREAM, DECODE,
        ("Packet did not validate."), (NULL));
    return NULL;
  }
#if 0
bad_payload:
  {
    GST_ELEMENT_WARNING (rtpac3depay, STREAM, DECODE,
        ("Unexpected payload type."), (NULL));
    return NULL;
  }
#endif
empty_packet:
  {
    GST_ELEMENT_WARNING (rtpac3depay, STREAM, DECODE,
        ("Empty Payload."), (NULL));
    return NULL;
  }
}