summaryrefslogtreecommitdiffstats
path: root/ext/libpng
diff options
context:
space:
mode:
authorStefan Kost <ensonic@users.sourceforge.net>2007-11-20 12:20:38 +0000
committerStefan Kost <ensonic@users.sourceforge.net>2007-11-20 12:20:38 +0000
commitdfdc0fa8c9ee0dce74fa4b353209356baea620c8 (patch)
tree8620862700824ae67d65d5030a799fe479616b85 /ext/libpng
parent696e4b02363c07971a0d914a5620606b04c2d53f (diff)
ext/libpng/gstpngdec.*: Don't release the png-memory from within the callback.
Original commit message from CVS: * ext/libpng/gstpngdec.c: * ext/libpng/gstpngdec.h: Don't release the png-memory from within the callback.
Diffstat (limited to 'ext/libpng')
-rw-r--r--ext/libpng/gstpngdec.c30
-rw-r--r--ext/libpng/gstpngdec.h1
2 files changed, 19 insertions, 12 deletions
diff --git a/ext/libpng/gstpngdec.c b/ext/libpng/gstpngdec.c
index 6d939756..f6655ebd 100644
--- a/ext/libpng/gstpngdec.c
+++ b/ext/libpng/gstpngdec.c
@@ -168,6 +168,8 @@ gst_pngdec_init (GstPngDec * pngdec)
pngdec->in_duration = GST_CLOCK_TIME_NONE;
gst_segment_init (&pngdec->segment, GST_FORMAT_UNDEFINED);
+
+ pngdec->image_ready = FALSE;
}
static void
@@ -292,18 +294,7 @@ user_end_callback (png_structp png_ptr, png_infop info)
gst_buffer_unref (pngdec->buffer_out);
}
pngdec->buffer_out = NULL;
-
- 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 = TRUE;
}
static void
@@ -564,6 +555,21 @@ gst_pngdec_chain (GstPad * pad, GstBuffer * buffer)
png_process_data (pngdec->png, pngdec->info, GST_BUFFER_DATA (buffer),
GST_BUFFER_SIZE (buffer));
+ 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;
+ }
+
/* grab new return code */
ret = pngdec->ret;
diff --git a/ext/libpng/gstpngdec.h b/ext/libpng/gstpngdec.h
index f7c4675a..439b2939 100644
--- a/ext/libpng/gstpngdec.h
+++ b/ext/libpng/gstpngdec.h
@@ -69,6 +69,7 @@ struct _GstPngDec
GstClockTime in_duration;
GstSegment segment;
+ gboolean image_ready;
};
struct _GstPngDecClass