mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 12:11:13 +00:00
3534e68563
Original commit message from CVS: Reworked the capsnegotiation function audiosink now uses capsnego to set its parameters mpg123/ac3dec use capsnego instead of metadata Added the beginnings of a testsuite for capsnego.
75 lines
2.1 KiB
C
75 lines
2.1 KiB
C
#include <gst/gst.h>
|
|
|
|
static GstPropsFactory mpeg2dec_sink_props = {
|
|
"mpegtype", GST_PROPS_LIST (
|
|
GST_PROPS_INT(1),
|
|
GST_PROPS_INT(2)
|
|
),
|
|
NULL
|
|
};
|
|
|
|
static GstPropsFactory mpeg2dec_src_props = {
|
|
"fourcc", GST_PROPS_LIST (
|
|
GST_PROPS_FOURCC ('Y','V','1','2'),
|
|
GST_PROPS_FOURCC_INT (0x56595559)
|
|
),
|
|
"width", GST_PROPS_INT_RANGE (16, 4096),
|
|
"height", GST_PROPS_INT_RANGE (16, 4096),
|
|
NULL
|
|
};
|
|
|
|
static GstProps *sinkprops = NULL,
|
|
*rawprops = NULL,
|
|
*testprops = NULL;
|
|
|
|
int main(int argc,char *argv[])
|
|
{
|
|
xmlDocPtr doc;
|
|
xmlNodePtr parent;
|
|
gint i;
|
|
|
|
doc = xmlNewDoc ("1.0");
|
|
doc->xmlRootNode = xmlNewDocNode (doc, NULL, "Properties", NULL);
|
|
|
|
_gst_type_initialize ();
|
|
|
|
sinkprops = gst_props_register (mpeg2dec_sink_props);
|
|
parent = xmlNewChild (doc->xmlRootNode, NULL, "Props1", NULL);
|
|
gst_props_save_thyself (sinkprops, parent);
|
|
|
|
rawprops = gst_props_register (mpeg2dec_src_props);
|
|
parent = xmlNewChild (doc->xmlRootNode, NULL, "Props2", NULL);
|
|
gst_props_save_thyself (rawprops, parent);
|
|
|
|
i=argc;
|
|
|
|
testprops = gst_props_new ("layer", GST_PROPS_INT (i),
|
|
"bitrate", GST_PROPS_INT_RANGE (i*300, i*10000),
|
|
NULL);
|
|
if (i==3) {
|
|
testprops = gst_props_merge (testprops,
|
|
gst_props_new ("framed", GST_PROPS_BOOLEAN (TRUE),
|
|
"mpegtest", GST_PROPS_BOOLEAN (FALSE),
|
|
"hello", GST_PROPS_LIST (
|
|
GST_PROPS_FOURCC_INT (0X5555),
|
|
GST_PROPS_FOURCC_INT (0X6666)
|
|
),
|
|
NULL));
|
|
}
|
|
|
|
parent = xmlNewChild (doc->xmlRootNode, NULL, "Props3", NULL);
|
|
gst_props_save_thyself (testprops, parent);
|
|
|
|
sinkprops = gst_props_set (sinkprops, "mpegtype", GST_PROPS_INT (1));
|
|
sinkprops = gst_props_set (sinkprops, "foobar", GST_PROPS_FOURCC_INT (0x56565656));
|
|
|
|
g_print ("%08lx\n", gst_props_get_fourcc_int (sinkprops, "foobar"));
|
|
g_print ("%d\n", gst_props_get_int (sinkprops, "mpegtype"));
|
|
|
|
parent = xmlNewChild (doc->xmlRootNode, NULL, "Props4", NULL);
|
|
gst_props_save_thyself (sinkprops, parent);
|
|
|
|
xmlDocDump(stdout, doc);
|
|
|
|
return 0;
|
|
}
|