2 * Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
3 * Copyright (C) 2012 Collabora Ltd.
4 * Author : Edward Hervey <edward@collabora.com>
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Library General Public License for more details.
16 * You should have received a copy of the GNU Library General Public
17 * License along with this library; if not, write to the
18 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
19 * Boston, MA 02110-1301, USA.
23 #ifndef __GST_JPEG_DEC_H__
24 #define __GST_JPEG_DEC_H__
29 #include <gst/video/video.h>
30 #include <gst/video/gstvideodecoder.h>
31 #include <gst/base/gstadapter.h>
33 /* this is a hack hack hack to get around jpeglib header bugs... */
42 #define GST_TYPE_JPEG_DEC \
43 (gst_jpeg_dec_get_type())
44 #define GST_JPEG_DEC(obj) \
45 (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_JPEG_DEC,GstJpegDec))
46 #define GST_JPEG_DEC_CLASS(klass) \
47 (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_JPEG_DEC,GstJpegDecClass))
48 #define GST_IS_JPEG_DEC(obj) \
49 (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_JPEG_DEC))
50 #define GST_IS_JPEG_DEC_CLASS(klass) \
51 (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_JPEG_DEC))
53 typedef struct _GstJpegDec GstJpegDec;
54 typedef struct _GstJpegDecClass GstJpegDecClass;
56 struct GstJpegDecErrorMgr {
57 struct jpeg_error_mgr pub; /* public fields */
58 jmp_buf setjmp_buffer;
61 struct GstJpegDecSourceMgr {
62 struct jpeg_source_mgr pub; /* public fields */
66 /* Can't use GstBaseTransform, because GstBaseTransform
67 * doesn't handle the N buffers in, 1 buffer out case,
68 * but only the 1-in 1-out case */
70 GstVideoDecoder decoder;
72 /* negotiated state */
73 GstVideoCodecState *input_state;
74 GstVideoCodecFrame *current_frame;
75 GstMapInfo current_frame_map;
79 gint parse_entropy_len;
84 gint max_errors; /* ATOMIC */
86 struct jpeg_decompress_struct cinfo;
87 struct GstJpegDecErrorMgr jerr;
88 struct GstJpegDecSourceMgr jsrc;
90 /* arrays for indirect decoding */
91 gboolean idr_width_allocated;
92 guchar *idr_y[16],*idr_u[16],*idr_v[16];
93 /* current (parsed) image size */
97 struct _GstJpegDecClass {
98 GstVideoDecoderClass decoder_class;
101 GType gst_jpeg_dec_get_type(void);
107 #endif /* __GST_JPEG_DEC_H__ */