~ubuntu-branches/ubuntu/warty/flac/warty

« back to all changes in this revision

Viewing changes to include/OggFLAC++/encoder.h

  • Committer: Bazaar Package Importer
  • Author(s): Matt Zimmerman
  • Date: 2004-04-16 15:14:31 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20040416151431-eyloggqxpwbwpogz
Tags: 1.1.0-11
Ensure that libFLAC is linked with -lm on all architectures, and
regardless of whether nasm is present

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* libOggFLAC++ - Free Lossless Audio Codec + Ogg library
 
2
 * Copyright (C) 2002,2003  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 OggFLACPP__ENCODER_H
 
21
#define OggFLACPP__ENCODER_H
 
22
 
 
23
#include "export.h"
 
24
 
 
25
#include "OggFLAC/stream_encoder.h"
 
26
#include "decoder.h"
 
27
// we only need these for the state abstractions really...
 
28
#include "FLAC++/decoder.h"
 
29
#include "FLAC++/encoder.h"
 
30
 
 
31
 
 
32
/** \file include/OggFLAC++/encoder.h
 
33
 *
 
34
 *  \brief
 
35
 *  This module contains the classes which implement the various
 
36
 *  encoders.
 
37
 *
 
38
 *  See the detailed documentation in the
 
39
 *  \link oggflacpp_encoder encoder \endlink module.
 
40
 */
 
41
 
 
42
/** \defgroup oggflacpp_encoder OggFLAC++/encoder.h: encoder classes
 
43
 *  \ingroup oggflacpp
 
44
 *
 
45
 *  \brief
 
46
 *  This module describes the encoder layers provided by libOggFLAC++.
 
47
 *
 
48
 * The libOggFLAC++ encoder classes are object wrappers around their
 
49
 * counterparts in libOggFLAC.  Only the stream encoding layer in
 
50
 * libOggFLAC is provided here.  The interface is very similar;
 
51
 * make sure to read the \link oggflac_encoder libOggFLAC encoder module \endlink.
 
52
 *
 
53
 * The only real difference here is that instead of passing in C function
 
54
 * pointers for callbacks, you inherit from the encoder class and provide
 
55
 * implementations for the callbacks in the derived class; because of this
 
56
 * there is no need for a 'client_data' property.
 
57
 */
 
