2004-07-16 10:56:31 +00:00
|
|
|
/* GStreamer
|
|
|
|
* Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Library General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Library General Public
|
|
|
|
* License along with this library; if not, write to the
|
|
|
|
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
|
|
* Boston, MA 02111-1307, USA.
|
|
|
|
*
|
|
|
|
*/
|
2007-07-18 09:21:23 +00:00
|
|
|
/**
|
|
|
|
* SECTION:element-pngdec
|
|
|
|
*
|
|
|
|
* Decodes png images. If there is no framerate set on sink caps, it sends EOS
|
|
|
|
* after the first picture.
|
|
|
|
*/
|
|
|
|
|
2004-07-16 10:56:31 +00:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
#include "config.h"
|
|
|
|
#endif
|
2005-10-15 16:48:55 +00:00
|
|
|
|
2004-07-16 10:56:31 +00:00
|
|
|
#include "gstpngdec.h"
|
2005-10-15 16:48:55 +00:00
|
|
|
|
2007-07-20 07:41:58 +00:00
|
|
|
#include <stdlib.h>
|
2005-10-15 16:48:55 +00:00
|
|
|
#include <string.h>
|
2004-07-16 10:56:31 +00:00
|
|
|
#include <gst/video/video.h>
|
2005-10-23 11:07:10 +00:00
|
|
|
#include <gst/gst-i18n-plugin.h>
|
2004-07-16 10:56:31 +00:00
|
|
|
|
2006-06-22 19:31:04 +00:00
|
|
|
GST_DEBUG_CATEGORY_STATIC (pngdec_debug);
|
2005-10-15 16:48:55 +00:00
|
|
|
#define GST_CAT_DEFAULT pngdec_debug
|
2004-07-16 10:56:31 +00:00
|
|
|
|
|
|
|
static void gst_pngdec_base_init (gpointer g_class);
|
|
|
|
static void gst_pngdec_class_init (GstPngDecClass * klass);
|
|
|
|
static void gst_pngdec_init (GstPngDec * pngdec);
|
|
|
|
|
ext/libpng/gstpngdec.*: Complete rewrite of pngdec. It's now very nice and handle push/pull based model. if you have ...
Original commit message from CVS:
2005-10-19 Julien MOUTTE <julien@moutte.net>
* ext/libpng/gstpngdec.c: (gst_pngdec_class_init),
(gst_pngdec_init), (user_error_fn), (user_warning_fn),
(user_info_callback), (user_endrow_callback),
(user_end_callback),
(user_read_data), (gst_pngdec_caps_create_and_set),
(gst_pngdec_task), (gst_pngdec_chain), (gst_pngdec_sink_event),
(gst_pngdec_libpng_clear), (gst_pngdec_libpng_init),
(gst_pngdec_change_state), (gst_pngdec_sink_activate_push),
(gst_pngdec_sink_activate_pull), (gst_pngdec_sink_activate):
* ext/libpng/gstpngdec.h: Complete rewrite of pngdec. It's now
very nice and handle push/pull based model. if you have filesrc
connected to it, it will do random access to load the png file.
If you have a network source that can't do _getrange, it does
progressive loading through the chain function.
* gst/alpha/gstalphacolor.c: (gst_alpha_color_transform_caps),
(transform_rgb), (transform_bgr): Fix caps negotiation correctly
thanks to Master Wim Taymans ;-)
2005-10-18 22:44:11 +00:00
|
|
|
static gboolean gst_pngdec_libpng_init (GstPngDec * pngdec);
|
|
|
|
static gboolean gst_pngdec_libpng_clear (GstPngDec * pngdec);
|
2004-07-16 10:56:31 +00:00
|
|
|
|
ext/libpng/gstpngdec.*: Complete rewrite of pngdec. It's now very nice and handle push/pull based model. if you have ...
Original commit message from CVS:
2005-10-19 Julien MOUTTE <julien@moutte.net>
* ext/libpng/gstpngdec.c: (gst_pngdec_class_init),
(gst_pngdec_init), (user_error_fn), (user_warning_fn),
(user_info_callback), (user_endrow_callback),
(user_end_callback),
(user_read_data), (gst_pngdec_caps_create_and_set),
(gst_pngdec_task), (gst_pngdec_chain), (gst_pngdec_sink_event),
(gst_pngdec_libpng_clear), (gst_pngdec_libpng_init),
(gst_pngdec_change_state), (gst_pngdec_sink_activate_push),
(gst_pngdec_sink_activate_pull), (gst_pngdec_sink_activate):
* ext/libpng/gstpngdec.h: Complete rewrite of pngdec. It's now
very nice and handle push/pull based model. if you have filesrc
connected to it, it will do random access to load the png file.
If you have a network source that can't do _getrange, it does
progressive loading through the chain function.
* gst/alpha/gstalphacolor.c: (gst_alpha_color_transform_caps),
(transform_rgb), (transform_bgr): Fix caps negotiation correctly
thanks to Master Wim Taymans ;-)
2005-10-18 22:44:11 +00:00
|
|
|
static GstStateChangeReturn gst_pngdec_change_state (GstElement * element,
|
|
|
|
GstStateChange transition);
|
2004-07-16 10:56:31 +00:00
|
|
|
|
ext/libpng/gstpngdec.*: Complete rewrite of pngdec. It's now very nice and handle push/pull based model. if you have ...
Original commit message from CVS:
2005-10-19 Julien MOUTTE <julien@moutte.net>
* ext/libpng/gstpngdec.c: (gst_pngdec_class_init),
(gst_pngdec_init), (user_error_fn), (user_warning_fn),
(user_info_callback), (user_endrow_callback),
(user_end_callback),
(user_read_data), (gst_pngdec_caps_create_and_set),
(gst_pngdec_task), (gst_pngdec_chain), (gst_pngdec_sink_event),
(gst_pngdec_libpng_clear), (gst_pngdec_libpng_init),
(gst_pngdec_change_state), (gst_pngdec_sink_activate_push),
(gst_pngdec_sink_activate_pull), (gst_pngdec_sink_activate):
* ext/libpng/gstpngdec.h: Complete rewrite of pngdec. It's now
very nice and handle push/pull based model. if you have filesrc
connected to it, it will do random access to load the png file.
If you have a network source that can't do _getrange, it does
progressive loading through the chain function.
* gst/alpha/gstalphacolor.c: (gst_alpha_color_transform_caps),
(transform_rgb), (transform_bgr): Fix caps negotiation correctly
thanks to Master Wim Taymans ;-)
2005-10-18 22:44:11 +00:00
|
|
|
static gboolean gst_pngdec_sink_activate_push (GstPad * sinkpad,
|
|
|
|
gboolean active);
|
|
|
|
static gboolean gst_pngdec_sink_activate_pull (GstPad * sinkpad,
|
|
|
|
gboolean active);
|
|
|
|
static gboolean gst_pngdec_sink_activate (GstPad * sinkpad);
|
2004-07-16 10:56:31 +00:00
|
|
|
|
ext/libpng/gstpngdec.*: Complete rewrite of pngdec. It's now very nice and handle push/pull based model. if you have ...
Original commit message from CVS:
2005-10-19 Julien MOUTTE <julien@moutte.net>
* ext/libpng/gstpngdec.c: (gst_pngdec_class_init),
(gst_pngdec_init), (user_error_fn), (user_warning_fn),
(user_info_callback), (user_endrow_callback),
(user_end_callback),
(user_read_data), (gst_pngdec_caps_create_and_set),
(gst_pngdec_task), (gst_pngdec_chain), (gst_pngdec_sink_event),
(gst_pngdec_libpng_clear), (gst_pngdec_libpng_init),
(gst_pngdec_change_state), (gst_pngdec_sink_activate_push),
(gst_pngdec_sink_activate_pull), (gst_pngdec_sink_activate):
* ext/libpng/gstpngdec.h: Complete rewrite of pngdec. It's now
very nice and handle push/pull based model. if you have filesrc
connected to it, it will do random access to load the png file.
If you have a network source that can't do _getrange, it does
progressive loading through the chain function.
* gst/alpha/gstalphacolor.c: (gst_alpha_color_transform_caps),
(transform_rgb), (transform_bgr): Fix caps negotiation correctly
thanks to Master Wim Taymans ;-)
2005-10-18 22:44:11 +00:00
|
|
|
static GstFlowReturn gst_pngdec_caps_create_and_set (GstPngDec * pngdec);
|
|
|
|
|
|
|
|
static void gst_pngdec_task (GstPad * pad);
|
|
|
|
static GstFlowReturn gst_pngdec_chain (GstPad * pad, GstBuffer * buffer);
|
|
|
|
static gboolean gst_pngdec_sink_event (GstPad * pad, GstEvent * event);
|
ext/libpng/gstpngdec.*: Handle more than one frame if the content is framed, like with png-in-quicktime (#331917).
Original commit message from CVS:
* ext/libpng/gstpngdec.c: (gst_pngdec_init),
(user_endrow_callback), (user_end_callback),
(gst_pngdec_caps_create_and_set), (gst_pngdec_chain),
(gst_pngdec_sink_setcaps), (gst_pngdec_sink_event),
(gst_pngdec_libpng_clear), (gst_pngdec_change_state):
* ext/libpng/gstpngdec.h:
Handle more than one frame if the content is framed,
like with png-in-quicktime (#331917).
2006-04-11 09:35:45 +00:00
|
|
|
static gboolean gst_pngdec_sink_setcaps (GstPad * pad, GstCaps * caps);
|
ext/libpng/gstpngdec.*: Complete rewrite of pngdec. It's now very nice and handle push/pull based model. if you have ...
Original commit message from CVS:
2005-10-19 Julien MOUTTE <julien@moutte.net>
* ext/libpng/gstpngdec.c: (gst_pngdec_class_init),
(gst_pngdec_init), (user_error_fn), (user_warning_fn),
(user_info_callback), (user_endrow_callback),
(user_end_callback),
(user_read_data), (gst_pngdec_caps_create_and_set),
(gst_pngdec_task), (gst_pngdec_chain), (gst_pngdec_sink_event),
(gst_pngdec_libpng_clear), (gst_pngdec_libpng_init),
(gst_pngdec_change_state), (gst_pngdec_sink_activate_push),
(gst_pngdec_sink_activate_pull), (gst_pngdec_sink_activate):
* ext/libpng/gstpngdec.h: Complete rewrite of pngdec. It's now
very nice and handle push/pull based model. if you have filesrc
connected to it, it will do random access to load the png file.
If you have a network source that can't do _getrange, it does
progressive loading through the chain function.
* gst/alpha/gstalphacolor.c: (gst_alpha_color_transform_caps),
(transform_rgb), (transform_bgr): Fix caps negotiation correctly
thanks to Master Wim Taymans ;-)
2005-10-18 22:44:11 +00:00
|
|
|
|
|
|
|
static GstElementClass *parent_class = NULL;
|
2004-07-16 10:56:31 +00:00
|
|
|
|
|
|
|
GType
|
|
|
|
gst_pngdec_get_type (void)
|
|
|
|
{
|
|
|
|
static GType pngdec_type = 0;
|
|
|
|
|
|
|
|
if (!pngdec_type) {
|
|
|
|
static const GTypeInfo pngdec_info = {
|
|
|
|
sizeof (GstPngDecClass),
|
|
|
|
gst_pngdec_base_init,
|
|
|
|
NULL,
|
|
|
|
(GClassInitFunc) gst_pngdec_class_init,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
sizeof (GstPngDec),
|
|
|
|
0,
|
|
|
|
(GInstanceInitFunc) gst_pngdec_init,
|
|
|
|
};
|
|
|
|
|
|
|
|
pngdec_type = g_type_register_static (GST_TYPE_ELEMENT, "GstPngDec",
|
|
|
|
&pngdec_info, 0);
|
|
|
|
}
|
|
|
|
return pngdec_type;
|
|
|
|
}
|
|
|
|
|
2011-02-19 23:48:22 +00:00
|
|
|
/* FIXME remove this after -good depends on -base-0.10.33 */
|
|
|
|
#ifdef GST_VIDEO_CAPS_ARGB_64
|
|
|
|
#define CAPS GST_VIDEO_CAPS_RGBA ";" GST_VIDEO_CAPS_RGB ";" GST_VIDEO_CAPS_ARGB_64
|
|
|
|
#else
|
|
|
|
#define CAPS GST_VIDEO_CAPS_RGBA ";" GST_VIDEO_CAPS_RGB
|
|
|
|
#endif
|
|
|
|
|
2004-07-16 10:56:31 +00:00
|
|
|
static GstStaticPadTemplate gst_pngdec_src_pad_template =
|
2011-02-19 23:48:22 +00:00
|
|
|
GST_STATIC_PAD_TEMPLATE ("src",
|
2004-07-16 10:56:31 +00:00
|
|
|
GST_PAD_SRC,
|
|
|
|
GST_PAD_ALWAYS,
|
2011-02-19 23:48:22 +00:00
|
|
|
GST_STATIC_CAPS (CAPS)
|
2004-07-16 10:56:31 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
static GstStaticPadTemplate gst_pngdec_sink_pad_template =
|
|
|
|
GST_STATIC_PAD_TEMPLATE ("sink",
|
|
|
|
GST_PAD_SINK,
|
|
|
|
GST_PAD_ALWAYS,
|
2005-10-17 15:23:24 +00:00
|
|
|
GST_STATIC_CAPS ("image/png")
|
2004-07-16 10:56:31 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
static void
|
|
|
|
gst_pngdec_base_init (gpointer g_class)
|
|
|
|
{
|
|
|
|
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
|
|
|
|
|
|
|
|
gst_element_class_add_pad_template (element_class,
|
|
|
|
gst_static_pad_template_get (&gst_pngdec_src_pad_template));
|
|
|
|
gst_element_class_add_pad_template (element_class,
|
|
|
|
gst_static_pad_template_get (&gst_pngdec_sink_pad_template));
|
2010-03-18 13:31:35 +00:00
|
|
|
gst_element_class_set_details_simple (element_class, "PNG image decoder",
|
|
|
|
"Codec/Decoder/Image",
|
|
|
|
"Decode a png video frame to a raw image",
|
|
|
|
"Wim Taymans <wim@fluendo.com>");
|
2004-07-16 10:56:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gst_pngdec_class_init (GstPngDecClass * klass)
|
|
|
|
{
|
|
|
|
GstElementClass *gstelement_class;
|
|
|
|
|
|
|
|
gstelement_class = (GstElementClass *) klass;
|
|
|
|
|
2006-04-08 21:21:45 +00:00
|
|
|
parent_class = g_type_class_peek_parent (klass);
|
2004-07-16 10:56:31 +00:00
|
|
|
|
ext/libpng/gstpngdec.*: Complete rewrite of pngdec. It's now very nice and handle push/pull based model. if you have ...
Original commit message from CVS:
2005-10-19 Julien MOUTTE <julien@moutte.net>
* ext/libpng/gstpngdec.c: (gst_pngdec_class_init),
(gst_pngdec_init), (user_error_fn), (user_warning_fn),
(user_info_callback), (user_endrow_callback),
(user_end_callback),
(user_read_data), (gst_pngdec_caps_create_and_set),
(gst_pngdec_task), (gst_pngdec_chain), (gst_pngdec_sink_event),
(gst_pngdec_libpng_clear), (gst_pngdec_libpng_init),
(gst_pngdec_change_state), (gst_pngdec_sink_activate_push),
(gst_pngdec_sink_activate_pull), (gst_pngdec_sink_activate):
* ext/libpng/gstpngdec.h: Complete rewrite of pngdec. It's now
very nice and handle push/pull based model. if you have filesrc
connected to it, it will do random access to load the png file.
If you have a network source that can't do _getrange, it does
progressive loading through the chain function.
* gst/alpha/gstalphacolor.c: (gst_alpha_color_transform_caps),
(transform_rgb), (transform_bgr): Fix caps negotiation correctly
thanks to Master Wim Taymans ;-)
2005-10-18 22:44:11 +00:00
|
|
|
gstelement_class->change_state = gst_pngdec_change_state;
|
|
|
|
|
2005-10-15 16:48:55 +00:00
|
|
|
GST_DEBUG_CATEGORY_INIT (pngdec_debug, "pngdec", 0, "PNG image decoder");
|
2004-07-16 10:56:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gst_pngdec_init (GstPngDec * pngdec)
|
|
|
|
{
|
2006-03-15 16:17:12 +00:00
|
|
|
pngdec->sinkpad =
|
|
|
|
gst_pad_new_from_static_template (&gst_pngdec_sink_pad_template, "sink");
|
ext/libpng/gstpngdec.*: Complete rewrite of pngdec. It's now very nice and handle push/pull based model. if you have ...
Original commit message from CVS:
2005-10-19 Julien MOUTTE <julien@moutte.net>
* ext/libpng/gstpngdec.c: (gst_pngdec_class_init),
(gst_pngdec_init), (user_error_fn), (user_warning_fn),
(user_info_callback), (user_endrow_callback),
(user_end_callback),
(user_read_data), (gst_pngdec_caps_create_and_set),
(gst_pngdec_task), (gst_pngdec_chain), (gst_pngdec_sink_event),
(gst_pngdec_libpng_clear), (gst_pngdec_libpng_init),
(gst_pngdec_change_state), (gst_pngdec_sink_activate_push),
(gst_pngdec_sink_activate_pull), (gst_pngdec_sink_activate):
* ext/libpng/gstpngdec.h: Complete rewrite of pngdec. It's now
very nice and handle push/pull based model. if you have filesrc
connected to it, it will do random access to load the png file.
If you have a network source that can't do _getrange, it does
progressive loading through the chain function.
* gst/alpha/gstalphacolor.c: (gst_alpha_color_transform_caps),
(transform_rgb), (transform_bgr): Fix caps negotiation correctly
thanks to Master Wim Taymans ;-)
2005-10-18 22:44:11 +00:00
|
|
|
gst_pad_set_activate_function (pngdec->sinkpad, gst_pngdec_sink_activate);
|
|
|
|
gst_pad_set_activatepush_function (pngdec->sinkpad,
|
|
|
|
gst_pngdec_sink_activate_push);
|
|
|
|
gst_pad_set_activatepull_function (pngdec->sinkpad,
|
|
|
|
gst_pngdec_sink_activate_pull);
|
|
|
|
gst_pad_set_chain_function (pngdec->sinkpad, gst_pngdec_chain);
|
|
|
|
gst_pad_set_event_function (pngdec->sinkpad, gst_pngdec_sink_event);
|
ext/libpng/gstpngdec.*: Handle more than one frame if the content is framed, like with png-in-quicktime (#331917).
Original commit message from CVS:
* ext/libpng/gstpngdec.c: (gst_pngdec_init),
(user_endrow_callback), (user_end_callback),
(gst_pngdec_caps_create_and_set), (gst_pngdec_chain),
(gst_pngdec_sink_setcaps), (gst_pngdec_sink_event),
(gst_pngdec_libpng_clear), (gst_pngdec_change_state):
* ext/libpng/gstpngdec.h:
Handle more than one frame if the content is framed,
like with png-in-quicktime (#331917).
2006-04-11 09:35:45 +00:00
|
|
|
gst_pad_set_setcaps_function (pngdec->sinkpad, gst_pngdec_sink_setcaps);
|
2004-07-16 10:56:31 +00:00
|
|
|
gst_element_add_pad (GST_ELEMENT (pngdec), pngdec->sinkpad);
|
|
|
|
|
2006-03-15 16:17:12 +00:00
|
|
|
pngdec->srcpad =
|
|
|
|
gst_pad_new_from_static_template (&gst_pngdec_src_pad_template, "src");
|
2005-10-17 15:23:24 +00:00
|
|
|
gst_pad_use_fixed_caps (pngdec->srcpad);
|
2004-07-16 10:56:31 +00:00
|
|
|
gst_element_add_pad (GST_ELEMENT (pngdec), pngdec->srcpad);
|
|
|
|
|
ext/libpng/gstpngdec.*: Complete rewrite of pngdec. It's now very nice and handle push/pull based model. if you have ...
Original commit message from CVS:
2005-10-19 Julien MOUTTE <julien@moutte.net>
* ext/libpng/gstpngdec.c: (gst_pngdec_class_init),
(gst_pngdec_init), (user_error_fn), (user_warning_fn),
(user_info_callback), (user_endrow_callback),
(user_end_callback),
(user_read_data), (gst_pngdec_caps_create_and_set),
(gst_pngdec_task), (gst_pngdec_chain), (gst_pngdec_sink_event),
(gst_pngdec_libpng_clear), (gst_pngdec_libpng_init),
(gst_pngdec_change_state), (gst_pngdec_sink_activate_push),
(gst_pngdec_sink_activate_pull), (gst_pngdec_sink_activate):
* ext/libpng/gstpngdec.h: Complete rewrite of pngdec. It's now
very nice and handle push/pull based model. if you have filesrc
connected to it, it will do random access to load the png file.
If you have a network source that can't do _getrange, it does
progressive loading through the chain function.
* gst/alpha/gstalphacolor.c: (gst_alpha_color_transform_caps),
(transform_rgb), (transform_bgr): Fix caps negotiation correctly
thanks to Master Wim Taymans ;-)
2005-10-18 22:44:11 +00:00
|
|
|
pngdec->buffer_out = NULL;
|
2004-07-16 10:56:31 +00:00
|
|
|
pngdec->png = NULL;
|
|
|
|
pngdec->info = NULL;
|
ext/libpng/gstpngdec.*: Complete rewrite of pngdec. It's now very nice and handle push/pull based model. if you have ...
Original commit message from CVS:
2005-10-19 Julien MOUTTE <julien@moutte.net>
* ext/libpng/gstpngdec.c: (gst_pngdec_class_init),
(gst_pngdec_init), (user_error_fn), (user_warning_fn),
(user_info_callback), (user_endrow_callback),
(user_end_callback),
(user_read_data), (gst_pngdec_caps_create_and_set),
(gst_pngdec_task), (gst_pngdec_chain), (gst_pngdec_sink_event),
(gst_pngdec_libpng_clear), (gst_pngdec_libpng_init),
(gst_pngdec_change_state), (gst_pngdec_sink_activate_push),
(gst_pngdec_sink_activate_pull), (gst_pngdec_sink_activate):
* ext/libpng/gstpngdec.h: Complete rewrite of pngdec. It's now
very nice and handle push/pull based model. if you have filesrc
connected to it, it will do random access to load the png file.
If you have a network source that can't do _getrange, it does
progressive loading through the chain function.
* gst/alpha/gstalphacolor.c: (gst_alpha_color_transform_caps),
(transform_rgb), (transform_bgr): Fix caps negotiation correctly
thanks to Master Wim Taymans ;-)
2005-10-18 22:44:11 +00:00
|
|
|
pngdec->endinfo = NULL;
|
|
|
|
pngdec->setup = FALSE;
|
2004-07-16 10:56:31 +00:00
|
|
|
|
|
|
|
pngdec->color_type = -1;
|
|
|
|
pngdec->width = -1;
|
|
|
|
pngdec->height = -1;
|
ext/libpng/gstpngdec.*: Complete rewrite of pngdec. It's now very nice and handle push/pull based model. if you have ...
Original commit message from CVS:
2005-10-19 Julien MOUTTE <julien@moutte.net>
* ext/libpng/gstpngdec.c: (gst_pngdec_class_init),
(gst_pngdec_init), (user_error_fn), (user_warning_fn),
(user_info_callback), (user_endrow_callback),
(user_end_callback),
(user_read_data), (gst_pngdec_caps_create_and_set),
(gst_pngdec_task), (gst_pngdec_chain), (gst_pngdec_sink_event),
(gst_pngdec_libpng_clear), (gst_pngdec_libpng_init),
(gst_pngdec_change_state), (gst_pngdec_sink_activate_push),
(gst_pngdec_sink_activate_pull), (gst_pngdec_sink_activate):
* ext/libpng/gstpngdec.h: Complete rewrite of pngdec. It's now
very nice and handle push/pull based model. if you have filesrc
connected to it, it will do random access to load the png file.
If you have a network source that can't do _getrange, it does
progressive loading through the chain function.
* gst/alpha/gstalphacolor.c: (gst_alpha_color_transform_caps),
(transform_rgb), (transform_bgr): Fix caps negotiation correctly
thanks to Master Wim Taymans ;-)
2005-10-18 22:44:11 +00:00
|
|
|
pngdec->bpp = -1;
|
2005-11-22 22:21:37 +00:00
|
|
|
pngdec->fps_n = 0;
|
|
|
|
pngdec->fps_d = 1;
|
ext/libpng/gstpngdec.*: Handle more than one frame if the content is framed, like with png-in-quicktime (#331917).
Original commit message from CVS:
* ext/libpng/gstpngdec.c: (gst_pngdec_init),
(user_endrow_callback), (user_end_callback),
(gst_pngdec_caps_create_and_set), (gst_pngdec_chain),
(gst_pngdec_sink_setcaps), (gst_pngdec_sink_event),
(gst_pngdec_libpng_clear), (gst_pngdec_change_state):
* ext/libpng/gstpngdec.h:
Handle more than one frame if the content is framed,
like with png-in-quicktime (#331917).
2006-04-11 09:35:45 +00:00
|
|
|
|
|
|
|
pngdec->in_timestamp = GST_CLOCK_TIME_NONE;
|
|
|
|
pngdec->in_duration = GST_CLOCK_TIME_NONE;
|
2006-07-03 15:31:22 +00:00
|
|
|
|
2006-07-17 10:22:54 +00:00
|
|
|
gst_segment_init (&pngdec->segment, GST_FORMAT_UNDEFINED);
|
2007-11-20 12:20:38 +00:00
|
|
|
|
|
|
|
pngdec->image_ready = FALSE;
|
2004-07-16 10:56:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
ext/libpng/gstpngdec.*: Complete rewrite of pngdec. It's now very nice and handle push/pull based model. if you have ...
Original commit message from CVS:
2005-10-19 Julien MOUTTE <julien@moutte.net>
* ext/libpng/gstpngdec.c: (gst_pngdec_class_init),
(gst_pngdec_init), (user_error_fn), (user_warning_fn),
(user_info_callback), (user_endrow_callback),
(user_end_callback),
(user_read_data), (gst_pngdec_caps_create_and_set),
(gst_pngdec_task), (gst_pngdec_chain), (gst_pngdec_sink_event),
(gst_pngdec_libpng_clear), (gst_pngdec_libpng_init),
(gst_pngdec_change_state), (gst_pngdec_sink_activate_push),
(gst_pngdec_sink_activate_pull), (gst_pngdec_sink_activate):
* ext/libpng/gstpngdec.h: Complete rewrite of pngdec. It's now
very nice and handle push/pull based model. if you have filesrc
connected to it, it will do random access to load the png file.
If you have a network source that can't do _getrange, it does
progressive loading through the chain function.
* gst/alpha/gstalphacolor.c: (gst_alpha_color_transform_caps),
(transform_rgb), (transform_bgr): Fix caps negotiation correctly
thanks to Master Wim Taymans ;-)
2005-10-18 22:44:11 +00:00
|
|
|
user_error_fn (png_structp png_ptr, png_const_charp error_msg)
|
2004-07-16 10:56:31 +00:00
|
|
|
{
|
ext/libpng/gstpngdec.*: Complete rewrite of pngdec. It's now very nice and handle push/pull based model. if you have ...
Original commit message from CVS:
2005-10-19 Julien MOUTTE <julien@moutte.net>
* ext/libpng/gstpngdec.c: (gst_pngdec_class_init),
(gst_pngdec_init), (user_error_fn), (user_warning_fn),
(user_info_callback), (user_endrow_callback),
(user_end_callback),
(user_read_data), (gst_pngdec_caps_create_and_set),
(gst_pngdec_task), (gst_pngdec_chain), (gst_pngdec_sink_event),
(gst_pngdec_libpng_clear), (gst_pngdec_libpng_init),
(gst_pngdec_change_state), (gst_pngdec_sink_activate_push),
(gst_pngdec_sink_activate_pull), (gst_pngdec_sink_activate):
* ext/libpng/gstpngdec.h: Complete rewrite of pngdec. It's now
very nice and handle push/pull based model. if you have filesrc
connected to it, it will do random access to load the png file.
If you have a network source that can't do _getrange, it does
progressive loading through the chain function.
* gst/alpha/gstalphacolor.c: (gst_alpha_color_transform_caps),
(transform_rgb), (transform_bgr): Fix caps negotiation correctly
thanks to Master Wim Taymans ;-)
2005-10-18 22:44:11 +00:00
|
|
|
GST_ERROR ("%s", error_msg);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
user_warning_fn (png_structp png_ptr, png_const_charp warning_msg)
|
|
|
|
{
|
|
|
|
GST_WARNING ("%s", warning_msg);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
user_info_callback (png_structp png_ptr, png_infop info)
|
|
|
|
{
|
|
|
|
GstPngDec *pngdec = NULL;
|
|
|
|
GstFlowReturn ret = GST_FLOW_OK;
|
|
|
|
size_t buffer_size;
|
|
|
|
GstBuffer *buffer = NULL;
|
|
|
|
|
2010-03-15 20:29:55 +00:00
|
|
|
pngdec = GST_PNGDEC (png_get_io_ptr (png_ptr));
|
2004-07-16 10:56:31 +00:00
|
|
|
|
ext/libpng/gstpngdec.*: Complete rewrite of pngdec. It's now very nice and handle push/pull based model. if you have ...
Original commit message from CVS:
2005-10-19 Julien MOUTTE <julien@moutte.net>
* ext/libpng/gstpngdec.c: (gst_pngdec_class_init),
(gst_pngdec_init), (user_error_fn), (user_warning_fn),
(user_info_callback), (user_endrow_callback),
(user_end_callback),
(user_read_data), (gst_pngdec_caps_create_and_set),
(gst_pngdec_task), (gst_pngdec_chain), (gst_pngdec_sink_event),
(gst_pngdec_libpng_clear), (gst_pngdec_libpng_init),
(gst_pngdec_change_state), (gst_pngdec_sink_activate_push),
(gst_pngdec_sink_activate_pull), (gst_pngdec_sink_activate):
* ext/libpng/gstpngdec.h: Complete rewrite of pngdec. It's now
very nice and handle push/pull based model. if you have filesrc
connected to it, it will do random access to load the png file.
If you have a network source that can't do _getrange, it does
progressive loading through the chain function.
* gst/alpha/gstalphacolor.c: (gst_alpha_color_transform_caps),
(transform_rgb), (transform_bgr): Fix caps negotiation correctly
thanks to Master Wim Taymans ;-)
2005-10-18 22:44:11 +00:00
|
|
|
GST_LOG ("info ready");
|
2004-07-16 10:56:31 +00:00
|
|
|
|
ext/libpng/gstpngdec.*: Complete rewrite of pngdec. It's now very nice and handle push/pull based model. if you have ...
Original commit message from CVS:
2005-10-19 Julien MOUTTE <julien@moutte.net>
* ext/libpng/gstpngdec.c: (gst_pngdec_class_init),
(gst_pngdec_init), (user_error_fn), (user_warning_fn),
(user_info_callback), (user_endrow_callback),
(user_end_callback),
(user_read_data), (gst_pngdec_caps_create_and_set),
(gst_pngdec_task), (gst_pngdec_chain), (gst_pngdec_sink_event),
(gst_pngdec_libpng_clear), (gst_pngdec_libpng_init),
(gst_pngdec_change_state), (gst_pngdec_sink_activate_push),
(gst_pngdec_sink_activate_pull), (gst_pngdec_sink_activate):
* ext/libpng/gstpngdec.h: Complete rewrite of pngdec. It's now
very nice and handle push/pull based model. if you have filesrc
connected to it, it will do random access to load the png file.
If you have a network source that can't do _getrange, it does
progressive loading through the chain function.
* gst/alpha/gstalphacolor.c: (gst_alpha_color_transform_caps),
(transform_rgb), (transform_bgr): Fix caps negotiation correctly
thanks to Master Wim Taymans ;-)
2005-10-18 22:44:11 +00:00
|
|
|
/* Generate the caps and configure */
|
|
|
|
ret = gst_pngdec_caps_create_and_set (pngdec);
|
|
|
|
if (ret != GST_FLOW_OK) {
|
|
|
|
goto beach;
|
|
|
|
}
|
2004-07-16 10:56:31 +00:00
|
|
|
|
ext/libpng/gstpngdec.*: Complete rewrite of pngdec. It's now very nice and handle push/pull based model. if you have ...
Original commit message from CVS:
2005-10-19 Julien MOUTTE <julien@moutte.net>
* ext/libpng/gstpngdec.c: (gst_pngdec_class_init),
(gst_pngdec_init), (user_error_fn), (user_warning_fn),
(user_info_callback), (user_endrow_callback),
(user_end_callback),
(user_read_data), (gst_pngdec_caps_create_and_set),
(gst_pngdec_task), (gst_pngdec_chain), (gst_pngdec_sink_event),
(gst_pngdec_libpng_clear), (gst_pngdec_libpng_init),
(gst_pngdec_change_state), (gst_pngdec_sink_activate_push),
(gst_pngdec_sink_activate_pull), (gst_pngdec_sink_activate):
* ext/libpng/gstpngdec.h: Complete rewrite of pngdec. It's now
very nice and handle push/pull based model. if you have filesrc
connected to it, it will do random access to load the png file.
If you have a network source that can't do _getrange, it does
progressive loading through the chain function.
* gst/alpha/gstalphacolor.c: (gst_alpha_color_transform_caps),
(transform_rgb), (transform_bgr): Fix caps negotiation correctly
thanks to Master Wim Taymans ;-)
2005-10-18 22:44:11 +00:00
|
|
|
/* Allocate output buffer */
|
|
|
|
pngdec->rowbytes = png_get_rowbytes (pngdec->png, pngdec->info);
|
2009-05-27 16:06:34 +00:00
|
|
|
if (pngdec->rowbytes > (G_MAXUINT32 - 3)
|
|
|
|
|| pngdec->height > G_MAXUINT32 / pngdec->rowbytes) {
|
|
|
|
ret = GST_FLOW_ERROR;
|
|
|
|
goto beach;
|
|
|
|
}
|
|
|
|
pngdec->rowbytes = GST_ROUND_UP_4 (pngdec->rowbytes);
|
|
|
|
buffer_size = pngdec->height * pngdec->rowbytes;
|
|
|
|
|
2005-12-05 13:03:00 +00:00
|
|
|
ret =
|
|
|
|
gst_pad_alloc_buffer_and_set_caps (pngdec->srcpad, GST_BUFFER_OFFSET_NONE,
|
ext/libpng/gstpngdec.*: Complete rewrite of pngdec. It's now very nice and handle push/pull based model. if you have ...
Original commit message from CVS:
2005-10-19 Julien MOUTTE <julien@moutte.net>
* ext/libpng/gstpngdec.c: (gst_pngdec_class_init),
(gst_pngdec_init), (user_error_fn), (user_warning_fn),
(user_info_callback), (user_endrow_callback),
(user_end_callback),
(user_read_data), (gst_pngdec_caps_create_and_set),
(gst_pngdec_task), (gst_pngdec_chain), (gst_pngdec_sink_event),
(gst_pngdec_libpng_clear), (gst_pngdec_libpng_init),
(gst_pngdec_change_state), (gst_pngdec_sink_activate_push),
(gst_pngdec_sink_activate_pull), (gst_pngdec_sink_activate):
* ext/libpng/gstpngdec.h: Complete rewrite of pngdec. It's now
very nice and handle push/pull based model. if you have filesrc
connected to it, it will do random access to load the png file.
If you have a network source that can't do _getrange, it does
progressive loading through the chain function.
* gst/alpha/gstalphacolor.c: (gst_alpha_color_transform_caps),
(transform_rgb), (transform_bgr): Fix caps negotiation correctly
thanks to Master Wim Taymans ;-)
2005-10-18 22:44:11 +00:00
|
|
|
buffer_size, GST_PAD_CAPS (pngdec->srcpad), &buffer);
|
|
|
|
if (ret != GST_FLOW_OK) {
|
|
|
|
goto beach;
|
|
|
|
}
|
|
|
|
|
|
|
|
pngdec->buffer_out = buffer;
|
|
|
|
|
|
|
|
beach:
|
|
|
|
pngdec->ret = ret;
|
2004-07-16 10:56:31 +00:00
|
|
|
}
|
|
|
|
|
ext/libpng/gstpngdec.*: Complete rewrite of pngdec. It's now very nice and handle push/pull based model. if you have ...
Original commit message from CVS:
2005-10-19 Julien MOUTTE <julien@moutte.net>
* ext/libpng/gstpngdec.c: (gst_pngdec_class_init),
(gst_pngdec_init), (user_error_fn), (user_warning_fn),
(user_info_callback), (user_endrow_callback),
(user_end_callback),
(user_read_data), (gst_pngdec_caps_create_and_set),
(gst_pngdec_task), (gst_pngdec_chain), (gst_pngdec_sink_event),
(gst_pngdec_libpng_clear), (gst_pngdec_libpng_init),
(gst_pngdec_change_state), (gst_pngdec_sink_activate_push),
(gst_pngdec_sink_activate_pull), (gst_pngdec_sink_activate):
* ext/libpng/gstpngdec.h: Complete rewrite of pngdec. It's now
very nice and handle push/pull based model. if you have filesrc
connected to it, it will do random access to load the png file.
If you have a network source that can't do _getrange, it does
progressive loading through the chain function.
* gst/alpha/gstalphacolor.c: (gst_alpha_color_transform_caps),
(transform_rgb), (transform_bgr): Fix caps negotiation correctly
thanks to Master Wim Taymans ;-)
2005-10-18 22:44:11 +00:00
|
|
|
static void
|
|
|
|
user_endrow_callback (png_structp png_ptr, png_bytep new_row,
|
|
|
|
png_uint_32 row_num, int pass)
|
|
|
|
{
|
|
|
|
GstPngDec *pngdec = NULL;
|
|
|
|
|
2010-03-15 20:29:55 +00:00
|
|
|
pngdec = GST_PNGDEC (png_get_io_ptr (png_ptr));
|
ext/libpng/gstpngdec.*: Complete rewrite of pngdec. It's now very nice and handle push/pull based model. if you have ...
Original commit message from CVS:
2005-10-19 Julien MOUTTE <julien@moutte.net>
* ext/libpng/gstpngdec.c: (gst_pngdec_class_init),
(gst_pngdec_init), (user_error_fn), (user_warning_fn),
(user_info_callback), (user_endrow_callback),
(user_end_callback),
(user_read_data), (gst_pngdec_caps_create_and_set),
(gst_pngdec_task), (gst_pngdec_chain), (gst_pngdec_sink_event),
(gst_pngdec_libpng_clear), (gst_pngdec_libpng_init),
(gst_pngdec_change_state), (gst_pngdec_sink_activate_push),
(gst_pngdec_sink_activate_pull), (gst_pngdec_sink_activate):
* ext/libpng/gstpngdec.h: Complete rewrite of pngdec. It's now
very nice and handle push/pull based model. if you have filesrc
connected to it, it will do random access to load the png file.
If you have a network source that can't do _getrange, it does
progressive loading through the chain function.
* gst/alpha/gstalphacolor.c: (gst_alpha_color_transform_caps),
(transform_rgb), (transform_bgr): Fix caps negotiation correctly
thanks to Master Wim Taymans ;-)
2005-10-18 22:44:11 +00:00
|
|
|
|
|
|
|
/* FIXME: implement interlaced pictures */
|
|
|
|
|
2008-06-30 22:53:39 +00:00
|
|
|
/* If buffer_out doesn't exist, it means buffer_alloc failed, which
|
|
|
|
* will already have set the return code */
|
ext/libpng/gstpngdec.*: Complete rewrite of pngdec. It's now very nice and handle push/pull based model. if you have ...
Original commit message from CVS:
2005-10-19 Julien MOUTTE <julien@moutte.net>
* ext/libpng/gstpngdec.c: (gst_pngdec_class_init),
(gst_pngdec_init), (user_error_fn), (user_warning_fn),
(user_info_callback), (user_endrow_callback),
(user_end_callback),
(user_read_data), (gst_pngdec_caps_create_and_set),
(gst_pngdec_task), (gst_pngdec_chain), (gst_pngdec_sink_event),
(gst_pngdec_libpng_clear), (gst_pngdec_libpng_init),
(gst_pngdec_change_state), (gst_pngdec_sink_activate_push),
(gst_pngdec_sink_activate_pull), (gst_pngdec_sink_activate):
* ext/libpng/gstpngdec.h: Complete rewrite of pngdec. It's now
very nice and handle push/pull based model. if you have filesrc
connected to it, it will do random access to load the png file.
If you have a network source that can't do _getrange, it does
progressive loading through the chain function.
* gst/alpha/gstalphacolor.c: (gst_alpha_color_transform_caps),
(transform_rgb), (transform_bgr): Fix caps negotiation correctly
thanks to Master Wim Taymans ;-)
2005-10-18 22:44:11 +00:00
|
|
|
if (GST_IS_BUFFER (pngdec->buffer_out)) {
|
2009-05-27 16:06:34 +00:00
|
|
|
size_t offset = row_num * pngdec->rowbytes;
|
ext/libpng/gstpngdec.*: Complete rewrite of pngdec. It's now very nice and handle push/pull based model. if you have ...
Original commit message from CVS:
2005-10-19 Julien MOUTTE <julien@moutte.net>
* ext/libpng/gstpngdec.c: (gst_pngdec_class_init),
(gst_pngdec_init), (user_error_fn), (user_warning_fn),
(user_info_callback), (user_endrow_callback),
(user_end_callback),
(user_read_data), (gst_pngdec_caps_create_and_set),
(gst_pngdec_task), (gst_pngdec_chain), (gst_pngdec_sink_event),
(gst_pngdec_libpng_clear), (gst_pngdec_libpng_init),
(gst_pngdec_change_state), (gst_pngdec_sink_activate_push),
(gst_pngdec_sink_activate_pull), (gst_pngdec_sink_activate):
* ext/libpng/gstpngdec.h: Complete rewrite of pngdec. It's now
very nice and handle push/pull based model. if you have filesrc
connected to it, it will do random access to load the png file.
If you have a network source that can't do _getrange, it does
progressive loading through the chain function.
* gst/alpha/gstalphacolor.c: (gst_alpha_color_transform_caps),
(transform_rgb), (transform_bgr): Fix caps negotiation correctly
thanks to Master Wim Taymans ;-)
2005-10-18 22:44:11 +00:00
|
|
|
|
2007-05-16 16:50:23 +00:00
|
|
|
GST_LOG ("got row %u, copying in buffer %p at offset %" G_GSIZE_FORMAT,
|
|
|
|
(guint) row_num, pngdec->buffer_out, offset);
|
ext/libpng/gstpngdec.*: Complete rewrite of pngdec. It's now very nice and handle push/pull based model. if you have ...
Original commit message from CVS:
2005-10-19 Julien MOUTTE <julien@moutte.net>
* ext/libpng/gstpngdec.c: (gst_pngdec_class_init),
(gst_pngdec_init), (user_error_fn), (user_warning_fn),
(user_info_callback), (user_endrow_callback),
(user_end_callback),
(user_read_data), (gst_pngdec_caps_create_and_set),
(gst_pngdec_task), (gst_pngdec_chain), (gst_pngdec_sink_event),
(gst_pngdec_libpng_clear), (gst_pngdec_libpng_init),
(gst_pngdec_change_state), (gst_pngdec_sink_activate_push),
(gst_pngdec_sink_activate_pull), (gst_pngdec_sink_activate):
* ext/libpng/gstpngdec.h: Complete rewrite of pngdec. It's now
very nice and handle push/pull based model. if you have filesrc
connected to it, it will do random access to load the png file.
If you have a network source that can't do _getrange, it does
progressive loading through the chain function.
* gst/alpha/gstalphacolor.c: (gst_alpha_color_transform_caps),
(transform_rgb), (transform_bgr): Fix caps negotiation correctly
thanks to Master Wim Taymans ;-)
2005-10-18 22:44:11 +00:00
|
|
|
memcpy (GST_BUFFER_DATA (pngdec->buffer_out) + offset, new_row,
|
|
|
|
pngdec->rowbytes);
|
|
|
|
pngdec->ret = GST_FLOW_OK;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-07-03 15:31:22 +00:00
|
|
|
static gboolean
|
|
|
|
buffer_clip (GstPngDec * dec, GstBuffer * buffer)
|
|
|
|
{
|
|
|
|
gboolean res = TRUE;
|
|
|
|
gint64 cstart, cstop;
|
|
|
|
|
2009-03-10 10:01:16 +00:00
|
|
|
|
2006-07-03 15:31:22 +00:00
|
|
|
if ((!GST_CLOCK_TIME_IS_VALID (GST_BUFFER_TIMESTAMP (buffer))) ||
|
|
|
|
(!GST_CLOCK_TIME_IS_VALID (GST_BUFFER_DURATION (buffer))) ||
|
2006-07-17 10:22:54 +00:00
|
|
|
(dec->segment.format != GST_FORMAT_TIME))
|
2006-07-03 15:31:22 +00:00
|
|
|
goto beach;
|
|
|
|
|
2009-03-10 10:01:16 +00:00
|
|
|
cstart = GST_BUFFER_TIMESTAMP (buffer);
|
|
|
|
cstop = GST_BUFFER_DURATION (buffer);
|
|
|
|
|
2006-07-17 10:22:54 +00:00
|
|
|
if ((res = gst_segment_clip (&dec->segment, GST_FORMAT_TIME,
|
2009-03-10 10:01:16 +00:00
|
|
|
cstart, cstart + cstop, &cstart, &cstop))) {
|
2006-07-03 15:31:22 +00:00
|
|
|
GST_BUFFER_TIMESTAMP (buffer) = cstart;
|
|
|
|
GST_BUFFER_DURATION (buffer) = cstop - cstart;
|
|
|
|
}
|
|
|
|
|
|
|
|
beach:
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
ext/libpng/gstpngdec.*: Complete rewrite of pngdec. It's now very nice and handle push/pull based model. if you have ...
Original commit message from CVS:
2005-10-19 Julien MOUTTE <julien@moutte.net>
* ext/libpng/gstpngdec.c: (gst_pngdec_class_init),
(gst_pngdec_init), (user_error_fn), (user_warning_fn),
(user_info_callback), (user_endrow_callback),
(user_end_callback),
(user_read_data), (gst_pngdec_caps_create_and_set),
(gst_pngdec_task), (gst_pngdec_chain), (gst_pngdec_sink_event),
(gst_pngdec_libpng_clear), (gst_pngdec_libpng_init),
(gst_pngdec_change_state), (gst_pngdec_sink_activate_push),
(gst_pngdec_sink_activate_pull), (gst_pngdec_sink_activate):
* ext/libpng/gstpngdec.h: Complete rewrite of pngdec. It's now
very nice and handle push/pull based model. if you have filesrc
connected to it, it will do random access to load the png file.
If you have a network source that can't do _getrange, it does
progressive loading through the chain function.
* gst/alpha/gstalphacolor.c: (gst_alpha_color_transform_caps),
(transform_rgb), (transform_bgr): Fix caps negotiation correctly
thanks to Master Wim Taymans ;-)
2005-10-18 22:44:11 +00:00
|
|
|
static void
|
|
|
|
user_end_callback (png_structp png_ptr, png_infop info)
|
|
|
|
{
|
|
|
|
GstPngDec *pngdec = NULL;
|
|
|
|
|
2010-03-15 20:29:55 +00:00
|
|
|
pngdec = GST_PNGDEC (png_get_io_ptr (png_ptr));
|
ext/libpng/gstpngdec.*: Complete rewrite of pngdec. It's now very nice and handle push/pull based model. if you have ...
Original commit message from CVS:
2005-10-19 Julien MOUTTE <julien@moutte.net>
* ext/libpng/gstpngdec.c: (gst_pngdec_class_init),
(gst_pngdec_init), (user_error_fn), (user_warning_fn),
(user_info_callback), (user_endrow_callback),
(user_end_callback),
(user_read_data), (gst_pngdec_caps_create_and_set),
(gst_pngdec_task), (gst_pngdec_chain), (gst_pngdec_sink_event),
(gst_pngdec_libpng_clear), (gst_pngdec_libpng_init),
(gst_pngdec_change_state), (gst_pngdec_sink_activate_push),
(gst_pngdec_sink_activate_pull), (gst_pngdec_sink_activate):
* ext/libpng/gstpngdec.h: Complete rewrite of pngdec. It's now
very nice and handle push/pull based model. if you have filesrc
connected to it, it will do random access to load the png file.
If you have a network source that can't do _getrange, it does
progressive loading through the chain function.
* gst/alpha/gstalphacolor.c: (gst_alpha_color_transform_caps),
(transform_rgb), (transform_bgr): Fix caps negotiation correctly
thanks to Master Wim Taymans ;-)
2005-10-18 22:44:11 +00:00
|
|
|
|
ext/libpng/gstpngdec.*: Handle more than one frame if the content is framed, like with png-in-quicktime (#331917).
Original commit message from CVS:
* ext/libpng/gstpngdec.c: (gst_pngdec_init),
(user_endrow_callback), (user_end_callback),
(gst_pngdec_caps_create_and_set), (gst_pngdec_chain),
(gst_pngdec_sink_setcaps), (gst_pngdec_sink_event),
(gst_pngdec_libpng_clear), (gst_pngdec_change_state):
* ext/libpng/gstpngdec.h:
Handle more than one frame if the content is framed,
like with png-in-quicktime (#331917).
2006-04-11 09:35:45 +00:00
|
|
|
GST_LOG_OBJECT (pngdec, "and we are done reading this image");
|
|
|
|
|
2006-07-03 15:31:22 +00:00
|
|
|
if (!pngdec->buffer_out)
|
|
|
|
return;
|
|
|
|
|
ext/libpng/gstpngdec.*: Handle more than one frame if the content is framed, like with png-in-quicktime (#331917).
Original commit message from CVS:
* ext/libpng/gstpngdec.c: (gst_pngdec_init),
(user_endrow_callback), (user_end_callback),
(gst_pngdec_caps_create_and_set), (gst_pngdec_chain),
(gst_pngdec_sink_setcaps), (gst_pngdec_sink_event),
(gst_pngdec_libpng_clear), (gst_pngdec_change_state):
* ext/libpng/gstpngdec.h:
Handle more than one frame if the content is framed,
like with png-in-quicktime (#331917).
2006-04-11 09:35:45 +00:00
|
|
|
if (GST_CLOCK_TIME_IS_VALID (pngdec->in_timestamp))
|
|
|
|
GST_BUFFER_TIMESTAMP (pngdec->buffer_out) = pngdec->in_timestamp;
|
|
|
|
if (GST_CLOCK_TIME_IS_VALID (pngdec->in_duration))
|
|
|
|
GST_BUFFER_DURATION (pngdec->buffer_out) = pngdec->in_duration;
|
|
|
|
|
2006-07-03 15:31:22 +00:00
|
|
|
/* buffer clipping */
|
|
|
|
if (buffer_clip (pngdec, pngdec->buffer_out)) {
|
|
|
|
/* Push our buffer and then EOS if needed */
|
|
|
|
GST_LOG_OBJECT (pngdec, "pushing buffer with ts=%" GST_TIME_FORMAT,
|
|
|
|
GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (pngdec->buffer_out)));
|
ext/libpng/gstpngdec.*: Complete rewrite of pngdec. It's now very nice and handle push/pull based model. if you have ...
Original commit message from CVS:
2005-10-19 Julien MOUTTE <julien@moutte.net>
* ext/libpng/gstpngdec.c: (gst_pngdec_class_init),
(gst_pngdec_init), (user_error_fn), (user_warning_fn),
(user_info_callback), (user_endrow_callback),
(user_end_callback),
(user_read_data), (gst_pngdec_caps_create_and_set),
(gst_pngdec_task), (gst_pngdec_chain), (gst_pngdec_sink_event),
(gst_pngdec_libpng_clear), (gst_pngdec_libpng_init),
(gst_pngdec_change_state), (gst_pngdec_sink_activate_push),
(gst_pngdec_sink_activate_pull), (gst_pngdec_sink_activate):
* ext/libpng/gstpngdec.h: Complete rewrite of pngdec. It's now
very nice and handle push/pull based model. if you have filesrc
connected to it, it will do random access to load the png file.
If you have a network source that can't do _getrange, it does
progressive loading through the chain function.
* gst/alpha/gstalphacolor.c: (gst_alpha_color_transform_caps),
(transform_rgb), (transform_bgr): Fix caps negotiation correctly
thanks to Master Wim Taymans ;-)
2005-10-18 22:44:11 +00:00
|
|
|
|
2006-07-03 15:31:22 +00:00
|
|
|
pngdec->ret = gst_pad_push (pngdec->srcpad, pngdec->buffer_out);
|
|
|
|
} else {
|
|
|
|
GST_LOG_OBJECT (pngdec, "dropped decoded buffer");
|
|
|
|
gst_buffer_unref (pngdec->buffer_out);
|
|
|
|
}
|
ext/libpng/gstpngdec.*: Handle more than one frame if the content is framed, like with png-in-quicktime (#331917).
Original commit message from CVS:
* ext/libpng/gstpngdec.c: (gst_pngdec_init),
(user_endrow_callback), (user_end_callback),
(gst_pngdec_caps_create_and_set), (gst_pngdec_chain),
(gst_pngdec_sink_setcaps), (gst_pngdec_sink_event),
(gst_pngdec_libpng_clear), (gst_pngdec_change_state):
* ext/libpng/gstpngdec.h:
Handle more than one frame if the content is framed,
like with png-in-quicktime (#331917).
2006-04-11 09:35:45 +00:00
|
|
|
pngdec->buffer_out = NULL;
|
2007-11-20 12:20:38 +00:00
|
|
|
pngdec->image_ready = TRUE;
|
ext/libpng/gstpngdec.*: Complete rewrite of pngdec. It's now very nice and handle push/pull based model. if you have ...
Original commit message from CVS:
2005-10-19 Julien MOUTTE <julien@moutte.net>
* ext/libpng/gstpngdec.c: (gst_pngdec_class_init),
(gst_pngdec_init), (user_error_fn), (user_warning_fn),
(user_info_callback), (user_endrow_callback),
(user_end_callback),
(user_read_data), (gst_pngdec_caps_create_and_set),
(gst_pngdec_task), (gst_pngdec_chain), (gst_pngdec_sink_event),
(gst_pngdec_libpng_clear), (gst_pngdec_libpng_init),
(gst_pngdec_change_state), (gst_pngdec_sink_activate_push),
(gst_pngdec_sink_activate_pull), (gst_pngdec_sink_activate):
* ext/libpng/gstpngdec.h: Complete rewrite of pngdec. It's now
very nice and handle push/pull based model. if you have filesrc
connected to it, it will do random access to load the png file.
If you have a network source that can't do _getrange, it does
progressive loading through the chain function.
* gst/alpha/gstalphacolor.c: (gst_alpha_color_transform_caps),
(transform_rgb), (transform_bgr): Fix caps negotiation correctly
thanks to Master Wim Taymans ;-)
2005-10-18 22:44:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
user_read_data (png_structp png_ptr, png_bytep data, png_size_t length)
|
|
|
|
{
|
|
|
|
GstPngDec *pngdec;
|
|
|
|
GstBuffer *buffer;
|
|
|
|
GstFlowReturn ret = GST_FLOW_OK;
|
2009-03-10 10:01:16 +00:00
|
|
|
guint size;
|
ext/libpng/gstpngdec.*: Complete rewrite of pngdec. It's now very nice and handle push/pull based model. if you have ...
Original commit message from CVS:
2005-10-19 Julien MOUTTE <julien@moutte.net>
* ext/libpng/gstpngdec.c: (gst_pngdec_class_init),
(gst_pngdec_init), (user_error_fn), (user_warning_fn),
(user_info_callback), (user_endrow_callback),
(user_end_callback),
(user_read_data), (gst_pngdec_caps_create_and_set),
(gst_pngdec_task), (gst_pngdec_chain), (gst_pngdec_sink_event),
(gst_pngdec_libpng_clear), (gst_pngdec_libpng_init),
(gst_pngdec_change_state), (gst_pngdec_sink_activate_push),
(gst_pngdec_sink_activate_pull), (gst_pngdec_sink_activate):
* ext/libpng/gstpngdec.h: Complete rewrite of pngdec. It's now
very nice and handle push/pull based model. if you have filesrc
connected to it, it will do random access to load the png file.
If you have a network source that can't do _getrange, it does
progressive loading through the chain function.
* gst/alpha/gstalphacolor.c: (gst_alpha_color_transform_caps),
(transform_rgb), (transform_bgr): Fix caps negotiation correctly
thanks to Master Wim Taymans ;-)
2005-10-18 22:44:11 +00:00
|
|
|
|
2010-03-15 20:29:55 +00:00
|
|
|
pngdec = GST_PNGDEC (png_get_io_ptr (png_ptr));
|
ext/libpng/gstpngdec.*: Complete rewrite of pngdec. It's now very nice and handle push/pull based model. if you have ...
Original commit message from CVS:
2005-10-19 Julien MOUTTE <julien@moutte.net>
* ext/libpng/gstpngdec.c: (gst_pngdec_class_init),
(gst_pngdec_init), (user_error_fn), (user_warning_fn),
(user_info_callback), (user_endrow_callback),
(user_end_callback),
(user_read_data), (gst_pngdec_caps_create_and_set),
(gst_pngdec_task), (gst_pngdec_chain), (gst_pngdec_sink_event),
(gst_pngdec_libpng_clear), (gst_pngdec_libpng_init),
(gst_pngdec_change_state), (gst_pngdec_sink_activate_push),
(gst_pngdec_sink_activate_pull), (gst_pngdec_sink_activate):
* ext/libpng/gstpngdec.h: Complete rewrite of pngdec. It's now
very nice and handle push/pull based model. if you have filesrc
connected to it, it will do random access to load the png file.
If you have a network source that can't do _getrange, it does
progressive loading through the chain function.
* gst/alpha/gstalphacolor.c: (gst_alpha_color_transform_caps),
(transform_rgb), (transform_bgr): Fix caps negotiation correctly
thanks to Master Wim Taymans ;-)
2005-10-18 22:44:11 +00:00
|
|
|
|
2007-05-16 16:50:23 +00:00
|
|
|
GST_LOG ("reading %" G_GSIZE_FORMAT " bytes of data at offset %d", length,
|
|
|
|
pngdec->offset);
|
ext/libpng/gstpngdec.*: Complete rewrite of pngdec. It's now very nice and handle push/pull based model. if you have ...
Original commit message from CVS:
2005-10-19 Julien MOUTTE <julien@moutte.net>
* ext/libpng/gstpngdec.c: (gst_pngdec_class_init),
(gst_pngdec_init), (user_error_fn), (user_warning_fn),
(user_info_callback), (user_endrow_callback),
(user_end_callback),
(user_read_data), (gst_pngdec_caps_create_and_set),
(gst_pngdec_task), (gst_pngdec_chain), (gst_pngdec_sink_event),
(gst_pngdec_libpng_clear), (gst_pngdec_libpng_init),
(gst_pngdec_change_state), (gst_pngdec_sink_activate_push),
(gst_pngdec_sink_activate_pull), (gst_pngdec_sink_activate):
* ext/libpng/gstpngdec.h: Complete rewrite of pngdec. It's now
very nice and handle push/pull based model. if you have filesrc
connected to it, it will do random access to load the png file.
If you have a network source that can't do _getrange, it does
progressive loading through the chain function.
* gst/alpha/gstalphacolor.c: (gst_alpha_color_transform_caps),
(transform_rgb), (transform_bgr): Fix caps negotiation correctly
thanks to Master Wim Taymans ;-)
2005-10-18 22:44:11 +00:00
|
|
|
|
|
|
|
ret = gst_pad_pull_range (pngdec->sinkpad, pngdec->offset, length, &buffer);
|
2009-03-10 10:01:16 +00:00
|
|
|
if (ret != GST_FLOW_OK)
|
ext/libpng/gstpngdec.*: Complete rewrite of pngdec. It's now very nice and handle push/pull based model. if you have ...
Original commit message from CVS:
2005-10-19 Julien MOUTTE <julien@moutte.net>
* ext/libpng/gstpngdec.c: (gst_pngdec_class_init),
(gst_pngdec_init), (user_error_fn), (user_warning_fn),
(user_info_callback), (user_endrow_callback),
(user_end_callback),
(user_read_data), (gst_pngdec_caps_create_and_set),
(gst_pngdec_task), (gst_pngdec_chain), (gst_pngdec_sink_event),
(gst_pngdec_libpng_clear), (gst_pngdec_libpng_init),
(gst_pngdec_change_state), (gst_pngdec_sink_activate_push),
(gst_pngdec_sink_activate_pull), (gst_pngdec_sink_activate):
* ext/libpng/gstpngdec.h: Complete rewrite of pngdec. It's now
very nice and handle push/pull based model. if you have filesrc
connected to it, it will do random access to load the png file.
If you have a network source that can't do _getrange, it does
progressive loading through the chain function.
* gst/alpha/gstalphacolor.c: (gst_alpha_color_transform_caps),
(transform_rgb), (transform_bgr): Fix caps negotiation correctly
thanks to Master Wim Taymans ;-)
2005-10-18 22:44:11 +00:00
|
|
|
goto pause;
|
|
|
|
|
2009-03-10 10:01:16 +00:00
|
|
|
size = GST_BUFFER_SIZE (buffer);
|
|
|
|
|
|
|
|
if (size != length)
|
|
|
|
goto short_buffer;
|
|
|
|
|
|
|
|
memcpy (data, GST_BUFFER_DATA (buffer), size);
|
ext/libpng/gstpngdec.*: Complete rewrite of pngdec. It's now very nice and handle push/pull based model. if you have ...
Original commit message from CVS:
2005-10-19 Julien MOUTTE <julien@moutte.net>
* ext/libpng/gstpngdec.c: (gst_pngdec_class_init),
(gst_pngdec_init), (user_error_fn), (user_warning_fn),
(user_info_callback), (user_endrow_callback),
(user_end_callback),
(user_read_data), (gst_pngdec_caps_create_and_set),
(gst_pngdec_task), (gst_pngdec_chain), (gst_pngdec_sink_event),
(gst_pngdec_libpng_clear), (gst_pngdec_libpng_init),
(gst_pngdec_change_state), (gst_pngdec_sink_activate_push),
(gst_pngdec_sink_activate_pull), (gst_pngdec_sink_activate):
* ext/libpng/gstpngdec.h: Complete rewrite of pngdec. It's now
very nice and handle push/pull based model. if you have filesrc
connected to it, it will do random access to load the png file.
If you have a network source that can't do _getrange, it does
progressive loading through the chain function.
* gst/alpha/gstalphacolor.c: (gst_alpha_color_transform_caps),
(transform_rgb), (transform_bgr): Fix caps negotiation correctly
thanks to Master Wim Taymans ;-)
2005-10-18 22:44:11 +00:00
|
|
|
|
2005-10-18 22:50:11 +00:00
|
|
|
gst_buffer_unref (buffer);
|
|
|
|
|
ext/libpng/gstpngdec.*: Complete rewrite of pngdec. It's now very nice and handle push/pull based model. if you have ...
Original commit message from CVS:
2005-10-19 Julien MOUTTE <julien@moutte.net>
* ext/libpng/gstpngdec.c: (gst_pngdec_class_init),
(gst_pngdec_init), (user_error_fn), (user_warning_fn),
(user_info_callback), (user_endrow_callback),
(user_end_callback),
(user_read_data), (gst_pngdec_caps_create_and_set),
(gst_pngdec_task), (gst_pngdec_chain), (gst_pngdec_sink_event),
(gst_pngdec_libpng_clear), (gst_pngdec_libpng_init),
(gst_pngdec_change_state), (gst_pngdec_sink_activate_push),
(gst_pngdec_sink_activate_pull), (gst_pngdec_sink_activate):
* ext/libpng/gstpngdec.h: Complete rewrite of pngdec. It's now
very nice and handle push/pull based model. if you have filesrc
connected to it, it will do random access to load the png file.
If you have a network source that can't do _getrange, it does
progressive loading through the chain function.
* gst/alpha/gstalphacolor.c: (gst_alpha_color_transform_caps),
(transform_rgb), (transform_bgr): Fix caps negotiation correctly
thanks to Master Wim Taymans ;-)
2005-10-18 22:44:11 +00:00
|
|
|
pngdec->offset += length;
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
2009-03-10 10:01:16 +00:00
|
|
|
/* ERRORS */
|
ext/libpng/gstpngdec.*: Complete rewrite of pngdec. It's now very nice and handle push/pull based model. if you have ...
Original commit message from CVS:
2005-10-19 Julien MOUTTE <julien@moutte.net>
* ext/libpng/gstpngdec.c: (gst_pngdec_class_init),
(gst_pngdec_init), (user_error_fn), (user_warning_fn),
(user_info_callback), (user_endrow_callback),
(user_end_callback),
(user_read_data), (gst_pngdec_caps_create_and_set),
(gst_pngdec_task), (gst_pngdec_chain), (gst_pngdec_sink_event),
(gst_pngdec_libpng_clear), (gst_pngdec_libpng_init),
(gst_pngdec_change_state), (gst_pngdec_sink_activate_push),
(gst_pngdec_sink_activate_pull), (gst_pngdec_sink_activate):
* ext/libpng/gstpngdec.h: Complete rewrite of pngdec. It's now
very nice and handle push/pull based model. if you have filesrc
connected to it, it will do random access to load the png file.
If you have a network source that can't do _getrange, it does
progressive loading through the chain function.
* gst/alpha/gstalphacolor.c: (gst_alpha_color_transform_caps),
(transform_rgb), (transform_bgr): Fix caps negotiation correctly
thanks to Master Wim Taymans ;-)
2005-10-18 22:44:11 +00:00
|
|
|
pause:
|
2009-03-10 10:01:16 +00:00
|
|
|
{
|
|
|
|
GST_INFO_OBJECT (pngdec, "pausing task, reason %s",
|
|
|
|
gst_flow_get_name (ret));
|
|
|
|
gst_pad_pause_task (pngdec->sinkpad);
|
2010-08-27 16:13:21 +00:00
|
|
|
if (ret == GST_FLOW_UNEXPECTED) {
|
|
|
|
gst_pad_push_event (pngdec->srcpad, gst_event_new_eos ());
|
|
|
|
} else if (ret < GST_FLOW_UNEXPECTED || ret == GST_FLOW_NOT_LINKED) {
|
2009-03-10 10:01:16 +00:00
|
|
|
GST_ELEMENT_ERROR (pngdec, STREAM, FAILED,
|
|
|
|
(_("Internal data stream error.")),
|
|
|
|
("stream stopped, reason %s", gst_flow_get_name (ret)));
|
|
|
|
gst_pad_push_event (pngdec->srcpad, gst_event_new_eos ());
|
|
|
|
}
|
2010-11-08 12:47:04 +00:00
|
|
|
png_error (png_ptr, "Internal data stream error.");
|
2009-03-10 10:01:16 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
short_buffer:
|
|
|
|
{
|
|
|
|
gst_buffer_unref (buffer);
|
2005-10-23 11:07:10 +00:00
|
|
|
GST_ELEMENT_ERROR (pngdec, STREAM, FAILED,
|
|
|
|
(_("Internal data stream error.")),
|
2009-04-20 13:48:21 +00:00
|
|
|
("Read %u, needed %" G_GSIZE_FORMAT "bytes", size, length));
|
2009-03-10 10:01:16 +00:00
|
|
|
ret = GST_FLOW_ERROR;
|
|
|
|
goto pause;
|
ext/libpng/gstpngdec.*: Complete rewrite of pngdec. It's now very nice and handle push/pull based model. if you have ...
Original commit message from CVS:
2005-10-19 Julien MOUTTE <julien@moutte.net>
* ext/libpng/gstpngdec.c: (gst_pngdec_class_init),
(gst_pngdec_init), (user_error_fn), (user_warning_fn),
(user_info_callback), (user_endrow_callback),
(user_end_callback),
(user_read_data), (gst_pngdec_caps_create_and_set),
(gst_pngdec_task), (gst_pngdec_chain), (gst_pngdec_sink_event),
(gst_pngdec_libpng_clear), (gst_pngdec_libpng_init),
(gst_pngdec_change_state), (gst_pngdec_sink_activate_push),
(gst_pngdec_sink_activate_pull), (gst_pngdec_sink_activate):
* ext/libpng/gstpngdec.h: Complete rewrite of pngdec. It's now
very nice and handle push/pull based model. if you have filesrc
connected to it, it will do random access to load the png file.
If you have a network source that can't do _getrange, it does
progressive loading through the chain function.
* gst/alpha/gstalphacolor.c: (gst_alpha_color_transform_caps),
(transform_rgb), (transform_bgr): Fix caps negotiation correctly
thanks to Master Wim Taymans ;-)
2005-10-18 22:44:11 +00:00
|
|
|
}
|
|
|
|
}
|
2005-10-15 16:48:55 +00:00
|
|
|
|
|
|
|
static GstFlowReturn
|
ext/libpng/gstpngdec.*: Complete rewrite of pngdec. It's now very nice and handle push/pull based model. if you have ...
Original commit message from CVS:
2005-10-19 Julien MOUTTE <julien@moutte.net>
* ext/libpng/gstpngdec.c: (gst_pngdec_class_init),
(gst_pngdec_init), (user_error_fn), (user_warning_fn),
(user_info_callback), (user_endrow_callback),
(user_end_callback),
(user_read_data), (gst_pngdec_caps_create_and_set),
(gst_pngdec_task), (gst_pngdec_chain), (gst_pngdec_sink_event),
(gst_pngdec_libpng_clear), (gst_pngdec_libpng_init),
(gst_pngdec_change_state), (gst_pngdec_sink_activate_push),
(gst_pngdec_sink_activate_pull), (gst_pngdec_sink_activate):
* ext/libpng/gstpngdec.h: Complete rewrite of pngdec. It's now
very nice and handle push/pull based model. if you have filesrc
connected to it, it will do random access to load the png file.
If you have a network source that can't do _getrange, it does
progressive loading through the chain function.
* gst/alpha/gstalphacolor.c: (gst_alpha_color_transform_caps),
(transform_rgb), (transform_bgr): Fix caps negotiation correctly
thanks to Master Wim Taymans ;-)
2005-10-18 22:44:11 +00:00
|
|
|
gst_pngdec_caps_create_and_set (GstPngDec * pngdec)
|
2004-07-16 10:56:31 +00:00
|
|
|
{
|
2005-10-15 16:48:55 +00:00
|
|
|
GstFlowReturn ret = GST_FLOW_OK;
|
ext/libpng/gstpngdec.*: Complete rewrite of pngdec. It's now very nice and handle push/pull based model. if you have ...
Original commit message from CVS:
2005-10-19 Julien MOUTTE <julien@moutte.net>
* ext/libpng/gstpngdec.c: (gst_pngdec_class_init),
(gst_pngdec_init), (user_error_fn), (user_warning_fn),
(user_info_callback), (user_endrow_callback),
(user_end_callback),
(user_read_data), (gst_pngdec_caps_create_and_set),
(gst_pngdec_task), (gst_pngdec_chain), (gst_pngdec_sink_event),
(gst_pngdec_libpng_clear), (gst_pngdec_libpng_init),
(gst_pngdec_change_state), (gst_pngdec_sink_activate_push),
(gst_pngdec_sink_activate_pull), (gst_pngdec_sink_activate):
* ext/libpng/gstpngdec.h: Complete rewrite of pngdec. It's now
very nice and handle push/pull based model. if you have filesrc
connected to it, it will do random access to load the png file.
If you have a network source that can't do _getrange, it does
progressive loading through the chain function.
* gst/alpha/gstalphacolor.c: (gst_alpha_color_transform_caps),
(transform_rgb), (transform_bgr): Fix caps negotiation correctly
thanks to Master Wim Taymans ;-)
2005-10-18 22:44:11 +00:00
|
|
|
GstCaps *caps = NULL, *res = NULL;
|
|
|
|
GstPadTemplate *templ = NULL;
|
2005-10-25 10:47:09 +00:00
|
|
|
gint bpc = 0, color_type;
|
|
|
|
png_uint_32 width, height;
|
ext/libpng/gstpngdec.*: Complete rewrite of pngdec. It's now very nice and handle push/pull based model. if you have ...
Original commit message from CVS:
2005-10-19 Julien MOUTTE <julien@moutte.net>
* ext/libpng/gstpngdec.c: (gst_pngdec_class_init),
(gst_pngdec_init), (user_error_fn), (user_warning_fn),
(user_info_callback), (user_endrow_callback),
(user_end_callback),
(user_read_data), (gst_pngdec_caps_create_and_set),
(gst_pngdec_task), (gst_pngdec_chain), (gst_pngdec_sink_event),
(gst_pngdec_libpng_clear), (gst_pngdec_libpng_init),
(gst_pngdec_change_state), (gst_pngdec_sink_activate_push),
(gst_pngdec_sink_activate_pull), (gst_pngdec_sink_activate):
* ext/libpng/gstpngdec.h: Complete rewrite of pngdec. It's now
very nice and handle push/pull based model. if you have filesrc
connected to it, it will do random access to load the png file.
If you have a network source that can't do _getrange, it does
progressive loading through the chain function.
* gst/alpha/gstalphacolor.c: (gst_alpha_color_transform_caps),
(transform_rgb), (transform_bgr): Fix caps negotiation correctly
thanks to Master Wim Taymans ;-)
2005-10-18 22:44:11 +00:00
|
|
|
|
|
|
|
g_return_val_if_fail (GST_IS_PNGDEC (pngdec), GST_FLOW_ERROR);
|
|
|
|
|
2005-10-25 10:47:09 +00:00
|
|
|
/* Get bits per channel */
|
|
|
|
bpc = png_get_bit_depth (pngdec->png, pngdec->info);
|
2011-02-19 23:48:22 +00:00
|
|
|
if (bpc > 8) {
|
|
|
|
/* Add alpha channel if 16-bit depth */
|
|
|
|
png_set_add_alpha (pngdec->png, 0xffff, PNG_FILLER_BEFORE);
|
|
|
|
png_set_swap (pngdec->png);
|
2005-10-25 10:47:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Get Color type */
|
|
|
|
color_type = png_get_color_type (pngdec->png, pngdec->info);
|
|
|
|
|
2007-07-06 11:42:53 +00:00
|
|
|
#if 0
|
|
|
|
/* We used to have this HACK to reverse the outgoing bytes, but the problem
|
|
|
|
* that originally required the hack seems to have been in ffmpegcolorspace's
|
|
|
|
* RGBA descriptions. It doesn't seem needed now that's fixed, but might
|
|
|
|
* still be needed on big-endian systems, I'm not sure. J.S. 6/7/2007 */
|
2005-10-25 10:47:09 +00:00
|
|
|
if (color_type == PNG_COLOR_TYPE_RGB_ALPHA)
|
|
|
|
png_set_bgr (pngdec->png);
|
2007-07-06 11:42:53 +00:00
|
|
|
#endif
|
2005-10-25 10:47:09 +00:00
|
|
|
|
2006-03-06 22:22:45 +00:00
|
|
|
/* Gray scale converted to RGB and upscaled to 8 bits */
|
|
|
|
if ((color_type == PNG_COLOR_TYPE_GRAY_ALPHA) ||
|
|
|
|
(color_type == PNG_COLOR_TYPE_GRAY)) {
|
|
|
|
GST_LOG_OBJECT (pngdec, "converting grayscale png to RGB");
|
|
|
|
png_set_gray_to_rgb (pngdec->png);
|
|
|
|
if (bpc < 8) { /* Convert to 8 bits */
|
|
|
|
GST_LOG_OBJECT (pngdec, "converting grayscale image to 8 bits");
|
2010-02-02 00:02:34 +00:00
|
|
|
#if PNG_LIBPNG_VER < 10400
|
2006-03-06 22:22:45 +00:00
|
|
|
png_set_gray_1_2_4_to_8 (pngdec->png);
|
2010-02-02 00:02:34 +00:00
|
|
|
#else
|
|
|
|
png_set_expand_gray_1_2_4_to_8 (pngdec->png);
|
|
|
|
#endif
|
2006-03-06 22:22:45 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Palette converted to RGB */
|
|
|
|
if (color_type == PNG_COLOR_TYPE_PALETTE) {
|
|
|
|
GST_LOG_OBJECT (pngdec, "converting palette png to RGB");
|
|
|
|
png_set_palette_to_rgb (pngdec->png);
|
|
|
|
}
|
|
|
|
|
2005-10-25 10:47:09 +00:00
|
|
|
/* Update the info structure */
|
|
|
|
png_read_update_info (pngdec->png, pngdec->info);
|
|
|
|
|
|
|
|
/* Get IHDR header again after transformation settings */
|
|
|
|
|
|
|
|
png_get_IHDR (pngdec->png, pngdec->info, &width, &height,
|
|
|
|
&bpc, &pngdec->color_type, NULL, NULL, NULL);
|
|
|
|
|
|
|
|
pngdec->width = width;
|
|
|
|
pngdec->height = height;
|
|
|
|
|
2006-03-06 22:22:45 +00:00
|
|
|
GST_LOG_OBJECT (pngdec, "this is a %dx%d PNG image", pngdec->width,
|
|
|
|
pngdec->height);
|
ext/libpng/gstpngdec.*: Complete rewrite of pngdec. It's now very nice and handle push/pull based model. if you have ...
Original commit message from CVS:
2005-10-19 Julien MOUTTE <julien@moutte.net>
* ext/libpng/gstpngdec.c: (gst_pngdec_class_init),
(gst_pngdec_init), (user_error_fn), (user_warning_fn),
(user_info_callback), (user_endrow_callback),
(user_end_callback),
(user_read_data), (gst_pngdec_caps_create_and_set),
(gst_pngdec_task), (gst_pngdec_chain), (gst_pngdec_sink_event),
(gst_pngdec_libpng_clear), (gst_pngdec_libpng_init),
(gst_pngdec_change_state), (gst_pngdec_sink_activate_push),
(gst_pngdec_sink_activate_pull), (gst_pngdec_sink_activate):
* ext/libpng/gstpngdec.h: Complete rewrite of pngdec. It's now
very nice and handle push/pull based model. if you have filesrc
connected to it, it will do random access to load the png file.
If you have a network source that can't do _getrange, it does
progressive loading through the chain function.
* gst/alpha/gstalphacolor.c: (gst_alpha_color_transform_caps),
(transform_rgb), (transform_bgr): Fix caps negotiation correctly
thanks to Master Wim Taymans ;-)
2005-10-18 22:44:11 +00:00
|
|
|
|
|
|
|
switch (pngdec->color_type) {
|
|
|
|
case PNG_COLOR_TYPE_RGB:
|
2006-03-06 22:22:45 +00:00
|
|
|
GST_LOG_OBJECT (pngdec, "we have no alpha channel, depth is 24 bits");
|
2011-02-19 23:48:22 +00:00
|
|
|
pngdec->bpp = 3 * bpc;
|
ext/libpng/gstpngdec.*: Complete rewrite of pngdec. It's now very nice and handle push/pull based model. if you have ...
Original commit message from CVS:
2005-10-19 Julien MOUTTE <julien@moutte.net>
* ext/libpng/gstpngdec.c: (gst_pngdec_class_init),
(gst_pngdec_init), (user_error_fn), (user_warning_fn),
(user_info_callback), (user_endrow_callback),
(user_end_callback),
(user_read_data), (gst_pngdec_caps_create_and_set),
(gst_pngdec_task), (gst_pngdec_chain), (gst_pngdec_sink_event),
(gst_pngdec_libpng_clear), (gst_pngdec_libpng_init),
(gst_pngdec_change_state), (gst_pngdec_sink_activate_push),
(gst_pngdec_sink_activate_pull), (gst_pngdec_sink_activate):
* ext/libpng/gstpngdec.h: Complete rewrite of pngdec. It's now
very nice and handle push/pull based model. if you have filesrc
connected to it, it will do random access to load the png file.
If you have a network source that can't do _getrange, it does
progressive loading through the chain function.
* gst/alpha/gstalphacolor.c: (gst_alpha_color_transform_caps),
(transform_rgb), (transform_bgr): Fix caps negotiation correctly
thanks to Master Wim Taymans ;-)
2005-10-18 22:44:11 +00:00
|
|
|
break;
|
|
|
|
case PNG_COLOR_TYPE_RGB_ALPHA:
|
2006-03-06 22:22:45 +00:00
|
|
|
GST_LOG_OBJECT (pngdec, "we have an alpha channel, depth is 32 bits");
|
2011-02-19 23:48:22 +00:00
|
|
|
pngdec->bpp = 4 * bpc;
|
ext/libpng/gstpngdec.*: Complete rewrite of pngdec. It's now very nice and handle push/pull based model. if you have ...
Original commit message from CVS:
2005-10-19 Julien MOUTTE <julien@moutte.net>
* ext/libpng/gstpngdec.c: (gst_pngdec_class_init),
(gst_pngdec_init), (user_error_fn), (user_warning_fn),
(user_info_callback), (user_endrow_callback),
(user_end_callback),
(user_read_data), (gst_pngdec_caps_create_and_set),
(gst_pngdec_task), (gst_pngdec_chain), (gst_pngdec_sink_event),
(gst_pngdec_libpng_clear), (gst_pngdec_libpng_init),
(gst_pngdec_change_state), (gst_pngdec_sink_activate_push),
(gst_pngdec_sink_activate_pull), (gst_pngdec_sink_activate):
* ext/libpng/gstpngdec.h: Complete rewrite of pngdec. It's now
very nice and handle push/pull based model. if you have filesrc
connected to it, it will do random access to load the png file.
If you have a network source that can't do _getrange, it does
progressive loading through the chain function.
* gst/alpha/gstalphacolor.c: (gst_alpha_color_transform_caps),
(transform_rgb), (transform_bgr): Fix caps negotiation correctly
thanks to Master Wim Taymans ;-)
2005-10-18 22:44:11 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
GST_ELEMENT_ERROR (pngdec, STREAM, NOT_IMPLEMENTED, (NULL),
|
2006-03-06 22:22:45 +00:00
|
|
|
("pngdec does not support this color type"));
|
2006-07-17 10:22:54 +00:00
|
|
|
ret = GST_FLOW_NOT_SUPPORTED;
|
ext/libpng/gstpngdec.*: Complete rewrite of pngdec. It's now very nice and handle push/pull based model. if you have ...
Original commit message from CVS:
2005-10-19 Julien MOUTTE <julien@moutte.net>
* ext/libpng/gstpngdec.c: (gst_pngdec_class_init),
(gst_pngdec_init), (user_error_fn), (user_warning_fn),
(user_info_callback), (user_endrow_callback),
(user_end_callback),
(user_read_data), (gst_pngdec_caps_create_and_set),
(gst_pngdec_task), (gst_pngdec_chain), (gst_pngdec_sink_event),
(gst_pngdec_libpng_clear), (gst_pngdec_libpng_init),
(gst_pngdec_change_state), (gst_pngdec_sink_activate_push),
(gst_pngdec_sink_activate_pull), (gst_pngdec_sink_activate):
* ext/libpng/gstpngdec.h: Complete rewrite of pngdec. It's now
very nice and handle push/pull based model. if you have filesrc
connected to it, it will do random access to load the png file.
If you have a network source that can't do _getrange, it does
progressive loading through the chain function.
* gst/alpha/gstalphacolor.c: (gst_alpha_color_transform_caps),
(transform_rgb), (transform_bgr): Fix caps negotiation correctly
thanks to Master Wim Taymans ;-)
2005-10-18 22:44:11 +00:00
|
|
|
goto beach;
|
|
|
|
}
|
|
|
|
|
|
|
|
caps = gst_caps_new_simple ("video/x-raw-rgb",
|
|
|
|
"width", G_TYPE_INT, pngdec->width,
|
|
|
|
"height", G_TYPE_INT, pngdec->height,
|
|
|
|
"bpp", G_TYPE_INT, pngdec->bpp,
|
2005-11-22 22:21:37 +00:00
|
|
|
"framerate", GST_TYPE_FRACTION, pngdec->fps_n, pngdec->fps_d, NULL);
|
ext/libpng/gstpngdec.*: Complete rewrite of pngdec. It's now very nice and handle push/pull based model. if you have ...
Original commit message from CVS:
2005-10-19 Julien MOUTTE <julien@moutte.net>
* ext/libpng/gstpngdec.c: (gst_pngdec_class_init),
(gst_pngdec_init), (user_error_fn), (user_warning_fn),
(user_info_callback), (user_endrow_callback),
(user_end_callback),
(user_read_data), (gst_pngdec_caps_create_and_set),
(gst_pngdec_task), (gst_pngdec_chain), (gst_pngdec_sink_event),
(gst_pngdec_libpng_clear), (gst_pngdec_libpng_init),
(gst_pngdec_change_state), (gst_pngdec_sink_activate_push),
(gst_pngdec_sink_activate_pull), (gst_pngdec_sink_activate):
* ext/libpng/gstpngdec.h: Complete rewrite of pngdec. It's now
very nice and handle push/pull based model. if you have filesrc
connected to it, it will do random access to load the png file.
If you have a network source that can't do _getrange, it does
progressive loading through the chain function.
* gst/alpha/gstalphacolor.c: (gst_alpha_color_transform_caps),
(transform_rgb), (transform_bgr): Fix caps negotiation correctly
thanks to Master Wim Taymans ;-)
2005-10-18 22:44:11 +00:00
|
|
|
|
|
|
|
templ = gst_static_pad_template_get (&gst_pngdec_src_pad_template);
|
|
|
|
|
|
|
|
res = gst_caps_intersect (caps, gst_pad_template_get_caps (templ));
|
|
|
|
|
|
|
|
gst_caps_unref (caps);
|
2006-03-15 16:17:12 +00:00
|
|
|
gst_object_unref (templ);
|
ext/libpng/gstpngdec.*: Complete rewrite of pngdec. It's now very nice and handle push/pull based model. if you have ...
Original commit message from CVS:
2005-10-19 Julien MOUTTE <julien@moutte.net>
* ext/libpng/gstpngdec.c: (gst_pngdec_class_init),
(gst_pngdec_init), (user_error_fn), (user_warning_fn),
(user_info_callback), (user_endrow_callback),
(user_end_callback),
(user_read_data), (gst_pngdec_caps_create_and_set),
(gst_pngdec_task), (gst_pngdec_chain), (gst_pngdec_sink_event),
(gst_pngdec_libpng_clear), (gst_pngdec_libpng_init),
(gst_pngdec_change_state), (gst_pngdec_sink_activate_push),
(gst_pngdec_sink_activate_pull), (gst_pngdec_sink_activate):
* ext/libpng/gstpngdec.h: Complete rewrite of pngdec. It's now
very nice and handle push/pull based model. if you have filesrc
connected to it, it will do random access to load the png file.
If you have a network source that can't do _getrange, it does
progressive loading through the chain function.
* gst/alpha/gstalphacolor.c: (gst_alpha_color_transform_caps),
(transform_rgb), (transform_bgr): Fix caps negotiation correctly
thanks to Master Wim Taymans ;-)
2005-10-18 22:44:11 +00:00
|
|
|
|
2006-07-17 10:22:54 +00:00
|
|
|
if (!gst_pad_set_caps (pngdec->srcpad, res))
|
|
|
|
ret = GST_FLOW_NOT_NEGOTIATED;
|
ext/libpng/gstpngdec.*: Complete rewrite of pngdec. It's now very nice and handle push/pull based model. if you have ...
Original commit message from CVS:
2005-10-19 Julien MOUTTE <julien@moutte.net>
* ext/libpng/gstpngdec.c: (gst_pngdec_class_init),
(gst_pngdec_init), (user_error_fn), (user_warning_fn),
(user_info_callback), (user_endrow_callback),
(user_end_callback),
(user_read_data), (gst_pngdec_caps_create_and_set),
(gst_pngdec_task), (gst_pngdec_chain), (gst_pngdec_sink_event),
(gst_pngdec_libpng_clear), (gst_pngdec_libpng_init),
(gst_pngdec_change_state), (gst_pngdec_sink_activate_push),
(gst_pngdec_sink_activate_pull), (gst_pngdec_sink_activate):
* ext/libpng/gstpngdec.h: Complete rewrite of pngdec. It's now
very nice and handle push/pull based model. if you have filesrc
connected to it, it will do random access to load the png file.
If you have a network source that can't do _getrange, it does
progressive loading through the chain function.
* gst/alpha/gstalphacolor.c: (gst_alpha_color_transform_caps),
(transform_rgb), (transform_bgr): Fix caps negotiation correctly
thanks to Master Wim Taymans ;-)
2005-10-18 22:44:11 +00:00
|
|
|
|
2005-10-25 10:23:26 +00:00
|
|
|
GST_DEBUG_OBJECT (pngdec, "our caps %" GST_PTR_FORMAT, res);
|
ext/libpng/gstpngdec.*: Complete rewrite of pngdec. It's now very nice and handle push/pull based model. if you have ...
Original commit message from CVS:
2005-10-19 Julien MOUTTE <julien@moutte.net>
* ext/libpng/gstpngdec.c: (gst_pngdec_class_init),
(gst_pngdec_init), (user_error_fn), (user_warning_fn),
(user_info_callback), (user_endrow_callback),
(user_end_callback),
(user_read_data), (gst_pngdec_caps_create_and_set),
(gst_pngdec_task), (gst_pngdec_chain), (gst_pngdec_sink_event),
(gst_pngdec_libpng_clear), (gst_pngdec_libpng_init),
(gst_pngdec_change_state), (gst_pngdec_sink_activate_push),
(gst_pngdec_sink_activate_pull), (gst_pngdec_sink_activate):
* ext/libpng/gstpngdec.h: Complete rewrite of pngdec. It's now
very nice and handle push/pull based model. if you have filesrc
connected to it, it will do random access to load the png file.
If you have a network source that can't do _getrange, it does
progressive loading through the chain function.
* gst/alpha/gstalphacolor.c: (gst_alpha_color_transform_caps),
(transform_rgb), (transform_bgr): Fix caps negotiation correctly
thanks to Master Wim Taymans ;-)
2005-10-18 22:44:11 +00:00
|
|
|
|
|
|
|
gst_caps_unref (res);
|
|
|
|
|
2005-10-25 10:47:09 +00:00
|
|
|
/* Push a newsegment event */
|
ext/libpng/gstpngdec.*: Handle more than one frame if the content is framed, like with png-in-quicktime (#331917).
Original commit message from CVS:
* ext/libpng/gstpngdec.c: (gst_pngdec_init),
(user_endrow_callback), (user_end_callback),
(gst_pngdec_caps_create_and_set), (gst_pngdec_chain),
(gst_pngdec_sink_setcaps), (gst_pngdec_sink_event),
(gst_pngdec_libpng_clear), (gst_pngdec_change_state):
* ext/libpng/gstpngdec.h:
Handle more than one frame if the content is framed,
like with png-in-quicktime (#331917).
2006-04-11 09:35:45 +00:00
|
|
|
if (pngdec->need_newsegment) {
|
|
|
|
gst_pad_push_event (pngdec->srcpad,
|
|
|
|
gst_event_new_new_segment (FALSE, 1.0, GST_FORMAT_TIME, 0, -1, 0));
|
|
|
|
pngdec->need_newsegment = FALSE;
|
2005-10-25 10:47:09 +00:00
|
|
|
}
|
|
|
|
|
ext/libpng/gstpngdec.*: Complete rewrite of pngdec. It's now very nice and handle push/pull based model. if you have ...
Original commit message from CVS:
2005-10-19 Julien MOUTTE <julien@moutte.net>
* ext/libpng/gstpngdec.c: (gst_pngdec_class_init),
(gst_pngdec_init), (user_error_fn), (user_warning_fn),
(user_info_callback), (user_endrow_callback),
(user_end_callback),
(user_read_data), (gst_pngdec_caps_create_and_set),
(gst_pngdec_task), (gst_pngdec_chain), (gst_pngdec_sink_event),
(gst_pngdec_libpng_clear), (gst_pngdec_libpng_init),
(gst_pngdec_change_state), (gst_pngdec_sink_activate_push),
(gst_pngdec_sink_activate_pull), (gst_pngdec_sink_activate):
* ext/libpng/gstpngdec.h: Complete rewrite of pngdec. It's now
very nice and handle push/pull based model. if you have filesrc
connected to it, it will do random access to load the png file.
If you have a network source that can't do _getrange, it does
progressive loading through the chain function.
* gst/alpha/gstalphacolor.c: (gst_alpha_color_transform_caps),
(transform_rgb), (transform_bgr): Fix caps negotiation correctly
thanks to Master Wim Taymans ;-)
2005-10-18 22:44:11 +00:00
|
|
|
beach:
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gst_pngdec_task (GstPad * pad)
|
|
|
|
{
|
2004-07-16 10:56:31 +00:00
|
|
|
GstPngDec *pngdec;
|
ext/libpng/gstpngdec.*: Complete rewrite of pngdec. It's now very nice and handle push/pull based model. if you have ...
Original commit message from CVS:
2005-10-19 Julien MOUTTE <julien@moutte.net>
* ext/libpng/gstpngdec.c: (gst_pngdec_class_init),
(gst_pngdec_init), (user_error_fn), (user_warning_fn),
(user_info_callback), (user_endrow_callback),
(user_end_callback),
(user_read_data), (gst_pngdec_caps_create_and_set),
(gst_pngdec_task), (gst_pngdec_chain), (gst_pngdec_sink_event),
(gst_pngdec_libpng_clear), (gst_pngdec_libpng_init),
(gst_pngdec_change_state), (gst_pngdec_sink_activate_push),
(gst_pngdec_sink_activate_pull), (gst_pngdec_sink_activate):
* ext/libpng/gstpngdec.h: Complete rewrite of pngdec. It's now
very nice and handle push/pull based model. if you have filesrc
connected to it, it will do random access to load the png file.
If you have a network source that can't do _getrange, it does
progressive loading through the chain function.
* gst/alpha/gstalphacolor.c: (gst_alpha_color_transform_caps),
(transform_rgb), (transform_bgr): Fix caps negotiation correctly
thanks to Master Wim Taymans ;-)
2005-10-18 22:44:11 +00:00
|
|
|
GstBuffer *buffer = NULL;
|
|
|
|
size_t buffer_size = 0;
|
2005-10-25 10:47:09 +00:00
|
|
|
gint i = 0;
|
2004-07-16 10:56:31 +00:00
|
|
|
png_bytep *rows, inp;
|
2005-10-25 10:47:09 +00:00
|
|
|
png_uint_32 rowbytes;
|
ext/libpng/gstpngdec.*: Complete rewrite of pngdec. It's now very nice and handle push/pull based model. if you have ...
Original commit message from CVS:
2005-10-19 Julien MOUTTE <julien@moutte.net>
* ext/libpng/gstpngdec.c: (gst_pngdec_class_init),
(gst_pngdec_init), (user_error_fn), (user_warning_fn),
(user_info_callback), (user_endrow_callback),
(user_end_callback),
(user_read_data), (gst_pngdec_caps_create_and_set),
(gst_pngdec_task), (gst_pngdec_chain), (gst_pngdec_sink_event),
(gst_pngdec_libpng_clear), (gst_pngdec_libpng_init),
(gst_pngdec_change_state), (gst_pngdec_sink_activate_push),
(gst_pngdec_sink_activate_pull), (gst_pngdec_sink_activate):
* ext/libpng/gstpngdec.h: Complete rewrite of pngdec. It's now
very nice and handle push/pull based model. if you have filesrc
connected to it, it will do random access to load the png file.
If you have a network source that can't do _getrange, it does
progressive loading through the chain function.
* gst/alpha/gstalphacolor.c: (gst_alpha_color_transform_caps),
(transform_rgb), (transform_bgr): Fix caps negotiation correctly
thanks to Master Wim Taymans ;-)
2005-10-18 22:44:11 +00:00
|
|
|
GstFlowReturn ret = GST_FLOW_OK;
|
|
|
|
|
|
|
|
pngdec = GST_PNGDEC (GST_OBJECT_PARENT (pad));
|
|
|
|
|
2007-07-18 09:21:23 +00:00
|
|
|
GST_LOG_OBJECT (pngdec, "read frame");
|
|
|
|
|
ext/libpng/gstpngdec.*: Complete rewrite of pngdec. It's now very nice and handle push/pull based model. if you have ...
Original commit message from CVS:
2005-10-19 Julien MOUTTE <julien@moutte.net>
* ext/libpng/gstpngdec.c: (gst_pngdec_class_init),
(gst_pngdec_init), (user_error_fn), (user_warning_fn),
(user_info_callback), (user_endrow_callback),
(user_end_callback),
(user_read_data), (gst_pngdec_caps_create_and_set),
(gst_pngdec_task), (gst_pngdec_chain), (gst_pngdec_sink_event),
(gst_pngdec_libpng_clear), (gst_pngdec_libpng_init),
(gst_pngdec_change_state), (gst_pngdec_sink_activate_push),
(gst_pngdec_sink_activate_pull), (gst_pngdec_sink_activate):
* ext/libpng/gstpngdec.h: Complete rewrite of pngdec. It's now
very nice and handle push/pull based model. if you have filesrc
connected to it, it will do random access to load the png file.
If you have a network source that can't do _getrange, it does
progressive loading through the chain function.
* gst/alpha/gstalphacolor.c: (gst_alpha_color_transform_caps),
(transform_rgb), (transform_bgr): Fix caps negotiation correctly
thanks to Master Wim Taymans ;-)
2005-10-18 22:44:11 +00:00
|
|
|
/* Let libpng come back here on error */
|
|
|
|
if (setjmp (png_jmpbuf (pngdec->png))) {
|
|
|
|
ret = GST_FLOW_ERROR;
|
|
|
|
goto pause;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Set reading callback */
|
|
|
|
png_set_read_fn (pngdec->png, pngdec, user_read_data);
|
|
|
|
|
|
|
|
/* Read info */
|
|
|
|
png_read_info (pngdec->png, pngdec->info);
|
|
|
|
|
|
|
|
/* Generate the caps and configure */
|
|
|
|
ret = gst_pngdec_caps_create_and_set (pngdec);
|
|
|
|
if (ret != GST_FLOW_OK) {
|
|
|
|
goto pause;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Allocate output buffer */
|
|
|
|
rowbytes = png_get_rowbytes (pngdec->png, pngdec->info);
|
2009-05-27 16:06:34 +00:00
|
|
|
if (rowbytes > (G_MAXUINT32 - 3) || pngdec->height > G_MAXUINT32 / rowbytes) {
|
|
|
|
ret = GST_FLOW_ERROR;
|
|
|
|
goto pause;
|
|
|
|
}
|
|
|
|
rowbytes = GST_ROUND_UP_4 (rowbytes);
|
|
|
|
buffer_size = pngdec->height * rowbytes;
|
2005-12-05 13:03:00 +00:00
|
|
|
ret =
|
|
|
|
gst_pad_alloc_buffer_and_set_caps (pngdec->srcpad, GST_BUFFER_OFFSET_NONE,
|
ext/libpng/gstpngdec.*: Complete rewrite of pngdec. It's now very nice and handle push/pull based model. if you have ...
Original commit message from CVS:
2005-10-19 Julien MOUTTE <julien@moutte.net>
* ext/libpng/gstpngdec.c: (gst_pngdec_class_init),
(gst_pngdec_init), (user_error_fn), (user_warning_fn),
(user_info_callback), (user_endrow_callback),
(user_end_callback),
(user_read_data), (gst_pngdec_caps_create_and_set),
(gst_pngdec_task), (gst_pngdec_chain), (gst_pngdec_sink_event),
(gst_pngdec_libpng_clear), (gst_pngdec_libpng_init),
(gst_pngdec_change_state), (gst_pngdec_sink_activate_push),
(gst_pngdec_sink_activate_pull), (gst_pngdec_sink_activate):
* ext/libpng/gstpngdec.h: Complete rewrite of pngdec. It's now
very nice and handle push/pull based model. if you have filesrc
connected to it, it will do random access to load the png file.
If you have a network source that can't do _getrange, it does
progressive loading through the chain function.
* gst/alpha/gstalphacolor.c: (gst_alpha_color_transform_caps),
(transform_rgb), (transform_bgr): Fix caps negotiation correctly
thanks to Master Wim Taymans ;-)
2005-10-18 22:44:11 +00:00
|
|
|
buffer_size, GST_PAD_CAPS (pngdec->srcpad), &buffer);
|
2009-03-10 10:01:16 +00:00
|
|
|
if (ret != GST_FLOW_OK)
|
ext/libpng/gstpngdec.*: Complete rewrite of pngdec. It's now very nice and handle push/pull based model. if you have ...
Original commit message from CVS:
2005-10-19 Julien MOUTTE <julien@moutte.net>
* ext/libpng/gstpngdec.c: (gst_pngdec_class_init),
(gst_pngdec_init), (user_error_fn), (user_warning_fn),
(user_info_callback), (user_endrow_callback),
(user_end_callback),
(user_read_data), (gst_pngdec_caps_create_and_set),
(gst_pngdec_task), (gst_pngdec_chain), (gst_pngdec_sink_event),
(gst_pngdec_libpng_clear), (gst_pngdec_libpng_init),
(gst_pngdec_change_state), (gst_pngdec_sink_activate_push),
(gst_pngdec_sink_activate_pull), (gst_pngdec_sink_activate):
* ext/libpng/gstpngdec.h: Complete rewrite of pngdec. It's now
very nice and handle push/pull based model. if you have filesrc
connected to it, it will do random access to load the png file.
If you have a network source that can't do _getrange, it does
progressive loading through the chain function.
* gst/alpha/gstalphacolor.c: (gst_alpha_color_transform_caps),
(transform_rgb), (transform_bgr): Fix caps negotiation correctly
thanks to Master Wim Taymans ;-)
2005-10-18 22:44:11 +00:00
|
|
|
goto pause;
|
|
|
|
|
2005-10-25 10:47:09 +00:00
|
|
|
rows = (png_bytep *) g_malloc (sizeof (png_bytep) * pngdec->height);
|
ext/libpng/gstpngdec.*: Complete rewrite of pngdec. It's now very nice and handle push/pull based model. if you have ...
Original commit message from CVS:
2005-10-19 Julien MOUTTE <julien@moutte.net>
* ext/libpng/gstpngdec.c: (gst_pngdec_class_init),
(gst_pngdec_init), (user_error_fn), (user_warning_fn),
(user_info_callback), (user_endrow_callback),
(user_end_callback),
(user_read_data), (gst_pngdec_caps_create_and_set),
(gst_pngdec_task), (gst_pngdec_chain), (gst_pngdec_sink_event),
(gst_pngdec_libpng_clear), (gst_pngdec_libpng_init),
(gst_pngdec_change_state), (gst_pngdec_sink_activate_push),
(gst_pngdec_sink_activate_pull), (gst_pngdec_sink_activate):
* ext/libpng/gstpngdec.h: Complete rewrite of pngdec. It's now
very nice and handle push/pull based model. if you have filesrc
connected to it, it will do random access to load the png file.
If you have a network source that can't do _getrange, it does
progressive loading through the chain function.
* gst/alpha/gstalphacolor.c: (gst_alpha_color_transform_caps),
(transform_rgb), (transform_bgr): Fix caps negotiation correctly
thanks to Master Wim Taymans ;-)
2005-10-18 22:44:11 +00:00
|
|
|
|
|
|
|
inp = GST_BUFFER_DATA (buffer);
|
|
|
|
|
2005-10-25 10:47:09 +00:00
|
|
|
for (i = 0; i < pngdec->height; i++) {
|
ext/libpng/gstpngdec.*: Complete rewrite of pngdec. It's now very nice and handle push/pull based model. if you have ...
Original commit message from CVS:
2005-10-19 Julien MOUTTE <julien@moutte.net>
* ext/libpng/gstpngdec.c: (gst_pngdec_class_init),
(gst_pngdec_init), (user_error_fn), (user_warning_fn),
(user_info_callback), (user_endrow_callback),
(user_end_callback),
(user_read_data), (gst_pngdec_caps_create_and_set),
(gst_pngdec_task), (gst_pngdec_chain), (gst_pngdec_sink_event),
(gst_pngdec_libpng_clear), (gst_pngdec_libpng_init),
(gst_pngdec_change_state), (gst_pngdec_sink_activate_push),
(gst_pngdec_sink_activate_pull), (gst_pngdec_sink_activate):
* ext/libpng/gstpngdec.h: Complete rewrite of pngdec. It's now
very nice and handle push/pull based model. if you have filesrc
connected to it, it will do random access to load the png file.
If you have a network source that can't do _getrange, it does
progressive loading through the chain function.
* gst/alpha/gstalphacolor.c: (gst_alpha_color_transform_caps),
(transform_rgb), (transform_bgr): Fix caps negotiation correctly
thanks to Master Wim Taymans ;-)
2005-10-18 22:44:11 +00:00
|
|
|
rows[i] = inp;
|
2009-05-27 16:06:34 +00:00
|
|
|
inp += rowbytes;
|
ext/libpng/gstpngdec.*: Complete rewrite of pngdec. It's now very nice and handle push/pull based model. if you have ...
Original commit message from CVS:
2005-10-19 Julien MOUTTE <julien@moutte.net>
* ext/libpng/gstpngdec.c: (gst_pngdec_class_init),
(gst_pngdec_init), (user_error_fn), (user_warning_fn),
(user_info_callback), (user_endrow_callback),
(user_end_callback),
(user_read_data), (gst_pngdec_caps_create_and_set),
(gst_pngdec_task), (gst_pngdec_chain), (gst_pngdec_sink_event),
(gst_pngdec_libpng_clear), (gst_pngdec_libpng_init),
(gst_pngdec_change_state), (gst_pngdec_sink_activate_push),
(gst_pngdec_sink_activate_pull), (gst_pngdec_sink_activate):
* ext/libpng/gstpngdec.h: Complete rewrite of pngdec. It's now
very nice and handle push/pull based model. if you have filesrc
connected to it, it will do random access to load the png file.
If you have a network source that can't do _getrange, it does
progressive loading through the chain function.
* gst/alpha/gstalphacolor.c: (gst_alpha_color_transform_caps),
(transform_rgb), (transform_bgr): Fix caps negotiation correctly
thanks to Master Wim Taymans ;-)
2005-10-18 22:44:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Read the actual picture */
|
|
|
|
png_read_image (pngdec->png, rows);
|
2009-05-25 14:33:35 +00:00
|
|
|
g_free (rows);
|
ext/libpng/gstpngdec.*: Complete rewrite of pngdec. It's now very nice and handle push/pull based model. if you have ...
Original commit message from CVS:
2005-10-19 Julien MOUTTE <julien@moutte.net>
* ext/libpng/gstpngdec.c: (gst_pngdec_class_init),
(gst_pngdec_init), (user_error_fn), (user_warning_fn),
(user_info_callback), (user_endrow_callback),
(user_end_callback),
(user_read_data), (gst_pngdec_caps_create_and_set),
(gst_pngdec_task), (gst_pngdec_chain), (gst_pngdec_sink_event),
(gst_pngdec_libpng_clear), (gst_pngdec_libpng_init),
(gst_pngdec_change_state), (gst_pngdec_sink_activate_push),
(gst_pngdec_sink_activate_pull), (gst_pngdec_sink_activate):
* ext/libpng/gstpngdec.h: Complete rewrite of pngdec. It's now
very nice and handle push/pull based model. if you have filesrc
connected to it, it will do random access to load the png file.
If you have a network source that can't do _getrange, it does
progressive loading through the chain function.
* gst/alpha/gstalphacolor.c: (gst_alpha_color_transform_caps),
(transform_rgb), (transform_bgr): Fix caps negotiation correctly
thanks to Master Wim Taymans ;-)
2005-10-18 22:44:11 +00:00
|
|
|
|
|
|
|
/* Push the raw RGB frame */
|
|
|
|
ret = gst_pad_push (pngdec->srcpad, buffer);
|
2009-03-10 10:01:16 +00:00
|
|
|
if (ret != GST_FLOW_OK)
|
ext/libpng/gstpngdec.*: Complete rewrite of pngdec. It's now very nice and handle push/pull based model. if you have ...
Original commit message from CVS:
2005-10-19 Julien MOUTTE <julien@moutte.net>
* ext/libpng/gstpngdec.c: (gst_pngdec_class_init),
(gst_pngdec_init), (user_error_fn), (user_warning_fn),
(user_info_callback), (user_endrow_callback),
(user_end_callback),
(user_read_data), (gst_pngdec_caps_create_and_set),
(gst_pngdec_task), (gst_pngdec_chain), (gst_pngdec_sink_event),
(gst_pngdec_libpng_clear), (gst_pngdec_libpng_init),
(gst_pngdec_change_state), (gst_pngdec_sink_activate_push),
(gst_pngdec_sink_activate_pull), (gst_pngdec_sink_activate):
* ext/libpng/gstpngdec.h: Complete rewrite of pngdec. It's now
very nice and handle push/pull based model. if you have filesrc
connected to it, it will do random access to load the png file.
If you have a network source that can't do _getrange, it does
progressive loading through the chain function.
* gst/alpha/gstalphacolor.c: (gst_alpha_color_transform_caps),
(transform_rgb), (transform_bgr): Fix caps negotiation correctly
thanks to Master Wim Taymans ;-)
2005-10-18 22:44:11 +00:00
|
|
|
goto pause;
|
|
|
|
|
|
|
|
/* And we are done */
|
|
|
|
gst_pad_pause_task (pngdec->sinkpad);
|
|
|
|
gst_pad_push_event (pngdec->srcpad, gst_event_new_eos ());
|
|
|
|
return;
|
|
|
|
|
|
|
|
pause:
|
2009-03-10 10:01:16 +00:00
|
|
|
{
|
|
|
|
GST_INFO_OBJECT (pngdec, "pausing task, reason %s",
|
|
|
|
gst_flow_get_name (ret));
|
|
|
|
gst_pad_pause_task (pngdec->sinkpad);
|
2010-08-27 16:13:21 +00:00
|
|
|
if (ret == GST_FLOW_UNEXPECTED) {
|
|
|
|
gst_pad_push_event (pngdec->srcpad, gst_event_new_eos ());
|
|
|
|
} else if (ret == GST_FLOW_NOT_LINKED || ret < GST_FLOW_UNEXPECTED) {
|
2009-03-10 10:01:16 +00:00
|
|
|
GST_ELEMENT_ERROR (pngdec, STREAM, FAILED,
|
|
|
|
(_("Internal data stream error.")),
|
|
|
|
("stream stopped, reason %s", gst_flow_get_name (ret)));
|
|
|
|
gst_pad_push_event (pngdec->srcpad, gst_event_new_eos ());
|
|
|
|
}
|
ext/libpng/gstpngdec.*: Complete rewrite of pngdec. It's now very nice and handle push/pull based model. if you have ...
Original commit message from CVS:
2005-10-19 Julien MOUTTE <julien@moutte.net>
* ext/libpng/gstpngdec.c: (gst_pngdec_class_init),
(gst_pngdec_init), (user_error_fn), (user_warning_fn),
(user_info_callback), (user_endrow_callback),
(user_end_callback),
(user_read_data), (gst_pngdec_caps_create_and_set),
(gst_pngdec_task), (gst_pngdec_chain), (gst_pngdec_sink_event),
(gst_pngdec_libpng_clear), (gst_pngdec_libpng_init),
(gst_pngdec_change_state), (gst_pngdec_sink_activate_push),
(gst_pngdec_sink_activate_pull), (gst_pngdec_sink_activate):
* ext/libpng/gstpngdec.h: Complete rewrite of pngdec. It's now
very nice and handle push/pull based model. if you have filesrc
connected to it, it will do random access to load the png file.
If you have a network source that can't do _getrange, it does
progressive loading through the chain function.
* gst/alpha/gstalphacolor.c: (gst_alpha_color_transform_caps),
(transform_rgb), (transform_bgr): Fix caps negotiation correctly
thanks to Master Wim Taymans ;-)
2005-10-18 22:44:11 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static GstFlowReturn
|
|
|
|
gst_pngdec_chain (GstPad * pad, GstBuffer * buffer)
|
|
|
|
{
|
|
|
|
GstPngDec *pngdec;
|
|
|
|
GstFlowReturn ret = GST_FLOW_OK;
|
2004-07-16 10:56:31 +00:00
|
|
|
|
2006-07-17 10:22:54 +00:00
|
|
|
pngdec = GST_PNGDEC (gst_pad_get_parent (pad));
|
ext/libpng/gstpngdec.*: Complete rewrite of pngdec. It's now very nice and handle push/pull based model. if you have ...
Original commit message from CVS:
2005-10-19 Julien MOUTTE <julien@moutte.net>
* ext/libpng/gstpngdec.c: (gst_pngdec_class_init),
(gst_pngdec_init), (user_error_fn), (user_warning_fn),
(user_info_callback), (user_endrow_callback),
(user_end_callback),
(user_read_data), (gst_pngdec_caps_create_and_set),
(gst_pngdec_task), (gst_pngdec_chain), (gst_pngdec_sink_event),
(gst_pngdec_libpng_clear), (gst_pngdec_libpng_init),
(gst_pngdec_change_state), (gst_pngdec_sink_activate_push),
(gst_pngdec_sink_activate_pull), (gst_pngdec_sink_activate):
* ext/libpng/gstpngdec.h: Complete rewrite of pngdec. It's now
very nice and handle push/pull based model. if you have filesrc
connected to it, it will do random access to load the png file.
If you have a network source that can't do _getrange, it does
progressive loading through the chain function.
* gst/alpha/gstalphacolor.c: (gst_alpha_color_transform_caps),
(transform_rgb), (transform_bgr): Fix caps negotiation correctly
thanks to Master Wim Taymans ;-)
2005-10-18 22:44:11 +00:00
|
|
|
|
ext/libpng/gstpngdec.*: Handle more than one frame if the content is framed, like with png-in-quicktime (#331917).
Original commit message from CVS:
* ext/libpng/gstpngdec.c: (gst_pngdec_init),
(user_endrow_callback), (user_end_callback),
(gst_pngdec_caps_create_and_set), (gst_pngdec_chain),
(gst_pngdec_sink_setcaps), (gst_pngdec_sink_event),
(gst_pngdec_libpng_clear), (gst_pngdec_change_state):
* ext/libpng/gstpngdec.h:
Handle more than one frame if the content is framed,
like with png-in-quicktime (#331917).
2006-04-11 09:35:45 +00:00
|
|
|
GST_LOG_OBJECT (pngdec, "Got buffer, size=%u", GST_BUFFER_SIZE (buffer));
|
|
|
|
|
2006-07-17 10:22:54 +00:00
|
|
|
if (G_UNLIKELY (!pngdec->setup))
|
|
|
|
goto not_configured;
|
ext/libpng/gstpngdec.*: Complete rewrite of pngdec. It's now very nice and handle push/pull based model. if you have ...
Original commit message from CVS:
2005-10-19 Julien MOUTTE <julien@moutte.net>
* ext/libpng/gstpngdec.c: (gst_pngdec_class_init),
(gst_pngdec_init), (user_error_fn), (user_warning_fn),
(user_info_callback), (user_endrow_callback),
(user_end_callback),
(user_read_data), (gst_pngdec_caps_create_and_set),
(gst_pngdec_task), (gst_pngdec_chain), (gst_pngdec_sink_event),
(gst_pngdec_libpng_clear), (gst_pngdec_libpng_init),
(gst_pngdec_change_state), (gst_pngdec_sink_activate_push),
(gst_pngdec_sink_activate_pull), (gst_pngdec_sink_activate):
* ext/libpng/gstpngdec.h: Complete rewrite of pngdec. It's now
very nice and handle push/pull based model. if you have filesrc
connected to it, it will do random access to load the png file.
If you have a network source that can't do _getrange, it does
progressive loading through the chain function.
* gst/alpha/gstalphacolor.c: (gst_alpha_color_transform_caps),
(transform_rgb), (transform_bgr): Fix caps negotiation correctly
thanks to Master Wim Taymans ;-)
2005-10-18 22:44:11 +00:00
|
|
|
|
|
|
|
/* Something is going wrong in our callbacks */
|
2006-07-17 10:22:54 +00:00
|
|
|
ret = pngdec->ret;
|
|
|
|
if (G_UNLIKELY (ret != GST_FLOW_OK)) {
|
|
|
|
GST_WARNING_OBJECT (pngdec, "we have a pending return code of %d", ret);
|
ext/libpng/gstpngdec.*: Complete rewrite of pngdec. It's now very nice and handle push/pull based model. if you have ...
Original commit message from CVS:
2005-10-19 Julien MOUTTE <julien@moutte.net>
* ext/libpng/gstpngdec.c: (gst_pngdec_class_init),
(gst_pngdec_init), (user_error_fn), (user_warning_fn),
(user_info_callback), (user_endrow_callback),
(user_end_callback),
(user_read_data), (gst_pngdec_caps_create_and_set),
(gst_pngdec_task), (gst_pngdec_chain), (gst_pngdec_sink_event),
(gst_pngdec_libpng_clear), (gst_pngdec_libpng_init),
(gst_pngdec_change_state), (gst_pngdec_sink_activate_push),
(gst_pngdec_sink_activate_pull), (gst_pngdec_sink_activate):
* ext/libpng/gstpngdec.h: Complete rewrite of pngdec. It's now
very nice and handle push/pull based model. if you have filesrc
connected to it, it will do random access to load the png file.
If you have a network source that can't do _getrange, it does
progressive loading through the chain function.
* gst/alpha/gstalphacolor.c: (gst_alpha_color_transform_caps),
(transform_rgb), (transform_bgr): Fix caps negotiation correctly
thanks to Master Wim Taymans ;-)
2005-10-18 22:44:11 +00:00
|
|
|
goto beach;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Let libpng come back here on error */
|
|
|
|
if (setjmp (png_jmpbuf (pngdec->png))) {
|
2006-07-17 10:22:54 +00:00
|
|
|
GST_WARNING_OBJECT (pngdec, "error during decoding");
|
ext/libpng/gstpngdec.*: Complete rewrite of pngdec. It's now very nice and handle push/pull based model. if you have ...
Original commit message from CVS:
2005-10-19 Julien MOUTTE <julien@moutte.net>
* ext/libpng/gstpngdec.c: (gst_pngdec_class_init),
(gst_pngdec_init), (user_error_fn), (user_warning_fn),
(user_info_callback), (user_endrow_callback),
(user_end_callback),
(user_read_data), (gst_pngdec_caps_create_and_set),
(gst_pngdec_task), (gst_pngdec_chain), (gst_pngdec_sink_event),
(gst_pngdec_libpng_clear), (gst_pngdec_libpng_init),
(gst_pngdec_change_state), (gst_pngdec_sink_activate_push),
(gst_pngdec_sink_activate_pull), (gst_pngdec_sink_activate):
* ext/libpng/gstpngdec.h: Complete rewrite of pngdec. It's now
very nice and handle push/pull based model. if you have filesrc
connected to it, it will do random access to load the png file.
If you have a network source that can't do _getrange, it does
progressive loading through the chain function.
* gst/alpha/gstalphacolor.c: (gst_alpha_color_transform_caps),
(transform_rgb), (transform_bgr): Fix caps negotiation correctly
thanks to Master Wim Taymans ;-)
2005-10-18 22:44:11 +00:00
|
|
|
ret = GST_FLOW_ERROR;
|
2005-10-15 16:48:55 +00:00
|
|
|
goto beach;
|
2004-07-16 10:56:31 +00:00
|
|
|
}
|
|
|
|
|
ext/libpng/gstpngdec.*: Handle more than one frame if the content is framed, like with png-in-quicktime (#331917).
Original commit message from CVS:
* ext/libpng/gstpngdec.c: (gst_pngdec_init),
(user_endrow_callback), (user_end_callback),
(gst_pngdec_caps_create_and_set), (gst_pngdec_chain),
(gst_pngdec_sink_setcaps), (gst_pngdec_sink_event),
(gst_pngdec_libpng_clear), (gst_pngdec_change_state):
* ext/libpng/gstpngdec.h:
Handle more than one frame if the content is framed,
like with png-in-quicktime (#331917).
2006-04-11 09:35:45 +00:00
|
|
|
pngdec->in_timestamp = GST_BUFFER_TIMESTAMP (buffer);
|
|
|
|
pngdec->in_duration = GST_BUFFER_DURATION (buffer);
|
|
|
|
|
ext/libpng/gstpngdec.*: Complete rewrite of pngdec. It's now very nice and handle push/pull based model. if you have ...
Original commit message from CVS:
2005-10-19 Julien MOUTTE <julien@moutte.net>
* ext/libpng/gstpngdec.c: (gst_pngdec_class_init),
(gst_pngdec_init), (user_error_fn), (user_warning_fn),
(user_info_callback), (user_endrow_callback),
(user_end_callback),
(user_read_data), (gst_pngdec_caps_create_and_set),
(gst_pngdec_task), (gst_pngdec_chain), (gst_pngdec_sink_event),
(gst_pngdec_libpng_clear), (gst_pngdec_libpng_init),
(gst_pngdec_change_state), (gst_pngdec_sink_activate_push),
(gst_pngdec_sink_activate_pull), (gst_pngdec_sink_activate):
* ext/libpng/gstpngdec.h: Complete rewrite of pngdec. It's now
very nice and handle push/pull based model. if you have filesrc
connected to it, it will do random access to load the png file.
If you have a network source that can't do _getrange, it does
progressive loading through the chain function.
* gst/alpha/gstalphacolor.c: (gst_alpha_color_transform_caps),
(transform_rgb), (transform_bgr): Fix caps negotiation correctly
thanks to Master Wim Taymans ;-)
2005-10-18 22:44:11 +00:00
|
|
|
/* Progressive loading of the PNG image */
|
|
|
|
png_process_data (pngdec->png, pngdec->info, GST_BUFFER_DATA (buffer),
|
|
|
|
GST_BUFFER_SIZE (buffer));
|
2006-07-17 10:22:54 +00:00
|
|
|
|
2007-11-20 12:20:38 +00:00
|
|
|
if (pngdec->image_ready) {
|
|
|
|
if (pngdec->framed) {
|
|
|
|
/* Reset ourselves for the next frame */
|
|
|
|
gst_pngdec_libpng_clear (pngdec);
|
|
|
|
gst_pngdec_libpng_init (pngdec);
|
|
|
|
GST_LOG_OBJECT (pngdec, "setting up callbacks for next frame");
|
|
|
|
png_set_progressive_read_fn (pngdec->png, pngdec,
|
|
|
|
user_info_callback, user_endrow_callback, user_end_callback);
|
|
|
|
} else {
|
|
|
|
GST_LOG_OBJECT (pngdec, "sending EOS");
|
|
|
|
pngdec->ret = gst_pad_push_event (pngdec->srcpad, gst_event_new_eos ());
|
|
|
|
}
|
|
|
|
pngdec->image_ready = FALSE;
|
|
|
|
}
|
|
|
|
|
2006-07-17 10:22:54 +00:00
|
|
|
/* grab new return code */
|
2006-07-03 15:31:22 +00:00
|
|
|
ret = pngdec->ret;
|
ext/libpng/gstpngdec.*: Complete rewrite of pngdec. It's now very nice and handle push/pull based model. if you have ...
Original commit message from CVS:
2005-10-19 Julien MOUTTE <julien@moutte.net>
* ext/libpng/gstpngdec.c: (gst_pngdec_class_init),
(gst_pngdec_init), (user_error_fn), (user_warning_fn),
(user_info_callback), (user_endrow_callback),
(user_end_callback),
(user_read_data), (gst_pngdec_caps_create_and_set),
(gst_pngdec_task), (gst_pngdec_chain), (gst_pngdec_sink_event),
(gst_pngdec_libpng_clear), (gst_pngdec_libpng_init),
(gst_pngdec_change_state), (gst_pngdec_sink_activate_push),
(gst_pngdec_sink_activate_pull), (gst_pngdec_sink_activate):
* ext/libpng/gstpngdec.h: Complete rewrite of pngdec. It's now
very nice and handle push/pull based model. if you have filesrc
connected to it, it will do random access to load the png file.
If you have a network source that can't do _getrange, it does
progressive loading through the chain function.
* gst/alpha/gstalphacolor.c: (gst_alpha_color_transform_caps),
(transform_rgb), (transform_bgr): Fix caps negotiation correctly
thanks to Master Wim Taymans ;-)
2005-10-18 22:44:11 +00:00
|
|
|
|
|
|
|
/* And release the buffer */
|
|
|
|
gst_buffer_unref (buffer);
|
|
|
|
|
|
|
|
beach:
|
2006-07-17 10:22:54 +00:00
|
|
|
gst_object_unref (pngdec);
|
|
|
|
|
ext/libpng/gstpngdec.*: Complete rewrite of pngdec. It's now very nice and handle push/pull based model. if you have ...
Original commit message from CVS:
2005-10-19 Julien MOUTTE <julien@moutte.net>
* ext/libpng/gstpngdec.c: (gst_pngdec_class_init),
(gst_pngdec_init), (user_error_fn), (user_warning_fn),
(user_info_callback), (user_endrow_callback),
(user_end_callback),
(user_read_data), (gst_pngdec_caps_create_and_set),
(gst_pngdec_task), (gst_pngdec_chain), (gst_pngdec_sink_event),
(gst_pngdec_libpng_clear), (gst_pngdec_libpng_init),
(gst_pngdec_change_state), (gst_pngdec_sink_activate_push),
(gst_pngdec_sink_activate_pull), (gst_pngdec_sink_activate):
* ext/libpng/gstpngdec.h: Complete rewrite of pngdec. It's now
very nice and handle push/pull based model. if you have filesrc
connected to it, it will do random access to load the png file.
If you have a network source that can't do _getrange, it does
progressive loading through the chain function.
* gst/alpha/gstalphacolor.c: (gst_alpha_color_transform_caps),
(transform_rgb), (transform_bgr): Fix caps negotiation correctly
thanks to Master Wim Taymans ;-)
2005-10-18 22:44:11 +00:00
|
|
|
return ret;
|
2006-07-17 10:22:54 +00:00
|
|
|
|
|
|
|
/* ERRORS */
|
|
|
|
not_configured:
|
|
|
|
{
|
|
|
|
GST_LOG_OBJECT (pngdec, "we are not configured yet");
|
|
|
|
ret = GST_FLOW_WRONG_STATE;
|
|
|
|
goto beach;
|
|
|
|
}
|
ext/libpng/gstpngdec.*: Complete rewrite of pngdec. It's now very nice and handle push/pull based model. if you have ...
Original commit message from CVS:
2005-10-19 Julien MOUTTE <julien@moutte.net>
* ext/libpng/gstpngdec.c: (gst_pngdec_class_init),
(gst_pngdec_init), (user_error_fn), (user_warning_fn),
(user_info_callback), (user_endrow_callback),
(user_end_callback),
(user_read_data), (gst_pngdec_caps_create_and_set),
(gst_pngdec_task), (gst_pngdec_chain), (gst_pngdec_sink_event),
(gst_pngdec_libpng_clear), (gst_pngdec_libpng_init),
(gst_pngdec_change_state), (gst_pngdec_sink_activate_push),
(gst_pngdec_sink_activate_pull), (gst_pngdec_sink_activate):
* ext/libpng/gstpngdec.h: Complete rewrite of pngdec. It's now
very nice and handle push/pull based model. if you have filesrc
connected to it, it will do random access to load the png file.
If you have a network source that can't do _getrange, it does
progressive loading through the chain function.
* gst/alpha/gstalphacolor.c: (gst_alpha_color_transform_caps),
(transform_rgb), (transform_bgr): Fix caps negotiation correctly
thanks to Master Wim Taymans ;-)
2005-10-18 22:44:11 +00:00
|
|
|
}
|
|
|
|
|
ext/libpng/gstpngdec.*: Handle more than one frame if the content is framed, like with png-in-quicktime (#331917).
Original commit message from CVS:
* ext/libpng/gstpngdec.c: (gst_pngdec_init),
(user_endrow_callback), (user_end_callback),
(gst_pngdec_caps_create_and_set), (gst_pngdec_chain),
(gst_pngdec_sink_setcaps), (gst_pngdec_sink_event),
(gst_pngdec_libpng_clear), (gst_pngdec_change_state):
* ext/libpng/gstpngdec.h:
Handle more than one frame if the content is framed,
like with png-in-quicktime (#331917).
2006-04-11 09:35:45 +00:00
|
|
|
static gboolean
|
|
|
|
gst_pngdec_sink_setcaps (GstPad * pad, GstCaps * caps)
|
|
|
|
{
|
|
|
|
GstStructure *s;
|
|
|
|
GstPngDec *pngdec;
|
|
|
|
gint num, denom;
|
|
|
|
|
|
|
|
pngdec = GST_PNGDEC (gst_pad_get_parent (pad));
|
|
|
|
|
|
|
|
s = gst_caps_get_structure (caps, 0);
|
|
|
|
if (gst_structure_get_fraction (s, "framerate", &num, &denom)) {
|
|
|
|
GST_DEBUG_OBJECT (pngdec, "framed input");
|
|
|
|
pngdec->framed = TRUE;
|
|
|
|
pngdec->fps_n = num;
|
|
|
|
pngdec->fps_d = denom;
|
|
|
|
} else {
|
2007-07-18 09:21:23 +00:00
|
|
|
GST_DEBUG_OBJECT (pngdec, "single picture input");
|
ext/libpng/gstpngdec.*: Handle more than one frame if the content is framed, like with png-in-quicktime (#331917).
Original commit message from CVS:
* ext/libpng/gstpngdec.c: (gst_pngdec_init),
(user_endrow_callback), (user_end_callback),
(gst_pngdec_caps_create_and_set), (gst_pngdec_chain),
(gst_pngdec_sink_setcaps), (gst_pngdec_sink_event),
(gst_pngdec_libpng_clear), (gst_pngdec_change_state):
* ext/libpng/gstpngdec.h:
Handle more than one frame if the content is framed,
like with png-in-quicktime (#331917).
2006-04-11 09:35:45 +00:00
|
|
|
pngdec->framed = FALSE;
|
|
|
|
pngdec->fps_n = 0;
|
|
|
|
pngdec->fps_d = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
gst_object_unref (pngdec);
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
ext/libpng/gstpngdec.*: Complete rewrite of pngdec. It's now very nice and handle push/pull based model. if you have ...
Original commit message from CVS:
2005-10-19 Julien MOUTTE <julien@moutte.net>
* ext/libpng/gstpngdec.c: (gst_pngdec_class_init),
(gst_pngdec_init), (user_error_fn), (user_warning_fn),
(user_info_callback), (user_endrow_callback),
(user_end_callback),
(user_read_data), (gst_pngdec_caps_create_and_set),
(gst_pngdec_task), (gst_pngdec_chain), (gst_pngdec_sink_event),
(gst_pngdec_libpng_clear), (gst_pngdec_libpng_init),
(gst_pngdec_change_state), (gst_pngdec_sink_activate_push),
(gst_pngdec_sink_activate_pull), (gst_pngdec_sink_activate):
* ext/libpng/gstpngdec.h: Complete rewrite of pngdec. It's now
very nice and handle push/pull based model. if you have filesrc
connected to it, it will do random access to load the png file.
If you have a network source that can't do _getrange, it does
progressive loading through the chain function.
* gst/alpha/gstalphacolor.c: (gst_alpha_color_transform_caps),
(transform_rgb), (transform_bgr): Fix caps negotiation correctly
thanks to Master Wim Taymans ;-)
2005-10-18 22:44:11 +00:00
|
|
|
static gboolean
|
|
|
|
gst_pngdec_sink_event (GstPad * pad, GstEvent * event)
|
|
|
|
{
|
|
|
|
GstPngDec *pngdec;
|
ext/libpng/gstpngdec.*: Handle more than one frame if the content is framed, like with png-in-quicktime (#331917).
Original commit message from CVS:
* ext/libpng/gstpngdec.c: (gst_pngdec_init),
(user_endrow_callback), (user_end_callback),
(gst_pngdec_caps_create_and_set), (gst_pngdec_chain),
(gst_pngdec_sink_setcaps), (gst_pngdec_sink_event),
(gst_pngdec_libpng_clear), (gst_pngdec_change_state):
* ext/libpng/gstpngdec.h:
Handle more than one frame if the content is framed,
like with png-in-quicktime (#331917).
2006-04-11 09:35:45 +00:00
|
|
|
gboolean res;
|
ext/libpng/gstpngdec.*: Complete rewrite of pngdec. It's now very nice and handle push/pull based model. if you have ...
Original commit message from CVS:
2005-10-19 Julien MOUTTE <julien@moutte.net>
* ext/libpng/gstpngdec.c: (gst_pngdec_class_init),
(gst_pngdec_init), (user_error_fn), (user_warning_fn),
(user_info_callback), (user_endrow_callback),
(user_end_callback),
(user_read_data), (gst_pngdec_caps_create_and_set),
(gst_pngdec_task), (gst_pngdec_chain), (gst_pngdec_sink_event),
(gst_pngdec_libpng_clear), (gst_pngdec_libpng_init),
(gst_pngdec_change_state), (gst_pngdec_sink_activate_push),
(gst_pngdec_sink_activate_pull), (gst_pngdec_sink_activate):
* ext/libpng/gstpngdec.h: Complete rewrite of pngdec. It's now
very nice and handle push/pull based model. if you have filesrc
connected to it, it will do random access to load the png file.
If you have a network source that can't do _getrange, it does
progressive loading through the chain function.
* gst/alpha/gstalphacolor.c: (gst_alpha_color_transform_caps),
(transform_rgb), (transform_bgr): Fix caps negotiation correctly
thanks to Master Wim Taymans ;-)
2005-10-18 22:44:11 +00:00
|
|
|
|
ext/libpng/gstpngdec.*: Handle more than one frame if the content is framed, like with png-in-quicktime (#331917).
Original commit message from CVS:
* ext/libpng/gstpngdec.c: (gst_pngdec_init),
(user_endrow_callback), (user_end_callback),
(gst_pngdec_caps_create_and_set), (gst_pngdec_chain),
(gst_pngdec_sink_setcaps), (gst_pngdec_sink_event),
(gst_pngdec_libpng_clear), (gst_pngdec_change_state):
* ext/libpng/gstpngdec.h:
Handle more than one frame if the content is framed,
like with png-in-quicktime (#331917).
2006-04-11 09:35:45 +00:00
|
|
|
pngdec = GST_PNGDEC (gst_pad_get_parent (pad));
|
ext/libpng/gstpngdec.*: Complete rewrite of pngdec. It's now very nice and handle push/pull based model. if you have ...
Original commit message from CVS:
2005-10-19 Julien MOUTTE <julien@moutte.net>
* ext/libpng/gstpngdec.c: (gst_pngdec_class_init),
(gst_pngdec_init), (user_error_fn), (user_warning_fn),
(user_info_callback), (user_endrow_callback),
(user_end_callback),
(user_read_data), (gst_pngdec_caps_create_and_set),
(gst_pngdec_task), (gst_pngdec_chain), (gst_pngdec_sink_event),
(gst_pngdec_libpng_clear), (gst_pngdec_libpng_init),
(gst_pngdec_change_state), (gst_pngdec_sink_activate_push),
(gst_pngdec_sink_activate_pull), (gst_pngdec_sink_activate):
* ext/libpng/gstpngdec.h: Complete rewrite of pngdec. It's now
very nice and handle push/pull based model. if you have filesrc
connected to it, it will do random access to load the png file.
If you have a network source that can't do _getrange, it does
progressive loading through the chain function.
* gst/alpha/gstalphacolor.c: (gst_alpha_color_transform_caps),
(transform_rgb), (transform_bgr): Fix caps negotiation correctly
thanks to Master Wim Taymans ;-)
2005-10-18 22:44:11 +00:00
|
|
|
|
|
|
|
switch (GST_EVENT_TYPE (event)) {
|
ext/libpng/gstpngdec.*: Handle more than one frame if the content is framed, like with png-in-quicktime (#331917).
Original commit message from CVS:
* ext/libpng/gstpngdec.c: (gst_pngdec_init),
(user_endrow_callback), (user_end_callback),
(gst_pngdec_caps_create_and_set), (gst_pngdec_chain),
(gst_pngdec_sink_setcaps), (gst_pngdec_sink_event),
(gst_pngdec_libpng_clear), (gst_pngdec_change_state):
* ext/libpng/gstpngdec.h:
Handle more than one frame if the content is framed,
like with png-in-quicktime (#331917).
2006-04-11 09:35:45 +00:00
|
|
|
case GST_EVENT_NEWSEGMENT:{
|
2006-07-17 10:22:54 +00:00
|
|
|
gdouble rate, arate;
|
2006-07-03 15:31:22 +00:00
|
|
|
gboolean update;
|
|
|
|
gint64 start, stop, position;
|
ext/libpng/gstpngdec.*: Handle more than one frame if the content is framed, like with png-in-quicktime (#331917).
Original commit message from CVS:
* ext/libpng/gstpngdec.c: (gst_pngdec_init),
(user_endrow_callback), (user_end_callback),
(gst_pngdec_caps_create_and_set), (gst_pngdec_chain),
(gst_pngdec_sink_setcaps), (gst_pngdec_sink_event),
(gst_pngdec_libpng_clear), (gst_pngdec_change_state):
* ext/libpng/gstpngdec.h:
Handle more than one frame if the content is framed,
like with png-in-quicktime (#331917).
2006-04-11 09:35:45 +00:00
|
|
|
GstFormat fmt;
|
|
|
|
|
2006-07-17 10:22:54 +00:00
|
|
|
gst_event_parse_new_segment_full (event, &update, &rate, &arate, &fmt,
|
|
|
|
&start, &stop, &position);
|
|
|
|
|
|
|
|
gst_segment_set_newsegment_full (&pngdec->segment, update, rate, arate,
|
|
|
|
fmt, start, stop, position);
|
|
|
|
|
ext/libpng/gstpngdec.*: Handle more than one frame if the content is framed, like with png-in-quicktime (#331917).
Original commit message from CVS:
* ext/libpng/gstpngdec.c: (gst_pngdec_init),
(user_endrow_callback), (user_end_callback),
(gst_pngdec_caps_create_and_set), (gst_pngdec_chain),
(gst_pngdec_sink_setcaps), (gst_pngdec_sink_event),
(gst_pngdec_libpng_clear), (gst_pngdec_change_state):
* ext/libpng/gstpngdec.h:
Handle more than one frame if the content is framed,
like with png-in-quicktime (#331917).
2006-04-11 09:35:45 +00:00
|
|
|
GST_LOG_OBJECT (pngdec, "NEWSEGMENT (%s)", gst_format_get_name (fmt));
|
2006-07-17 10:22:54 +00:00
|
|
|
|
ext/libpng/gstpngdec.*: Handle more than one frame if the content is framed, like with png-in-quicktime (#331917).
Original commit message from CVS:
* ext/libpng/gstpngdec.c: (gst_pngdec_init),
(user_endrow_callback), (user_end_callback),
(gst_pngdec_caps_create_and_set), (gst_pngdec_chain),
(gst_pngdec_sink_setcaps), (gst_pngdec_sink_event),
(gst_pngdec_libpng_clear), (gst_pngdec_change_state):
* ext/libpng/gstpngdec.h:
Handle more than one frame if the content is framed,
like with png-in-quicktime (#331917).
2006-04-11 09:35:45 +00:00
|
|
|
if (fmt == GST_FORMAT_TIME) {
|
|
|
|
pngdec->need_newsegment = FALSE;
|
2006-07-17 10:22:54 +00:00
|
|
|
res = gst_pad_push_event (pngdec->srcpad, event);
|
ext/libpng/gstpngdec.*: Handle more than one frame if the content is framed, like with png-in-quicktime (#331917).
Original commit message from CVS:
* ext/libpng/gstpngdec.c: (gst_pngdec_init),
(user_endrow_callback), (user_end_callback),
(gst_pngdec_caps_create_and_set), (gst_pngdec_chain),
(gst_pngdec_sink_setcaps), (gst_pngdec_sink_event),
(gst_pngdec_libpng_clear), (gst_pngdec_change_state):
* ext/libpng/gstpngdec.h:
Handle more than one frame if the content is framed,
like with png-in-quicktime (#331917).
2006-04-11 09:35:45 +00:00
|
|
|
} else {
|
|
|
|
gst_event_unref (event);
|
|
|
|
res = TRUE;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
2006-07-03 15:31:22 +00:00
|
|
|
case GST_EVENT_FLUSH_STOP:
|
2006-07-17 10:22:54 +00:00
|
|
|
{
|
|
|
|
gst_pngdec_libpng_clear (pngdec);
|
2006-07-03 15:31:22 +00:00
|
|
|
gst_pngdec_libpng_init (pngdec);
|
2006-07-17 10:22:54 +00:00
|
|
|
png_set_progressive_read_fn (pngdec->png, pngdec,
|
|
|
|
user_info_callback, user_endrow_callback, user_end_callback);
|
|
|
|
pngdec->ret = GST_FLOW_OK;
|
|
|
|
gst_segment_init (&pngdec->segment, GST_FORMAT_UNDEFINED);
|
|
|
|
res = gst_pad_push_event (pngdec->srcpad, event);
|
2006-07-03 15:31:22 +00:00
|
|
|
break;
|
2006-07-17 10:22:54 +00:00
|
|
|
}
|
ext/libpng/gstpngdec.*: Complete rewrite of pngdec. It's now very nice and handle push/pull based model. if you have ...
Original commit message from CVS:
2005-10-19 Julien MOUTTE <julien@moutte.net>
* ext/libpng/gstpngdec.c: (gst_pngdec_class_init),
(gst_pngdec_init), (user_error_fn), (user_warning_fn),
(user_info_callback), (user_endrow_callback),
(user_end_callback),
(user_read_data), (gst_pngdec_caps_create_and_set),
(gst_pngdec_task), (gst_pngdec_chain), (gst_pngdec_sink_event),
(gst_pngdec_libpng_clear), (gst_pngdec_libpng_init),
(gst_pngdec_change_state), (gst_pngdec_sink_activate_push),
(gst_pngdec_sink_activate_pull), (gst_pngdec_sink_activate):
* ext/libpng/gstpngdec.h: Complete rewrite of pngdec. It's now
very nice and handle push/pull based model. if you have filesrc
connected to it, it will do random access to load the png file.
If you have a network source that can't do _getrange, it does
progressive loading through the chain function.
* gst/alpha/gstalphacolor.c: (gst_alpha_color_transform_caps),
(transform_rgb), (transform_bgr): Fix caps negotiation correctly
thanks to Master Wim Taymans ;-)
2005-10-18 22:44:11 +00:00
|
|
|
case GST_EVENT_EOS:
|
2006-07-17 10:22:54 +00:00
|
|
|
{
|
ext/libpng/gstpngdec.*: Handle more than one frame if the content is framed, like with png-in-quicktime (#331917).
Original commit message from CVS:
* ext/libpng/gstpngdec.c: (gst_pngdec_init),
(user_endrow_callback), (user_end_callback),
(gst_pngdec_caps_create_and_set), (gst_pngdec_chain),
(gst_pngdec_sink_setcaps), (gst_pngdec_sink_event),
(gst_pngdec_libpng_clear), (gst_pngdec_change_state):
* ext/libpng/gstpngdec.h:
Handle more than one frame if the content is framed,
like with png-in-quicktime (#331917).
2006-04-11 09:35:45 +00:00
|
|
|
GST_LOG_OBJECT (pngdec, "EOS");
|
ext/libpng/gstpngdec.*: Complete rewrite of pngdec. It's now very nice and handle push/pull based model. if you have ...
Original commit message from CVS:
2005-10-19 Julien MOUTTE <julien@moutte.net>
* ext/libpng/gstpngdec.c: (gst_pngdec_class_init),
(gst_pngdec_init), (user_error_fn), (user_warning_fn),
(user_info_callback), (user_endrow_callback),
(user_end_callback),
(user_read_data), (gst_pngdec_caps_create_and_set),
(gst_pngdec_task), (gst_pngdec_chain), (gst_pngdec_sink_event),
(gst_pngdec_libpng_clear), (gst_pngdec_libpng_init),
(gst_pngdec_change_state), (gst_pngdec_sink_activate_push),
(gst_pngdec_sink_activate_pull), (gst_pngdec_sink_activate):
* ext/libpng/gstpngdec.h: Complete rewrite of pngdec. It's now
very nice and handle push/pull based model. if you have filesrc
connected to it, it will do random access to load the png file.
If you have a network source that can't do _getrange, it does
progressive loading through the chain function.
* gst/alpha/gstalphacolor.c: (gst_alpha_color_transform_caps),
(transform_rgb), (transform_bgr): Fix caps negotiation correctly
thanks to Master Wim Taymans ;-)
2005-10-18 22:44:11 +00:00
|
|
|
gst_pngdec_libpng_clear (pngdec);
|
2006-07-17 10:22:54 +00:00
|
|
|
pngdec->ret = GST_FLOW_UNEXPECTED;
|
|
|
|
res = gst_pad_push_event (pngdec->srcpad, event);
|
ext/libpng/gstpngdec.*: Handle more than one frame if the content is framed, like with png-in-quicktime (#331917).
Original commit message from CVS:
* ext/libpng/gstpngdec.c: (gst_pngdec_init),
(user_endrow_callback), (user_end_callback),
(gst_pngdec_caps_create_and_set), (gst_pngdec_chain),
(gst_pngdec_sink_setcaps), (gst_pngdec_sink_event),
(gst_pngdec_libpng_clear), (gst_pngdec_change_state):
* ext/libpng/gstpngdec.h:
Handle more than one frame if the content is framed,
like with png-in-quicktime (#331917).
2006-04-11 09:35:45 +00:00
|
|
|
break;
|
2006-07-17 10:22:54 +00:00
|
|
|
}
|
ext/libpng/gstpngdec.*: Complete rewrite of pngdec. It's now very nice and handle push/pull based model. if you have ...
Original commit message from CVS:
2005-10-19 Julien MOUTTE <julien@moutte.net>
* ext/libpng/gstpngdec.c: (gst_pngdec_class_init),
(gst_pngdec_init), (user_error_fn), (user_warning_fn),
(user_info_callback), (user_endrow_callback),
(user_end_callback),
(user_read_data), (gst_pngdec_caps_create_and_set),
(gst_pngdec_task), (gst_pngdec_chain), (gst_pngdec_sink_event),
(gst_pngdec_libpng_clear), (gst_pngdec_libpng_init),
(gst_pngdec_change_state), (gst_pngdec_sink_activate_push),
(gst_pngdec_sink_activate_pull), (gst_pngdec_sink_activate):
* ext/libpng/gstpngdec.h: Complete rewrite of pngdec. It's now
very nice and handle push/pull based model. if you have filesrc
connected to it, it will do random access to load the png file.
If you have a network source that can't do _getrange, it does
progressive loading through the chain function.
* gst/alpha/gstalphacolor.c: (gst_alpha_color_transform_caps),
(transform_rgb), (transform_bgr): Fix caps negotiation correctly
thanks to Master Wim Taymans ;-)
2005-10-18 22:44:11 +00:00
|
|
|
default:
|
2006-07-17 10:22:54 +00:00
|
|
|
res = gst_pad_push_event (pngdec->srcpad, event);
|
ext/libpng/gstpngdec.*: Handle more than one frame if the content is framed, like with png-in-quicktime (#331917).
Original commit message from CVS:
* ext/libpng/gstpngdec.c: (gst_pngdec_init),
(user_endrow_callback), (user_end_callback),
(gst_pngdec_caps_create_and_set), (gst_pngdec_chain),
(gst_pngdec_sink_setcaps), (gst_pngdec_sink_event),
(gst_pngdec_libpng_clear), (gst_pngdec_change_state):
* ext/libpng/gstpngdec.h:
Handle more than one frame if the content is framed,
like with png-in-quicktime (#331917).
2006-04-11 09:35:45 +00:00
|
|
|
break;
|
ext/libpng/gstpngdec.*: Complete rewrite of pngdec. It's now very nice and handle push/pull based model. if you have ...
Original commit message from CVS:
2005-10-19 Julien MOUTTE <julien@moutte.net>
* ext/libpng/gstpngdec.c: (gst_pngdec_class_init),
(gst_pngdec_init), (user_error_fn), (user_warning_fn),
(user_info_callback), (user_endrow_callback),
(user_end_callback),
(user_read_data), (gst_pngdec_caps_create_and_set),
(gst_pngdec_task), (gst_pngdec_chain), (gst_pngdec_sink_event),
(gst_pngdec_libpng_clear), (gst_pngdec_libpng_init),
(gst_pngdec_change_state), (gst_pngdec_sink_activate_push),
(gst_pngdec_sink_activate_pull), (gst_pngdec_sink_activate):
* ext/libpng/gstpngdec.h: Complete rewrite of pngdec. It's now
very nice and handle push/pull based model. if you have filesrc
connected to it, it will do random access to load the png file.
If you have a network source that can't do _getrange, it does
progressive loading through the chain function.
* gst/alpha/gstalphacolor.c: (gst_alpha_color_transform_caps),
(transform_rgb), (transform_bgr): Fix caps negotiation correctly
thanks to Master Wim Taymans ;-)
2005-10-18 22:44:11 +00:00
|
|
|
}
|
ext/libpng/gstpngdec.*: Handle more than one frame if the content is framed, like with png-in-quicktime (#331917).
Original commit message from CVS:
* ext/libpng/gstpngdec.c: (gst_pngdec_init),
(user_endrow_callback), (user_end_callback),
(gst_pngdec_caps_create_and_set), (gst_pngdec_chain),
(gst_pngdec_sink_setcaps), (gst_pngdec_sink_event),
(gst_pngdec_libpng_clear), (gst_pngdec_change_state):
* ext/libpng/gstpngdec.h:
Handle more than one frame if the content is framed,
like with png-in-quicktime (#331917).
2006-04-11 09:35:45 +00:00
|
|
|
|
|
|
|
gst_object_unref (pngdec);
|
|
|
|
return res;
|
ext/libpng/gstpngdec.*: Complete rewrite of pngdec. It's now very nice and handle push/pull based model. if you have ...
Original commit message from CVS:
2005-10-19 Julien MOUTTE <julien@moutte.net>
* ext/libpng/gstpngdec.c: (gst_pngdec_class_init),
(gst_pngdec_init), (user_error_fn), (user_warning_fn),
(user_info_callback), (user_endrow_callback),
(user_end_callback),
(user_read_data), (gst_pngdec_caps_create_and_set),
(gst_pngdec_task), (gst_pngdec_chain), (gst_pngdec_sink_event),
(gst_pngdec_libpng_clear), (gst_pngdec_libpng_init),
(gst_pngdec_change_state), (gst_pngdec_sink_activate_push),
(gst_pngdec_sink_activate_pull), (gst_pngdec_sink_activate):
* ext/libpng/gstpngdec.h: Complete rewrite of pngdec. It's now
very nice and handle push/pull based model. if you have filesrc
connected to it, it will do random access to load the png file.
If you have a network source that can't do _getrange, it does
progressive loading through the chain function.
* gst/alpha/gstalphacolor.c: (gst_alpha_color_transform_caps),
(transform_rgb), (transform_bgr): Fix caps negotiation correctly
thanks to Master Wim Taymans ;-)
2005-10-18 22:44:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* Clean up the libpng structures */
|
|
|
|
static gboolean
|
|
|
|
gst_pngdec_libpng_clear (GstPngDec * pngdec)
|
|
|
|
{
|
|
|
|
png_infopp info = NULL, endinfo = NULL;
|
|
|
|
|
|
|
|
g_return_val_if_fail (GST_IS_PNGDEC (pngdec), FALSE);
|
|
|
|
|
|
|
|
GST_LOG ("cleaning up libpng structures");
|
|
|
|
|
|
|
|
if (pngdec->info) {
|
|
|
|
info = &pngdec->info;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (pngdec->endinfo) {
|
|
|
|
endinfo = &pngdec->endinfo;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (pngdec->png) {
|
|
|
|
png_destroy_read_struct (&(pngdec->png), info, endinfo);
|
|
|
|
pngdec->png = NULL;
|
|
|
|
pngdec->info = NULL;
|
|
|
|
pngdec->endinfo = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
pngdec->bpp = pngdec->color_type = pngdec->height = pngdec->width = -1;
|
2004-07-16 10:56:31 +00:00
|
|
|
pngdec->offset = 0;
|
ext/libpng/gstpngdec.*: Complete rewrite of pngdec. It's now very nice and handle push/pull based model. if you have ...
Original commit message from CVS:
2005-10-19 Julien MOUTTE <julien@moutte.net>
* ext/libpng/gstpngdec.c: (gst_pngdec_class_init),
(gst_pngdec_init), (user_error_fn), (user_warning_fn),
(user_info_callback), (user_endrow_callback),
(user_end_callback),
(user_read_data), (gst_pngdec_caps_create_and_set),
(gst_pngdec_task), (gst_pngdec_chain), (gst_pngdec_sink_event),
(gst_pngdec_libpng_clear), (gst_pngdec_libpng_init),
(gst_pngdec_change_state), (gst_pngdec_sink_activate_push),
(gst_pngdec_sink_activate_pull), (gst_pngdec_sink_activate):
* ext/libpng/gstpngdec.h: Complete rewrite of pngdec. It's now
very nice and handle push/pull based model. if you have filesrc
connected to it, it will do random access to load the png file.
If you have a network source that can't do _getrange, it does
progressive loading through the chain function.
* gst/alpha/gstalphacolor.c: (gst_alpha_color_transform_caps),
(transform_rgb), (transform_bgr): Fix caps negotiation correctly
thanks to Master Wim Taymans ;-)
2005-10-18 22:44:11 +00:00
|
|
|
pngdec->rowbytes = 0;
|
|
|
|
pngdec->buffer_out = NULL;
|
|
|
|
|
|
|
|
pngdec->setup = FALSE;
|
|
|
|
|
ext/libpng/gstpngdec.*: Handle more than one frame if the content is framed, like with png-in-quicktime (#331917).
Original commit message from CVS:
* ext/libpng/gstpngdec.c: (gst_pngdec_init),
(user_endrow_callback), (user_end_callback),
(gst_pngdec_caps_create_and_set), (gst_pngdec_chain),
(gst_pngdec_sink_setcaps), (gst_pngdec_sink_event),
(gst_pngdec_libpng_clear), (gst_pngdec_change_state):
* ext/libpng/gstpngdec.h:
Handle more than one frame if the content is framed,
like with png-in-quicktime (#331917).
2006-04-11 09:35:45 +00:00
|
|
|
pngdec->in_timestamp = GST_CLOCK_TIME_NONE;
|
|
|
|
pngdec->in_duration = GST_CLOCK_TIME_NONE;
|
|
|
|
|
ext/libpng/gstpngdec.*: Complete rewrite of pngdec. It's now very nice and handle push/pull based model. if you have ...
Original commit message from CVS:
2005-10-19 Julien MOUTTE <julien@moutte.net>
* ext/libpng/gstpngdec.c: (gst_pngdec_class_init),
(gst_pngdec_init), (user_error_fn), (user_warning_fn),
(user_info_callback), (user_endrow_callback),
(user_end_callback),
(user_read_data), (gst_pngdec_caps_create_and_set),
(gst_pngdec_task), (gst_pngdec_chain), (gst_pngdec_sink_event),
(gst_pngdec_libpng_clear), (gst_pngdec_libpng_init),
(gst_pngdec_change_state), (gst_pngdec_sink_activate_push),
(gst_pngdec_sink_activate_pull), (gst_pngdec_sink_activate):
* ext/libpng/gstpngdec.h: Complete rewrite of pngdec. It's now
very nice and handle push/pull based model. if you have filesrc
connected to it, it will do random access to load the png file.
If you have a network source that can't do _getrange, it does
progressive loading through the chain function.
* gst/alpha/gstalphacolor.c: (gst_alpha_color_transform_caps),
(transform_rgb), (transform_bgr): Fix caps negotiation correctly
thanks to Master Wim Taymans ;-)
2005-10-18 22:44:11 +00:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
gst_pngdec_libpng_init (GstPngDec * pngdec)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (GST_IS_PNGDEC (pngdec), FALSE);
|
|
|
|
|
2006-07-17 10:22:54 +00:00
|
|
|
if (pngdec->setup)
|
|
|
|
return TRUE;
|
|
|
|
|
|
|
|
GST_LOG ("init libpng structures");
|
2004-07-16 10:56:31 +00:00
|
|
|
|
|
|
|
/* initialize png struct stuff */
|
|
|
|
pngdec->png = png_create_read_struct (PNG_LIBPNG_VER_STRING,
|
|
|
|
(png_voidp) NULL, user_error_fn, user_warning_fn);
|
|
|
|
|
2006-07-17 10:22:54 +00:00
|
|
|
if (pngdec->png == NULL)
|
|
|
|
goto init_failed;
|
|
|
|
|
|
|
|
pngdec->info = png_create_info_struct (pngdec->png);
|
|
|
|
if (pngdec->info == NULL)
|
|
|
|
goto info_failed;
|
|
|
|
|
|
|
|
pngdec->endinfo = png_create_info_struct (pngdec->png);
|
|
|
|
if (pngdec->endinfo == NULL)
|
|
|
|
goto endinfo_failed;
|
|
|
|
|
|
|
|
pngdec->setup = TRUE;
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
|
|
|
|
/* ERRORS */
|
|
|
|
init_failed:
|
|
|
|
{
|
2005-01-09 01:40:14 +00:00
|
|
|
GST_ELEMENT_ERROR (pngdec, LIBRARY, INIT, (NULL),
|
|
|
|
("Failed to initialize png structure"));
|
2006-07-17 10:22:54 +00:00
|
|
|
return FALSE;
|
2004-07-16 10:56:31 +00:00
|
|
|
}
|
2006-07-17 10:22:54 +00:00
|
|
|
info_failed:
|
|
|
|
{
|
ext/libpng/gstpngdec.*: Complete rewrite of pngdec. It's now very nice and handle push/pull based model. if you have ...
Original commit message from CVS:
2005-10-19 Julien MOUTTE <julien@moutte.net>
* ext/libpng/gstpngdec.c: (gst_pngdec_class_init),
(gst_pngdec_init), (user_error_fn), (user_warning_fn),
(user_info_callback), (user_endrow_callback),
(user_end_callback),
(user_read_data), (gst_pngdec_caps_create_and_set),
(gst_pngdec_task), (gst_pngdec_chain), (gst_pngdec_sink_event),
(gst_pngdec_libpng_clear), (gst_pngdec_libpng_init),
(gst_pngdec_change_state), (gst_pngdec_sink_activate_push),
(gst_pngdec_sink_activate_pull), (gst_pngdec_sink_activate):
* ext/libpng/gstpngdec.h: Complete rewrite of pngdec. It's now
very nice and handle push/pull based model. if you have filesrc
connected to it, it will do random access to load the png file.
If you have a network source that can't do _getrange, it does
progressive loading through the chain function.
* gst/alpha/gstalphacolor.c: (gst_alpha_color_transform_caps),
(transform_rgb), (transform_bgr): Fix caps negotiation correctly
thanks to Master Wim Taymans ;-)
2005-10-18 22:44:11 +00:00
|
|
|
gst_pngdec_libpng_clear (pngdec);
|
2005-01-09 01:40:14 +00:00
|
|
|
GST_ELEMENT_ERROR (pngdec, LIBRARY, INIT, (NULL),
|
|
|
|
("Failed to initialize info structure"));
|
2006-07-17 10:22:54 +00:00
|
|
|
return FALSE;
|
2004-07-16 10:56:31 +00:00
|
|
|
}
|
2006-07-17 10:22:54 +00:00
|
|
|
endinfo_failed:
|
|
|
|
{
|
ext/libpng/gstpngdec.*: Complete rewrite of pngdec. It's now very nice and handle push/pull based model. if you have ...
Original commit message from CVS:
2005-10-19 Julien MOUTTE <julien@moutte.net>
* ext/libpng/gstpngdec.c: (gst_pngdec_class_init),
(gst_pngdec_init), (user_error_fn), (user_warning_fn),
(user_info_callback), (user_endrow_callback),
(user_end_callback),
(user_read_data), (gst_pngdec_caps_create_and_set),
(gst_pngdec_task), (gst_pngdec_chain), (gst_pngdec_sink_event),
(gst_pngdec_libpng_clear), (gst_pngdec_libpng_init),
(gst_pngdec_change_state), (gst_pngdec_sink_activate_push),
(gst_pngdec_sink_activate_pull), (gst_pngdec_sink_activate):
* ext/libpng/gstpngdec.h: Complete rewrite of pngdec. It's now
very nice and handle push/pull based model. if you have filesrc
connected to it, it will do random access to load the png file.
If you have a network source that can't do _getrange, it does
progressive loading through the chain function.
* gst/alpha/gstalphacolor.c: (gst_alpha_color_transform_caps),
(transform_rgb), (transform_bgr): Fix caps negotiation correctly
thanks to Master Wim Taymans ;-)
2005-10-18 22:44:11 +00:00
|
|
|
gst_pngdec_libpng_clear (pngdec);
|
2005-01-09 01:40:14 +00:00
|
|
|
GST_ELEMENT_ERROR (pngdec, LIBRARY, INIT, (NULL),
|
|
|
|
("Failed to initialize endinfo structure"));
|
2006-07-17 10:22:54 +00:00
|
|
|
return FALSE;
|
2004-07-16 10:56:31 +00:00
|
|
|
}
|
ext/libpng/gstpngdec.*: Complete rewrite of pngdec. It's now very nice and handle push/pull based model. if you have ...
Original commit message from CVS:
2005-10-19 Julien MOUTTE <julien@moutte.net>
* ext/libpng/gstpngdec.c: (gst_pngdec_class_init),
(gst_pngdec_init), (user_error_fn), (user_warning_fn),
(user_info_callback), (user_endrow_callback),
(user_end_callback),
(user_read_data), (gst_pngdec_caps_create_and_set),
(gst_pngdec_task), (gst_pngdec_chain), (gst_pngdec_sink_event),
(gst_pngdec_libpng_clear), (gst_pngdec_libpng_init),
(gst_pngdec_change_state), (gst_pngdec_sink_activate_push),
(gst_pngdec_sink_activate_pull), (gst_pngdec_sink_activate):
* ext/libpng/gstpngdec.h: Complete rewrite of pngdec. It's now
very nice and handle push/pull based model. if you have filesrc
connected to it, it will do random access to load the png file.
If you have a network source that can't do _getrange, it does
progressive loading through the chain function.
* gst/alpha/gstalphacolor.c: (gst_alpha_color_transform_caps),
(transform_rgb), (transform_bgr): Fix caps negotiation correctly
thanks to Master Wim Taymans ;-)
2005-10-18 22:44:11 +00:00
|
|
|
}
|
2004-07-16 10:56:31 +00:00
|
|
|
|
ext/libpng/gstpngdec.*: Complete rewrite of pngdec. It's now very nice and handle push/pull based model. if you have ...
Original commit message from CVS:
2005-10-19 Julien MOUTTE <julien@moutte.net>
* ext/libpng/gstpngdec.c: (gst_pngdec_class_init),
(gst_pngdec_init), (user_error_fn), (user_warning_fn),
(user_info_callback), (user_endrow_callback),
(user_end_callback),
(user_read_data), (gst_pngdec_caps_create_and_set),
(gst_pngdec_task), (gst_pngdec_chain), (gst_pngdec_sink_event),
(gst_pngdec_libpng_clear), (gst_pngdec_libpng_init),
(gst_pngdec_change_state), (gst_pngdec_sink_activate_push),
(gst_pngdec_sink_activate_pull), (gst_pngdec_sink_activate):
* ext/libpng/gstpngdec.h: Complete rewrite of pngdec. It's now
very nice and handle push/pull based model. if you have filesrc
connected to it, it will do random access to load the png file.
If you have a network source that can't do _getrange, it does
progressive loading through the chain function.
* gst/alpha/gstalphacolor.c: (gst_alpha_color_transform_caps),
(transform_rgb), (transform_bgr): Fix caps negotiation correctly
thanks to Master Wim Taymans ;-)
2005-10-18 22:44:11 +00:00
|
|
|
static GstStateChangeReturn
|
|
|
|
gst_pngdec_change_state (GstElement * element, GstStateChange transition)
|
|
|
|
{
|
2006-03-23 19:57:34 +00:00
|
|
|
GstStateChangeReturn ret;
|
|
|
|
GstPngDec *pngdec;
|
ext/libpng/gstpngdec.*: Complete rewrite of pngdec. It's now very nice and handle push/pull based model. if you have ...
Original commit message from CVS:
2005-10-19 Julien MOUTTE <julien@moutte.net>
* ext/libpng/gstpngdec.c: (gst_pngdec_class_init),
(gst_pngdec_init), (user_error_fn), (user_warning_fn),
(user_info_callback), (user_endrow_callback),
(user_end_callback),
(user_read_data), (gst_pngdec_caps_create_and_set),
(gst_pngdec_task), (gst_pngdec_chain), (gst_pngdec_sink_event),
(gst_pngdec_libpng_clear), (gst_pngdec_libpng_init),
(gst_pngdec_change_state), (gst_pngdec_sink_activate_push),
(gst_pngdec_sink_activate_pull), (gst_pngdec_sink_activate):
* ext/libpng/gstpngdec.h: Complete rewrite of pngdec. It's now
very nice and handle push/pull based model. if you have filesrc
connected to it, it will do random access to load the png file.
If you have a network source that can't do _getrange, it does
progressive loading through the chain function.
* gst/alpha/gstalphacolor.c: (gst_alpha_color_transform_caps),
(transform_rgb), (transform_bgr): Fix caps negotiation correctly
thanks to Master Wim Taymans ;-)
2005-10-18 22:44:11 +00:00
|
|
|
|
|
|
|
pngdec = GST_PNGDEC (element);
|
|
|
|
|
|
|
|
switch (transition) {
|
|
|
|
case GST_STATE_CHANGE_READY_TO_PAUSED:
|
|
|
|
gst_pngdec_libpng_init (pngdec);
|
ext/libpng/gstpngdec.*: Handle more than one frame if the content is framed, like with png-in-quicktime (#331917).
Original commit message from CVS:
* ext/libpng/gstpngdec.c: (gst_pngdec_init),
(user_endrow_callback), (user_end_callback),
(gst_pngdec_caps_create_and_set), (gst_pngdec_chain),
(gst_pngdec_sink_setcaps), (gst_pngdec_sink_event),
(gst_pngdec_libpng_clear), (gst_pngdec_change_state):
* ext/libpng/gstpngdec.h:
Handle more than one frame if the content is framed,
like with png-in-quicktime (#331917).
2006-04-11 09:35:45 +00:00
|
|
|
pngdec->need_newsegment = TRUE;
|
|
|
|
pngdec->framed = FALSE;
|
2006-07-17 10:22:54 +00:00
|
|
|
pngdec->ret = GST_FLOW_OK;
|
|
|
|
gst_segment_init (&pngdec->segment, GST_FORMAT_UNDEFINED);
|
ext/libpng/gstpngdec.*: Complete rewrite of pngdec. It's now very nice and handle push/pull based model. if you have ...
Original commit message from CVS:
2005-10-19 Julien MOUTTE <julien@moutte.net>
* ext/libpng/gstpngdec.c: (gst_pngdec_class_init),
(gst_pngdec_init), (user_error_fn), (user_warning_fn),
(user_info_callback), (user_endrow_callback),
(user_end_callback),
(user_read_data), (gst_pngdec_caps_create_and_set),
(gst_pngdec_task), (gst_pngdec_chain), (gst_pngdec_sink_event),
(gst_pngdec_libpng_clear), (gst_pngdec_libpng_init),
(gst_pngdec_change_state), (gst_pngdec_sink_activate_push),
(gst_pngdec_sink_activate_pull), (gst_pngdec_sink_activate):
* ext/libpng/gstpngdec.h: Complete rewrite of pngdec. It's now
very nice and handle push/pull based model. if you have filesrc
connected to it, it will do random access to load the png file.
If you have a network source that can't do _getrange, it does
progressive loading through the chain function.
* gst/alpha/gstalphacolor.c: (gst_alpha_color_transform_caps),
(transform_rgb), (transform_bgr): Fix caps negotiation correctly
thanks to Master Wim Taymans ;-)
2005-10-18 22:44:11 +00:00
|
|
|
break;
|
2006-03-23 19:57:34 +00:00
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
ret = parent_class->change_state (element, transition);
|
|
|
|
if (ret != GST_STATE_CHANGE_SUCCESS)
|
|
|
|
return ret;
|
|
|
|
|
|
|
|
switch (transition) {
|
ext/libpng/gstpngdec.*: Complete rewrite of pngdec. It's now very nice and handle push/pull based model. if you have ...
Original commit message from CVS:
2005-10-19 Julien MOUTTE <julien@moutte.net>
* ext/libpng/gstpngdec.c: (gst_pngdec_class_init),
(gst_pngdec_init), (user_error_fn), (user_warning_fn),
(user_info_callback), (user_endrow_callback),
(user_end_callback),
(user_read_data), (gst_pngdec_caps_create_and_set),
(gst_pngdec_task), (gst_pngdec_chain), (gst_pngdec_sink_event),
(gst_pngdec_libpng_clear), (gst_pngdec_libpng_init),
(gst_pngdec_change_state), (gst_pngdec_sink_activate_push),
(gst_pngdec_sink_activate_pull), (gst_pngdec_sink_activate):
* ext/libpng/gstpngdec.h: Complete rewrite of pngdec. It's now
very nice and handle push/pull based model. if you have filesrc
connected to it, it will do random access to load the png file.
If you have a network source that can't do _getrange, it does
progressive loading through the chain function.
* gst/alpha/gstalphacolor.c: (gst_alpha_color_transform_caps),
(transform_rgb), (transform_bgr): Fix caps negotiation correctly
thanks to Master Wim Taymans ;-)
2005-10-18 22:44:11 +00:00
|
|
|
case GST_STATE_CHANGE_PAUSED_TO_READY:
|
|
|
|
gst_pngdec_libpng_clear (pngdec);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
2005-02-08 11:11:21 +00:00
|
|
|
}
|
|
|
|
|
ext/libpng/gstpngdec.*: Complete rewrite of pngdec. It's now very nice and handle push/pull based model. if you have ...
Original commit message from CVS:
2005-10-19 Julien MOUTTE <julien@moutte.net>
* ext/libpng/gstpngdec.c: (gst_pngdec_class_init),
(gst_pngdec_init), (user_error_fn), (user_warning_fn),
(user_info_callback), (user_endrow_callback),
(user_end_callback),
(user_read_data), (gst_pngdec_caps_create_and_set),
(gst_pngdec_task), (gst_pngdec_chain), (gst_pngdec_sink_event),
(gst_pngdec_libpng_clear), (gst_pngdec_libpng_init),
(gst_pngdec_change_state), (gst_pngdec_sink_activate_push),
(gst_pngdec_sink_activate_pull), (gst_pngdec_sink_activate):
* ext/libpng/gstpngdec.h: Complete rewrite of pngdec. It's now
very nice and handle push/pull based model. if you have filesrc
connected to it, it will do random access to load the png file.
If you have a network source that can't do _getrange, it does
progressive loading through the chain function.
* gst/alpha/gstalphacolor.c: (gst_alpha_color_transform_caps),
(transform_rgb), (transform_bgr): Fix caps negotiation correctly
thanks to Master Wim Taymans ;-)
2005-10-18 22:44:11 +00:00
|
|
|
return ret;
|
|
|
|
}
|
2005-10-15 16:48:55 +00:00
|
|
|
|
ext/libpng/gstpngdec.*: Complete rewrite of pngdec. It's now very nice and handle push/pull based model. if you have ...
Original commit message from CVS:
2005-10-19 Julien MOUTTE <julien@moutte.net>
* ext/libpng/gstpngdec.c: (gst_pngdec_class_init),
(gst_pngdec_init), (user_error_fn), (user_warning_fn),
(user_info_callback), (user_endrow_callback),
(user_end_callback),
(user_read_data), (gst_pngdec_caps_create_and_set),
(gst_pngdec_task), (gst_pngdec_chain), (gst_pngdec_sink_event),
(gst_pngdec_libpng_clear), (gst_pngdec_libpng_init),
(gst_pngdec_change_state), (gst_pngdec_sink_activate_push),
(gst_pngdec_sink_activate_pull), (gst_pngdec_sink_activate):
* ext/libpng/gstpngdec.h: Complete rewrite of pngdec. It's now
very nice and handle push/pull based model. if you have filesrc
connected to it, it will do random access to load the png file.
If you have a network source that can't do _getrange, it does
progressive loading through the chain function.
* gst/alpha/gstalphacolor.c: (gst_alpha_color_transform_caps),
(transform_rgb), (transform_bgr): Fix caps negotiation correctly
thanks to Master Wim Taymans ;-)
2005-10-18 22:44:11 +00:00
|
|
|
/* this function gets called when we activate ourselves in push mode. */
|
|
|
|
static gboolean
|
|
|
|
gst_pngdec_sink_activate_push (GstPad * sinkpad, gboolean active)
|
|
|
|
{
|
|
|
|
GstPngDec *pngdec;
|
2004-07-16 10:56:31 +00:00
|
|
|
|
ext/libpng/gstpngdec.*: Complete rewrite of pngdec. It's now very nice and handle push/pull based model. if you have ...
Original commit message from CVS:
2005-10-19 Julien MOUTTE <julien@moutte.net>
* ext/libpng/gstpngdec.c: (gst_pngdec_class_init),
(gst_pngdec_init), (user_error_fn), (user_warning_fn),
(user_info_callback), (user_endrow_callback),
(user_end_callback),
(user_read_data), (gst_pngdec_caps_create_and_set),
(gst_pngdec_task), (gst_pngdec_chain), (gst_pngdec_sink_event),
(gst_pngdec_libpng_clear), (gst_pngdec_libpng_init),
(gst_pngdec_change_state), (gst_pngdec_sink_activate_push),
(gst_pngdec_sink_activate_pull), (gst_pngdec_sink_activate):
* ext/libpng/gstpngdec.h: Complete rewrite of pngdec. It's now
very nice and handle push/pull based model. if you have filesrc
connected to it, it will do random access to load the png file.
If you have a network source that can't do _getrange, it does
progressive loading through the chain function.
* gst/alpha/gstalphacolor.c: (gst_alpha_color_transform_caps),
(transform_rgb), (transform_bgr): Fix caps negotiation correctly
thanks to Master Wim Taymans ;-)
2005-10-18 22:44:11 +00:00
|
|
|
pngdec = GST_PNGDEC (GST_OBJECT_PARENT (sinkpad));
|
2004-07-16 10:56:31 +00:00
|
|
|
|
ext/libpng/gstpngdec.*: Complete rewrite of pngdec. It's now very nice and handle push/pull based model. if you have ...
Original commit message from CVS:
2005-10-19 Julien MOUTTE <julien@moutte.net>
* ext/libpng/gstpngdec.c: (gst_pngdec_class_init),
(gst_pngdec_init), (user_error_fn), (user_warning_fn),
(user_info_callback), (user_endrow_callback),
(user_end_callback),
(user_read_data), (gst_pngdec_caps_create_and_set),
(gst_pngdec_task), (gst_pngdec_chain), (gst_pngdec_sink_event),
(gst_pngdec_libpng_clear), (gst_pngdec_libpng_init),
(gst_pngdec_change_state), (gst_pngdec_sink_activate_push),
(gst_pngdec_sink_activate_pull), (gst_pngdec_sink_activate):
* ext/libpng/gstpngdec.h: Complete rewrite of pngdec. It's now
very nice and handle push/pull based model. if you have filesrc
connected to it, it will do random access to load the png file.
If you have a network source that can't do _getrange, it does
progressive loading through the chain function.
* gst/alpha/gstalphacolor.c: (gst_alpha_color_transform_caps),
(transform_rgb), (transform_bgr): Fix caps negotiation correctly
thanks to Master Wim Taymans ;-)
2005-10-18 22:44:11 +00:00
|
|
|
pngdec->ret = GST_FLOW_OK;
|
2005-10-15 16:48:55 +00:00
|
|
|
|
ext/libpng/gstpngdec.*: Complete rewrite of pngdec. It's now very nice and handle push/pull based model. if you have ...
Original commit message from CVS:
2005-10-19 Julien MOUTTE <julien@moutte.net>
* ext/libpng/gstpngdec.c: (gst_pngdec_class_init),
(gst_pngdec_init), (user_error_fn), (user_warning_fn),
(user_info_callback), (user_endrow_callback),
(user_end_callback),
(user_read_data), (gst_pngdec_caps_create_and_set),
(gst_pngdec_task), (gst_pngdec_chain), (gst_pngdec_sink_event),
(gst_pngdec_libpng_clear), (gst_pngdec_libpng_init),
(gst_pngdec_change_state), (gst_pngdec_sink_activate_push),
(gst_pngdec_sink_activate_pull), (gst_pngdec_sink_activate):
* ext/libpng/gstpngdec.h: Complete rewrite of pngdec. It's now
very nice and handle push/pull based model. if you have filesrc
connected to it, it will do random access to load the png file.
If you have a network source that can't do _getrange, it does
progressive loading through the chain function.
* gst/alpha/gstalphacolor.c: (gst_alpha_color_transform_caps),
(transform_rgb), (transform_bgr): Fix caps negotiation correctly
thanks to Master Wim Taymans ;-)
2005-10-18 22:44:11 +00:00
|
|
|
if (active) {
|
|
|
|
/* Let libpng come back here on error */
|
2006-07-17 10:22:54 +00:00
|
|
|
if (setjmp (png_jmpbuf (pngdec->png)))
|
|
|
|
goto setup_failed;
|
2004-07-16 10:56:31 +00:00
|
|
|
|
ext/libpng/gstpngdec.*: Complete rewrite of pngdec. It's now very nice and handle push/pull based model. if you have ...
Original commit message from CVS:
2005-10-19 Julien MOUTTE <julien@moutte.net>
* ext/libpng/gstpngdec.c: (gst_pngdec_class_init),
(gst_pngdec_init), (user_error_fn), (user_warning_fn),
(user_info_callback), (user_endrow_callback),
(user_end_callback),
(user_read_data), (gst_pngdec_caps_create_and_set),
(gst_pngdec_task), (gst_pngdec_chain), (gst_pngdec_sink_event),
(gst_pngdec_libpng_clear), (gst_pngdec_libpng_init),
(gst_pngdec_change_state), (gst_pngdec_sink_activate_push),
(gst_pngdec_sink_activate_pull), (gst_pngdec_sink_activate):
* ext/libpng/gstpngdec.h: Complete rewrite of pngdec. It's now
very nice and handle push/pull based model. if you have filesrc
connected to it, it will do random access to load the png file.
If you have a network source that can't do _getrange, it does
progressive loading through the chain function.
* gst/alpha/gstalphacolor.c: (gst_alpha_color_transform_caps),
(transform_rgb), (transform_bgr): Fix caps negotiation correctly
thanks to Master Wim Taymans ;-)
2005-10-18 22:44:11 +00:00
|
|
|
GST_LOG ("setting up progressive loading callbacks");
|
|
|
|
png_set_progressive_read_fn (pngdec->png, pngdec,
|
|
|
|
user_info_callback, user_endrow_callback, user_end_callback);
|
2004-07-16 10:56:31 +00:00
|
|
|
}
|
ext/libpng/gstpngdec.*: Complete rewrite of pngdec. It's now very nice and handle push/pull based model. if you have ...
Original commit message from CVS:
2005-10-19 Julien MOUTTE <julien@moutte.net>
* ext/libpng/gstpngdec.c: (gst_pngdec_class_init),
(gst_pngdec_init), (user_error_fn), (user_warning_fn),
(user_info_callback), (user_endrow_callback),
(user_end_callback),
(user_read_data), (gst_pngdec_caps_create_and_set),
(gst_pngdec_task), (gst_pngdec_chain), (gst_pngdec_sink_event),
(gst_pngdec_libpng_clear), (gst_pngdec_libpng_init),
(gst_pngdec_change_state), (gst_pngdec_sink_activate_push),
(gst_pngdec_sink_activate_pull), (gst_pngdec_sink_activate):
* ext/libpng/gstpngdec.h: Complete rewrite of pngdec. It's now
very nice and handle push/pull based model. if you have filesrc
connected to it, it will do random access to load the png file.
If you have a network source that can't do _getrange, it does
progressive loading through the chain function.
* gst/alpha/gstalphacolor.c: (gst_alpha_color_transform_caps),
(transform_rgb), (transform_bgr): Fix caps negotiation correctly
thanks to Master Wim Taymans ;-)
2005-10-18 22:44:11 +00:00
|
|
|
return TRUE;
|
2006-07-17 10:22:54 +00:00
|
|
|
|
|
|
|
setup_failed:
|
|
|
|
{
|
|
|
|
GST_LOG ("failed setting up libpng jmpbuf");
|
|
|
|
gst_pngdec_libpng_clear (pngdec);
|
|
|
|
return FALSE;
|
|
|
|
}
|
ext/libpng/gstpngdec.*: Complete rewrite of pngdec. It's now very nice and handle push/pull based model. if you have ...
Original commit message from CVS:
2005-10-19 Julien MOUTTE <julien@moutte.net>
* ext/libpng/gstpngdec.c: (gst_pngdec_class_init),
(gst_pngdec_init), (user_error_fn), (user_warning_fn),
(user_info_callback), (user_endrow_callback),
(user_end_callback),
(user_read_data), (gst_pngdec_caps_create_and_set),
(gst_pngdec_task), (gst_pngdec_chain), (gst_pngdec_sink_event),
(gst_pngdec_libpng_clear), (gst_pngdec_libpng_init),
(gst_pngdec_change_state), (gst_pngdec_sink_activate_push),
(gst_pngdec_sink_activate_pull), (gst_pngdec_sink_activate):
* ext/libpng/gstpngdec.h: Complete rewrite of pngdec. It's now
very nice and handle push/pull based model. if you have filesrc
connected to it, it will do random access to load the png file.
If you have a network source that can't do _getrange, it does
progressive loading through the chain function.
* gst/alpha/gstalphacolor.c: (gst_alpha_color_transform_caps),
(transform_rgb), (transform_bgr): Fix caps negotiation correctly
thanks to Master Wim Taymans ;-)
2005-10-18 22:44:11 +00:00
|
|
|
}
|
2004-07-16 10:56:31 +00:00
|
|
|
|
ext/libpng/gstpngdec.*: Complete rewrite of pngdec. It's now very nice and handle push/pull based model. if you have ...
Original commit message from CVS:
2005-10-19 Julien MOUTTE <julien@moutte.net>
* ext/libpng/gstpngdec.c: (gst_pngdec_class_init),
(gst_pngdec_init), (user_error_fn), (user_warning_fn),
(user_info_callback), (user_endrow_callback),
(user_end_callback),
(user_read_data), (gst_pngdec_caps_create_and_set),
(gst_pngdec_task), (gst_pngdec_chain), (gst_pngdec_sink_event),
(gst_pngdec_libpng_clear), (gst_pngdec_libpng_init),
(gst_pngdec_change_state), (gst_pngdec_sink_activate_push),
(gst_pngdec_sink_activate_pull), (gst_pngdec_sink_activate):
* ext/libpng/gstpngdec.h: Complete rewrite of pngdec. It's now
very nice and handle push/pull based model. if you have filesrc
connected to it, it will do random access to load the png file.
If you have a network source that can't do _getrange, it does
progressive loading through the chain function.
* gst/alpha/gstalphacolor.c: (gst_alpha_color_transform_caps),
(transform_rgb), (transform_bgr): Fix caps negotiation correctly
thanks to Master Wim Taymans ;-)
2005-10-18 22:44:11 +00:00
|
|
|
/* this function gets called when we activate ourselves in pull mode.
|
|
|
|
* We can perform random access to the resource and we start a task
|
|
|
|
* to start reading */
|
|
|
|
static gboolean
|
|
|
|
gst_pngdec_sink_activate_pull (GstPad * sinkpad, gboolean active)
|
|
|
|
{
|
|
|
|
if (active) {
|
|
|
|
return gst_pad_start_task (sinkpad, (GstTaskFunction) gst_pngdec_task,
|
|
|
|
sinkpad);
|
|
|
|
} else {
|
|
|
|
return gst_pad_stop_task (sinkpad);
|
|
|
|
}
|
|
|
|
}
|
2005-10-15 16:48:55 +00:00
|
|
|
|
ext/libpng/gstpngdec.*: Complete rewrite of pngdec. It's now very nice and handle push/pull based model. if you have ...
Original commit message from CVS:
2005-10-19 Julien MOUTTE <julien@moutte.net>
* ext/libpng/gstpngdec.c: (gst_pngdec_class_init),
(gst_pngdec_init), (user_error_fn), (user_warning_fn),
(user_info_callback), (user_endrow_callback),
(user_end_callback),
(user_read_data), (gst_pngdec_caps_create_and_set),
(gst_pngdec_task), (gst_pngdec_chain), (gst_pngdec_sink_event),
(gst_pngdec_libpng_clear), (gst_pngdec_libpng_init),
(gst_pngdec_change_state), (gst_pngdec_sink_activate_push),
(gst_pngdec_sink_activate_pull), (gst_pngdec_sink_activate):
* ext/libpng/gstpngdec.h: Complete rewrite of pngdec. It's now
very nice and handle push/pull based model. if you have filesrc
connected to it, it will do random access to load the png file.
If you have a network source that can't do _getrange, it does
progressive loading through the chain function.
* gst/alpha/gstalphacolor.c: (gst_alpha_color_transform_caps),
(transform_rgb), (transform_bgr): Fix caps negotiation correctly
thanks to Master Wim Taymans ;-)
2005-10-18 22:44:11 +00:00
|
|
|
/* this function is called when the pad is activated and should start
|
|
|
|
* processing data.
|
|
|
|
*
|
|
|
|
* We check if we can do random access to decide if we work push or
|
|
|
|
* pull based.
|
|
|
|
*/
|
|
|
|
static gboolean
|
|
|
|
gst_pngdec_sink_activate (GstPad * sinkpad)
|
|
|
|
{
|
|
|
|
if (gst_pad_check_pull_range (sinkpad)) {
|
|
|
|
return gst_pad_activate_pull (sinkpad, TRUE);
|
|
|
|
} else {
|
|
|
|
return gst_pad_activate_push (sinkpad, TRUE);
|
|
|
|
}
|
2004-07-16 10:56:31 +00:00
|
|
|
}
|