1 /* GStreamer
2  *
3  * Copyright (C) 2008 Sebastian Dröge <sebastian.droege@collabora.co.uk>.
4  * Copyright (C) 2009 Mark Nauwelaerts <mark.nauwelaerts@collabora.co.uk>
5  * Copyright (C) 2009 Nokia Corporation. All rights reserved.
6  *   Contact: Stefan Kost <stefan.kost@nokia.com>
7  *
8  * This library is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Library General Public
10  * License as published by the Free Software Foundation; either
11  * version 2 of the License, or (at your option) any later version.
12  *
13  * This library is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16  * Library General Public License for more details.
17  *
18  * You should have received a copy of the GNU Library General Public
19  * License along with this library; if not, write to the
20  * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
21  * Boston, MA 02110-1301, USA.
22  */
23 
24 #ifndef __GST_FLAC_PARSE_H__
25 #define __GST_FLAC_PARSE_H__
26 
27 #include <gst/gst.h>
28 #include <gst/base/gstbaseparse.h>
29 
30 G_BEGIN_DECLS
31 
32 #define GST_TYPE_FLAC_PARSE		   (gst_flac_parse_get_type())
33 #define GST_FLAC_PARSE(obj)		   (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_FLAC_PARSE,GstFlacParse))
34 #define GST_FLAC_PARSE_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_FLAC_PARSE,GstFlacParseClass))
35 #define GST_FLAC_PARSE_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS((obj),GST_TYPE_FLAC_PARSE,GstFlacParseClass))
36 #define GST_IS_FLAC_PARSE(obj)	   (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_FLAC_PARSE))
37 #define GST_IS_FLAC_PARSE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_FLAC_PARSE))
38 #define GST_FLAC_PARSE_CAST(obj)	((GstFlacParse *)(obj))
39 
40 typedef struct _GstFlacParse GstFlacParse;
41 typedef struct _GstFlacParseClass GstFlacParseClass;
42 
43 typedef enum {
44   GST_FLAC_PARSE_STATE_INIT,
45   GST_FLAC_PARSE_STATE_HEADERS,
46   GST_FLAC_PARSE_STATE_GENERATE_HEADERS,
47   GST_FLAC_PARSE_STATE_DATA
48 } GstFlacParseState;
49 
50 typedef struct {
51   guint8 type;
52 } GstFlacParseSubFrame;
53 
54 struct _GstFlacParse {
55   GstBaseParse parent;
56 
57   /* Properties */
58   gboolean check_frame_checksums;
59 
60   GstFlacParseState state;
61 
62   gint64 upstream_length;
63 
64   /* STREAMINFO content */
65   guint16 min_blocksize, max_blocksize;
66   guint32 min_framesize, max_framesize;
67   guint32 samplerate;
68   guint8 channels;
69   guint8 bps;
70   guint64 total_samples;
71 
72   /* Current frame */
73   guint64 offset;
74   guint8 blocking_strategy;
75   guint16 block_size;
76   guint64 sample_number;
77   guint64 first_sample_number;
78   gboolean strategy_checked;
79 
80   gboolean sent_codec_tag;
81 
82   GstTagList *tags;
83   GstToc *toc;
84 
85   GList *headers;
86   GstBuffer *seektable;
87 
88   gboolean force_variable_block_size;
89 };
90 
91 struct _GstFlacParseClass {
92   GstBaseParseClass parent_class;
93 };
94 
95 GType gst_flac_parse_get_type (void);
96 
97 G_END_DECLS
98 
99 #endif /* __GST_FLAC_PARSE_H__ */
100