From 0475cf26131ccb8e8488625e45e92ea53e01b9bf Mon Sep 17 00:00:00 2001 From: "Ronald S. Bultje" Date: Tue, 23 Dec 2003 22:50:06 +0000 Subject: Fix caps breakage after Dave's caps branch merge. Original commit message from CVS: 2003-12-23 Ronald Bultje * ext/divx/gstdivxdec.c: (gst_divxdec_base_init), (gst_divxdec_init), (gst_divxdec_negotiate): * ext/divx/gstdivxdec.h: * ext/divx/gstdivxenc.c: (gst_divxenc_base_init), (gst_divxenc_init): * ext/faac/gstfaac.c: (gst_faac_base_init), (gst_faac_init), (gst_faac_sinkconnect), (gst_faac_srcconnect): * ext/mpeg2enc/gstmpeg2enc.cc: * ext/mpeg2enc/gstmpeg2encoder.cc: * ext/mpeg2enc/gstmpeg2encpicturereader.cc: * sys/dxr3/dxr3audiosink.c: (dxr3audiosink_base_init), (dxr3audiosink_init), (dxr3audiosink_pcm_sinklink): * sys/dxr3/dxr3spusink.c: (dxr3spusink_base_init), (dxr3spusink_init): * sys/dxr3/dxr3videosink.c: (dxr3videosink_base_init), (dxr3videosink_init): Fix caps breakage after Dave's caps branch merge. --- ChangeLog | 20 +++ ext/divx/gstdivxdec.c | 91 ++++++-------- ext/divx/gstdivxdec.h | 2 +- ext/divx/gstdivxenc.c | 181 ++++++++++++--------------- ext/faac/gstfaac.c | 205 +++++++++++++++---------------- ext/mpeg2enc/gstmpeg2enc.cc | 138 ++++++++++++--------- ext/mpeg2enc/gstmpeg2encoder.cc | 14 +-- ext/mpeg2enc/gstmpeg2encpicturereader.cc | 11 +- sys/dxr3/dxr3audiosink.c | 74 ++++------- sys/dxr3/dxr3spusink.c | 9 +- sys/dxr3/dxr3videosink.c | 22 ++-- 11 files changed, 366 insertions(+), 401 deletions(-) diff --git a/ChangeLog b/ChangeLog index 55e9a2ba..b2ee7071 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,23 @@ +2003-12-23 Ronald Bultje + + * ext/divx/gstdivxdec.c: (gst_divxdec_base_init), + (gst_divxdec_init), (gst_divxdec_negotiate): + * ext/divx/gstdivxdec.h: + * ext/divx/gstdivxenc.c: (gst_divxenc_base_init), + (gst_divxenc_init): + * ext/faac/gstfaac.c: (gst_faac_base_init), (gst_faac_init), + (gst_faac_sinkconnect), (gst_faac_srcconnect): + * ext/mpeg2enc/gstmpeg2enc.cc: + * ext/mpeg2enc/gstmpeg2encoder.cc: + * ext/mpeg2enc/gstmpeg2encpicturereader.cc: + * sys/dxr3/dxr3audiosink.c: (dxr3audiosink_base_init), + (dxr3audiosink_init), (dxr3audiosink_pcm_sinklink): + * sys/dxr3/dxr3spusink.c: (dxr3spusink_base_init), + (dxr3spusink_init): + * sys/dxr3/dxr3videosink.c: (dxr3videosink_base_init), + (dxr3videosink_init): + Fix caps breakage after Dave's caps branch merge. + 2003-12-23 Ronald Bultje * sys/ximage/ximagesink.c: (gst_ximagesink_xcontext_get): diff --git a/ext/divx/gstdivxdec.c b/ext/divx/gstdivxdec.c index c68d12dc..c2cd6324 100644 --- a/ext/divx/gstdivxdec.c +++ b/ext/divx/gstdivxdec.c @@ -33,47 +33,30 @@ GstElementDetails gst_divxdec_details = { "Ronald Bultje " }; -GST_PAD_TEMPLATE_FACTORY(sink_template, +static GstStaticPadTemplate sink_template = +GST_STATIC_PAD_TEMPLATE ( "sink", GST_PAD_SINK, GST_PAD_ALWAYS, - GST_CAPS_NEW( - "divxdec_sink", - "video/x-divx", - "divxversion", GST_PROPS_INT_RANGE(3, 5), - "width", GST_PROPS_INT_RANGE(0, G_MAXINT), - "height", GST_PROPS_INT_RANGE(0, G_MAXINT), - "framerate", GST_PROPS_FLOAT_RANGE(0, G_MAXFLOAT) + GST_STATIC_CAPS ( + "video/x-divx, " + "divxversion = (int) [ 3, 5 ], " + "width = (int) [ 16, 4096 ], " + "height = (int) [ 16, 4096 ], " + "framerate = (double) [ 0, MAX ]" ) -) +); -GST_PAD_TEMPLATE_FACTORY(src_template, +static GstStaticPadTemplate src_template = +GST_STATIC_PAD_TEMPLATE ( "src", GST_PAD_SRC, GST_PAD_ALWAYS, - gst_caps_new( - "divxdec_src", - "video/x-raw-yuv", - GST_VIDEO_YUV_PAD_TEMPLATE_PROPS( - GST_PROPS_LIST( - GST_PROPS_FOURCC(GST_MAKE_FOURCC('I','4','2','0')), - GST_PROPS_FOURCC(GST_MAKE_FOURCC('Y','U','Y','2')), - GST_PROPS_FOURCC(GST_MAKE_FOURCC('Y','V','1','2')), - GST_PROPS_FOURCC(GST_MAKE_FOURCC('U','Y','V','Y')) - ) - ) - ), - gst_caps_new( - "divxdec_src_rgb1", - "video/x-raw-rgb", - GST_VIDEO_RGB_PAD_TEMPLATE_PROPS_24_32 - ), - gst_caps_new( - "divxdec_src_rgb2", - "video/x-raw-rgb", - GST_VIDEO_RGB_PAD_TEMPLATE_PROPS_15_16 + GST_STATIC_CAPS ( + GST_VIDEO_YUV_PAD_TEMPLATE_CAPS ("{ I420, YUY2, YV12, UYVY }") + /* FIXME: 15/16/24/32bpp RGB */ ) -) +); /* DivxDec signals and args */ @@ -95,8 +78,8 @@ static void gst_divxdec_dispose (GObject *object); static void gst_divxdec_chain (GstPad *pad, GstData *data); static GstPadLinkReturn gst_divxdec_connect (GstPad *pad, - GstCaps *vscapslist); -static GstPadLinkReturn gst_divxdec_negotiate (GstDivxDec *divxdec); + const GstCaps *vscapslist); +static GstPadLinkReturn gst_divxdec_negotiate (GstDivxDec *divxdec); static GstElementClass *parent_class = NULL; /* static guint gst_divxdec_signals[LAST_SIGNAL] = { 0 }; */ @@ -163,9 +146,9 @@ gst_divxdec_base_init (GstDivxDecClass *klass) GstElementClass *element_class = GST_ELEMENT_CLASS (klass); gst_element_class_add_pad_template (element_class, - GST_PAD_TEMPLATE_GET (sink_template)); + gst_static_pad_template_get (&sink_template)); gst_element_class_add_pad_template (element_class, - GST_PAD_TEMPLATE_GET (src_template)); + gst_static_pad_template_get (&src_template)); gst_element_class_set_details (element_class, &gst_divxdec_details); } @@ -187,7 +170,7 @@ gst_divxdec_init (GstDivxDec *divxdec) { /* create the sink pad */ divxdec->sinkpad = gst_pad_new_from_template( - GST_PAD_TEMPLATE_GET(sink_template), + gst_static_pad_template_get (&sink_template), "sink"); gst_element_add_pad(GST_ELEMENT(divxdec), divxdec->sinkpad); @@ -196,7 +179,7 @@ gst_divxdec_init (GstDivxDec *divxdec) /* create the src pad */ divxdec->srcpad = gst_pad_new_from_template( - GST_PAD_TEMPLATE_GET(src_template), + gst_static_pad_template_get (&src_template), "src"); gst_element_add_pad(GST_ELEMENT(divxdec), divxdec->srcpad); @@ -344,6 +327,8 @@ gst_divxdec_negotiate (GstDivxDec *divxdec) GST_MAKE_FOURCC('I','4','2','0'), 0 }, { GST_MAKE_FOURCC('Y','V','1','2'), 12, 12, GST_MAKE_FOURCC('Y','V','1','2'), 0 }, +#if 0 + /* FIXME: someone fix RGB here please */ { GST_MAKE_FOURCC('R','G','B',' '), 32, 32, #if (G_BYTE_ORDER == G_BIG_ENDIAN) GST_MAKE_FOURCC('A','B','G','R'), 32 }, @@ -360,6 +345,7 @@ gst_divxdec_negotiate (GstDivxDec *divxdec) 3, 16 }, { GST_MAKE_FOURCC('R','G','B',' '), 15, 16, 0, 16 }, +#endif { 0, 0, 0, 0, 0 } }; gint i; @@ -367,6 +353,7 @@ gst_divxdec_negotiate (GstDivxDec *divxdec) for (i = 0; fmt_list[i].fourcc != 0; i++) { divxdec->csp = fmt_list[i].csp; +#if 0 /* try making a caps to set on the other side */ if (fmt_list[i].fourcc == GST_MAKE_FOURCC('R','G','B',' ')) { guint32 r_mask = 0, b_mask = 0, g_mask = 0; @@ -401,13 +388,14 @@ gst_divxdec_negotiate (GstDivxDec *divxdec) "green_mask", GST_PROPS_INT(g_mask), "blue_mask", GST_PROPS_INT(b_mask)); } else { - caps = GST_CAPS_NEW("divxdec_src_pad_yuv", - "video/x-raw-yuv", - "width", GST_PROPS_INT(divxdec->width), - "height", GST_PROPS_INT(divxdec->height), - "framerate", GST_PROPS_FLOAT(divxdec->fps), - "format", GST_PROPS_FOURCC(fmt_list[i].fourcc)); - } +#endif + caps = gst_caps_new_simple ("video/x-raw-yuv", + "width", G_TYPE_INT, divxdec->width, + "height", G_TYPE_INT, divxdec->height, + "framerate", G_TYPE_DOUBLE, divxdec->fps, + "format", GST_TYPE_FOURCC, fmt_list[i].fourcc, + NULL); + /*}*/ if ((ret = gst_pad_try_set_caps(divxdec->srcpad, caps)) > 0) { divxdec->csp = fmt_list[i].csp; @@ -426,10 +414,11 @@ gst_divxdec_negotiate (GstDivxDec *divxdec) static GstPadLinkReturn -gst_divxdec_connect (GstPad *pad, - GstCaps *vscaps) +gst_divxdec_connect (GstPad *pad, + const GstCaps *caps) { GstDivxDec *divxdec; + GstStructure *structure = gst_caps_get_structure (caps, 0); divxdec = GST_DIVXDEC(gst_pad_get_parent (pad)); @@ -439,14 +428,14 @@ gst_divxdec_connect (GstPad *pad, } /* we are not going to act on variable caps */ - if (!GST_CAPS_IS_FIXED(vscaps)) + if (!gst_caps_is_fixed(caps)) return GST_PAD_LINK_DELAYED; /* if we get here, we know the input is divx. we * only need to bother with the output colorspace */ - gst_caps_get_int(vscaps, "width", &divxdec->width); - gst_caps_get_int(vscaps, "height", &divxdec->height); - gst_caps_get_float(vscaps, "framerate", &divxdec->fps); + gst_structure_get_int(structure, "width", &divxdec->width); + gst_structure_get_int(structure, "height", &divxdec->height); + gst_structure_get_double(structure, "framerate", &divxdec->fps); return gst_divxdec_negotiate(divxdec); } diff --git a/ext/divx/gstdivxdec.h b/ext/divx/gstdivxdec.h index 9f1da3ff..f181a08a 100644 --- a/ext/divx/gstdivxdec.h +++ b/ext/divx/gstdivxdec.h @@ -55,7 +55,7 @@ struct _GstDivxDec { guint32 csp; int bitcnt, bpp; int width, height; - float fps; + gdouble fps; }; struct _GstDivxDecClass { diff --git a/ext/divx/gstdivxenc.c b/ext/divx/gstdivxenc.c index ba9c0351..ea9c56f4 100644 --- a/ext/divx/gstdivxenc.c +++ b/ext/divx/gstdivxenc.c @@ -34,48 +34,30 @@ GstElementDetails gst_divxenc_details = { "Ronald Bultje " }; -GST_PAD_TEMPLATE_FACTORY(sink_template, +static GstStaticPadTemplate sink_template = +GST_STATIC_PAD_TEMPLATE ( "sink", GST_PAD_SINK, GST_PAD_ALWAYS, - gst_caps_new( - "divxdec_src", - "video/x-raw-yuv", - GST_VIDEO_YUV_PAD_TEMPLATE_PROPS( - GST_PROPS_LIST( - GST_PROPS_FOURCC(GST_MAKE_FOURCC('R','G','B',' ')), - GST_PROPS_FOURCC(GST_MAKE_FOURCC('I','4','2','0')), - GST_PROPS_FOURCC(GST_MAKE_FOURCC('Y','U','Y','2')), - GST_PROPS_FOURCC(GST_MAKE_FOURCC('Y','V','1','2')), - GST_PROPS_FOURCC(GST_MAKE_FOURCC('U','Y','V','Y')) - ) - ) - ), - gst_caps_new( - "divxdec_src_rgb1", - "video/x-raw-rgb", - GST_VIDEO_RGB_PAD_TEMPLATE_PROPS_24_32 - ), - gst_caps_new( - "divxdec_src_rgb2", - "video/x-raw-rgb", - GST_VIDEO_RGB_PAD_TEMPLATE_PROPS_15_16 + GST_STATIC_CAPS ( + GST_VIDEO_YUV_PAD_TEMPLATE_CAPS ("{ I420, YUY2, YV12, YVYU, UYVY }") + /* FIXME: 15/16/24/32bpp RGB */ ) -) +); -GST_PAD_TEMPLATE_FACTORY(src_template, +static GstStaticPadTemplate src_template = +GST_STATIC_PAD_TEMPLATE ( "src", GST_PAD_SRC, GST_PAD_ALWAYS, - GST_CAPS_NEW( - "divxenc_sink", - "video/x-divx", - "divxversion", GST_PROPS_INT(5), - "width", GST_PROPS_INT_RANGE(0, G_MAXINT), - "height", GST_PROPS_INT_RANGE(0, G_MAXINT), - "framerate", GST_PROPS_FLOAT_RANGE(0, G_MAXFLOAT) + GST_STATIC_CAPS ( + "video/x-divx, " + "divxversion = (int) 5, " + "width = (int) [ 16, 4096 ], " + "height = (int) [ 16, 4096 ], " + "framerate = (double) [ 0, MAX ]" ) -) +); /* DivxEnc signals and args */ @@ -100,7 +82,7 @@ static void gst_divxenc_dispose (GObject *object); static void gst_divxenc_chain (GstPad *pad, GstData *data); static GstPadLinkReturn gst_divxenc_connect (GstPad *pad, - GstCaps *vscapslist); + const GstCaps *vscapslist); /* properties */ static void gst_divxenc_set_property (GObject *object, @@ -181,9 +163,9 @@ gst_divxenc_base_init (GstDivxEncClass *klass) GstElementClass *element_class = GST_ELEMENT_CLASS (klass); gst_element_class_add_pad_template (element_class, - GST_PAD_TEMPLATE_GET (sink_template)); + gst_static_pad_template_get (&sink_template)); gst_element_class_add_pad_template (element_class, - GST_PAD_TEMPLATE_GET (src_template)); + gst_static_pad_template_get (&src_template)); gst_element_class_set_details (element_class, &gst_divxenc_details); } @@ -239,7 +221,7 @@ gst_divxenc_init (GstDivxEnc *divxenc) { /* create the sink pad */ divxenc->sinkpad = gst_pad_new_from_template( - GST_PAD_TEMPLATE_GET(sink_template), + gst_static_pad_template_get (&sink_template), "sink"); gst_element_add_pad(GST_ELEMENT(divxenc), divxenc->sinkpad); @@ -248,7 +230,7 @@ gst_divxenc_init (GstDivxEnc *divxenc) /* create the src pad */ divxenc->srcpad = gst_pad_new_from_template( - GST_PAD_TEMPLATE_GET(src_template), + gst_static_pad_template_get (&src_template), "src"); gst_element_add_pad(GST_ELEMENT(divxenc), divxenc->srcpad); @@ -397,11 +379,16 @@ gst_divxenc_chain (GstPad *pad, static GstPadLinkReturn -gst_divxenc_connect (GstPad *pad, - GstCaps *vscaps) +gst_divxenc_connect (GstPad *pad, + const GstCaps *caps) { GstDivxEnc *divxenc; - GstCaps *caps; + GstStructure *structure = gst_caps_get_structure (caps, 0); + gint w,h; + gdouble fps; + guint32 fourcc; + guint32 divx_cs; + gint bitcnt = 0; divxenc = GST_DIVXENC(gst_pad_get_parent (pad)); @@ -409,36 +396,32 @@ gst_divxenc_connect (GstPad *pad, gst_divxenc_unset(divxenc); /* we are not going to act on variable caps */ - if (!GST_CAPS_IS_FIXED(vscaps)) + if (!gst_caps_is_fixed(caps)) return GST_PAD_LINK_DELAYED; - for (caps = vscaps; caps != NULL; caps = caps->next) { - gint w,h,d; - gfloat fps; - guint32 fourcc; - guint32 divx_cs; - gint bitcnt = 0; - gst_caps_get_int(caps, "width", &w); - gst_caps_get_int(caps, "height", &h); - gst_caps_get_float(caps, "framerate", &fps); - gst_caps_get_fourcc_int(caps, "format", &fourcc); - - switch (fourcc) { - case GST_MAKE_FOURCC('I','4','2','0'): - divx_cs = GST_MAKE_FOURCC('I','4','2','0'); - break; - case GST_MAKE_FOURCC('Y','U','Y','2'): - divx_cs = GST_MAKE_FOURCC('Y','U','Y','2'); - break; - case GST_MAKE_FOURCC('Y','V','1','2'): - divx_cs = GST_MAKE_FOURCC('Y','V','1','2'); - break; - case GST_MAKE_FOURCC('Y','V','Y','U'): - divx_cs = GST_MAKE_FOURCC('Y','V','Y','U'); - break; - case GST_MAKE_FOURCC('U','Y','V','Y'): - divx_cs = GST_MAKE_FOURCC('U','Y','V','Y'); - break; + gst_structure_get_int(structure, "width", &w); + gst_structure_get_int(structure, "height", &h); + gst_structure_get_double(structure, "framerate", &fps); + gst_structure_get_fourcc(structure, "format", &fourcc); + + switch (fourcc) { + case GST_MAKE_FOURCC('I','4','2','0'): + divx_cs = GST_MAKE_FOURCC('I','4','2','0'); + break; + case GST_MAKE_FOURCC('Y','U','Y','2'): + divx_cs = GST_MAKE_FOURCC('Y','U','Y','2'); + break; + case GST_MAKE_FOURCC('Y','V','1','2'): + divx_cs = GST_MAKE_FOURCC('Y','V','1','2'); + break; + case GST_MAKE_FOURCC('Y','V','Y','U'): + divx_cs = GST_MAKE_FOURCC('Y','V','Y','U'); + break; + case GST_MAKE_FOURCC('U','Y','V','Y'): + divx_cs = GST_MAKE_FOURCC('U','Y','V','Y'); + break; +#if 0 + /* someone fix RGB please */ case GST_MAKE_FOURCC('R','G','B',' '): gst_caps_get_int(caps, "depth", &d); switch (d) { @@ -450,43 +433,35 @@ gst_divxenc_connect (GstPad *pad, divx_cs = 0; bitcnt = 32; break; - default: - goto trynext; - } - break; - default: - goto trynext; - } - - divxenc->csp = divx_cs; - divxenc->bitcnt = bitcnt; - divxenc->width = w; - divxenc->height = h; - divxenc->fps = fps; - - /* try it */ - if (gst_divxenc_setup(divxenc)) { - GstPadLinkReturn ret; - GstCaps *new_caps; - - new_caps = GST_CAPS_NEW("divxenc_src_caps", - "video/x-divx", - "divxversion", GST_PROPS_INT(5), - "width", GST_PROPS_INT(w), - "height", GST_PROPS_INT(h), - "framerate", GST_PROPS_FLOAT(fps)); - - ret = gst_pad_try_set_caps(divxenc->srcpad, new_caps); - - if (ret <= 0) { - gst_divxenc_unset(divxenc); - } +#endif + default: + return GST_PAD_LINK_REFUSED; + } - return ret; + divxenc->csp = divx_cs; + divxenc->bitcnt = bitcnt; + divxenc->width = w; + divxenc->height = h; + divxenc->fps = fps; + + /* try it */ + if (gst_divxenc_setup(divxenc)) { + GstPadLinkReturn ret; + GstCaps *new_caps; + + new_caps = gst_caps_new_simple ("video/x-divx", + "divxversion", G_TYPE_INT, 5, + "width", G_TYPE_INT, w, + "height", G_TYPE_INT, h, + "framerate", G_TYPE_DOUBLE, fps, + NULL); + + ret = gst_pad_try_set_caps(divxenc->srcpad, new_caps); + if (ret <= 0) { + gst_divxenc_unset(divxenc); } -trynext: - continue; + return ret; } /* if we got here - it's not good */ diff --git a/ext/faac/gstfaac.c b/ext/faac/gstfaac.c index be4c56cb..b5e4f9f6 100644 --- a/ext/faac/gstfaac.c +++ b/ext/faac/gstfaac.c @@ -23,54 +23,44 @@ #include "gstfaac.h" -GST_PAD_TEMPLATE_FACTORY (src_template, +static GstStaticPadTemplate src_template = +GST_STATIC_PAD_TEMPLATE ( "src", GST_PAD_SRC, GST_PAD_ALWAYS, - GST_CAPS_NEW ( - "faac_mpeg_templ", - "audio/mpeg", - "systemstream", GST_PROPS_BOOLEAN (FALSE), - "mpegversion", GST_PROPS_LIST ( - GST_PROPS_INT (4), /* we prefer 4 */ - GST_PROPS_INT (2) - ), - "channels", GST_PROPS_INT_RANGE (1, 6), - "samplerate", GST_PROPS_INT_RANGE (8000, 96000) + GST_STATIC_CAPS ( + "audio/mpeg, " + "mpegversion = (int) { 4, 2 }, " + "channels = (int) [ 1, 6 ], " + "rate = (int) [ 8000, 96000 ]" ) ); -GST_PAD_TEMPLATE_FACTORY (sink_template, +static GstStaticPadTemplate sink_template = +GST_STATIC_PAD_TEMPLATE ( "sink", GST_PAD_SINK, GST_PAD_ALWAYS, - GST_CAPS_NEW ( - "faac_int16_templ", - "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 (8000, 96000), - "channels", GST_PROPS_INT_RANGE (1, 6) - ), - GST_CAPS_NEW ( - "faac_int24_templ", - "audio/x-raw-int", - "endianness", GST_PROPS_INT (G_BYTE_ORDER), - "signed", GST_PROPS_BOOLEAN (TRUE), - "width", GST_PROPS_INT (32), - "depth", GST_PROPS_INT (24), - "rate", GST_PROPS_INT_RANGE (8000, 96000), - "channels", GST_PROPS_INT_RANGE (1, 6) - ), - GST_CAPS_NEW ( - "faac_float_templ", - "audio/x-raw-float", - "endianness", GST_PROPS_INT (G_BYTE_ORDER), - "depth", GST_PROPS_INT (32), /* float */ - "rate", GST_PROPS_INT_RANGE (8000, 96000), - "channels", GST_PROPS_INT_RANGE (1, 6) + GST_STATIC_CAPS ( + "audio/x-raw-int, " + "endianness = (int) BYTE_ORDER, " + "signed = (boolean) TRUE, " + "width = (int) 16, " + "depth = (int) 16, " + "rate = (int) [ 8000, 96000 ], " + "channels = (int) [ 1, 6]; " + "audio/x-raw-int, " + "endianness = (int) BYTE_ORDER, " + "signed = (boolean) TRUE, " + "width = (int) 32, " + "depth = (int) 24, " + "rate = (int) [ 8000, 96000], " + "channels = (int) [ 1, 6]; " + "audio/x-raw-float, " + "endianness = (int) BYTE_ORDER, " + "depth = (int) 32, " /* sizeof (gfloat) */ + "rate = (int) [ 8000, 96000], " + "channels = (int) [ 1, 6]" ) ); @@ -99,10 +89,10 @@ static void gst_faac_get_property (GObject *object, static GstPadLinkReturn gst_faac_sinkconnect (GstPad *pad, - GstCaps *caps); + const GstCaps *caps); static GstPadLinkReturn gst_faac_srcconnect (GstPad *pad, - GstCaps *caps); + const GstCaps *caps); static void gst_faac_chain (GstPad *pad, GstData *data); static GstElementStateReturn @@ -149,9 +139,9 @@ gst_faac_base_init (GstFaacClass *klass) GstElementClass *element_class = GST_ELEMENT_CLASS (klass); gst_element_class_add_pad_template (element_class, - GST_PAD_TEMPLATE_GET (src_template)); + gst_static_pad_template_get (&src_template)); gst_element_class_add_pad_template (element_class, - GST_PAD_TEMPLATE_GET (sink_template)); + gst_static_pad_template_get (&sink_template)); gst_element_class_set_details (element_class, &gst_faac_details); } @@ -245,13 +235,13 @@ gst_faac_init (GstFaac *faac) GST_FLAG_SET (faac, GST_ELEMENT_EVENT_AWARE); faac->sinkpad = gst_pad_new_from_template ( - GST_PAD_TEMPLATE_GET (sink_template), "sink"); + gst_static_pad_template_get (&sink_template), "sink"); gst_element_add_pad (GST_ELEMENT (faac), faac->sinkpad); gst_pad_set_chain_function (faac->sinkpad, gst_faac_chain); gst_pad_set_link_function (faac->sinkpad, gst_faac_sinkconnect); faac->srcpad = gst_pad_new_from_template ( - GST_PAD_TEMPLATE_GET (src_template), "src"); + gst_static_pad_template_get (&src_template), "src"); gst_element_add_pad (GST_ELEMENT (faac), faac->srcpad); gst_pad_set_link_function (faac->srcpad, gst_faac_srcconnect); @@ -264,12 +254,16 @@ gst_faac_init (GstFaac *faac) } static GstPadLinkReturn -gst_faac_sinkconnect (GstPad *pad, - GstCaps *caps) +gst_faac_sinkconnect (GstPad *pad, + const GstCaps *caps) { GstFaac *faac = GST_FAAC (gst_pad_get_parent (pad)); + GstStructure *structure = gst_caps_get_structure (caps, 0); + faacEncHandle *handle; + gint channels, samplerate, depth; + gulong samples, bytes, fmt = 0, bps = 0; - if (!GST_CAPS_IS_FIXED (caps)) + if (!gst_caps_is_fixed (caps)) return GST_PAD_LINK_DELAYED; if (faac->handle) { @@ -281,66 +275,58 @@ gst_faac_sinkconnect (GstPad *pad, faac->cache = NULL; } - for (; caps != NULL; caps = caps->next) { - faacEncHandle *handle; - gint channels, samplerate, depth; - gulong samples, bytes, fmt = 0, bps = 0; + gst_structure_get_int (structure, "channels", &channels); + gst_structure_get_int (structure, "rate", &samplerate); + gst_structure_get_int (structure, "depth", &depth); - gst_caps_get (caps, "channels", &channels, - "rate", &samplerate, - "depth", &depth, NULL); + /* open a new handle to the encoder */ + if (!(handle = faacEncOpen (samplerate, channels, + &samples, &bytes))) + return GST_PAD_LINK_REFUSED; - /* open a new handle to the encoder */ - if (!(handle = faacEncOpen (samplerate, channels, - &samples, &bytes))) - continue; - - switch (depth) { - case 16: - fmt = FAAC_INPUT_16BIT; - bps = 2; - break; - case 24: - fmt = FAAC_INPUT_32BIT; /* 24-in-32, actually */ - bps = 4; - break; - case 32: - fmt = FAAC_INPUT_FLOAT; /* see template, this is right */ - bps = 4; - break; - } - - if (!fmt) { - faacEncClose (handle); - continue; - } + switch (depth) { + case 16: + fmt = FAAC_INPUT_16BIT; + bps = 2; + break; + case 24: + fmt = FAAC_INPUT_32BIT; /* 24-in-32, actually */ + bps = 4; + break; + case 32: + fmt = FAAC_INPUT_FLOAT; /* see template, this is right */ + bps = 4; + break; + } - faac->format = fmt; - faac->bps = bps; - faac->handle = handle; - faac->bytes = bytes; - faac->samples = samples; - faac->channels = channels; - faac->samplerate = samplerate; - - /* if the other side was already set-up, redo that */ - if (GST_PAD_CAPS (faac->srcpad)) - return gst_faac_srcconnect (faac->srcpad, - gst_pad_get_allowed_caps (faac->srcpad)); - - /* else, that'll be done later */ - return GST_PAD_LINK_OK; + if (!fmt) { + faacEncClose (handle); + return GST_PAD_LINK_REFUSED; } - return GST_PAD_LINK_REFUSED; + faac->format = fmt; + faac->bps = bps; + faac->handle = handle; + faac->bytes = bytes; + faac->samples = samples; + faac->channels = channels; + faac->samplerate = samplerate; + + /* if the other side was already set-up, redo that */ + if (GST_PAD_CAPS (faac->srcpad)) + return gst_faac_srcconnect (faac->srcpad, + gst_pad_get_caps (GST_PAD_PEER (faac->srcpad))); + + /* else, that'll be done later */ + return GST_PAD_LINK_OK; } static GstPadLinkReturn -gst_faac_srcconnect (GstPad *pad, - GstCaps *caps) +gst_faac_srcconnect (GstPad *pad, + const GstCaps *caps) { GstFaac *faac = GST_FAAC (gst_pad_get_parent (pad)); - GstCaps *t; + gint n; if (!faac->handle || (faac->samplerate == -1 || faac->channels == -1)) { @@ -348,20 +334,22 @@ gst_faac_srcconnect (GstPad *pad, } /* we do samplerate/channels ourselves */ - for (t = caps; t != NULL; t = t->next) { - gst_props_remove_entry_by_name (t->properties, "rate"); - gst_props_remove_entry_by_name (t->properties, "channels"); + for (n = 0; n < gst_caps_get_size (caps); n++) { + GstStructure *structure = gst_caps_get_structure (caps, n); + gst_structure_remove_field (structure, "rate"); + gst_structure_remove_field (structure, "channels"); } /* go through list */ caps = gst_caps_normalize (caps); - for ( ; caps != NULL; caps = caps->next) { + for (n = 0; n < gst_caps_get_size (caps); n++) { + GstStructure *structure = gst_caps_get_structure (caps, n); faacEncConfiguration *conf; gint mpegversion = 0; GstCaps *newcaps; GstPadLinkReturn ret; - gst_caps_get_int (caps, "mpegversion", &mpegversion); + gst_structure_get_int (structure, "mpegversion", &mpegversion); /* new conf */ conf = faacEncGetCurrentConfiguration (faac->handle); @@ -388,12 +376,11 @@ gst_faac_srcconnect (GstPad *pad, continue; } - newcaps = GST_CAPS_NEW ("faac_mpeg_caps", - "audio/mpeg", - "systemstream", GST_PROPS_BOOLEAN (FALSE), - "mpegversion", GST_PROPS_INT (mpegversion), - "channels", GST_PROPS_INT (faac->channels), - "rate", GST_PROPS_INT (faac->samplerate)); + newcaps = gst_caps_new_simple ("audio/mpeg", + "mpegversion", G_TYPE_INT, mpegversion, + "channels", G_TYPE_INT, faac->channels, + "rate", G_TYPE_INT, faac->samplerate, + NULL); ret = gst_pad_try_set_caps (faac->srcpad, newcaps); switch (ret) { diff --git a/ext/mpeg2enc/gstmpeg2enc.cc b/ext/mpeg2enc/gstmpeg2enc.cc index ecf101a3..71a41ade 100644 --- a/ext/mpeg2enc/gstmpeg2enc.cc +++ b/ext/mpeg2enc/gstmpeg2enc.cc @@ -25,52 +25,76 @@ #include "gstmpeg2enc.hh" -GST_PAD_TEMPLATE_FACTORY (sink_templ, - "sink", - GST_PAD_SINK, - GST_PAD_ALWAYS, - GST_CAPS_NEW ( - "mpeg2enc_sink", - "video/x-raw-yuv", - "format", GST_PROPS_FOURCC (GST_MAKE_FOURCC ('I','4','2','0')), - "width", GST_PROPS_INT_RANGE (16, 4096), - "height", GST_PROPS_INT_RANGE (16, 4096), - "framerate", GST_PROPS_LIST ( - GST_PROPS_FLOAT (24/1.001), - GST_PROPS_FLOAT (24.), - GST_PROPS_FLOAT (25.), - GST_PROPS_FLOAT (30/1.001), - GST_PROPS_FLOAT (30.), - GST_PROPS_FLOAT (50.), - GST_PROPS_FLOAT (60/1.001), - GST_PROPS_FLOAT (60.) - ) - ) -) +/* + * We can't use fractions in static pad templates, so + * we do something manual... + */ +static void +add_fps (GstCaps *caps) +{ + GstStructure *structure = gst_caps_get_structure (caps, 0); + GValue list = { 0 }, fps = { 0 }; + gdouble fpss[] = { 24.0/1.001, 24.0, 25.0, + 30.0/1.001, 30.0, 50.0, + 60.0/1.001, 60.0, 0 }; + guint n; + + g_value_init (&list, GST_TYPE_LIST); + g_value_init (&fps, G_TYPE_DOUBLE); + for (n = 0; fpss[n] != 0; n++) { + g_value_set_double (&fps, fpss[n]); + gst_value_list_append_value (&list, &fps); + } + gst_structure_set_value (structure, "framerate", &list); + g_value_unset (&list); + g_value_unset (&fps); +} -GST_PAD_TEMPLATE_FACTORY (src_templ, - "src", - GST_PAD_SRC, - GST_PAD_ALWAYS, - GST_CAPS_NEW ( - "mpeg2enc_src", - "video/mpeg", - "systemstream", GST_PROPS_BOOLEAN (FALSE), - "mpegversion", GST_PROPS_INT_RANGE (1, 2), - "width", GST_PROPS_INT_RANGE (16, 4096), - "height", GST_PROPS_INT_RANGE (16, 4096), - "framerate", GST_PROPS_LIST ( - GST_PROPS_FLOAT (24/1.001), - GST_PROPS_FLOAT (24.), - GST_PROPS_FLOAT (25.), - GST_PROPS_FLOAT (30/1.001), - GST_PROPS_FLOAT (30.), - GST_PROPS_FLOAT (50.), - GST_PROPS_FLOAT (60/1.001), - GST_PROPS_FLOAT (60.) - ) - ) -) +static GstPadTemplate * +sink_templ (void) +{ + static GstPadTemplate *templ = NULL; + + if (!templ) { + GstCaps *caps; + + caps = gst_caps_new_simple ("video/x-raw-yuv", + "format", GST_TYPE_FOURCC, + GST_MAKE_FOURCC ('I','4','2','0'), + "width", GST_TYPE_INT_RANGE, 16, 4096, + "height", GST_TYPE_INT_RANGE, 16, 4096, + NULL); + add_fps (caps); + + templ = gst_pad_template_new ("sink", GST_PAD_SINK, + GST_PAD_ALWAYS, caps); + } + + return templ; +} + +static GstPadTemplate * +src_templ (void) +{ + static GstPadTemplate *templ = NULL; + + if (!templ) { + GstCaps *caps; + + caps = gst_caps_new_simple ("video/mpeg", + "systemstream", G_TYPE_BOOLEAN, FALSE, + "mpegversion", GST_TYPE_INT_RANGE, 1, 2, + "width", GST_TYPE_INT_RANGE, 16, 4096, + "height", GST_TYPE_INT_RANGE, 16, 4096, + NULL); + add_fps (caps); + + templ = gst_pad_template_new ("sink", GST_PAD_SINK, + GST_PAD_ALWAYS, caps); + } + + return templ; +} static void gst_mpeg2enc_base_init (GstMpeg2encClass *klass); static void gst_mpeg2enc_class_init (GstMpeg2encClass *klass); @@ -81,10 +105,9 @@ static void gst_mpeg2enc_loop (GstElement *element); static GstPadLinkReturn gst_mpeg2enc_sink_link (GstPad *pad, - GstCaps *caps); + const GstCaps *caps); static GstCaps * - gst_mpeg2enc_src_getcaps (GstPad *pad, - GstCaps *caps); + gst_mpeg2enc_src_getcaps (GstPad *pad); static GstElementStateReturn gst_mpeg2enc_change_state (GstElement *element); @@ -140,10 +163,8 @@ gst_mpeg2enc_base_init (GstMpeg2encClass *klass) }; GstElementClass *element_class = GST_ELEMENT_CLASS (klass); - gst_element_class_add_pad_template (element_class, - GST_PAD_TEMPLATE_GET (src_templ)); - gst_element_class_add_pad_template (element_class, - GST_PAD_TEMPLATE_GET (sink_templ)); + gst_element_class_add_pad_template (element_class, src_templ ()); + gst_element_class_add_pad_template (element_class, sink_templ ()); gst_element_class_set_details (element_class, &gst_mpeg2enc_details); } @@ -235,12 +256,12 @@ gst_mpeg2enc_loop (GstElement *element) } static GstPadLinkReturn -gst_mpeg2enc_sink_link (GstPad *pad, - GstCaps *caps) +gst_mpeg2enc_sink_link (GstPad *pad, + const GstCaps *caps) { GstMpeg2enc *enc = GST_MPEG2ENC (gst_pad_get_parent (pad)); - if (!GST_CAPS_IS_FIXED (caps)) + if (!gst_caps_is_fixed (caps)) return GST_PAD_LINK_DELAYED; if (enc->encoder) { @@ -252,8 +273,7 @@ gst_mpeg2enc_sink_link (GstPad *pad, } static GstCaps * -gst_mpeg2enc_src_getcaps (GstPad *pad, - GstCaps *caps) +gst_mpeg2enc_src_getcaps (GstPad *pad) { GstMpeg2enc *enc = GST_MPEG2ENC (gst_pad_get_parent (pad)); @@ -261,8 +281,8 @@ gst_mpeg2enc_src_getcaps (GstPad *pad, return enc->encoder->getFormat (); } - return gst_caps_ref (gst_pad_template_get_caps ( - gst_element_get_pad_template (gst_pad_get_parent (pad), "src"))); + return (GstCaps* ) gst_pad_template_get_caps ( + gst_element_get_pad_template (gst_pad_get_parent (pad), "src")); } static void diff --git a/ext/mpeg2enc/gstmpeg2encoder.cc b/ext/mpeg2enc/gstmpeg2encoder.cc index e0952db1..b1c2b8ef 100644 --- a/ext/mpeg2enc/gstmpeg2encoder.cc +++ b/ext/mpeg2enc/gstmpeg2encoder.cc @@ -85,11 +85,11 @@ GstMpeg2Encoder::getFormat () { gdouble fps = Y4M_RATIO_DBL (mpeg_framerate (options.frame_rate)); - return GST_CAPS_NEW ("mpeg2enc_src", - "video/mpeg", - "systemstream", GST_PROPS_BOOLEAN (FALSE), - "mpegversion", GST_PROPS_INT (options.mpeg), - "width", GST_PROPS_INT (options.in_img_width), - "height", GST_PROPS_INT (options.in_img_height), - "framerate", GST_PROPS_FLOAT (fps)); + return gst_caps_new_simple ("video/mpeg", + "systemstream", G_TYPE_BOOLEAN, FALSE, + "mpegversion", G_TYPE_INT, options.mpeg, + "width", G_TYPE_INT, options.in_img_width, + "height", G_TYPE_INT, options.in_img_height, + "framerate", G_TYPE_DOUBLE, fps, + NULL); } diff --git a/ext/mpeg2enc/gstmpeg2encpicturereader.cc b/ext/mpeg2enc/gstmpeg2encpicturereader.cc index 226acc8d..1c8e9f4c 100644 --- a/ext/mpeg2enc/gstmpeg2encpicturereader.cc +++ b/ext/mpeg2enc/gstmpeg2encpicturereader.cc @@ -42,7 +42,7 @@ GstMpeg2EncPictureReader::GstMpeg2EncPictureReader (GstPad *in_pad, GstMpeg2EncPictureReader::~GstMpeg2EncPictureReader () { - gst_caps_unref (caps); + gst_caps_free (caps); } /* @@ -52,12 +52,13 @@ GstMpeg2EncPictureReader::~GstMpeg2EncPictureReader () void GstMpeg2EncPictureReader::StreamPictureParams (MPEG2EncInVidParams &strm) { + GstStructure *structure = gst_caps_get_structure (caps, 0); gint width, height; - gfloat fps; + gdouble fps; - gst_caps_get (caps, "width", &width, - "height", &height, - "framerate", &fps, NULL); + gst_structure_get_int (structure, "width", &width); + gst_structure_get_int (structure, "height", &height); + gst_structure_get_double (structure, "framerate", &fps); strm.horizontal_size = width; strm.vertical_size = height; diff --git a/sys/dxr3/dxr3audiosink.c b/sys/dxr3/dxr3audiosink.c index e01d370b..bff47594 100644 --- a/sys/dxr3/dxr3audiosink.c +++ b/sys/dxr3/dxr3audiosink.c @@ -65,39 +65,32 @@ enum { ARG_DIGITAL_PCM }; - -GST_PAD_TEMPLATE_FACTORY (dxr3audiosink_pcm_sink_factory, +static GstStaticPadTemplate dxr3audiosink_pcm_sink_factory = +GST_STATIC_PAD_TEMPLATE ( "pcm_sink", GST_PAD_SINK, GST_PAD_ALWAYS, - GST_CAPS_NEW ( - "dxr3audiosink_pcm_sink", - "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_LIST ( - GST_PROPS_INT (32000), - GST_PROPS_INT (44100), - GST_PROPS_INT (48000), - GST_PROPS_INT (66000) - ), - "channels", GST_PROPS_INT (2) + GST_STATIC_CAPS ( + "audio/x-raw-int, " + "endianness = (int) BYTE_ORDER, " + "signed = (boolean) TRUE, " + "width = (int) 16, " + "depth = (int) 16, " + "rate = (int) { 32000, 44100, 48000, 66000 }, " + "channels = (int) 2" ) -) +); -GST_PAD_TEMPLATE_FACTORY (dxr3audiosink_ac3_sink_factory, +static GstStaticPadTemplate dxr3audiosink_ac3_sink_factory = +GST_STATIC_PAD_TEMPLATE ( "ac3_sink", GST_PAD_SINK, GST_PAD_ALWAYS, - GST_CAPS_NEW ( - "dxr3audiosink_ac3_sink", - "audio/x-ac3", - NULL + GST_STATIC_CAPS ( + "audio/x-ac3" /* no parameters needed, we don't need a parsed stream */ ) -) +); GST_PAD_EVENT_MASK_FUNCTION(dxr3audiosink_get_event_mask, @@ -128,7 +121,7 @@ static void dxr3audiosink_set_clock (GstElement *element, GstClock *clock); static GstPadLinkReturn dxr3audiosink_pcm_sinklink (GstPad *pad, - GstCaps *caps); + const GstCaps *caps); static void dxr3audiosink_set_scr (Dxr3AudioSink *sink, guint32 scr); @@ -182,9 +175,9 @@ dxr3audiosink_base_init (Dxr3AudioSinkClass *klass) GstElementClass *element_class = GST_ELEMENT_CLASS (klass); gst_element_class_add_pad_template (element_class, - GST_PAD_TEMPLATE_GET (dxr3audiosink_pcm_sink_factory)); + gst_static_pad_template_get (&dxr3audiosink_pcm_sink_factory)); gst_element_class_add_pad_template (element_class, - GST_PAD_TEMPLATE_GET (dxr3audiosink_ac3_sink_factory)); + gst_static_pad_template_get (&dxr3audiosink_ac3_sink_factory)); gst_element_class_set_details (element_class, &dxr3audiosink_details); } @@ -226,22 +219,18 @@ dxr3audiosink_class_init (Dxr3AudioSinkClass *klass) static void dxr3audiosink_init (Dxr3AudioSink *sink) { - GstCaps *caps; GstPadTemplate *temp; /* Create the PCM pad. */ - temp = GST_PAD_TEMPLATE_GET (dxr3audiosink_pcm_sink_factory); + temp = gst_static_pad_template_get (&dxr3audiosink_pcm_sink_factory); sink->pcm_sinkpad = gst_pad_new_from_template (temp, "pcm_sink"); gst_pad_set_chain_function (sink->pcm_sinkpad, dxr3audiosink_chain_pcm); gst_pad_set_link_function (sink->pcm_sinkpad, dxr3audiosink_pcm_sinklink); gst_element_add_pad (GST_ELEMENT (sink), sink->pcm_sinkpad); /* Create the AC3 pad. */ - temp = GST_PAD_TEMPLATE_GET (dxr3audiosink_ac3_sink_factory); + temp = gst_static_pad_template_get (&dxr3audiosink_ac3_sink_factory); sink->ac3_sinkpad = gst_pad_new_from_template (temp, "ac3_sink"); - caps = gst_pad_template_get_caps (temp); - gst_pad_try_set_caps (sink->ac3_sinkpad, caps); - gst_caps_unref (caps); gst_pad_set_chain_function (sink->ac3_sinkpad, dxr3audiosink_chain_ac3); gst_element_add_pad (GST_ELEMENT (sink), sink->ac3_sinkpad); @@ -506,30 +495,17 @@ dxr3audiosink_set_clock (GstElement *element, GstClock *clock) static GstPadLinkReturn -dxr3audiosink_pcm_sinklink (GstPad *pad, GstCaps *caps) +dxr3audiosink_pcm_sinklink (GstPad *pad, const GstCaps *caps) { Dxr3AudioSink *sink = DXR3AUDIOSINK (gst_pad_get_parent (pad)); - const gchar* mimetype; + GstStructure *structure = gst_caps_get_structure (caps, 0); gint rate; - if (!GST_CAPS_IS_FIXED(caps)) { + if (!gst_caps_is_fixed (caps)) { return GST_PAD_LINK_DELAYED; } - mimetype = gst_caps_get_mime(caps); - if (strcmp (mimetype, "audio/x-raw-int") != 0) { - return GST_PAD_LINK_REFUSED; - } - - if (!gst_caps_has_property (caps, "rate")) { - return GST_PAD_LINK_REFUSED; - } - - gst_caps_get_int (caps, "rate", &rate); - if (rate != 32000 && rate != 44100 && - rate != 48000 && rate != 66000) { - return GST_PAD_LINK_DELAYED; - } + gst_structure_get_int (structure, "rate", &rate); sink->rate = rate; return GST_PAD_LINK_OK; diff --git a/sys/dxr3/dxr3spusink.c b/sys/dxr3/dxr3spusink.c index b6141bb3..00969c42 100644 --- a/sys/dxr3/dxr3spusink.c +++ b/sys/dxr3/dxr3spusink.c @@ -61,11 +61,12 @@ enum { }; -GST_PAD_TEMPLATE_FACTORY (dxr3spusink_sink_factory, +static GstStaticPadTemplate dxr3spusink_sink_factory = +GST_STATIC_PAD_TEMPLATE ( "sink", GST_PAD_SINK, GST_PAD_ALWAYS, - NULL + GST_STATIC_CAPS_ANY ); @@ -149,7 +150,7 @@ dxr3spusink_base_init (Dxr3SpuSinkClass *klass) GstElementClass *element_class = GST_ELEMENT_CLASS (klass); gst_element_class_add_pad_template (element_class, - GST_PAD_TEMPLATE_GET (dxr3spusink_sink_factory)); + gst_static_pad_template_get (&dxr3spusink_sink_factory)); gst_element_class_set_details (element_class, &dxr3spusink_details); } @@ -222,7 +223,7 @@ dxr3spusink_init (Dxr3SpuSink *sink) GstPad *pad; pad = gst_pad_new_from_template ( - GST_PAD_TEMPLATE_GET (dxr3spusink_sink_factory), "sink"); + gst_static_pad_template_get (&dxr3spusink_sink_factory), "sink"); gst_element_add_pad (GST_ELEMENT (sink), pad); gst_pad_set_chain_function (pad, dxr3spusink_chain); diff --git a/sys/dxr3/dxr3videosink.c b/sys/dxr3/dxr3videosink.c index eb08aae0..596a3831 100644 --- a/sys/dxr3/dxr3videosink.c +++ b/sys/dxr3/dxr3videosink.c @@ -78,23 +78,19 @@ enum { #define START_CODE_SEQUENCE_HEADER 0xB3 #define START_CODE_SEQUENCE_END 0xB7 - -GST_PAD_TEMPLATE_FACTORY (dxr3videosink_sink_factory, +static GstStaticPadTemplate dxr3videosink_sink_factory = +GST_STATIC_PAD_TEMPLATE ( "sink", GST_PAD_SINK, GST_PAD_ALWAYS, - GST_CAPS_NEW ( - "dxr3videosink_sink", - "video/mpeg", - "mpegversion", GST_PROPS_LIST ( - GST_PROPS_INT (1), - GST_PROPS_INT (2) - ), - "systemstream", GST_PROPS_BOOLEAN (FALSE) + GST_STATIC_CAPS ( + "video/mpeg, " + "mpegversion = (int) { 1, 2 }, " + "systemstream = (boolean) FALSE" /* width/height/framerate omitted, we don't * need a parsed stream */ ) -) +); GST_PAD_EVENT_MASK_FUNCTION (dxr3videosink_get_event_mask, @@ -178,7 +174,7 @@ dxr3videosink_base_init (Dxr3VideoSinkClass *klass) GstElementClass *element_class = GST_ELEMENT_CLASS (klass); gst_element_class_add_pad_template (element_class, - GST_PAD_TEMPLATE_GET (dxr3videosink_sink_factory)); + gst_static_pad_template_get (&dxr3videosink_sink_factory)); gst_element_class_set_details (element_class, &dxr3videosink_details); } @@ -218,7 +214,7 @@ dxr3videosink_init (Dxr3VideoSink *sink) GstPad *pad; pad = gst_pad_new_from_template ( - GST_PAD_TEMPLATE_GET (dxr3videosink_sink_factory), "sink"); + gst_static_pad_template_get (&dxr3videosink_sink_factory), "sink"); gst_element_add_pad (GST_ELEMENT (sink), pad); gst_pad_set_chain_function (pad, dxr3videosink_chain); -- cgit v1.2.1