58
 
 
59
namespace OggFLAC {
 
60
        namespace Encoder {
 
61
 
 
62
                // ============================================================
 
63
                //
 
64
                //  Equivalent: OggFLAC__StreamEncoder
 
65
                //
 
66
                // ============================================================
 
67
 
 
68
                /** \defgroup oggflacpp_stream_encoder OggFLAC++/encoder.h: stream encoder class
 
69
                 *  \ingroup oggflacpp_encoder
 
70
                 *
 
71
                 *  \brief
 
72
                 *  This class wraps the ::OggFLAC__StreamEncoder.
 
73
                 *
 
74
                 * See the \link oggflac_stream_encoder libOggFLAC stream encoder module \endlink.
 
75
                 *
 
76
                 * \{
 
77
                 */
 
78
 
 
79
                /** This class wraps the ::OggFLAC__StreamEncoder.
 
80
                 */
 
81
                class OggFLACPP_API Stream {
 
82
                public:
 
83
                        class OggFLACPP_API State {
 
84
                        public:
 
85
                                inline State(::OggFLAC__StreamEncoderState state): state_(state) { }
 
86
                                inline operator ::OggFLAC__StreamEncoderState() const { return state_; }
 
87
                                inline const char *as_cstring() const { return ::OggFLAC__StreamEncoderStateString[state_]; }
 
88
                        protected:
 
89
                                ::OggFLAC__StreamEncoderState state_;
 
90
                        };
 
91
 
 
92
                        Stream();
 
93
                        virtual ~Stream();
 
94
 
 
95
                        bool is_valid() const;
 
96
                        inline operator bool() const { return is_valid(); }
 
97
 
 
98
                        bool set_serial_number(long value);
 
99
                        bool set_verify(bool value);
 
100
                        bool set_streamable_subset(bool value);
 
101
                        bool set_do_mid_side_stereo(bool value);
 
102
                        bool set_loose_mid_side_stereo(bool value);
 
103
                        bool set_channels(unsigned value);
 
104
                        bool set_bits_per_sample(unsigned value);
 
105
                        bool set_sample_rate(unsigned value);
 
106
                        bool set_blocksize(unsigned value);
 
107
                        bool set_max_lpc_order(unsigned value);
 
108
                        bool set_qlp_coeff_precision(unsigned value);
 
109
                        bool set_do_qlp_coeff_prec_search(bool value);
 
110
                        bool set_do_escape_coding(bool value);
 
111
                        bool set_do_exhaustive_model_search(bool value);
 
112
                        bool set_min_residual_partition_order(unsigned value);
 
113
                        bool set_max_residual_partition_order(unsigned value);
 
114
                        bool set_rice_parameter_search_dist(unsigned value);
 
115
                        bool set_total_samples_estimate(FLAC__uint64 value);
 
116
                        bool set_metadata(::FLAC__StreamMetadata **metadata, unsigned num_blocks);
 
117
 
 
118
                        State    get_state() const;
 
119
                        FLAC::Encoder::Stream::State get_FLAC_stream_encoder_state() const;
 
120
                        FLAC::Decoder::Stream::State get_verify_decoder_state() const;
 
121
                        void get_verify_decoder_error_stats(FLAC__uint64 *absolute_sample, unsigned *frame_number, unsigned *channel, unsigned *sample, FLAC__int32 *expected, FLAC__int32 *got);
 
122
                        bool     get_verify() const;
 
123
                        bool     get_streamable_subset() const;
 
124
                        bool     get_do_mid_side_stereo() const;
 
125
                        bool     get_loose_mid_side_stereo() const;
 
126
                        unsigned get_channels() const;
 
127
                        unsigned get_bits_per_sample() const;
 
128
                        unsigned get_sample_rate() const;
 
129
                        unsigned get_blocksize() const;
 
130
                        unsigned get_max_lpc_order() const;
 
131
                        unsigned get_qlp_coeff_precision() const;
 
132
                        bool     get_do_qlp_coeff_prec_search() const;
 
133
                        bool     get_do_escape_coding() const;
 
134
                        bool     get_do_exhaustive_model_search() const;
 
135
                        unsigned get_min_residual_partition_order() const;
 
136
                        unsigned get_max_residual_partition_order() const;
 
137
                        unsigned get_rice_parameter_search_dist() const;
 
138
                        FLAC__uint64 get_total_samples_estimate() const;
 
139
 
 
140
                        State init();
 
141
 
 
142
                        void finish();
 
143
 
 
144
                        bool process(const FLAC__int32 * const buffer[], unsigned samples);
 
145
                        bool process_interleaved(const FLAC__int32 buffer[], unsigned samples);
 
146
                protected:
 
147
                        virtual ::FLAC__StreamEncoderWriteStatus write_callback(const FLAC__byte buffer[], unsigned bytes, unsigned samples, unsigned current_frame) = 0;
 
148
 
 
149
                        ::OggFLAC__StreamEncoder *encoder_;
 
150
                private:
 
151
                        static ::FLAC__StreamEncoderWriteStatus write_callback_(const ::OggFLAC__StreamEncoder *encoder, const FLAC__byte buffer[], unsigned bytes, unsigned samples, unsigned current_frame, void *client_data);
 
152
 
 
153
                        // Private and undefined so you can't use them:
 
154
                        Stream(const Stream &);
 
155
                        void operator=(const Stream &);
 
156
                };
 
157
 
 
158
                /* \} */
 
159
 
 
160
        };
 
161
};
 
162
 
 
163
#endif