1 /* GStreamer Wavpack parser 2 * Copyright (C) 2012 Mark Nauwelaerts <mark.nauwelaerts@collabora.co.uk> 3 * Copyright (C) 2012 Nokia Corporation. All rights reserved. 4 * Contact: Stefan Kost <stefan.kost@nokia.com> 5 * 6 * This library is free software; you can redistribute it and/or 7 * modify it under the terms of the GNU Library General Public 8 * License as published by the Free Software Foundation; either 9 * version 2 of the License, or (at your option) any later version. 10 * 11 * This library is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 * Library General Public License for more details. 15 * 16 * You should have received a copy of the GNU Library General Public 17 * License along with this library; if not, write to the 18 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, 19 * Boston, MA 02110-1301, USA. 20 */ 21 22 #ifndef __GST_WAVPACK_PARSE_H__ 23 #define __GST_WAVPACK_PARSE_H__ 24 25 #include <gst/gst.h> 26 #include <gst/base/gstbaseparse.h> 27 28 G_BEGIN_DECLS 29 30 #define GST_TYPE_WAVPACK_PARSE \ 31 (gst_wavpack_parse_get_type()) 32 #define GST_WAVPACK_PARSE(obj) \ 33 (G_TYPE_CHECK_INSTANCE_CAST((obj), GST_TYPE_WAVPACK_PARSE, GstWavpackParse)) 34 #define GST_WAVPACK_PARSE_CLASS(klass) \ 35 (G_TYPE_CHECK_CLASS_CAST((klass), GST_TYPE_WAVPACK_PARSE, GstWavpackParseClass)) 36 #define GST_IS_WAVPACK_PARSE(obj) \ 37 (G_TYPE_CHECK_INSTANCE_TYPE((obj), GST_TYPE_WAVPACK_PARSE)) 38 #define GST_IS_WAVPACK_PARSE_CLASS(klass) \ 39 (G_TYPE_CHECK_CLASS_TYPE((klass), GST_TYPE_WAVPACK_PARSE)) 40 41 42 #define ID_UNIQUE 0x3f 43 #define ID_OPTIONAL_DATA 0x20 44 #define ID_ODD_SIZE 0x40 45 #define ID_LARGE 0x80 46 47 #define ID_DUMMY 0x0 48 #define ID_ENCODER_INFO 0x1 49 #define ID_DECORR_TERMS 0x2 50 #define ID_DECORR_WEIGHTS 0x3 51 #define ID_DECORR_SAMPLES 0x4 52 #define ID_ENTROPY_VARS 0x5 53 #define ID_HYBRID_PROFILE 0x6 54 #define ID_SHAPING_WEIGHTS 0x7 55 #define ID_FLOAT_INFO 0x8 56 #define ID_INT32_INFO 0x9 57 #define ID_WV_BITSTREAM 0xa 58 #define ID_WVC_BITSTREAM 0xb 59 #define ID_WVX_BITSTREAM 0xc 60 #define ID_CHANNEL_INFO 0xd 61 62 #define ID_RIFF_HEADER (ID_OPTIONAL_DATA | 0x1) 63 #define ID_RIFF_TRAILER (ID_OPTIONAL_DATA | 0x2) 64 #define ID_REPLAY_GAIN (ID_OPTIONAL_DATA | 0x3) 65 #define ID_CUESHEET (ID_OPTIONAL_DATA | 0x4) 66 #define ID_CONFIG_BLOCK (ID_OPTIONAL_DATA | 0x5) 67 #define ID_MD5_CHECKSUM (ID_OPTIONAL_DATA | 0x6) 68 #define ID_SAMPLE_RATE (ID_OPTIONAL_DATA | 0x7) 69 70 #define FLAG_FINAL_BLOCK (1 << 12) 71 72 typedef struct { 73 char ckID [4]; /* "wvpk" */ 74 guint32 ckSize; /* size of entire block (minus 8, of course) */ 75 guint16 version; /* 0x402 to 0x410 are currently valid for decode */ 76 guchar track_no; /* track number (0 if not used, like now) */ 77 guchar index_no; /* track sub-index (0 if not used, like now) */ 78 guint32 total_samples; /* total samples for entire file, but this is 79 * only valid if block_index == 0 and a value of 80 * -1 indicates unknown length */ 81 guint32 block_index; /* index of first sample in block relative to 82 * beginning of file (normally this would start 83 * at 0 for the first block) */ 84 guint32 block_samples; /* number of samples in this block (0 = no audio) */ 85 guint32 flags; /* various flags for id and decoding */ 86 guint32 crc; /* crc for actual decoded data */ 87 } WavpackHeader; 88 89 typedef struct { 90 gboolean correction; 91 guint rate; 92 guint width; 93 guint channels; 94 guint channel_mask; 95 } WavpackInfo; 96 97 typedef struct _GstWavpackParse GstWavpackParse; 98 typedef struct _GstWavpackParseClass GstWavpackParseClass; 99 100 /** 101 * GstWavpackParse: 102 * 103 * The opaque GstWavpackParse object 104 */ 105 struct _GstWavpackParse { 106 GstBaseParse baseparse; 107 108 /*< private >*/ 109 gint sample_rate; 110 gint channels; 111 gint width; 112 gint channel_mask; 113 114 guint total_samples; 115 116 gboolean sent_codec_tag; 117 }; 118 119 /** 120 * GstWavpackParseClass: 121 * @parent_class: Element parent class. 122 * 123 * The opaque GstWavpackParseClass data structure. 124 */ 125 struct _GstWavpackParseClass { 126 GstBaseParseClass baseparse_class; 127 }; 128 129 GType gst_wavpack_parse_get_type (void); 130 131 G_END_DECLS 132 133 #endif /* __GST_WAVPACK_PARSE_H__ */ 134