2001-03-12 21:02:12 +00:00
|
|
|
#include <gst/gst.h>
|
|
|
|
|
|
|
|
/* this is an example of the src pad dictating the caps
|
|
|
|
* the sink pad only accepts audio/raw */
|
|
|
|
|
2001-06-01 18:24:41 +00:00
|
|
|
static GstPadNegotiateReturn
|
|
|
|
negotiate (GstPad *pad, GstCaps **caps, gpointer *count)
|
2001-03-12 21:02:12 +00:00
|
|
|
{
|
|
|
|
g_print ("negotiation entered\n");
|
|
|
|
|
2001-06-01 18:24:41 +00:00
|
|
|
if (!strcmp (gst_caps_get_mime (*caps), "audio/raw"))
|
|
|
|
return GST_PAD_NEGOTIATE_AGREE;
|
2001-03-12 21:02:12 +00:00
|
|
|
|
2001-06-01 18:24:41 +00:00
|
|
|
return GST_PAD_NEGOTIATE_FAIL;
|
2001-03-12 21:02:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
main(int argc,char *argv[])
|
|
|
|
{
|
|
|
|
GstPad *srcpad, *sinkpad;
|
|
|
|
GstCaps *new;
|
|
|
|
|
|
|
|
gst_init(&argc,&argv);
|
|
|
|
|
|
|
|
srcpad = gst_pad_new ("src", GST_PAD_SRC);
|
|
|
|
sinkpad = gst_pad_new ("sink", GST_PAD_SINK);
|
|
|
|
|
|
|
|
gst_pad_connect (srcpad, sinkpad);
|
|
|
|
|
|
|
|
gst_pad_set_negotiate_function (sinkpad, negotiate);
|
|
|
|
|
|
|
|
/* fill in our desired caps */
|
2001-05-27 22:55:46 +00:00
|
|
|
new = gst_caps_new (
|
2001-03-12 21:02:12 +00:00
|
|
|
"src_caps", /* name */
|
|
|
|
"audio/raw", /* mime */
|
|
|
|
gst_props_new (
|
|
|
|
"format", GST_PROPS_INT (16),
|
|
|
|
"depth", GST_PROPS_INT (16),
|
|
|
|
"rate", GST_PROPS_INT (48000),
|
|
|
|
"channels", GST_PROPS_INT (2),
|
|
|
|
NULL
|
|
|
|
)
|
|
|
|
);
|
|
|
|
|
|
|
|
gst_pad_set_caps (srcpad, new);
|
|
|
|
|
2001-05-27 22:55:46 +00:00
|
|
|
new = gst_caps_new (
|
2001-03-12 21:02:12 +00:00
|
|
|
"src_caps", /* name */
|
|
|
|
"video/raw", /* mime */
|
|
|
|
gst_props_new (
|
2001-05-27 22:55:46 +00:00
|
|
|
"format", GST_PROPS_FOURCC (GST_MAKE_FOURCC ('Y','U','Y','V')),
|
2001-03-12 21:02:12 +00:00
|
|
|
NULL
|
|
|
|
)
|
|
|
|
);
|
|
|
|
|
|
|
|
gst_pad_set_caps (srcpad, new);
|
|
|
|
|
|
|
|
exit (0);
|
|
|
|
}
|