gstwavparse.h 3.28 KB
Newer Older
Andy Wingo Wingo's avatar
Andy Wingo Wingo committed
1
/* GStreamer
Andy Wingo Wingo's avatar
Andy Wingo Wingo committed
2
 * Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
3
 * Copyright (C) <2006> Nokia Corporation, Stefan Kost <stefan.kost@nokia.com>.
Andy Wingo Wingo's avatar
Andy Wingo Wingo committed
4 5 6 7 8 9 10 11 12 13 14 15 16
 *
 * 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
Tim-Philipp Müller's avatar
Tim-Philipp Müller committed
17 18
 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
 * Boston, MA 02110-1301, USA.
Andy Wingo Wingo's avatar
Andy Wingo Wingo committed
19 20 21
 */


Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
22 23
#ifndef __GST_WAVPARSE_H__
#define __GST_WAVPARSE_H__
Andy Wingo Wingo's avatar
Andy Wingo Wingo committed
24 25 26


#include <gst/gst.h>
27 28
#include "gst/riff/riff-ids.h"
#include "gst/riff/riff-read.h"
29
#include <gst/base/gstadapter.h>
Andy Wingo Wingo's avatar
Andy Wingo Wingo committed
30

31
G_BEGIN_DECLS
Andy Wingo Wingo's avatar
Andy Wingo Wingo committed
32

Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
33 34 35 36 37
#define GST_TYPE_WAVPARSE \
  (gst_wavparse_get_type())
#define GST_WAVPARSE(obj) \
  (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_WAVPARSE,GstWavParse))
#define GST_WAVPARSE_CLASS(klass) \
38
  (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_WAVPARSE,GstWavParseClass))
Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
39 40
#define GST_IS_WAVPARSE(obj) \
  (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_WAVPARSE))
41
#define GST_IS_WAVPARSE_CLASS(klass) \
Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
42
  (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_WAVPARSE))
Andy Wingo Wingo's avatar
Andy Wingo Wingo committed
43

44 45
typedef enum {
  GST_WAVPARSE_START,
46
  GST_WAVPARSE_HEADER,
47
  GST_WAVPARSE_DATA
48
} GstWavParseState;
Andy Wingo Wingo's avatar
Andy Wingo Wingo committed
49

Johan Dahlin's avatar
Johan Dahlin committed
50 51 52
typedef struct _GstWavParse GstWavParse;
typedef struct _GstWavParseClass GstWavParseClass;

53 54 55 56 57
/**
 * GstWavParse:
 *
 * Opaque data structure.
 */
Johan Dahlin's avatar
Johan Dahlin committed
58
struct _GstWavParse {
59
  GstElement parent;
Johan Dahlin's avatar
Johan Dahlin committed
60 61 62 63

  /* pads */
  GstPad *sinkpad,*srcpad;

64 65 66 67 68
  /* for delayed source pad creation for when
   * we have the first chunk of data and know
   * the format for sure */
  GstCaps     *caps;
  GstTagList  *tags;
Anton Belka's avatar
Anton Belka committed
69 70 71
  GstToc      *toc;
  GList       *cues;
  GList       *labls;
72
  GList       *notes;
73
  GstEvent    *start_segment;
74

Johan Dahlin's avatar
Johan Dahlin committed
75
  /* WAVE decoding state */
76
  GstWavParseState state;
77
  gboolean abort_buffering;
Johan Dahlin's avatar
Johan Dahlin committed
78 79 80 81 82

  /* format of audio, see defines below */
  gint format;

  /* useful audio data */
83
  guint16 depth;
84
  guint32 rate;
85
  guint16 channels;
86
  guint16 blockalign;
87
  guint16 width;
88
  guint32 av_bps;
Peter G. Baum's avatar
Peter G. Baum committed
89
  guint64 fact;
Johan Dahlin's avatar
Johan Dahlin committed
90

91 92
  /* real bps used or 0 when no bitrate is known */
  guint32 bps;
93
  gboolean vbr;
94

95
  guint bytes_per_sample;
96
  guint max_buf_size;
97

98 99 100 101 102 103 104
  /* position in data part */
  guint64	offset;
  guint64	end_offset;
  guint64 	dataleft;
  /* offset/length of data part */
  guint64 	datastart;
  guint64 	datasize;
105 106
  /* duration in time */
  guint64 	duration;
107

108
  /* pending seek */
109
  GstEvent *seek_event;
110

111 112 113 114 115
  /* For streaming */
  GstAdapter *adapter;
  gboolean got_fmt;
  gboolean streaming;

Mark Nauwelaerts's avatar
Mark Nauwelaerts committed
116
  /* configured segment, start/stop expressed in time or bytes */
117
  GstSegment segment;
118

119 120
  /* for late pad configuration */
  gboolean first;
121 122
  /* discont after seek */
  gboolean discont;
123 124

  gboolean ignore_length;
125 126 127

  /* Size of the data as written in the chunk size */
  guint32 chunk_size;
Johan Dahlin's avatar
Johan Dahlin committed
128 129 130
};

struct _GstWavParseClass {
131
  GstElementClass parent_class;
Johan Dahlin's avatar
Johan Dahlin committed
132 133 134 135
};

GType gst_wavparse_get_type(void);

136
G_END_DECLS
Andy Wingo Wingo's avatar
Andy Wingo Wingo committed
137

Johan Dahlin's avatar
Johan Dahlin committed
138
#endif /* __GST_WAVPARSE_H__ */