125dceda8e7f33d0017e8d210abd96f6e6818d27
[platform/upstream/gstreamer.git] / ext / jpeg / gstjpegdec.h
1 /* GStreamer
2  * Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Library General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Library General Public License for more details.
13  *
14  * You should have received a copy of the GNU Library General Public
15  * License along with this library; if not, write to the
16  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17  * Boston, MA 02111-1307, USA.
18  */
19
20
21 #ifndef __GST_JPEG_DEC_H__
22 #define __GST_JPEG_DEC_H__
23
24
25 #include <setjmp.h>
26 #include <gst/gst.h>
27
28 /* this is a hack hack hack to get around jpeglib header bugs... */
29 #ifdef HAVE_STDLIB_H
30 # undef HAVE_STDLIB_H
31 #endif
32 #include <jpeglib.h>
33
34 G_BEGIN_DECLS
35
36 #define GST_TYPE_JPEG_DEC \
37   (gst_jpeg_dec_get_type())
38 #define GST_JPEG_DEC(obj) \
39   (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_JPEG_DEC,GstJpegDec))
40 #define GST_JPEG_DEC_CLASS(klass) \
41   (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_JPEG_DEC,GstJpegDecClass))
42 #define GST_IS_JPEG_DEC(obj) \
43   (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_JPEG_DEC))
44 #define GST_IS_JPEG_DEC_CLASS(klass) \
45   (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_JPEG_DEC))
46
47 typedef struct _GstJpegDec           GstJpegDec;
48 typedef struct _GstJpegDecClass      GstJpegDecClass;
49
50 struct GstJpegDecErrorMgr {
51   struct jpeg_error_mgr    pub;   /* public fields */
52   jmp_buf                  setjmp_buffer;
53 };
54
55 struct GstJpegDecSourceMgr {
56   struct jpeg_source_mgr   pub;   /* public fields */
57   GstJpegDec              *dec;
58 };
59
60 #define CINFO_GET_JPEGDEC(cinfo_ptr) \
61         (((struct GstJpegDecSourceMgr*)((cinfo_ptr)->src))->dec)
62
63 /* Can't use GstBaseTransform, because GstBaseTransform
64  * doesn't handle the N buffers in, 1 buffer out case,
65  * but only the 1-in 1-out case */
66 struct _GstJpegDec {
67   GstElement element;
68
69   /* pads */
70   GstPad  *sinkpad;
71   GstPad  *srcpad;
72
73   GstBuffer *tempbuf;
74
75   /* TRUE if each input buffer contains a whole jpeg image */
76   gboolean packetized;
77
78   /* the (expected) timestamp of the next frame */
79   guint64  next_ts;
80
81   GstSegment segment;
82
83   /* TRUE if the next output buffer should have the DISCONT flag set */
84   gboolean discont;
85
86   /* QoS stuff *//* with LOCK */
87   gdouble proportion;
88   GstClockTime earliest_time;
89   GstClockTime qos_duration;
90
91   /* video state */
92   gint framerate_numerator;
93   gint framerate_denominator;
94
95   /* negotiated state */
96   gint     caps_framerate_numerator;
97   gint     caps_framerate_denominator;
98   gint     caps_width;
99   gint     caps_height;
100   gint     outsize;
101   /* temp space for samples */
102   gboolean direct;
103   guchar **scanarray[3];
104
105   /* properties */
106   gint     idct_method;
107
108   struct jpeg_decompress_struct cinfo;
109   struct GstJpegDecErrorMgr     jerr;
110   struct GstJpegDecSourceMgr    jsrc;
111 };
112
113 struct _GstJpegDecClass {
114   GstElementClass  parent_class;
115 };
116
117 GType gst_jpeg_dec_get_type(void);
118
119
120 G_END_DECLS
121
122
123 #endif /* __GST_JPEG_DEC_H__ */