Commit a678b180 authored by David Schleef's avatar David Schleef

convert to new caps

Original commit message from CVS:
convert to new caps
parent 25c66d2d
common @ fcdc6ccb
Subproject commit b5288e8215c6eacf0782880f6c5b6dea8f445a34
Subproject commit fcdc6ccbcc674dd487021d87a0313abf02bae396
......@@ -41,29 +41,27 @@ enum
ARG_PAYLOAD_TYPE,
};
GST_PAD_TEMPLATE_FACTORY (src_factory,
"src",
GST_PAD_SRC,
GST_PAD_ALWAYS,
GST_CAPS_NEW (
"audio_raw",
"audio/x-raw-int",
"endianness", GST_PROPS_INT (G_BYTE_ORDER),
"signed", GST_PROPS_BOOLEAN (TRUE),
"width", GST_PROPS_INT (16),
"depth", GST_PROPS_INT (16),
"rate", GST_PROPS_INT_RANGE (1000, 48000),
"channels", GST_PROPS_INT_RANGE (1, 2))
)
GST_PAD_TEMPLATE_FACTORY (sink_factory,
"sink",
GST_PAD_SINK,
GST_PAD_ALWAYS,
GST_CAPS_NEW (
"rtp",
"application/x-rtp",
NULL)
static GstStaticPadTemplate gst_rtpL16parse_src_template =
GST_STATIC_PAD_TEMPLATE (
"src",
GST_PAD_SRC,
GST_PAD_ALWAYS,
GST_STATIC_CAPS ( "audio/x-raw-int, "
"endianness = (int) " G_STRINGIFY(G_BYTE_ORDER) ", "
"signed = (int) true, "
"width = (int) 16, "
"depth = (int) 16, "
"rate = (int) [ 1000, 48000 ], "
"channels = (int) [ 1, 2 ]"
)
);
static GstStaticPadTemplate gst_rtpL16parse_sink_template =
GST_STATIC_PAD_TEMPLATE (
"sink",
GST_PAD_SINK,
GST_PAD_ALWAYS,
GST_STATIC_CAPS ("application/x-rtp")
);
static void gst_rtpL16parse_class_init (GstRtpL16ParseClass * klass);
......@@ -108,9 +106,9 @@ gst_rtpL16parse_base_init (GstRtpL16ParseClass * klass)
GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
gst_element_class_add_pad_template (element_class,
GST_PAD_TEMPLATE_GET (src_factory));
gst_static_pad_template_get (&gst_rtpL16parse_src_template));
gst_element_class_add_pad_template (element_class,
GST_PAD_TEMPLATE_GET (sink_factory));
gst_static_pad_template_get (&gst_rtpL16parse_sink_template));
gst_element_class_set_details (element_class, &gst_rtp_L16parse_details);
}
......@@ -141,8 +139,10 @@ gst_rtpL16parse_class_init (GstRtpL16ParseClass * klass)
static void
gst_rtpL16parse_init (GstRtpL16Parse * rtpL16parse)
{
rtpL16parse->srcpad = gst_pad_new_from_template (GST_PAD_TEMPLATE_GET (src_factory), "src");
rtpL16parse->sinkpad = gst_pad_new_from_template (GST_PAD_TEMPLATE_GET (sink_factory), "sink");
rtpL16parse->srcpad = gst_pad_new_from_template (
gst_static_pad_template_get (&gst_rtpL16parse_src_template), "src");
rtpL16parse->sinkpad = gst_pad_new_from_template (
gst_static_pad_template_get (&gst_rtpL16parse_sink_template), "sink");
gst_element_add_pad (GST_ELEMENT (rtpL16parse), rtpL16parse->srcpad);
gst_element_add_pad (GST_ELEMENT (rtpL16parse), rtpL16parse->sinkpad);
gst_pad_set_chain_function (rtpL16parse->sinkpad, gst_rtpL16parse_chain);
......@@ -170,17 +170,13 @@ gst_rtpL16parse_ntohs (GstBuffer *buf)
void
gst_rtpL16_caps_nego (GstRtpL16Parse *rtpL16parse)
{
GstCaps *caps;
caps = GST_CAPS_NEW (
"audio_raw",
"audio/x-raw-int",
"endianness", GST_PROPS_INT (G_BYTE_ORDER),
"signed", GST_PROPS_BOOLEAN (TRUE),
"width", GST_PROPS_INT (16),
"depth", GST_PROPS_INT (16),
"rate", GST_PROPS_INT (rtpL16parse->frequency),
"channels", GST_PROPS_INT (rtpL16parse->channels));
GstCaps2 *caps;
caps = gst_caps2_copy(gst_static_caps2_get (&gst_rtpL16parse_src_template.static_caps));
gst_caps2_set_simple (caps,
"rate", G_TYPE_INT, rtpL16parse->frequency,
"channel", G_TYPE_INT, rtpL16parse->channels, NULL);
gst_pad_try_set_caps (rtpL16parse->srcpad, caps);
}
......
......@@ -44,30 +44,27 @@ enum
ARG_0,
};
GST_PAD_TEMPLATE_FACTORY (sink_factory,
"sink",
GST_PAD_SINK,
GST_PAD_ALWAYS,
GST_CAPS_NEW (
"audio_raw",
"audio/x-raw-int",
"endianness", GST_PROPS_INT (G_BYTE_ORDER),
"signed", GST_PROPS_BOOLEAN (TRUE),
"width", GST_PROPS_INT (16),
"depth", GST_PROPS_INT (16),
"rate", GST_PROPS_INT_RANGE (1000, 48000),
"channels", GST_PROPS_INT_RANGE (1, 2)
)
static GstStaticPadTemplate gst_rtpL16enc_sink_template =
GST_STATIC_PAD_TEMPLATE (
"sink",
GST_PAD_SINK,
GST_PAD_ALWAYS,
GST_STATIC_CAPS ( "audio/x-raw-int, "
"endianness = (int) " G_STRINGIFY(G_BYTE_ORDER) ", "
"signed = (int) true, "
"width = (int) 16, "
"depth = (int) 16, "
"rate = (int) [ 1000, 48000 ], "
"channels = (int) [ 1, 2 ]"
)
);
GST_PAD_TEMPLATE_FACTORY (src_factory,
"src",
GST_PAD_SRC,
GST_PAD_ALWAYS,
GST_CAPS_NEW (
"rtp",
"application/x-rtp",
NULL)
static GstStaticPadTemplate gst_rtpL16enc_src_template =
GST_STATIC_PAD_TEMPLATE (
"src",
GST_PAD_SRC,
GST_PAD_ALWAYS,
GST_STATIC_CAPS ("application/x-rtp")
);
static void gst_rtpL16enc_class_init (GstRtpL16EncClass * klass);
......@@ -78,7 +75,7 @@ static void gst_rtpL16enc_set_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec);
static void gst_rtpL16enc_get_property (GObject * object, guint prop_id,
GValue * value, GParamSpec * pspec);
static GstPadLinkReturn gst_rtpL16enc_sinkconnect (GstPad * pad, GstCaps * caps);
static GstPadLinkReturn gst_rtpL16enc_sinkconnect (GstPad * pad, const GstCaps2 * caps);
static GstElementStateReturn gst_rtpL16enc_change_state (GstElement * element);
static GstElementClass *parent_class = NULL;
......@@ -111,9 +108,9 @@ gst_rtpL16enc_base_init (GstRtpL16EncClass * klass)
GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
gst_element_class_add_pad_template (element_class,
GST_PAD_TEMPLATE_GET (sink_factory));
gst_static_pad_template_get (&gst_rtpL16enc_sink_template));
gst_element_class_add_pad_template (element_class,
GST_PAD_TEMPLATE_GET (src_factory));
gst_static_pad_template_get (&gst_rtpL16enc_src_template));
gst_element_class_set_details (element_class, &gst_rtpL16enc_details);
}
......@@ -137,8 +134,10 @@ gst_rtpL16enc_class_init (GstRtpL16EncClass * klass)
static void
gst_rtpL16enc_init (GstRtpL16Enc * rtpL16enc)
{
rtpL16enc->sinkpad = gst_pad_new_from_template (GST_PAD_TEMPLATE_GET (sink_factory), "sink");
rtpL16enc->srcpad = gst_pad_new_from_template (GST_PAD_TEMPLATE_GET (src_factory), "src");
rtpL16enc->sinkpad = gst_pad_new_from_template (
gst_static_pad_template_get (&gst_rtpL16enc_sink_template), "sink");
rtpL16enc->srcpad = gst_pad_new_from_template (
gst_static_pad_template_get (&gst_rtpL16enc_src_template), "src");
gst_element_add_pad (GST_ELEMENT (rtpL16enc), rtpL16enc->sinkpad);
gst_element_add_pad (GST_ELEMENT (rtpL16enc), rtpL16enc->srcpad);
gst_pad_set_chain_function (rtpL16enc->sinkpad, gst_rtpL16enc_chain);
......@@ -155,14 +154,20 @@ gst_rtpL16enc_init (GstRtpL16Enc * rtpL16enc)
}
static GstPadLinkReturn
gst_rtpL16enc_sinkconnect (GstPad * pad, GstCaps * caps)
gst_rtpL16enc_sinkconnect (GstPad * pad, const GstCaps2 * caps)
{
GstRtpL16Enc *rtpL16enc;
GstStructure *structure;
gboolean ret;
rtpL16enc = GST_RTP_L16_ENC (gst_pad_get_parent (pad));
gst_caps_get_int (caps, "rate", &rtpL16enc->frequency);
gst_caps_get_int (caps, "channels", &rtpL16enc->channels);
structure = gst_caps2_get_nth_cap (caps, 0);
ret = gst_structure_get_int (structure, "rate", &rtpL16enc->frequency);
ret &= gst_structure_get_int (structure, "channels", &rtpL16enc->channels);
if (!ret) return GST_PAD_LINK_REFUSED;
/* Pre-calculate what we can */
rtpL16enc->time_interval = GST_SECOND / (2 * rtpL16enc->channels * rtpL16enc->frequency);
......
......@@ -41,29 +41,27 @@ enum
ARG_PAYLOAD_TYPE,
};
GST_PAD_TEMPLATE_FACTORY (src_factory,
"src",
GST_PAD_SRC,
GST_PAD_ALWAYS,
GST_CAPS_NEW (
"audio_raw",
"audio/x-raw-int",
"endianness", GST_PROPS_INT (G_BYTE_ORDER),
"signed", GST_PROPS_BOOLEAN (TRUE),
"width", GST_PROPS_INT (16),
"depth", GST_PROPS_INT (16),
"rate", GST_PROPS_INT_RANGE (1000, 48000),
"channels", GST_PROPS_INT_RANGE (1, 2))
)
GST_PAD_TEMPLATE_FACTORY (sink_factory,
"sink",
GST_PAD_SINK,
GST_PAD_ALWAYS,
GST_CAPS_NEW (
"rtp",
"application/x-rtp",
NULL)
static GstStaticPadTemplate gst_rtpL16parse_src_template =
GST_STATIC_PAD_TEMPLATE (
"src",
GST_PAD_SRC,
GST_PAD_ALWAYS,
GST_STATIC_CAPS ( "audio/x-raw-int, "
"endianness = (int) " G_STRINGIFY(G_BYTE_ORDER) ", "
"signed = (int) true, "
"width = (int) 16, "
"depth = (int) 16, "
"rate = (int) [ 1000, 48000 ], "
"channels = (int) [ 1, 2 ]"
)
);
static GstStaticPadTemplate gst_rtpL16parse_sink_template =
GST_STATIC_PAD_TEMPLATE (
"sink",
GST_PAD_SINK,
GST_PAD_ALWAYS,
GST_STATIC_CAPS ("application/x-rtp")
);
static void gst_rtpL16parse_class_init (GstRtpL16ParseClass * klass);
......@@ -108,9 +106,9 @@ gst_rtpL16parse_base_init (GstRtpL16ParseClass * klass)
GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
gst_element_class_add_pad_template (element_class,
GST_PAD_TEMPLATE_GET (src_factory));
gst_static_pad_template_get (&gst_rtpL16parse_src_template));
gst_element_class_add_pad_template (element_class,
GST_PAD_TEMPLATE_GET (sink_factory));
gst_static_pad_template_get (&gst_rtpL16parse_sink_template));
gst_element_class_set_details (element_class, &gst_rtp_L16parse_details);
}
......@@ -141,8 +139,10 @@ gst_rtpL16parse_class_init (GstRtpL16ParseClass * klass)
static void
gst_rtpL16parse_init (GstRtpL16Parse * rtpL16parse)
{
rtpL16parse->srcpad = gst_pad_new_from_template (GST_PAD_TEMPLATE_GET (src_factory), "src");
rtpL16parse->sinkpad = gst_pad_new_from_template (GST_PAD_TEMPLATE_GET (sink_factory), "sink");
rtpL16parse->srcpad = gst_pad_new_from_template (
gst_static_pad_template_get (&gst_rtpL16parse_src_template), "src");
rtpL16parse->sinkpad = gst_pad_new_from_template (
gst_static_pad_template_get (&gst_rtpL16parse_sink_template), "sink");
gst_element_add_pad (GST_ELEMENT (rtpL16parse), rtpL16parse->srcpad);
gst_element_add_pad (GST_ELEMENT (rtpL16parse), rtpL16parse->sinkpad);
gst_pad_set_chain_function (rtpL16parse->sinkpad, gst_rtpL16parse_chain);
......@@ -170,17 +170,13 @@ gst_rtpL16parse_ntohs (GstBuffer *buf)
void
gst_rtpL16_caps_nego (GstRtpL16Parse *rtpL16parse)
{
GstCaps *caps;
caps = GST_CAPS_NEW (
"audio_raw",
"audio/x-raw-int",
"endianness", GST_PROPS_INT (G_BYTE_ORDER),
"signed", GST_PROPS_BOOLEAN (TRUE),
"width", GST_PROPS_INT (16),
"depth", GST_PROPS_INT (16),
"rate", GST_PROPS_INT (rtpL16parse->frequency),
"channels", GST_PROPS_INT (rtpL16parse->channels));
GstCaps2 *caps;
caps = gst_caps2_copy(gst_static_caps2_get (&gst_rtpL16parse_src_template.static_caps));
gst_caps2_set_simple (caps,
"rate", G_TYPE_INT, rtpL16parse->frequency,
"channel", G_TYPE_INT, rtpL16parse->channels, NULL);
gst_pad_try_set_caps (rtpL16parse->srcpad, caps);
}
......
......@@ -44,30 +44,27 @@ enum
ARG_0,
};
GST_PAD_TEMPLATE_FACTORY (sink_factory,
"sink",
GST_PAD_SINK,
GST_PAD_ALWAYS,
GST_CAPS_NEW (
"audio_raw",
"audio/x-raw-int",
"endianness", GST_PROPS_INT (G_BYTE_ORDER),
"signed", GST_PROPS_BOOLEAN (TRUE),
"width", GST_PROPS_INT (16),
"depth", GST_PROPS_INT (16),
"rate", GST_PROPS_INT_RANGE (1000, 48000),
"channels", GST_PROPS_INT_RANGE (1, 2)
)
static GstStaticPadTemplate gst_rtpL16enc_sink_template =
GST_STATIC_PAD_TEMPLATE (
"sink",
GST_PAD_SINK,
GST_PAD_ALWAYS,
GST_STATIC_CAPS ( "audio/x-raw-int, "
"endianness = (int) " G_STRINGIFY(G_BYTE_ORDER) ", "
"signed = (int) true, "
"width = (int) 16, "
"depth = (int) 16, "
"rate = (int) [ 1000, 48000 ], "
"channels = (int) [ 1, 2 ]"
)
);
GST_PAD_TEMPLATE_FACTORY (src_factory,
"src",
GST_PAD_SRC,
GST_PAD_ALWAYS,
GST_CAPS_NEW (
"rtp",
"application/x-rtp",
NULL)
static GstStaticPadTemplate gst_rtpL16enc_src_template =
GST_STATIC_PAD_TEMPLATE (
"src",
GST_PAD_SRC,
GST_PAD_ALWAYS,
GST_STATIC_CAPS ("application/x-rtp")
);
static void gst_rtpL16enc_class_init (GstRtpL16EncClass * klass);
......@@ -78,7 +75,7 @@ static void gst_rtpL16enc_set_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec);
static void gst_rtpL16enc_get_property (GObject * object, guint prop_id,
GValue * value, GParamSpec * pspec);
static GstPadLinkReturn gst_rtpL16enc_sinkconnect (GstPad * pad, GstCaps * caps);
static GstPadLinkReturn gst_rtpL16enc_sinkconnect (GstPad * pad, const GstCaps2 * caps);
static GstElementStateReturn gst_rtpL16enc_change_state (GstElement * element);
static GstElementClass *parent_class = NULL;
......@@ -111,9 +108,9 @@ gst_rtpL16enc_base_init (GstRtpL16EncClass * klass)
GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
gst_element_class_add_pad_template (element_class,
GST_PAD_TEMPLATE_GET (sink_factory));
gst_static_pad_template_get (&gst_rtpL16enc_sink_template));
gst_element_class_add_pad_template (element_class,
GST_PAD_TEMPLATE_GET (src_factory));
gst_static_pad_template_get (&gst_rtpL16enc_src_template));
gst_element_class_set_details (element_class, &gst_rtpL16enc_details);
}
......@@ -137,8 +134,10 @@ gst_rtpL16enc_class_init (GstRtpL16EncClass * klass)
static void
gst_rtpL16enc_init (GstRtpL16Enc * rtpL16enc)
{
rtpL16enc->sinkpad = gst_pad_new_from_template (GST_PAD_TEMPLATE_GET (sink_factory), "sink");
rtpL16enc->srcpad = gst_pad_new_from_template (GST_PAD_TEMPLATE_GET (src_factory), "src");
rtpL16enc->sinkpad = gst_pad_new_from_template (
gst_static_pad_template_get (&gst_rtpL16enc_sink_template), "sink");
rtpL16enc->srcpad = gst_pad_new_from_template (
gst_static_pad_template_get (&gst_rtpL16enc_src_template), "src");
gst_element_add_pad (GST_ELEMENT (rtpL16enc), rtpL16enc->sinkpad);
gst_element_add_pad (GST_ELEMENT (rtpL16enc), rtpL16enc->srcpad);
gst_pad_set_chain_function (rtpL16enc->sinkpad, gst_rtpL16enc_chain);
......@@ -155,14 +154,20 @@ gst_rtpL16enc_init (GstRtpL16Enc * rtpL16enc)
}
static GstPadLinkReturn
gst_rtpL16enc_sinkconnect (GstPad * pad, GstCaps * caps)
gst_rtpL16enc_sinkconnect (GstPad * pad, const GstCaps2 * caps)
{
GstRtpL16Enc *rtpL16enc;
GstStructure *structure;
gboolean ret;
rtpL16enc = GST_RTP_L16_ENC (gst_pad_get_parent (pad));
gst_caps_get_int (caps, "rate", &rtpL16enc->frequency);
gst_caps_get_int (caps, "channels", &rtpL16enc->channels);
structure = gst_caps2_get_nth_cap (caps, 0);
ret = gst_structure_get_int (structure, "rate", &rtpL16enc->frequency);
ret &= gst_structure_get_int (structure, "channels", &rtpL16enc->channels);
if (!ret) return GST_PAD_LINK_REFUSED;
/* Pre-calculate what we can */
rtpL16enc->time_interval = GST_SECOND / (2 * rtpL16enc->channels * rtpL16enc->frequency);
......
......@@ -41,26 +41,25 @@ enum
ARG_FREQUENCY
};
GST_PAD_TEMPLATE_FACTORY (src_factory,
"src",
GST_PAD_SRC,
GST_PAD_ALWAYS,
GST_CAPS_NEW (
"gsm_gsm",
"audio/x-gsm",
"rate", GST_PROPS_INT_RANGE (1000, 48000))
)
GST_PAD_TEMPLATE_FACTORY (sink_factory,
"sink",
GST_PAD_SINK,
GST_PAD_ALWAYS,
GST_CAPS_NEW (
"rtp",
"application/x-rtp",
NULL)
static GstStaticPadTemplate gst_rtpgsmparse_src_template =
GST_STATIC_PAD_TEMPLATE (
"src",
GST_PAD_SRC,
GST_PAD_ALWAYS,
GST_STATIC_CAPS ( "audio/x-gsm, "
"rate = (int) [ 1000, 48000 ]"
)
);
static GstStaticPadTemplate gst_rtpgsmparse_sink_template =
GST_STATIC_PAD_TEMPLATE (
"sink",
GST_PAD_SINK,
GST_PAD_ALWAYS,
GST_STATIC_CAPS ("application/x-rtp")
);
static void gst_rtpgsmparse_class_init (GstRtpGSMParseClass * klass);
static void gst_rtpgsmparse_base_init (GstRtpGSMParseClass * klass);
static void gst_rtpgsmparse_init (GstRtpGSMParse * rtpgsmparse);
......@@ -103,9 +102,9 @@ gst_rtpgsmparse_base_init (GstRtpGSMParseClass * klass)
GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
gst_element_class_add_pad_template (element_class,
GST_PAD_TEMPLATE_GET (src_factory));
gst_static_pad_template_get(&gst_rtpgsmparse_src_template));
gst_element_class_add_pad_template (element_class,
GST_PAD_TEMPLATE_GET (sink_factory));
gst_static_pad_template_get(&gst_rtpgsmparse_sink_template));
gst_element_class_set_details (element_class, &gst_rtp_gsmparse_details);
}
......@@ -133,8 +132,10 @@ gst_rtpgsmparse_class_init (GstRtpGSMParseClass * klass)
static void
gst_rtpgsmparse_init (GstRtpGSMParse * rtpgsmparse)
{
rtpgsmparse->srcpad = gst_pad_new_from_template (GST_PAD_TEMPLATE_GET (src_factory), "src");
rtpgsmparse->sinkpad = gst_pad_new_from_template (GST_PAD_TEMPLATE_GET (sink_factory), "sink");
rtpgsmparse->srcpad = gst_pad_new_from_template (
gst_static_pad_template_get(&gst_rtpgsmparse_src_template), "src");
rtpgsmparse->sinkpad = gst_pad_new_from_template (
gst_static_pad_template_get(&gst_rtpgsmparse_sink_template), "sink");
gst_element_add_pad (GST_ELEMENT (rtpgsmparse), rtpgsmparse->srcpad);
gst_element_add_pad (GST_ELEMENT (rtpgsmparse), rtpgsmparse->sinkpad);
gst_pad_set_chain_function (rtpgsmparse->sinkpad, gst_rtpgsmparse_chain);
......@@ -159,12 +160,10 @@ gst_rtpgsmparse_ntohs (GstBuffer *buf)
void
gst_rtpgsm_caps_nego (GstRtpGSMParse *rtpgsmparse)
{
GstCaps *caps;
GstCaps2 *caps;
caps = GST_CAPS_NEW (
"gsm_gsm",
"audio/x-gsm",
"rate", GST_PROPS_INT (rtpgsmparse->frequency));
caps = gst_caps2_new_simple ("audio/x-gsm",
"rate", G_TYPE_INT, rtpgsmparse->frequency);
gst_pad_try_set_caps (rtpgsmparse->srcpad, caps);
}
......
......@@ -45,26 +45,24 @@ enum
ARG_0,
};
GST_PAD_TEMPLATE_FACTORY (sink_factory,
"sink",
GST_PAD_SINK,
GST_PAD_ALWAYS,
GST_CAPS_NEW (
"gsm_gsm",
"audio/x-gsm",
"rate", GST_PROPS_INT_RANGE (1000, 48000)
)
)
GST_PAD_TEMPLATE_FACTORY (src_factory,
"src",
GST_PAD_SRC,
GST_PAD_ALWAYS,
GST_CAPS_NEW (
"rtp",
"application/x-rtp",
NULL)
)
static GstStaticPadTemplate gst_rtpgsmenc_sink_template =
GST_STATIC_PAD_TEMPLATE (
"sink",
GST_PAD_SINK,
GST_PAD_ALWAYS,
GST_STATIC_CAPS ( "audio/x-gsm, "
"rate = (int) [ 1000, 48000 ]"
)
);
static GstStaticPadTemplate gst_rtpgsmenc_src_template =
GST_STATIC_PAD_TEMPLATE (
"src",
GST_PAD_SRC,
GST_PAD_ALWAYS,
GST_STATIC_CAPS ("application/x-rtp")
);
static void gst_rtpgsmenc_class_init (GstRtpGSMEncClass * klass);
static void gst_rtpgsmenc_base_init (GstRtpGSMEncClass * klass);
......@@ -74,7 +72,7 @@ static void gst_rtpgsmenc_set_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec);
static void gst_rtpgsmenc_get_property (GObject * object, guint prop_id,
GValue * value, GParamSpec * pspec);
static GstPadLinkReturn gst_rtpgsmenc_sinkconnect (GstPad * pad, GstCaps * caps);
static GstPadLinkReturn gst_rtpgsmenc_sinkconnect (GstPad * pad, const GstCaps2 * caps);
static GstElementStateReturn gst_rtpgsmenc_change_state (GstElement * element);
static GstElementClass *parent_class = NULL;
......@@ -107,9 +105,9 @@ gst_rtpgsmenc_base_init (GstRtpGSMEncClass * klass)
GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
gst_element_class_add_pad_template (element_class,
GST_PAD_TEMPLATE_GET (sink_factory));
gst_static_pad_template_get (&gst_rtpgsmenc_sink_template));
gst_element_class_add_pad_template (element_class,
GST_PAD_TEMPLATE_GET (src_factory));
gst_static_pad_template_get (&gst_rtpgsmenc_src_template));
gst_element_class_set_details (element_class, &gst_rtpgsmenc_details);
}
......@@ -133,8 +131,10 @@ gst_rtpgsmenc_class_init (GstRtpGSMEncClass * klass)
static void
gst_rtpgsmenc_init (GstRtpGSMEnc * rtpgsmenc)
{
rtpgsmenc->sinkpad = gst_pad_new_from_template (GST_PAD_TEMPLATE_GET (sink_factory), "sink");
rtpgsmenc->srcpad = gst_pad_new_from_template (GST_PAD_TEMPLATE_GET (src_factory), "src");
rtpgsmenc->sinkpad = gst_pad_new_from_template (
gst_static_pad_template_get (&gst_rtpgsmenc_sink_template), "sink");
rtpgsmenc->srcpad = gst_pad_new_from_template (
gst_static_pad_template_get (&gst_rtpgsmenc_sink_template), "src");
gst_element_add_pad (GST_ELEMENT (rtpgsmenc), rtpgsmenc->sinkpad);
gst_element_add_pad (GST_ELEMENT (rtpgsmenc), rtpgsmenc->srcpad);
gst_pad_set_chain_function (rtpgsmenc->sinkpad, gst_rtpgsmenc_chain);
......@@ -150,13 +150,18 @@ gst_rtpgsmenc_init (GstRtpGSMEnc * rtpgsmenc)
}
static GstPadLinkReturn
gst_rtpgsmenc_sinkconnect (GstPad * pad, GstCaps * caps)
gst_rtpgsmenc_sinkconnect (GstPad * pad, const GstCaps2 * caps)
{
GstRtpGSMEnc *rtpgsmenc;
GstStructure *structure;
gboolean ret;
rtpgsmenc = GST_RTP_GSM_ENC (gst_pad_get_parent (pad));
gst_caps_get_int (caps, "rate", &rtpgsmenc->frequency);
structure = gst_caps2_get_nth_cap (caps, 0);
ret = gst_structure_get_int (structure, "rate", &rtpgsmenc->frequency);
if (!ret) return GST_PAD_LINK_REFUSED;
/* Pre-calculate what we can */
rtpgsmenc->time_interval = GST_SECOND / (2 * rtpgsmenc->frequency);
......
......@@ -41,26 +41,25 @@ enum
ARG_FREQUENCY
};
GST_PAD_TEMPLATE_FACTORY (src_factory,
"src",
GST_PAD_SRC,
GST_PAD_ALWAYS,
GST_CAPS_NEW (
"gsm_gsm",
"audio/x-gsm",
"rate", GST_PROPS_INT_RANGE (1000, 48000))
)
GST_PAD_TEMPLATE_FACTORY (sink_factory,
"sink",
GST_PAD_SINK,
GST_PAD_ALWAYS,
GST_CAPS_NEW (
"rtp",
"application/x-rtp",
NULL)
static GstStaticPadTemplate gst_rtpgsmparse_src_template =
GST_STATIC_PAD_TEMPLATE (