/* GStreamer
 * Copyright (C) 2009 Igalia S.L. <itoral@igalia.com>
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Library General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Library General Public License for more details.
 *
 * You should have received a copy of the GNU Library General Public
 * License along with this library; if not, write to the
 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 * Boston, MA 02111-1307, USA.
 */

#ifndef __GST_BASE_DECODE_H__
#define __GST_BASE_DECODE_H__

#include <gst/gst.h>

G_BEGIN_DECLS

#define GST_TYPE_BASE_DECODE		(gst_base_decode_get_type())
#define GST_BASE_DECODE(obj)		(G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_BASE_DECODE,GstBaseDecode))
#define GST_BASE_DECODE_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_BASE_DECODE,GstBaseDecodeClass))
#define GST_BASE_DECODE_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS((obj),GST_TYPE_BASE_DECODE,GstBaseDecodeClass))
#define GST_IS_BASE_DECODE(obj)	        (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_BASE_DECODE))
#define GST_IS_BASE_DECODE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_BASE_DECODE))
#define GST_BASE_DECODE_CAST(obj)	((GstBaseDecode *)(obj))

typedef struct _GstBaseDecode GstBaseDecode;
typedef struct _GstBaseDecodeClass GstBaseDecodeClass;
typedef struct _GstBaseDecodePrivate GstBaseDecodePrivate;

/**
 * GstBaseDecode:
 * @element: the parent element.
 *
 * The opaque #GstBaseDecode data structure.
 */
struct _GstBaseDecode {
  GstElement	 element;

  /*< protected >*/
  /* source and sink pads */
  GstPad	*sinkpad;
  GstPad	*srcpad;

  GstSegment    segment;
  GList         *queued;

  /*< private >*/
  GstBaseDecodePrivate *priv;

  gpointer       _gst_reserved[GST_PADDING_LARGE - 1];
};

/**
 * GstBaseDecodeClass:
 */
struct _GstBaseDecodeClass {
  GstElementClass parent_class;

  /*< public >*/
  void (*handle_discont) (GstBaseDecode *dec);
  GstFlowReturn (*decode) (GstBaseDecode *dec, 
			   GstBuffer *buffer,
			   GstBuffer **out_buffer);

  gboolean (*init)  (GstBaseDecode *dec);
  gboolean (*reset) (GstBaseDecode *dec);
  gboolean (*stop)  (GstBaseDecode *dec);
  gboolean (*clean) (GstBaseDecode *dec);

  gboolean (*src_convert)  (GstBaseDecode *dec,
			    GstPad *pad,
			    GstFormat src_format,
			    gint64 src_value,
			    GstFormat *dest_format,
			    gint64 *dest_value);
  gboolean (*sink_convert) (GstBaseDecode *dec,
			    GstPad *pad,
			    GstFormat src_format,
			    gint64 src_value,
			    GstFormat *dest_format,
			    gint64 *dest_value);
  
  /*< private >*/
  gpointer       _gst_reserved[GST_PADDING_LARGE - 2];
};

GType           gst_base_decode_get_type         (void);

G_END_DECLS

#endif /* __GST_BASE_DECODE_H__ */
