blob: 933cf94300964caf93ba917f7abbe190206cf7ec [file] [log] [blame]
Josh Coalsonfda98fb2002-05-17 06:33:39 +00001/* libFLAC++ - Free Lossless Audio Codec library
2 * Copyright (C) 2002 Josh Coalson
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., 59 Temple Place - Suite 330,
17 * Boston, MA 02111-1307, USA.
18 */
19
20#ifndef FLACPP__METADATA_H
21#define FLACPP__METADATA_H
22
23#include "FLAC/metadata.h"
24
25namespace FLAC {
26 namespace Metadata {
27
28 // NOTE: When the get_*() methods return you a const pointer,
29 // absolutely DO NOT write into it. Always use the set_*()
30 // methods.
31
32 // base class for all metadata blocks
33 class Prototype {
34 protected:
35 Prototype(::FLAC__StreamMetaData *object, bool copy);
36 virtual ~Prototype();
37
38 ::FLAC__StreamMetaData *object_;
39 public:
40 inline bool is_valid() const { return 0 != object_; }
41 inline operator bool() const { return is_valid(); }
42
43 bool get_is_last() const;
44 FLAC__MetaDataType get_type() const;
45 unsigned get_length() const; // NOTE: does not include the header, per spec
46 };
47
48 class StreamInfo : public Prototype {
49 public:
50 StreamInfo();
51 StreamInfo(::FLAC__StreamMetaData *object, bool copy = false);
52 ~StreamInfo();
53
54 unsigned get_min_blocksize() const;
55 unsigned get_max_blocksize() const;
56 unsigned get_min_framesize() const;
57 unsigned get_max_framesize() const;
58 unsigned get_sample_rate() const;
59 unsigned get_channels() const;
60 unsigned get_bits_per_sample() const;
61 FLAC__uint64 get_total_samples() const;
62 const FLAC__byte *get_md5sum() const;
63
64 void set_min_blocksize(unsigned value);
65 void set_max_blocksize(unsigned value);
66 void set_min_framesize(unsigned value);
67 void set_max_framesize(unsigned value);
68 void set_sample_rate(unsigned value);
69 void set_channels(unsigned value);
70 void set_bits_per_sample(unsigned value);
71 void set_total_samples(FLAC__uint64 value);
72 void set_md5sum(const FLAC__byte value[16]);
73 };
74
75 class Padding : public Prototype {
76 public:
77 Padding();
78 Padding(::FLAC__StreamMetaData *object, bool copy = false);
79 ~Padding();
80 };
81
82 class Application : public Prototype {
83 public:
84 Application();
85 Application(::FLAC__StreamMetaData *object, bool copy = false);
86 ~Application();
87
88 const FLAC__byte *get_id() const;
89 const FLAC__byte *get_data() const;
90
91 void set_id(FLAC__byte value[4]);
92 bool set_data(FLAC__byte *data, unsigned length, bool copy = false);
93 };
94
95 class SeekTable : public Prototype {
96 public:
97 SeekTable();
98 SeekTable(::FLAC__StreamMetaData *object, bool copy = false);
99 ~SeekTable();
100 };
101
102 class VorbisComment : public Prototype {
103 public:
104 VorbisComment();
105 VorbisComment(::FLAC__StreamMetaData *object, bool copy = false);
106 ~VorbisComment();
107 };
108
109 };
110};
111
112#endif