gst_plugins_good/ext/jpeg/gstjpegdec.h
changeset 27 d43ce56a1534
parent 23 29ecd5cb86b3
child 31 aec498aab1d3
equal deleted inserted replaced
23:29ecd5cb86b3 27:d43ce56a1534
     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/gstelement.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 /* Can't use GstBaseTransform, because GstBaseTransform
       
    61  * doesn't handle the N buffers in, 1 buffer out case,
       
    62  * but only the 1-in 1-out case */
       
    63 struct _GstJpegDec {
       
    64   GstElement element;
       
    65 
       
    66   /* pads */
       
    67   GstPad  *sinkpad;
       
    68   GstPad  *srcpad;
       
    69 
       
    70   GstBuffer *tempbuf;
       
    71 
       
    72   /* TRUE if each input buffer contains a whole jpeg image */
       
    73   gboolean packetized;
       
    74 
       
    75   /* the (expected) timestamp of the next frame */
       
    76   guint64  next_ts;
       
    77 
       
    78   /* video state */
       
    79   gint framerate_numerator;
       
    80   gint framerate_denominator;
       
    81 
       
    82   /* negotiated state */
       
    83   gint     caps_framerate_numerator;
       
    84   gint     caps_framerate_denominator;
       
    85   gint     caps_width;
       
    86   gint     caps_height;
       
    87 
       
    88   struct jpeg_decompress_struct cinfo;
       
    89   struct GstJpegDecErrorMgr     jerr;
       
    90   struct GstJpegDecSourceMgr    jsrc;
       
    91 };
       
    92 
       
    93 struct _GstJpegDecClass {
       
    94   GstElementClass  parent_class;
       
    95 };
       
    96 
       
    97 GType gst_jpeg_dec_get_type(void);
       
    98 
       
    99 
       
   100 G_END_DECLS
       
   101 
       
   102 
       
   103 #endif /* __GST_JPEG_DEC_H__ */