1 /* GStreamer libsndfile plugin
2  * Copyright (C) 2013 Stefan Sauer <ensonic@users.sf.net>
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., 51 Franklin St, Fifth Floor,
17  * Boston, MA 02110-1301, USA.
18  */
19 
20 
21 #ifndef __GST_SF_DEC_H__
22 #define __GST_SF_DEC_H__
23 
24 
25 #include "gstsf.h"
26 #include <gst/base/gstbasesrc.h>
27 
28 
29 G_BEGIN_DECLS
30 
31 
32 #define GST_TYPE_SF_DEC \
33   (gst_sf_dec_get_type())
34 #define GST_SF_DEC(obj) \
35   (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_SF_DEC,GstSFDec))
36 #define GST_SF_DEC_CLASS(klass) \
37   (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_SF_DEC,GstSFDecClass))
38 #define GST_IS_SF_DEC(obj) \
39   (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_SF_DEC))
40 #define GST_IS_SF_DEC_CLASS(klass) \
41   (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_SF_DEC))
42 
43 typedef struct _GstSFDec GstSFDec;
44 typedef struct _GstSFDecClass GstSFDecClass;
45 
46 typedef sf_count_t (*GstSFReader)(SNDFILE *f, void *data, sf_count_t nframes);
47 
48 struct _GstSFDec {
49   GstElement parent;
50 
51   GstPad *sinkpad;
52   GstPad *srcpad;
53 
54   guint64 pos;      /* in bytes */
55   guint64 duration; /* in frames */
56 
57   gboolean seekable;
58 
59   SNDFILE *file;
60   sf_count_t offset;
61   GstSFReader reader;
62   gint bytes_per_frame;
63 
64   gint channels;
65   gint rate;
66 };
67 
68 struct _GstSFDecClass {
69   GstElementClass parent_class;
70 };
71 
72 
73 G_END_DECLS
74 
75 
76 #endif /* __GST_SF_DEC_H__ */
77