mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-06 06:22:29 +00:00
Updated the padfactory test code.
Original commit message from CVS: Updated the padfactory test code.
This commit is contained in:
parent
6118b074bc
commit
ac7bf2494d
2 changed files with 91 additions and 51 deletions
|
@ -2,7 +2,7 @@ SUBDIRS = sched eos
|
||||||
|
|
||||||
noinst_PROGRAMS = init loadall simplefake states caps queue registry \
|
noinst_PROGRAMS = init loadall simplefake states caps queue registry \
|
||||||
paranoia rip mp3encode autoplug props case4 markup load tee autoplug2 autoplug3 \
|
paranoia rip mp3encode autoplug props case4 markup load tee autoplug2 autoplug3 \
|
||||||
capsconnect
|
capsconnect padfactory
|
||||||
|
|
||||||
# we have nothing but apps here, we can do this safely
|
# we have nothing but apps here, we can do this safely
|
||||||
LIBS += $(GST_LIBS)
|
LIBS += $(GST_LIBS)
|
||||||
|
|
|
@ -1,55 +1,93 @@
|
||||||
#include <gst/gst.h>
|
#include <gst/gst.h>
|
||||||
|
|
||||||
static GstCapsFactory mpeg2dec_sink_caps = {
|
static GstCaps*
|
||||||
"mpeg2deccaps",
|
mpeg2dec_sink_caps (void)
|
||||||
"video/mpeg",
|
{
|
||||||
"mpegtype", GST_PROPS_LIST (
|
static GstCaps *caps;
|
||||||
GST_PROPS_INT(1),
|
|
||||||
GST_PROPS_INT(2)
|
|
||||||
),
|
|
||||||
NULL
|
|
||||||
};
|
|
||||||
|
|
||||||
static GstCapsFactory mpeg2dec_src_caps = {
|
if (!caps) {
|
||||||
"name",
|
caps = gst_caps_new (
|
||||||
"video/raw",
|
"mpeg2deccaps",
|
||||||
"fourcc", GST_PROPS_LIST (
|
"video/mpeg",
|
||||||
GST_PROPS_FOURCC ('Y','V','1','2'),
|
gst_props_new (
|
||||||
GST_PROPS_FOURCC_INT (0x56595559)
|
"mpegtype", GST_PROPS_LIST (
|
||||||
|
GST_PROPS_INT(1),
|
||||||
|
GST_PROPS_INT(2)
|
||||||
|
),
|
||||||
|
NULL));
|
||||||
|
}
|
||||||
|
return caps;
|
||||||
|
}
|
||||||
|
|
||||||
|
GST_CAPS_FACTORY (mpeg2dec_src_caps,
|
||||||
|
GST_CAPS_NEW (
|
||||||
|
"mpeg2dec_src_caps",
|
||||||
|
"video/raw",
|
||||||
|
"fourcc", GST_PROPS_LIST (
|
||||||
|
GST_PROPS_FOURCC ( GST_MAKE_FOURCC ('Y','V','1','2')),
|
||||||
|
GST_PROPS_FOURCC (0x56595559)
|
||||||
|
),
|
||||||
|
"width", GST_PROPS_INT_RANGE (16, 4096),
|
||||||
|
"height", GST_PROPS_INT_RANGE (16, 4096)
|
||||||
|
),
|
||||||
|
GST_CAPS_NEW (
|
||||||
|
"mpeg2dec_src_caps",
|
||||||
|
"video/raw",
|
||||||
|
"foo", GST_PROPS_BOOLEAN (TRUE)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
static GstPadTemplate*
|
||||||
|
pad_caps (void)
|
||||||
|
{
|
||||||
|
static GstPadTemplate *template = NULL;
|
||||||
|
|
||||||
|
if (!template) {
|
||||||
|
template = gst_padtemplate_new (
|
||||||
|
"src",
|
||||||
|
GST_PAD_SRC,
|
||||||
|
GST_PAD_ALWAYS,
|
||||||
|
gst_caps_new (
|
||||||
|
"videocaps",
|
||||||
|
"video/raw",
|
||||||
|
gst_props_new (
|
||||||
|
"fourcc", GST_PROPS_LIST (
|
||||||
|
GST_PROPS_FOURCC (0x32315659),
|
||||||
|
GST_PROPS_FOURCC (GST_MAKE_FOURCC ('Y','U','Y','V'))
|
||||||
),
|
),
|
||||||
"width", GST_PROPS_INT_RANGE (16, 4096),
|
"height", GST_PROPS_INT_RANGE (16, 4096),
|
||||||
"height", GST_PROPS_INT_RANGE (16, 4096),
|
NULL)),
|
||||||
NULL
|
gst_caps_new (
|
||||||
};
|
"videocaps2",
|
||||||
|
"video/raw",
|
||||||
|
gst_props_new (
|
||||||
|
"fourcc", GST_PROPS_LIST (
|
||||||
|
GST_PROPS_FOURCC (0x32315659)
|
||||||
|
),
|
||||||
|
"height", GST_PROPS_INT_RANGE (16, 256),
|
||||||
|
NULL)),
|
||||||
|
NULL);
|
||||||
|
}
|
||||||
|
return template;
|
||||||
|
}
|
||||||
|
|
||||||
static GstCapsFactory raw_sink_caps = {
|
GST_PADTEMPLATE_FACTORY (testtempl,
|
||||||
NULL
|
|
||||||
};
|
|
||||||
|
|
||||||
static GstPadFactory pad_caps = {
|
|
||||||
"src",
|
"src",
|
||||||
GST_PAD_FACTORY_SRC,
|
GST_PAD_SRC,
|
||||||
GST_PAD_FACTORY_ALWAYS,
|
GST_PAD_ALWAYS,
|
||||||
GST_PAD_FACTORY_CAPS (
|
GST_CAPS_NEW (
|
||||||
"videocaps",
|
"mycaps",
|
||||||
"video/raw",
|
"audio/raw",
|
||||||
"fourcc", GST_PROPS_LIST (
|
"format", GST_PROPS_INT (55),
|
||||||
GST_PROPS_FOURCC_INT (0x32315659),
|
"foo", GST_PROPS_STRING ("bar")
|
||||||
GST_PROPS_FOURCC ('Y','U','Y','V')
|
|
||||||
),
|
|
||||||
"height", GST_PROPS_INT_RANGE (16, 4096)
|
|
||||||
),
|
),
|
||||||
GST_PAD_FACTORY_CAPS (
|
GST_CAPS_NEW (
|
||||||
"videocaps2",
|
"mycaps2",
|
||||||
"video/raw",
|
"audio/float",
|
||||||
"fourcc", GST_PROPS_LIST (
|
"format", GST_PROPS_INT (7),
|
||||||
GST_PROPS_FOURCC_INT (0x32315659)
|
"baz", GST_PROPS_STRING ("toe")
|
||||||
),
|
)
|
||||||
"height", GST_PROPS_INT_RANGE (16, 256)
|
)
|
||||||
),
|
|
||||||
NULL
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
static GstCaps *sinkcaps = NULL,
|
static GstCaps *sinkcaps = NULL,
|
||||||
*rawcaps = NULL;
|
*rawcaps = NULL;
|
||||||
|
@ -58,27 +96,29 @@ static GstPadTemplate *temp;
|
||||||
|
|
||||||
int main(int argc,char *argv[])
|
int main(int argc,char *argv[])
|
||||||
{
|
{
|
||||||
gboolean testret;
|
|
||||||
xmlDocPtr doc;
|
xmlDocPtr doc;
|
||||||
xmlNodePtr parent;
|
xmlNodePtr parent;
|
||||||
|
|
||||||
doc = xmlNewDoc ("1.0");
|
doc = xmlNewDoc ("1.0");
|
||||||
doc->xmlRootNode = xmlNewDocNode (doc, NULL, "Capabilities", NULL);
|
doc->xmlRootNode = xmlNewDocNode (doc, NULL, "Capabilities", NULL);
|
||||||
|
|
||||||
_gst_type_initialize ();
|
gst_init (&argc, &argv);
|
||||||
|
|
||||||
sinkcaps = gst_caps_register (&mpeg2dec_sink_caps);
|
sinkcaps = mpeg2dec_sink_caps ();
|
||||||
parent = xmlNewChild (doc->xmlRootNode, NULL, "Capabilities1", NULL);
|
parent = xmlNewChild (doc->xmlRootNode, NULL, "Capabilities1", NULL);
|
||||||
gst_caps_save_thyself (sinkcaps, parent);
|
gst_caps_save_thyself (sinkcaps, parent);
|
||||||
|
|
||||||
rawcaps = gst_caps_register (&mpeg2dec_src_caps);
|
rawcaps = GST_CAPS_GET (mpeg2dec_src_caps);
|
||||||
parent = xmlNewChild (doc->xmlRootNode, NULL, "Capabilities2", NULL);
|
parent = xmlNewChild (doc->xmlRootNode, NULL, "Capabilities2", NULL);
|
||||||
gst_caps_save_thyself (rawcaps, parent);
|
gst_caps_save_thyself (rawcaps, parent);
|
||||||
|
|
||||||
temp = gst_padtemplate_new (&pad_caps);
|
temp = pad_caps ();
|
||||||
parent = xmlNewChild (doc->xmlRootNode, NULL, "Padtemplate", NULL);
|
parent = xmlNewChild (doc->xmlRootNode, NULL, "Padtemplate", NULL);
|
||||||
gst_padtemplate_save_thyself (temp, parent);
|
gst_padtemplate_save_thyself (temp, parent);
|
||||||
|
|
||||||
|
parent = xmlNewChild (doc->xmlRootNode, NULL, "Padtemplate2", NULL);
|
||||||
|
gst_padtemplate_save_thyself (GST_PADTEMPLATE_GET (testtempl), parent);
|
||||||
|
|
||||||
xmlDocDump(stdout, doc);
|
xmlDocDump(stdout, doc);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Loading…
Reference in a new issue