mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-23 00:36:51 +00:00
ext/libpng/: mime fixage.
Original commit message from CVS: Reviewed by: Ronald S. Bultje <rbultje@ronald.bitfreak.net> * ext/libpng/gstpngdec.c: * ext/libpng/gstpngenc.c: (gst_pngenc_base_init), (gst_pngenc_sinklink), (gst_pngenc_init), (gst_pngenc_chain): * ext/libpng/gstpngenc.h: Alpha support (encoder; #163161), mime fixage.
This commit is contained in:
parent
0715626523
commit
536f3d6c43
4 changed files with 35 additions and 37 deletions
10
ChangeLog
10
ChangeLog
|
@ -1,3 +1,13 @@
|
||||||
|
2005-01-07 Gergely Nagy <algernon@bonehunter.rulez.org>
|
||||||
|
|
||||||
|
Reviewed by: Ronald S. Bultje <rbultje@ronald.bitfreak.net>
|
||||||
|
|
||||||
|
* ext/libpng/gstpngdec.c:
|
||||||
|
* ext/libpng/gstpngenc.c: (gst_pngenc_base_init),
|
||||||
|
(gst_pngenc_sinklink), (gst_pngenc_init), (gst_pngenc_chain):
|
||||||
|
* ext/libpng/gstpngenc.h:
|
||||||
|
Alpha support (encoder; #163161), mime fixage.
|
||||||
|
|
||||||
2005-01-07 Sebastien Cote <sc5@hermes.usherb.ca>
|
2005-01-07 Sebastien Cote <sc5@hermes.usherb.ca>
|
||||||
|
|
||||||
Reviewed by: Ronald S. Bultje <rbultje@ronald.bitfreak.net>
|
Reviewed by: Ronald S. Bultje <rbultje@ronald.bitfreak.net>
|
||||||
|
|
|
@ -100,7 +100,7 @@ static GstStaticPadTemplate gst_pngdec_sink_pad_template =
|
||||||
GST_STATIC_PAD_TEMPLATE ("sink",
|
GST_STATIC_PAD_TEMPLATE ("sink",
|
||||||
GST_PAD_SINK,
|
GST_PAD_SINK,
|
||||||
GST_PAD_ALWAYS,
|
GST_PAD_ALWAYS,
|
||||||
GST_STATIC_CAPS ("video/x-png, "
|
GST_STATIC_CAPS ("image/png, "
|
||||||
"width = (int) [ 16, 4096 ], "
|
"width = (int) [ 16, 4096 ], "
|
||||||
"height = (int) [ 16, 4096 ], " "framerate = (double) [ 0.0, MAX ]")
|
"height = (int) [ 16, 4096 ], " "framerate = (double) [ 0.0, MAX ]")
|
||||||
);
|
);
|
||||||
|
|
|
@ -61,11 +61,24 @@ static void gst_pngenc_get_property (GObject * object,
|
||||||
|
|
||||||
static void gst_pngenc_chain (GstPad * pad, GstData * _data);
|
static void gst_pngenc_chain (GstPad * pad, GstData * _data);
|
||||||
|
|
||||||
GstPadTemplate *pngenc_src_template, *pngenc_sink_template;
|
static GstStaticPadTemplate pngenc_src_template =
|
||||||
|
GST_STATIC_PAD_TEMPLATE ("src",
|
||||||
|
GST_PAD_SRC,
|
||||||
|
GST_PAD_ALWAYS,
|
||||||
|
GST_STATIC_CAPS ("image/png, "
|
||||||
|
"width = (int) [ 16, 4096 ], "
|
||||||
|
"height = (int) [ 16, 4096 ], " "framerate = (double) [ 0.0, MAX ]")
|
||||||
|
);
|
||||||
|
|
||||||
|
static GstStaticPadTemplate pngenc_sink_template =
|
||||||
|
GST_STATIC_PAD_TEMPLATE ("sink",
|
||||||
|
GST_PAD_SINK,
|
||||||
|
GST_PAD_ALWAYS,
|
||||||
|
GST_STATIC_CAPS (GST_VIDEO_CAPS_RGBA ";" GST_VIDEO_CAPS_RGB)
|
||||||
|
);
|
||||||
|
|
||||||
static GstElementClass *parent_class = NULL;
|
static GstElementClass *parent_class = NULL;
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
user_error_fn (png_structp png_ptr, png_const_charp error_msg)
|
user_error_fn (png_structp png_ptr, png_const_charp error_msg)
|
||||||
{
|
{
|
||||||
|
@ -103,39 +116,15 @@ gst_pngenc_get_type (void)
|
||||||
return pngenc_type;
|
return pngenc_type;
|
||||||
}
|
}
|
||||||
|
|
||||||
static GstCaps *
|
|
||||||
png_caps_factory (void)
|
|
||||||
{
|
|
||||||
return gst_caps_new_simple ("video/x-png",
|
|
||||||
"width", GST_TYPE_INT_RANGE, 16, 4096,
|
|
||||||
"height", GST_TYPE_INT_RANGE, 16, 4096,
|
|
||||||
"framerate", GST_TYPE_DOUBLE_RANGE, 0.0, G_MAXDOUBLE, NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static GstCaps *
|
|
||||||
raw_caps_factory (void)
|
|
||||||
{
|
|
||||||
return gst_caps_from_string (GST_VIDEO_CAPS_RGB);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gst_pngenc_base_init (gpointer g_class)
|
gst_pngenc_base_init (gpointer g_class)
|
||||||
{
|
{
|
||||||
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
|
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
|
||||||
GstCaps *raw_caps, *png_caps;
|
|
||||||
|
|
||||||
raw_caps = raw_caps_factory ();
|
gst_element_class_add_pad_template
|
||||||
png_caps = png_caps_factory ();
|
(element_class, gst_static_pad_template_get (&pngenc_sink_template));
|
||||||
|
gst_element_class_add_pad_template
|
||||||
pngenc_sink_template = gst_pad_template_new ("sink", GST_PAD_SINK,
|
(element_class, gst_static_pad_template_get (&pngenc_src_template));
|
||||||
GST_PAD_ALWAYS, raw_caps);
|
|
||||||
|
|
||||||
pngenc_src_template = gst_pad_template_new ("src", GST_PAD_SRC,
|
|
||||||
GST_PAD_ALWAYS, png_caps);
|
|
||||||
|
|
||||||
gst_element_class_add_pad_template (element_class, pngenc_sink_template);
|
|
||||||
gst_element_class_add_pad_template (element_class, pngenc_src_template);
|
|
||||||
gst_element_class_set_details (element_class, &gst_pngenc_details);
|
gst_element_class_set_details (element_class, &gst_pngenc_details);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -180,7 +169,7 @@ gst_pngenc_sinklink (GstPad * pad, const GstCaps * caps)
|
||||||
gst_structure_get_double (structure, "framerate", &fps);
|
gst_structure_get_double (structure, "framerate", &fps);
|
||||||
gst_structure_get_int (structure, "bpp", &pngenc->bpp);
|
gst_structure_get_int (structure, "bpp", &pngenc->bpp);
|
||||||
|
|
||||||
caps = gst_caps_new_simple ("video/x-png",
|
caps = gst_caps_new_simple ("image/png",
|
||||||
"framerate", G_TYPE_DOUBLE, fps,
|
"framerate", G_TYPE_DOUBLE, fps,
|
||||||
"width", G_TYPE_INT, pngenc->width,
|
"width", G_TYPE_INT, pngenc->width,
|
||||||
"height", G_TYPE_INT, pngenc->height, NULL);
|
"height", G_TYPE_INT, pngenc->height, NULL);
|
||||||
|
@ -191,7 +180,8 @@ gst_pngenc_sinklink (GstPad * pad, const GstCaps * caps)
|
||||||
static void
|
static void
|
||||||
gst_pngenc_init (GstPngEnc * pngenc)
|
gst_pngenc_init (GstPngEnc * pngenc)
|
||||||
{
|
{
|
||||||
pngenc->sinkpad = gst_pad_new_from_template (pngenc_sink_template, "sink");
|
pngenc->sinkpad = gst_pad_new_from_template
|
||||||
|
(gst_static_pad_template_get (&pngenc_sink_template), "sink");
|
||||||
gst_element_add_pad (GST_ELEMENT (pngenc), pngenc->sinkpad);
|
gst_element_add_pad (GST_ELEMENT (pngenc), pngenc->sinkpad);
|
||||||
|
|
||||||
pngenc->srcpad = gst_pad_new ("src", GST_PAD_SRC);
|
pngenc->srcpad = gst_pad_new ("src", GST_PAD_SRC);
|
||||||
|
@ -285,8 +275,8 @@ gst_pngenc_chain (GstPad * pad, GstData * _data)
|
||||||
pngenc->png_info_ptr,
|
pngenc->png_info_ptr,
|
||||||
pngenc->width,
|
pngenc->width,
|
||||||
pngenc->height,
|
pngenc->height,
|
||||||
pngenc->bpp / 3,
|
8,
|
||||||
PNG_COLOR_TYPE_RGB,
|
(pngenc->bpp == 32) ? PNG_COLOR_TYPE_RGBA : PNG_COLOR_TYPE_RGB,
|
||||||
PNG_INTERLACE_NONE,
|
PNG_INTERLACE_NONE,
|
||||||
PNG_COMPRESSION_TYPE_DEFAULT, PNG_FILTER_TYPE_DEFAULT);
|
PNG_COMPRESSION_TYPE_DEFAULT, PNG_FILTER_TYPE_DEFAULT);
|
||||||
|
|
||||||
|
|
|
@ -38,8 +38,6 @@ extern "C" {
|
||||||
typedef struct _GstPngEnc GstPngEnc;
|
typedef struct _GstPngEnc GstPngEnc;
|
||||||
typedef struct _GstPngEncClass GstPngEncClass;
|
typedef struct _GstPngEncClass GstPngEncClass;
|
||||||
|
|
||||||
extern GstPadTemplate *pngenc_src_template, *pngenc_sink_template;
|
|
||||||
|
|
||||||
struct _GstPngEnc
|
struct _GstPngEnc
|
||||||
{
|
{
|
||||||
GstElement element;
|
GstElement element;
|
||||||
|
|
Loading…
Reference in a new issue