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.
This commit is contained in:
Stefan Kost 2007-11-20 12:20:38 +00:00
parent 696e4b0236
commit dfdc0fa8c9
3 changed files with 25 additions and 12 deletions

View file

@ -1,3 +1,9 @@
2007-11-20 Stefan Kost <ensonic@users.sf.net>
* ext/libpng/gstpngdec.c:
* ext/libpng/gstpngdec.h:
Don't release the png-memory from within the callback.
2007-11-20 Stefan Kost <ensonic@users.sf.net>
Patch by: René Stadler <mail at renestadler dot de>

View file

@ -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;

View file

@ -69,6 +69,7 @@ struct _GstPngDec
GstClockTime in_duration;
GstSegment segment;
gboolean image_ready;
};
struct _GstPngDecClass