static void gst_rtp_amr_depay_init (GstRtpAMRDepay * rtpamrdepay, GstRtpAMRDepayClass * klass) { GstBaseRTPDepayload *depayload; depayload = GST_BASE_RTP_DEPAYLOAD (rtpamrdepay); gst_pad_use_fixed_caps (GST_BASE_RTP_DEPAYLOAD_SRCPAD (depayload)); }
static gboolean gst_rtp_vp8_depay_set_caps (GstBaseRTPDepayload * depayload, GstCaps * caps) { GstCaps *srccaps = gst_caps_new_simple ("video/x-vp8", "framerate", GST_TYPE_FRACTION, 0, 1, NULL); gst_pad_set_caps (GST_BASE_RTP_DEPAYLOAD_SRCPAD (depayload), srccaps); gst_caps_unref (srccaps); return TRUE; }
static gboolean gst_rtp_qcelp_depay_setcaps (GstBaseRTPDepayload * depayload, GstCaps * caps) { GstCaps *srccaps; gboolean res; srccaps = gst_caps_new_simple ("audio/qcelp", "channels", G_TYPE_INT, 1, "rate", G_TYPE_INT, 8000, NULL); res = gst_pad_set_caps (GST_BASE_RTP_DEPAYLOAD_SRCPAD (depayload), srccaps); gst_caps_unref (srccaps); return res; }
static gboolean gst_rtp_g729_depay_setcaps (GstBaseRTPDepayload * depayload, GstCaps * caps) { GstStructure *structure; GstCaps *srccaps; GstRtpG729Depay *rtpg729depay; const gchar *params; gint clock_rate, channels; gboolean ret; rtpg729depay = GST_RTP_G729_DEPAY (depayload); structure = gst_caps_get_structure (caps, 0); if (!(params = gst_structure_get_string (structure, "encoding-params"))) channels = 1; else { channels = atoi (params); } if (!gst_structure_get_int (structure, "clock-rate", &clock_rate)) clock_rate = 8000; if (channels != 1) goto wrong_channels; if (clock_rate != 8000) goto wrong_clock_rate; depayload->clock_rate = clock_rate; srccaps = gst_caps_new_simple ("audio/G729", "channels", G_TYPE_INT, channels, "rate", G_TYPE_INT, clock_rate, NULL); ret = gst_pad_set_caps (GST_BASE_RTP_DEPAYLOAD_SRCPAD (depayload), srccaps); gst_caps_unref (srccaps); return ret; /* ERRORS */ wrong_channels: { GST_DEBUG_OBJECT (rtpg729depay, "expected 1 channel, got %d", channels); return FALSE; } wrong_clock_rate: { GST_DEBUG_OBJECT (rtpg729depay, "expected 8000 clock-rate, got %d", clock_rate); return FALSE; } }
static gboolean gst_rtp_mp1s_depay_setcaps (GstBaseRTPDepayload * depayload, GstCaps * caps) { GstCaps *srccaps; GstStructure *structure; gint clock_rate; gboolean res; structure = gst_caps_get_structure (caps, 0); if (!gst_structure_get_int (structure, "clock-rate", &clock_rate)) clock_rate = 90000; /* default */ depayload->clock_rate = clock_rate; srccaps = gst_caps_new_simple ("video/mpeg", "systemstream", G_TYPE_BOOLEAN, TRUE, NULL); res = gst_pad_set_caps (GST_BASE_RTP_DEPAYLOAD_SRCPAD (depayload), srccaps); gst_caps_unref (srccaps); return res; }
gboolean gst_rtp_dtmf_depay_setcaps (GstBaseRTPDepayload * filter, GstCaps * caps) { GstCaps *srccaps; GstStructure *structure = gst_caps_get_structure (caps, 0); gint clock_rate = 8000; /* default */ gst_structure_get_int (structure, "clock-rate", &clock_rate); filter->clock_rate = clock_rate; srccaps = gst_caps_new_simple ("audio/x-raw-int", "width", G_TYPE_INT, 16, "depth", G_TYPE_INT, 16, "endianness", G_TYPE_INT, G_BYTE_ORDER, "signed", G_TYPE_BOOLEAN, TRUE, "channels", G_TYPE_INT, 1, "rate", G_TYPE_INT, clock_rate, NULL); gst_pad_set_caps (GST_BASE_RTP_DEPAYLOAD_SRCPAD (filter), srccaps); gst_caps_unref (srccaps); return TRUE; }
static gboolean gst_rtp_pcma_depay_setcaps (GstBaseRTPDepayload * depayload, GstCaps * caps) { GstCaps *srccaps; GstStructure *structure; gboolean ret; gint clock_rate; structure = gst_caps_get_structure (caps, 0); if (!gst_structure_get_int (structure, "clock-rate", &clock_rate)) clock_rate = 8000; /* default */ depayload->clock_rate = clock_rate; srccaps = gst_caps_new_simple ("audio/x-alaw", "channels", G_TYPE_INT, 1, "rate", G_TYPE_INT, clock_rate, NULL); ret = gst_pad_set_caps (GST_BASE_RTP_DEPAYLOAD_SRCPAD (depayload), srccaps); gst_caps_unref (srccaps); return ret; }
static gboolean gst_rtp_ilbc_depay_setcaps (GstBaseRTPDepayload * depayload, GstCaps * caps) { GstRTPiLBCDepay *rtpilbcdepay = GST_RTP_ILBC_DEPAY (depayload); GstCaps *srccaps; GstStructure *structure; const gchar *mode_str = NULL; gint mode, clock_rate; gboolean ret; structure = gst_caps_get_structure (caps, 0); mode = rtpilbcdepay->mode; if (!gst_structure_get_int (structure, "clock-rate", &clock_rate)) clock_rate = 8000; depayload->clock_rate = clock_rate; /* parse mode, if we can */ mode_str = gst_structure_get_string (structure, "mode"); if (mode_str) { mode = strtol (mode_str, NULL, 10); if (mode != 20 && mode != 30) mode = rtpilbcdepay->mode; } rtpilbcdepay->mode = mode; srccaps = gst_caps_new_simple ("audio/x-iLBC", "mode", G_TYPE_INT, rtpilbcdepay->mode, NULL); ret = gst_pad_set_caps (GST_BASE_RTP_DEPAYLOAD_SRCPAD (depayload), srccaps); GST_DEBUG ("set caps on source: %" GST_PTR_FORMAT " (ret=%d)", srccaps, ret); gst_caps_unref (srccaps); return ret; }
static GstBuffer * gst_rtp_sv3v_depay_process (GstBaseRTPDepayload * depayload, GstBuffer * buf) { GstRtpSV3VDepay *rtpsv3vdepay; GstBuffer *outbuf; guint16 seq; rtpsv3vdepay = GST_RTP_SV3V_DEPAY (depayload); if (!gst_rtp_buffer_validate (buf)) goto bad_packet; /* flush on sequence number gaps */ seq = gst_rtp_buffer_get_seq (buf); if (seq != rtpsv3vdepay->nextseq) { gst_adapter_clear (rtpsv3vdepay->adapter); } rtpsv3vdepay->nextseq = seq + 1; { gint payload_len; guint8 *payload; gboolean M; gboolean C, S, E; payload_len = gst_rtp_buffer_get_payload_len (buf); if (payload_len < 3) goto bad_packet; payload = gst_rtp_buffer_get_payload (buf); M = gst_rtp_buffer_get_marker (buf); /* This is all a guess: * 1 1 1 1 1 1 * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * |0|C|S|E|0|0|0|0|0|0|0|0|0|0|0|0| * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * * C: config, packet contains config info * S: start, packet contains start of frame * E: end, packet contains end of frame */ /* this seems to indicate a packet with a config string sent before each * keyframe */ C = (payload[0] & 0x40) == 0x40; /* redundant with the RTP marker bit */ S = (payload[0] & 0x20) == 0x20; E = (payload[0] & 0x10) == 0x10; if (C) { GstCaps *caps; GstBuffer *codec_data; GValue value = { 0 }; /* if we already have caps, we don't need to do anything. FIXME, check if * something changed. */ if (GST_PAD_CAPS (GST_BASE_RTP_DEPAYLOAD_SRCPAD (depayload))) return NULL; /* No idea... These are the two examples I found.. */ if (payload[2] == 0x1d) { rtpsv3vdepay->width = 160; rtpsv3vdepay->height = 128; } else if (payload[2] == 0xdd) { rtpsv3vdepay->width = 320; rtpsv3vdepay->height = 240; } /* we need a dummy empty codec data */ g_value_init (&value, GST_TYPE_BUFFER); gst_value_deserialize (&value, ""); codec_data = gst_value_get_buffer (&value); caps = gst_caps_new_simple ("video/x-svq", "svqversion", G_TYPE_INT, 3, "width", G_TYPE_INT, rtpsv3vdepay->width, "height", G_TYPE_INT, rtpsv3vdepay->height, "codec_data", GST_TYPE_BUFFER, codec_data, NULL); gst_pad_set_caps (GST_BASE_RTP_DEPAYLOAD_SRCPAD (depayload), caps); gst_caps_unref (caps); g_value_unset (&value); return NULL; } /* store data in adapter, stip off 2 bytes header */ outbuf = gst_rtp_buffer_get_payload_subbuffer (buf, 2, -1); gst_adapter_push (rtpsv3vdepay->adapter, outbuf); if (M) { /* frame is completed: push contents of adapter */ guint avail; avail = gst_adapter_available (rtpsv3vdepay->adapter); outbuf = gst_adapter_take_buffer (rtpsv3vdepay->adapter, avail); /* timestamp for complete buffer is that of last buffer as well */ gst_buffer_set_caps (outbuf, GST_PAD_CAPS (depayload->srcpad)); return outbuf; } } return NULL; /* ERRORS */ bad_packet: { GST_ELEMENT_WARNING (rtpsv3vdepay, STREAM, DECODE, ("Packet did not validate"), (NULL)); return NULL; } }
static GstBuffer * gst_rtp_qdm2_depay_process (GstBaseRTPDepayload * depayload, GstBuffer * buf) { GstRtpQDM2Depay *rtpqdm2depay; GstBuffer *outbuf; guint16 seq; rtpqdm2depay = GST_RTP_QDM2_DEPAY (depayload); { gint payload_len; guint8 *payload; guint avail; guint pos = 0; payload_len = gst_rtp_buffer_get_payload_len (buf); if (payload_len < 3) goto bad_packet; payload = gst_rtp_buffer_get_payload (buf); seq = gst_rtp_buffer_get_seq (buf); if (G_UNLIKELY (seq != rtpqdm2depay->nextseq)) { GST_DEBUG ("GAP in sequence number, Resetting data !"); /* Flush previous data */ flush_data (rtpqdm2depay); /* And store new timestamp */ rtpqdm2depay->ptimestamp = rtpqdm2depay->timestamp; rtpqdm2depay->timestamp = GST_BUFFER_TIMESTAMP (buf); /* And that previous data will be pushed at the bottom */ } rtpqdm2depay->nextseq = seq + 1; GST_DEBUG ("Payload size %d 0x%x sequence:%d", payload_len, payload_len, seq); GST_MEMDUMP ("Incoming payload", payload, payload_len); while (pos < payload_len) { switch (payload[pos]) { case 0x80:{ GST_DEBUG ("Unrecognized 0x80 marker, skipping 12 bytes"); pos += 12; } break; case 0xff: /* HEADERS */ GST_DEBUG ("Headers"); /* Store the incoming timestamp */ rtpqdm2depay->ptimestamp = rtpqdm2depay->timestamp; rtpqdm2depay->timestamp = GST_BUFFER_TIMESTAMP (buf); /* flush the internal data if needed */ flush_data (rtpqdm2depay); if (G_UNLIKELY (!rtpqdm2depay->configured)) { guint8 *ourdata; GstBuffer *codecdata; GstCaps *caps; /* First bytes are unknown */ GST_MEMDUMP ("Header", payload + pos, 32); ourdata = payload + pos + 10; pos += 10; rtpqdm2depay->channs = GST_READ_UINT32_BE (payload + pos + 4); rtpqdm2depay->samplerate = GST_READ_UINT32_BE (payload + pos + 8); rtpqdm2depay->bitrate = GST_READ_UINT32_BE (payload + pos + 12); rtpqdm2depay->blocksize = GST_READ_UINT32_BE (payload + pos + 16); rtpqdm2depay->framesize = GST_READ_UINT32_BE (payload + pos + 20); rtpqdm2depay->packetsize = GST_READ_UINT32_BE (payload + pos + 24); /* 16 bit empty block (0x02 0x00) */ pos += 30; GST_DEBUG ("channs:%d, samplerate:%d, bitrate:%d, blocksize:%d, framesize:%d, packetsize:%d", rtpqdm2depay->channs, rtpqdm2depay->samplerate, rtpqdm2depay->bitrate, rtpqdm2depay->blocksize, rtpqdm2depay->framesize, rtpqdm2depay->packetsize); /* Caps */ codecdata = gst_buffer_new_and_alloc (48); memcpy (GST_BUFFER_DATA (codecdata), headheader, 20); memcpy (GST_BUFFER_DATA (codecdata) + 20, ourdata, 28); caps = gst_caps_new_simple ("audio/x-qdm2", "samplesize", G_TYPE_INT, 16, "rate", G_TYPE_INT, rtpqdm2depay->samplerate, "channels", G_TYPE_INT, rtpqdm2depay->channs, "codec_data", GST_TYPE_BUFFER, codecdata, NULL); gst_pad_set_caps (GST_BASE_RTP_DEPAYLOAD_SRCPAD (depayload), caps); gst_caps_unref (caps); rtpqdm2depay->configured = TRUE; } else { GST_DEBUG ("Already configured, skipping headers"); pos += 40; } break; default:{ /* Shuffled packet contents */ guint packetid = payload[pos++]; guint packettype = payload[pos++]; guint packlen = payload[pos++]; guint hsize = 2; GST_DEBUG ("Packet id:%d, type:0x%x, len:%d", packetid, packettype, packlen); /* Packets bigger than 0xff bytes have a type with the high bit set */ if (G_UNLIKELY (packettype & 0x80)) { packettype &= 0x7f; packlen <<= 8; packlen |= payload[pos++]; hsize = 3; GST_DEBUG ("Packet id:%d, type:0x%x, len:%d", packetid, packettype, packlen); } if (packettype > 0x7f) { GST_ERROR ("HOUSTON WE HAVE A PROBLEM !!!!"); } add_packet (rtpqdm2depay, packetid, packlen + hsize, payload + pos - hsize); pos += packlen; } } } GST_DEBUG ("final pos %d", pos); avail = gst_adapter_available (rtpqdm2depay->adapter); if (G_UNLIKELY (avail)) { GST_DEBUG ("Pushing out %d bytes of collected data", avail); outbuf = gst_adapter_take_buffer (rtpqdm2depay->adapter, avail); GST_BUFFER_TIMESTAMP (outbuf) = rtpqdm2depay->ptimestamp; GST_DEBUG ("Outgoing buffer timestamp %" GST_TIME_FORMAT, GST_TIME_ARGS (rtpqdm2depay->ptimestamp)); return outbuf; } } return NULL; /* ERRORS */ bad_packet: { GST_ELEMENT_WARNING (rtpqdm2depay, STREAM, DECODE, (NULL), ("Packet was too short")); return NULL; } }
static gboolean gst_rtp_vraw_depay_setcaps (GstBaseRTPDepayload * depayload, GstCaps * caps) { GstStructure *structure; GstRtpVRawDepay *rtpvrawdepay; gint clock_rate; const gchar *str, *type; gint format, width, height, pgroup, xinc, yinc; guint ystride, uvstride, yp, up, vp, outsize; GstCaps *srccaps; guint32 fourcc = 0; gboolean res; rtpvrawdepay = GST_RTP_VRAW_DEPAY (depayload); structure = gst_caps_get_structure (caps, 0); yp = up = vp = uvstride = 0; xinc = yinc = 1; if (!gst_structure_get_int (structure, "clock-rate", &clock_rate)) clock_rate = 90000; /* default */ depayload->clock_rate = clock_rate; if (!(str = gst_structure_get_string (structure, "width"))) goto no_width; width = atoi (str); if (!(str = gst_structure_get_string (structure, "height"))) goto no_height; height = atoi (str); /* optional interlace value but we don't handle interlaced * formats yet */ if (gst_structure_get_string (structure, "interlace")) goto interlaced; if (!(str = gst_structure_get_string (structure, "sampling"))) goto no_sampling; if (!strcmp (str, "RGB")) { format = GST_VIDEO_FORMAT_RGB; pgroup = 3; ystride = GST_ROUND_UP_4 (width * 3); outsize = ystride * height; type = "video/x-raw-rgb"; } else if (!strcmp (str, "RGBA")) { format = GST_VIDEO_FORMAT_RGBA; pgroup = 4; ystride = width * 4; outsize = ystride * height; type = "video/x-raw-rgb"; } else if (!strcmp (str, "BGR")) { format = GST_VIDEO_FORMAT_BGR; pgroup = 3; ystride = GST_ROUND_UP_4 (width * 3); outsize = ystride * height; type = "video/x-raw-rgb"; } else if (!strcmp (str, "BGRA")) { format = GST_VIDEO_FORMAT_BGRA; pgroup = 4; ystride = width * 4; outsize = ystride * height; type = "video/x-raw-rgb"; } else if (!strcmp (str, "YCbCr-4:4:4")) { format = GST_VIDEO_FORMAT_AYUV; pgroup = 3; ystride = width * 4; outsize = ystride * height; type = "video/x-raw-yuv"; fourcc = GST_MAKE_FOURCC ('A', 'Y', 'U', 'V'); } else if (!strcmp (str, "YCbCr-4:2:2")) { format = GST_VIDEO_FORMAT_UYVY; pgroup = 4; ystride = GST_ROUND_UP_2 (width) * 2; outsize = ystride * height; type = "video/x-raw-yuv"; fourcc = GST_MAKE_FOURCC ('U', 'Y', 'V', 'Y'); xinc = 2; } else if (!strcmp (str, "YCbCr-4:2:0")) { format = GST_VIDEO_FORMAT_I420; pgroup = 6; ystride = GST_ROUND_UP_4 (width); uvstride = GST_ROUND_UP_8 (width) / 2; up = ystride * GST_ROUND_UP_2 (height); vp = up + uvstride * GST_ROUND_UP_2 (height) / 2; outsize = vp + uvstride * GST_ROUND_UP_2 (height) / 2; type = "video/x-raw-yuv"; fourcc = GST_MAKE_FOURCC ('I', '4', '2', '0'); xinc = yinc = 2; } else if (!strcmp (str, "YCbCr-4:1:1")) { format = GST_VIDEO_FORMAT_Y41B; pgroup = 6; ystride = GST_ROUND_UP_4 (width); uvstride = GST_ROUND_UP_8 (width) / 4; up = ystride * height; vp = up + uvstride * height; outsize = vp + uvstride * height; type = "video/x-raw-yuv"; fourcc = GST_MAKE_FOURCC ('Y', '4', '1', 'B'); xinc = 4; } else goto unknown_format; rtpvrawdepay->width = width; rtpvrawdepay->height = height; rtpvrawdepay->format = format; rtpvrawdepay->yp = yp; rtpvrawdepay->up = up; rtpvrawdepay->vp = vp; rtpvrawdepay->pgroup = pgroup; rtpvrawdepay->xinc = xinc; rtpvrawdepay->yinc = yinc; rtpvrawdepay->ystride = ystride; rtpvrawdepay->uvstride = uvstride; rtpvrawdepay->outsize = outsize; srccaps = gst_caps_new_simple (type, "width", G_TYPE_INT, width, "height", G_TYPE_INT, height, "format", GST_TYPE_FOURCC, fourcc, "framerate", GST_TYPE_FRACTION, 0, 1, NULL); res = gst_pad_set_caps (GST_BASE_RTP_DEPAYLOAD_SRCPAD (depayload), srccaps); gst_caps_unref (srccaps); GST_DEBUG_OBJECT (depayload, "width %d, height %d, format %d", width, height, format); GST_DEBUG_OBJECT (depayload, "yp %d, up %d, vp %d", yp, up, vp); GST_DEBUG_OBJECT (depayload, "pgroup %d, ystride %d, uvstride %d", pgroup, ystride, uvstride); GST_DEBUG_OBJECT (depayload, "outsize %u", outsize); return res; /* ERRORS */ no_width: { GST_ERROR_OBJECT (depayload, "no width specified"); return FALSE; } no_height: { GST_ERROR_OBJECT (depayload, "no height specified"); return FALSE; } interlaced: { GST_ERROR_OBJECT (depayload, "interlaced formats not supported yet"); return FALSE; } no_sampling: { GST_ERROR_OBJECT (depayload, "no sampling specified"); return FALSE; } unknown_format: { GST_ERROR_OBJECT (depayload, "unknown sampling format '%s'", str); return FALSE; } }
static gboolean gst_rtp_amr_depay_setcaps (GstBaseRTPDepayload * depayload, GstCaps * caps) { GstStructure *structure; GstCaps *srccaps; GstRtpAMRDepay *rtpamrdepay; const gchar *params; const gchar *str, *type; gint clock_rate, need_clock_rate; gboolean res; rtpamrdepay = GST_RTP_AMR_DEPAY (depayload); structure = gst_caps_get_structure (caps, 0); /* figure out the mode first and set the clock rates */ if ((str = gst_structure_get_string (structure, "encoding-name"))) { if (strcmp (str, "AMR") == 0) { rtpamrdepay->mode = GST_RTP_AMR_DP_MODE_NB; need_clock_rate = 8000; type = "audio/AMR"; } else if (strcmp (str, "AMR-WB") == 0) { rtpamrdepay->mode = GST_RTP_AMR_DP_MODE_WB; need_clock_rate = 16000; type = "audio/AMR-WB"; } else goto invalid_mode; } else goto invalid_mode; if (!(str = gst_structure_get_string (structure, "octet-align"))) rtpamrdepay->octet_align = FALSE; else rtpamrdepay->octet_align = (atoi (str) == 1); if (!(str = gst_structure_get_string (structure, "crc"))) rtpamrdepay->crc = FALSE; else rtpamrdepay->crc = (atoi (str) == 1); if (rtpamrdepay->crc) { /* crc mode implies octet aligned mode */ rtpamrdepay->octet_align = TRUE; } if (!(str = gst_structure_get_string (structure, "robust-sorting"))) rtpamrdepay->robust_sorting = FALSE; else rtpamrdepay->robust_sorting = (atoi (str) == 1); if (rtpamrdepay->robust_sorting) { /* robust_sorting mode implies octet aligned mode */ rtpamrdepay->octet_align = TRUE; } if (!(str = gst_structure_get_string (structure, "interleaving"))) rtpamrdepay->interleaving = FALSE; else rtpamrdepay->interleaving = (atoi (str) == 1); if (rtpamrdepay->interleaving) { /* interleaving mode implies octet aligned mode */ rtpamrdepay->octet_align = TRUE; } if (!(params = gst_structure_get_string (structure, "encoding-params"))) rtpamrdepay->channels = 1; else { rtpamrdepay->channels = atoi (params); } if (!gst_structure_get_int (structure, "clock-rate", &clock_rate)) clock_rate = need_clock_rate; depayload->clock_rate = clock_rate; /* we require 1 channel, 8000 Hz, octet aligned, no CRC, * no robust sorting, no interleaving for now */ if (rtpamrdepay->channels != 1) return FALSE; if (clock_rate != need_clock_rate) return FALSE; if (rtpamrdepay->octet_align != TRUE) return FALSE; if (rtpamrdepay->robust_sorting != FALSE) return FALSE; if (rtpamrdepay->interleaving != FALSE) return FALSE; srccaps = gst_caps_new_simple (type, "channels", G_TYPE_INT, rtpamrdepay->channels, "rate", G_TYPE_INT, clock_rate, NULL); res = gst_pad_set_caps (GST_BASE_RTP_DEPAYLOAD_SRCPAD (depayload), srccaps); gst_caps_unref (srccaps); return res; /* ERRORS */ invalid_mode: { GST_ERROR_OBJECT (rtpamrdepay, "invalid encoding-name"); return FALSE; } }
static gboolean gst_rtp_bv_depay_setcaps (GstBaseRTPDepayload * depayload, GstCaps * caps) { GstRTPBVDepay *rtpbvdepay = GST_RTP_BV_DEPAY (depayload); GstCaps *srccaps; GstStructure *structure; const gchar *mode_str = NULL; gint mode, clock_rate, expected_rate; gboolean ret; structure = gst_caps_get_structure (caps, 0); mode_str = gst_structure_get_string (structure, "encoding-name"); if (!mode_str) goto no_mode; if (!strcmp (mode_str, "BV16")) { mode = 16; expected_rate = 8000; } else if (!strcmp (mode_str, "BV32")) { mode = 32; expected_rate = 16000; } else goto invalid_mode; if (!gst_structure_get_int (structure, "clock-rate", &clock_rate)) clock_rate = expected_rate; else if (clock_rate != expected_rate) goto wrong_rate; depayload->clock_rate = clock_rate; rtpbvdepay->mode = mode; srccaps = gst_caps_new_simple ("audio/x-bv", "mode", G_TYPE_INT, rtpbvdepay->mode, NULL); ret = gst_pad_set_caps (GST_BASE_RTP_DEPAYLOAD_SRCPAD (depayload), srccaps); GST_DEBUG ("set caps on source: %" GST_PTR_FORMAT " (ret=%d)", srccaps, ret); gst_caps_unref (srccaps); return ret; /* ERRORS */ no_mode: { GST_ERROR_OBJECT (rtpbvdepay, "did not receive an encoding-name"); return FALSE; } invalid_mode: { GST_ERROR_OBJECT (rtpbvdepay, "invalid encoding-name, expected BV16 or BV32, got %s", mode_str); return FALSE; } wrong_rate: { GST_ERROR_OBJECT (rtpbvdepay, "invalid clock-rate, expected %d, got %d", expected_rate, clock_rate); return FALSE; } }