From 7cc1cf7dbba5bdab0475c97dc7aeb2e036c77980 Mon Sep 17 00:00:00 2001 From: Tim-Philipp Müller Date: Mon, 8 Aug 2005 12:13:08 +0000 Subject: Port jpegdec to 0.9; handles 'progressive loading' now, ie. input does no longer need to be one single buffer. Original commit message from CVS: * configure.ac: * ext/Makefile.am: * ext/jpeg/Makefile.am: * ext/jpeg/gstjpeg.c: (plugin_init): * ext/jpeg/gstjpegdec.c: (gst_jpeg_dec_get_type), (gst_jpeg_dec_finalize), (gst_jpeg_dec_base_init), (gst_jpeg_dec_class_init), (gst_jpeg_dec_fill_input_buffer), (gst_jpeg_dec_init_source), (gst_jpeg_dec_skip_input_data), (gst_jpeg_dec_resync_to_restart), (gst_jpeg_dec_term_source), (gst_jpeg_dec_my_output_message), (gst_jpeg_dec_my_emit_message), (gst_jpeg_dec_my_error_exit), (gst_jpeg_dec_init), (is_jpeg_start_marker), (is_jpeg_end_marker), (gst_jpeg_dec_find_jpeg_header), (gst_jpeg_dec_ensure_header), (gst_jpeg_dec_have_end_marker), (gst_jpeg_dec_parse_tag_has_entropy_segment), (gst_jpeg_dec_parse_image_data), (gst_jpeg_dec_chain), (gst_jpeg_dec_change_state): * ext/jpeg/gstjpegdec.h: Port jpegdec to 0.9; handles 'progressive loading' now, ie. input does no longer need to be one single buffer. --- ext/jpeg/gstjpegdec.h | 86 ++++++++++++++++++++++++++++----------------------- 1 file changed, 47 insertions(+), 39 deletions(-) (limited to 'ext/jpeg/gstjpegdec.h') diff --git a/ext/jpeg/gstjpegdec.h b/ext/jpeg/gstjpegdec.h index 05187873..d52efcf8 100644 --- a/ext/jpeg/gstjpegdec.h +++ b/ext/jpeg/gstjpegdec.h @@ -18,73 +18,81 @@ */ -#ifndef __GST_JPEGDEC_H__ -#define __GST_JPEGDEC_H__ +#ifndef __GST_JPEG_DEC_H__ +#define __GST_JPEG_DEC_H__ -#include +#include +#include + /* this is a hack hack hack to get around jpeglib header bugs... */ #ifdef HAVE_STDLIB_H # undef HAVE_STDLIB_H #endif #include -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - - -#define GST_TYPE_JPEGDEC \ - (gst_jpegdec_get_type()) -#define GST_JPEGDEC(obj) \ - (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_JPEGDEC,GstJpegDec)) -#define GST_JPEGDEC_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_JPEGDEC,GstJpegDec)) -#define GST_IS_JPEGDEC(obj) \ - (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_JPEGDEC)) -#define GST_IS_JPEGDEC_CLASS(obj) \ - (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_JPEGDEC)) +G_BEGIN_DECLS + +#define GST_TYPE_JPEG_DEC \ + (gst_jpeg_dec_get_type()) +#define GST_JPEG_DEC(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_JPEG_DEC,GstJpegDec)) +#define GST_JPEG_DEC_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_JPEG_DEC,GstJpegDec)) +#define GST_IS_JPEG_DEC(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_JPEG_DEC)) +#define GST_IS_JPEG_DEC_CLASS(obj) \ + (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_JPEG_DEC)) + +typedef struct _GstJpegDec GstJpegDec; +typedef struct _GstJpegDecClass GstJpegDecClass; + +struct GstJpegDecErrorMgr { + struct jpeg_error_mgr pub; /* public fields */ + jmp_buf setjmp_buffer; +}; -typedef struct _GstJpegDec GstJpegDec; -typedef struct _GstJpegDecClass GstJpegDecClass; +struct GstJpegDecSourceMgr { + struct jpeg_source_mgr pub; /* public fields */ + GstJpegDec *dec; +}; +/* Can't use GstBaseTransform, because GstBaseTransform + * doesn't handle the N buffers in, 1 buffer out case, + * but only the 1-in 1-out case */ struct _GstJpegDec { GstElement element; /* pads */ - GstPad *sinkpad,*srcpad; + GstPad *sinkpad; + GstPad *srcpad; + + GstBuffer *tempbuf; - int parse_state; /* the timestamp of the next frame */ - guint64 next_time; - /* the interval between frames */ - guint64 time_interval; + guint64 next_ts; /* video state */ - gint format; - gint width; - gint height; - gdouble fps; - /* the size of the output buffer */ - gint outsize; + guint width; + guint height; + gdouble fps; + /* the jpeg line buffer */ guchar **line[3]; struct jpeg_decompress_struct cinfo; - struct jpeg_error_mgr jerr; - struct jpeg_source_mgr jsrc; + struct GstJpegDecErrorMgr jerr; + struct GstJpegDecSourceMgr jsrc; }; struct _GstJpegDecClass { - GstElementClass parent_class; + GstElementClass parent_class; }; -GType gst_jpegdec_get_type(void); +GType gst_jpeg_dec_get_type(void); -#ifdef __cplusplus -} -#endif /* __cplusplus */ +G_END_DECLS -#endif /* __GST_JPEGDEC_H__ */ +#endif /* __GST_JPEG_DEC_H__ */ -- cgit