Exemplo n.º 1
0
static void gst_rtp_sbc_pay_finalize(GObject *object)
{
	GstRtpSBCPay *sbcpay = GST_RTP_SBC_PAY(object);
	g_object_unref(sbcpay->adapter);

	GST_CALL_PARENT(G_OBJECT_CLASS, finalize, (object));
}
Exemplo n.º 2
0
static gboolean gst_rtp_sbc_pay_handle_event(GstPad *pad,
				GstEvent *event)
{
	GstRtpSBCPay *sbcpay = GST_RTP_SBC_PAY(GST_PAD_PARENT(pad));

	switch (GST_EVENT_TYPE(event)) {
	case GST_EVENT_EOS:
		gst_rtp_sbc_pay_flush_buffers(sbcpay);
		break;
	default:
		break;
	}

	return FALSE;
}
static gboolean
gst_rtp_sbc_pay_sink_event (GstRTPBasePayload * payload, GstEvent * event)
{
  GstRtpSBCPay *sbcpay = GST_RTP_SBC_PAY (payload);

  switch (GST_EVENT_TYPE (event)) {
    case GST_EVENT_EOS:
      gst_rtp_sbc_pay_flush_buffers (sbcpay);
      break;
    default:
      break;
  }

  return GST_RTP_BASE_PAYLOAD_CLASS (parent_class)->sink_event (payload, event);
}
Exemplo n.º 4
0
static void gst_rtp_sbc_pay_get_property(GObject *object, guint prop_id,
					GValue *value, GParamSpec *pspec)
{
	GstRtpSBCPay *sbcpay;

	sbcpay = GST_RTP_SBC_PAY(object);

	switch (prop_id) {
	case PROP_MIN_FRAMES:
		g_value_set_int(value, sbcpay->min_frames);
		break;
	default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
	break;
	}
}
static GstFlowReturn
gst_rtp_sbc_pay_handle_buffer (GstRTPBasePayload * payload, GstBuffer * buffer)
{
  GstRtpSBCPay *sbcpay;
  guint available;

  /* FIXME check for negotiation */

  sbcpay = GST_RTP_SBC_PAY (payload);
  sbcpay->timestamp = GST_BUFFER_PTS (buffer);

  gst_adapter_push (sbcpay->adapter, buffer);

  available = gst_adapter_available (sbcpay->adapter);
  if (available + RTP_SBC_HEADER_TOTAL >=
      GST_RTP_BASE_PAYLOAD_MTU (sbcpay) ||
      (available > (sbcpay->min_frames * sbcpay->frame_length)))
    return gst_rtp_sbc_pay_flush_buffers (sbcpay);

  return GST_FLOW_OK;
}
Exemplo n.º 6
0
static gboolean gst_rtp_sbc_pay_set_caps(GstBaseRTPPayload *payload,
			GstCaps *caps)
{
	GstRtpSBCPay *sbcpay;
	gint rate, subbands, channels, blocks, bitpool;
	gint frame_len;
	const gchar *channel_mode;
	GstStructure *structure;

	sbcpay = GST_RTP_SBC_PAY(payload);

	structure = gst_caps_get_structure(caps, 0);
	if (!gst_structure_get_int(structure, "rate", &rate))
		return FALSE;
	if (!gst_structure_get_int(structure, "channels", &channels))
		return FALSE;
	if (!gst_structure_get_int(structure, "blocks", &blocks))
		return FALSE;
	if (!gst_structure_get_int(structure, "bitpool", &bitpool))
		return FALSE;
	if (!gst_structure_get_int(structure, "subbands", &subbands))
		return FALSE;

	channel_mode = gst_structure_get_string(structure, "mode");
	if (!channel_mode)
		return FALSE;

	frame_len = gst_rtp_sbc_pay_get_frame_len(subbands, channels, blocks,
				bitpool, channel_mode);

	sbcpay->frame_length = frame_len;

	gst_basertppayload_set_options(payload, "audio", TRUE, "SBC", rate);

	GST_DEBUG_OBJECT(payload, "calculated frame length: %d ", frame_len);

	return gst_basertppayload_set_outcaps(payload, NULL);
}