1 /* GStreamer Wavpack plugin
2  * Copyright (c) 2005 Arwed v. Merkatz <v.merkatz@gmx.net>
3  * Copyright (c) 2006 Sebastian Dröge <slomo@circular-chaos.org>
4  *
5  * gstwavpackcommon.h: common helper functions
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Library General Public
9  * License as published by the Free Software Foundation; either
10  * version 2 of the License, or (at your option) any later version.
11  *
12  * This library is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  * Library General Public License for more details.
16  *
17  * You should have received a copy of the GNU Library General Public
18  * License along with this library; if not, write to the
19  * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
20  * Boston, MA 02110-1301, USA.
21  */
22 
23 #ifndef __GST_WAVPACK_COMMON_H__
24 #define __GST_WAVPACK_COMMON_H__
25 
26 #include <gst/gst.h>
27 #include <gst/audio/audio.h>
28 #include <wavpack/wavpack.h>
29 
30 typedef struct
31 {
32   guint32 byte_length;
33   guint8 *data;
34   guint8 id;
35 } GstWavpackMetadata;
36 
37 #define ID_UNIQUE               0x3f
38 #define ID_OPTIONAL_DATA        0x20
39 #define ID_ODD_SIZE             0x40
40 #define ID_LARGE                0x80
41 
42 #define ID_DUMMY                0x0
43 #define ID_ENCODER_INFO         0x1
44 #define ID_DECORR_TERMS         0x2
45 #define ID_DECORR_WEIGHTS       0x3
46 #define ID_DECORR_SAMPLES       0x4
47 #define ID_ENTROPY_VARS         0x5
48 #define ID_HYBRID_PROFILE       0x6
49 #define ID_SHAPING_WEIGHTS      0x7
50 #define ID_FLOAT_INFO           0x8
51 #define ID_INT32_INFO           0x9
52 #define ID_WV_BITSTREAM         0xa
53 #define ID_WVC_BITSTREAM        0xb
54 #define ID_WVX_BITSTREAM        0xc
55 #define ID_CHANNEL_INFO         0xd
56 
57 #define ID_RIFF_HEADER          (ID_OPTIONAL_DATA | 0x1)
58 #define ID_RIFF_TRAILER         (ID_OPTIONAL_DATA | 0x2)
59 #define ID_REPLAY_GAIN          (ID_OPTIONAL_DATA | 0x3)
60 #define ID_CUESHEET             (ID_OPTIONAL_DATA | 0x4)
61 #define ID_CONFIG_BLOCK         (ID_OPTIONAL_DATA | 0x5)
62 #define ID_MD5_CHECKSUM         (ID_OPTIONAL_DATA | 0x6)
63 #define ID_SAMPLE_RATE          (ID_OPTIONAL_DATA | 0x7)
64 
65 
66 gboolean gst_wavpack_read_header (WavpackHeader * header, guint8 * buf);
67 gboolean gst_wavpack_read_metadata (GstWavpackMetadata * meta,
68     guint8 * header_data, guint8 ** p_data);
69 gint gst_wavpack_get_default_channel_mask (gint nchannels);
70 gboolean gst_wavpack_get_channel_positions (gint nchannels, gint layout, GstAudioChannelPosition *pos);
71 GstAudioChannelPosition *gst_wavpack_get_default_channel_positions (gint nchannels);
72 gint gst_wavpack_get_channel_mask_from_positions (GstAudioChannelPosition *pos, gint nchannels);
73 gboolean gst_wavpack_set_channel_mapping (GstAudioChannelPosition *pos, gint nchannels, gint8 *channel_mapping);
74 
75 #endif
76