diff options
author | Ronald S. Bultje <rbultje@ronald.bitfreak.net> | 2003-12-23 22:50:06 +0000 |
---|---|---|
committer | Ronald S. Bultje <rbultje@ronald.bitfreak.net> | 2003-12-23 22:50:06 +0000 |
commit | 0475cf26131ccb8e8488625e45e92ea53e01b9bf (patch) | |
tree | e86516321658b9156bde05ece2ea550f3cd8b8ae /ext/divx | |
parent | d3def8f8f2c9ca01c0b3c4b8236b277323982457 (diff) | |
download | gst-plugins-bad-0475cf26131ccb8e8488625e45e92ea53e01b9bf.tar.gz gst-plugins-bad-0475cf26131ccb8e8488625e45e92ea53e01b9bf.tar.bz2 gst-plugins-bad-0475cf26131ccb8e8488625e45e92ea53e01b9bf.zip |
Fix caps breakage after Dave's caps branch merge.
Original commit message from CVS:
2003-12-23 Ronald Bultje <rbultje@ronald.bitfreak.net>
* 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.
Diffstat (limited to 'ext/divx')
-rw-r--r-- | ext/divx/gstdivxdec.c | 91 | ||||
-rw-r--r-- | ext/divx/gstdivxdec.h | 2 | ||||
-rw-r--r-- | ext/divx/gstdivxenc.c | 181 |
3 files changed, 119 insertions, 155 deletions
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 <rbultje@ronald.bitfreak.net>" }; -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 <rbultje@ronald.bitfreak.net>" }; -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 */ |