Blame ext/jpeg/gstjpegdec.h

Packit 8ff292
/* GStreamer
Packit 8ff292
 * Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
Packit 8ff292
 * Copyright (C) 2012 Collabora Ltd.
Packit 8ff292
 *	Author : Edward Hervey <edward@collabora.com>
Packit 8ff292
 *
Packit 8ff292
 * This library is free software; you can redistribute it and/or
Packit 8ff292
 * modify it under the terms of the GNU Library General Public
Packit 8ff292
 * License as published by the Free Software Foundation; either
Packit 8ff292
 * version 2 of the License, or (at your option) any later version.
Packit 8ff292
 *
Packit 8ff292
 * This library is distributed in the hope that it will be useful,
Packit 8ff292
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit 8ff292
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Packit 8ff292
 * Library General Public License for more details.
Packit 8ff292
 *
Packit 8ff292
 * You should have received a copy of the GNU Library General Public
Packit 8ff292
 * License along with this library; if not, write to the
Packit 8ff292
 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
Packit 8ff292
 * Boston, MA 02110-1301, USA.
Packit 8ff292
 */
Packit 8ff292
Packit 8ff292
Packit 8ff292
#ifndef __GST_JPEG_DEC_H__
Packit 8ff292
#define __GST_JPEG_DEC_H__
Packit 8ff292
Packit 8ff292
Packit 8ff292
#include <setjmp.h>
Packit 8ff292
#include <gst/gst.h>
Packit 8ff292
#include <gst/video/video.h>
Packit 8ff292
#include <gst/video/gstvideodecoder.h>
Packit 8ff292
#include <gst/base/gstadapter.h>
Packit 8ff292
Packit 8ff292
/* this is a hack hack hack to get around jpeglib header bugs... */
Packit 8ff292
#ifdef HAVE_STDLIB_H
Packit 8ff292
# undef HAVE_STDLIB_H
Packit 8ff292
#endif
Packit 8ff292
#include <stdio.h>
Packit 8ff292
#include <jpeglib.h>
Packit 8ff292
Packit 8ff292
G_BEGIN_DECLS
Packit 8ff292
Packit 8ff292
#define GST_TYPE_JPEG_DEC \
Packit 8ff292
  (gst_jpeg_dec_get_type())
Packit 8ff292
#define GST_JPEG_DEC(obj) \
Packit 8ff292
  (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_JPEG_DEC,GstJpegDec))
Packit 8ff292
#define GST_JPEG_DEC_CLASS(klass) \
Packit 8ff292
  (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_JPEG_DEC,GstJpegDecClass))
Packit 8ff292
#define GST_IS_JPEG_DEC(obj) \
Packit 8ff292
  (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_JPEG_DEC))
Packit 8ff292
#define GST_IS_JPEG_DEC_CLASS(klass) \
Packit 8ff292
  (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_JPEG_DEC))
Packit 8ff292
Packit 8ff292
typedef struct _GstJpegDec           GstJpegDec;
Packit 8ff292
typedef struct _GstJpegDecClass      GstJpegDecClass;
Packit 8ff292
Packit 8ff292
struct GstJpegDecErrorMgr {
Packit 8ff292
  struct jpeg_error_mgr    pub;   /* public fields */
Packit 8ff292
  jmp_buf                  setjmp_buffer;
Packit 8ff292
};
Packit 8ff292
Packit 8ff292
struct GstJpegDecSourceMgr {
Packit 8ff292
  struct jpeg_source_mgr   pub;   /* public fields */
Packit 8ff292
  GstJpegDec              *dec;
Packit 8ff292
};
Packit 8ff292
Packit 8ff292
/* Can't use GstBaseTransform, because GstBaseTransform
Packit 8ff292
 * doesn't handle the N buffers in, 1 buffer out case,
Packit 8ff292
 * but only the 1-in 1-out case */
Packit 8ff292
struct _GstJpegDec {
Packit 8ff292
  GstVideoDecoder decoder;
Packit 8ff292
Packit 8ff292
  /* negotiated state */
Packit 8ff292
  GstVideoCodecState *input_state;
Packit 8ff292
  GstVideoCodecFrame *current_frame;
Packit 8ff292
  GstMapInfo current_frame_map;
Packit 8ff292
Packit 8ff292
  /* parse state */
Packit 8ff292
  gboolean saw_header;
Packit 8ff292
  gint     parse_entropy_len;
Packit 8ff292
  gint     parse_resync;
Packit 8ff292
Packit 8ff292
  /* properties */
Packit 8ff292
  gint     idct_method;
Packit 8ff292
  gint     max_errors;  /* ATOMIC */
Packit 8ff292
Packit 8ff292
  struct jpeg_decompress_struct cinfo;
Packit 8ff292
  struct GstJpegDecErrorMgr     jerr;
Packit 8ff292
  struct GstJpegDecSourceMgr    jsrc;
Packit 8ff292
Packit 8ff292
  /* arrays for indirect decoding */
Packit 8ff292
  gboolean idr_width_allocated;
Packit 8ff292
  guchar *idr_y[16],*idr_u[16],*idr_v[16];
Packit 8ff292
  /* current (parsed) image size */
Packit 8ff292
  guint    rem_img_len;
Packit 8ff292
};
Packit 8ff292
Packit 8ff292
struct _GstJpegDecClass {
Packit 8ff292
  GstVideoDecoderClass decoder_class;
Packit 8ff292
};
Packit 8ff292
Packit 8ff292
GType gst_jpeg_dec_get_type(void);
Packit 8ff292
Packit 8ff292
Packit 8ff292
G_END_DECLS
Packit 8ff292
Packit 8ff292
Packit 8ff292
#endif /* __GST_JPEG_DEC_H__ */