Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Stefan Strogin
flac
Commits
b04a16e4
Commit
b04a16e4
authored
May 29, 2002
by
Josh Coalson
Browse files
initial import
parent
a8942051
Changes
6
Hide whitespace changes
Inline
Side-by-side
include/FLAC++/decoder.h
0 → 100644
View file @
b04a16e4
/* libFLAC++ - Free Lossless Audio Codec library
* Copyright (C) 2002 Josh Coalson
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef FLACPP__DECODER_H
#define FLACPP__DECODER_H
#include "FLAC/file_decoder.h"
#include "FLAC/seekable_stream_decoder.h"
#include "FLAC/stream_decoder.h"
// ===============================================================
//
// Full documentation for the decoder interfaces can be found
// in the C layer in include/FLAC/*_decoder.h
//
// ===============================================================
namespace
FLAC
{
namespace
Decoder
{
// ============================================================
//
// The only real difference here is that instead of passing
// in C function pointers for callbacks, you inherit from
// stream and provide implementations for the callbacks in
// the derived class; because of this there is no need for a
// 'client_data' property.
//
// ============================================================
// ============================================================
//
// Equivalent: FLAC__StreamDecoder
//
// ============================================================
class
Stream
{
public:
class
State
{
public:
inline
State
(
::
FLAC__StreamDecoderState
state
)
:
state_
(
state
)
{
}
inline
operator
::
FLAC__StreamDecoderState
()
const
{
return
state_
;
}
inline
const
char
*
as_cstring
()
const
{
return
::
FLAC__StreamDecoderStateString
[
state_
];
}
protected:
::
FLAC__StreamDecoderState
state_
;
};
Stream
();
virtual
~
Stream
();
bool
is_valid
()
const
;
inline
operator
bool
()
const
{
return
is_valid
();
}
bool
set_metadata_respond
(
::
FLAC__MetaDataType
type
);
bool
set_metadata_respond_application
(
const
FLAC__byte
id
[
4
]);
bool
set_metadata_respond_all
();
bool
set_metadata_ignore
(
::
FLAC__MetaDataType
type
);
bool
set_metadata_ignore_application
(
const
FLAC__byte
id
[
4
]);
bool
set_metadata_ignore_all
();
State
get_state
()
const
;
unsigned
get_channels
()
const
;
::
FLAC__ChannelAssignment
get_channel_assignment
()
const
;
unsigned
get_bits_per_sample
()
const
;
unsigned
get_sample_rate
()
const
;
unsigned
get_blocksize
()
const
;
// Initialize the instance; as with the C interface,
// init() should be called after construction and 'set'
// calls but before any of the 'process' calls.
State
init
();
void
finish
();
bool
flush
();
bool
reset
();
bool
process_whole_stream
();
bool
process_metadata
();
bool
process_one_frame
();
bool
process_remaining_frames
();
protected:
virtual
::
FLAC__StreamDecoderReadStatus
read_callback
(
FLAC__byte
buffer
[],
unsigned
*
bytes
)
=
0
;
virtual
::
FLAC__StreamDecoderWriteStatus
write_callback
(
const
::
FLAC__Frame
*
frame
,
const
FLAC__int32
*
buffer
[])
=
0
;
virtual
void
metadata_callback
(
const
::
FLAC__StreamMetaData
*
metadata
)
=
0
;
virtual
void
error_callback
(
::
FLAC__StreamDecoderErrorStatus
status
)
=
0
;
::
FLAC__StreamDecoder
*
decoder_
;
private:
static
::
FLAC__StreamDecoderReadStatus
read_callback_
(
const
::
FLAC__StreamDecoder
*
decoder
,
FLAC__byte
buffer
[],
unsigned
*
bytes
,
void
*
client_data
);
static
::
FLAC__StreamDecoderWriteStatus
write_callback_
(
const
::
FLAC__StreamDecoder
*
decoder
,
const
::
FLAC__Frame
*
frame
,
const
FLAC__int32
*
buffer
[],
void
*
client_data
);
static
void
metadata_callback_
(
const
::
FLAC__StreamDecoder
*
decoder
,
const
::
FLAC__StreamMetaData
*
metadata
,
void
*
client_data
);
static
void
error_callback_
(
const
::
FLAC__StreamDecoder
*
decoder
,
::
FLAC__StreamDecoderErrorStatus
status
,
void
*
client_data
);
// Private and undefined so you can't use them:
Stream
(
const
Stream
&
);
void
operator
=
(
const
Stream
&
);
};
// ============================================================
//
// Equivalent: FLAC__SeekableStreamDecoder
//
// ============================================================
class
SeekableStream
{
public:
class
State
{
public:
inline
State
(
::
FLAC__SeekableStreamDecoderState
state
)
:
state_
(
state
)
{
}
inline
operator
::
FLAC__SeekableStreamDecoderState
()
const
{
return
state_
;
}
inline
const
char
*
as_cstring
()
const
{
return
::
FLAC__SeekableStreamDecoderStateString
[
state_
];
}
protected:
::
FLAC__SeekableStreamDecoderState
state_
;
};
SeekableStream
();
virtual
~
SeekableStream
();
bool
is_valid
()
const
;
inline
operator
bool
()
const
{
return
is_valid
();
}
bool
set_md5_checking
(
bool
value
);
bool
set_metadata_respond
(
::
FLAC__MetaDataType
type
);
bool
set_metadata_respond_application
(
const
FLAC__byte
id
[
4
]);
bool
set_metadata_respond_all
();
bool
set_metadata_ignore
(
::
FLAC__MetaDataType
type
);
bool
set_metadata_ignore_application
(
const
FLAC__byte
id
[
4
]);
bool
set_metadata_ignore_all
();
State
get_state
()
const
;
bool
get_md5_checking
()
const
;
State
init
();
bool
finish
();
bool
process_whole_stream
();
bool
process_metadata
();
bool
process_one_frame
();
bool
process_remaining_frames
();
bool
seek_absolute
(
FLAC__uint64
sample
);
protected:
virtual
::
FLAC__SeekableStreamDecoderReadStatus
read_callback
(
FLAC__byte
buffer
[],
unsigned
*
bytes
)
=
0
;
virtual
::
FLAC__SeekableStreamDecoderSeekStatus
seek_callback
(
FLAC__uint64
absolute_byte_offset
)
=
0
;
virtual
::
FLAC__SeekableStreamDecoderTellStatus
tell_callback
(
FLAC__uint64
*
absolute_byte_offset
)
=
0
;
virtual
::
FLAC__SeekableStreamDecoderLengthStatus
length_callback
(
FLAC__uint64
*
stream_length
)
=
0
;
virtual
bool
eof_callback
()
=
0
;
virtual
::
FLAC__StreamDecoderWriteStatus
write_callback
(
const
::
FLAC__Frame
*
frame
,
const
FLAC__int32
*
buffer
[])
=
0
;
virtual
void
metadata_callback
(
const
::
FLAC__StreamMetaData
*
metadata
)
=
0
;
virtual
void
error_callback
(
::
FLAC__StreamDecoderErrorStatus
status
)
=
0
;
::
FLAC__SeekableStreamDecoder
*
decoder_
;
private:
static
FLAC__SeekableStreamDecoderReadStatus
read_callback_
(
const
::
FLAC__SeekableStreamDecoder
*
decoder
,
FLAC__byte
buffer
[],
unsigned
*
bytes
,
void
*
client_data
);
static
FLAC__SeekableStreamDecoderSeekStatus
seek_callback_
(
const
::
FLAC__SeekableStreamDecoder
*
decoder
,
FLAC__uint64
absolute_byte_offset
,
void
*
client_data
);
static
FLAC__SeekableStreamDecoderTellStatus
tell_callback_
(
const
::
FLAC__SeekableStreamDecoder
*
decoder
,
FLAC__uint64
*
absolute_byte_offset
,
void
*
client_data
);
static
FLAC__SeekableStreamDecoderLengthStatus
length_callback_
(
const
::
FLAC__SeekableStreamDecoder
*
decoder
,
FLAC__uint64
*
stream_length
,
void
*
client_data
);
static
FLAC__bool
eof_callback_
(
const
::
FLAC__SeekableStreamDecoder
*
decoder
,
void
*
client_data
);
static
FLAC__StreamDecoderWriteStatus
write_callback_
(
const
::
FLAC__SeekableStreamDecoder
*
decoder
,
const
::
FLAC__Frame
*
frame
,
const
FLAC__int32
*
buffer
[],
void
*
client_data
);
static
void
metadata_callback_
(
const
::
FLAC__SeekableStreamDecoder
*
decoder
,
const
::
FLAC__StreamMetaData
*
metadata
,
void
*
client_data
);
static
void
error_callback_
(
const
::
FLAC__SeekableStreamDecoder
*
decoder
,
::
FLAC__StreamDecoderErrorStatus
status
,
void
*
client_data
);
// Private and undefined so you can't use them:
SeekableStream
(
const
SeekableStream
&
);
void
operator
=
(
const
SeekableStream
&
);
};
// ============================================================
//
// Equivalent: FLAC__FileDecoder
//
// ============================================================
class
File
{
public:
class
State
{
public:
inline
State
(
::
FLAC__FileDecoderState
state
)
:
state_
(
state
)
{
}
inline
operator
::
FLAC__FileDecoderState
()
const
{
return
state_
;
}
inline
const
char
*
as_cstring
()
const
{
return
::
FLAC__FileDecoderStateString
[
state_
];
}
protected:
::
FLAC__FileDecoderState
state_
;
};
File
();
virtual
~
File
();
bool
is_valid
()
const
;
inline
operator
bool
()
const
{
return
is_valid
();
}
bool
set_md5_checking
(
bool
value
);
bool
set_filename
(
const
char
*
value
);
// 'value' may not be 0; use "-" for stdin
bool
set_metadata_respond
(
::
FLAC__MetaDataType
type
);
bool
set_metadata_respond_application
(
const
FLAC__byte
id
[
4
]);
bool
set_metadata_respond_all
();
bool
set_metadata_ignore
(
::
FLAC__MetaDataType
type
);
bool
set_metadata_ignore_application
(
const
FLAC__byte
id
[
4
]);
bool
set_metadata_ignore_all
();
State
get_state
()
const
;
bool
get_md5_checking
()
const
;
State
init
();
bool
finish
();
bool
process_whole_file
();
bool
process_metadata
();
bool
process_one_frame
();
bool
process_remaining_frames
();
bool
seek_absolute
(
FLAC__uint64
sample
);
protected:
virtual
::
FLAC__StreamDecoderWriteStatus
write_callback
(
const
::
FLAC__Frame
*
frame
,
const
FLAC__int32
*
buffer
[])
=
0
;
virtual
void
metadata_callback
(
const
::
FLAC__StreamMetaData
*
metadata
)
=
0
;
virtual
void
error_callback
(
::
FLAC__StreamDecoderErrorStatus
status
)
=
0
;
::
FLAC__FileDecoder
*
decoder_
;
private:
static
::
FLAC__StreamDecoderWriteStatus
write_callback_
(
const
::
FLAC__FileDecoder
*
decoder
,
const
::
FLAC__Frame
*
frame
,
const
FLAC__int32
*
buffer
[],
void
*
client_data
);
static
void
metadata_callback_
(
const
::
FLAC__FileDecoder
*
decoder
,
const
::
FLAC__StreamMetaData
*
metadata
,
void
*
client_data
);
static
void
error_callback_
(
const
::
FLAC__FileDecoder
*
decoder
,
::
FLAC__StreamDecoderErrorStatus
status
,
void
*
client_data
);
// Private and undefined so you can't use them:
File
(
const
File
&
);
void
operator
=
(
const
File
&
);
};
};
};
#endif
include/FLAC++/encoder.h
0 → 100644
View file @
b04a16e4
/* libFLAC++ - Free Lossless Audio Codec library
* Copyright (C) 2002 Josh Coalson
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef FLACPP__ENCODER_H
#define FLACPP__ENCODER_H
#include "FLAC/stream_encoder.h"
// ===============================================================
//
// Full documentation for the encoder interface can be found
// in the C layer in include/FLAC/stream_encoder.h
//
// ===============================================================
namespace
FLAC
{
namespace
Encoder
{
// ============================================================
//
// Equivalent: FLAC__StreamEncoder
//
// ----------------------------------------------------------
//
// The only real difference here is that instead of passing
// in C function pointers for callbacks, you inherit from
// stream and provide implementations for the callbacks in
// the derived class; because of this there is no need for a
// 'client_data' property.
//
// ============================================================
class
Stream
{
public:
class
State
{
public:
inline
State
(
::
FLAC__StreamEncoderState
state
)
:
state_
(
state
)
{
}
inline
operator
::
FLAC__StreamEncoderState
()
const
{
return
state_
;
}
inline
const
char
*
as_cstring
()
const
{
return
::
FLAC__StreamEncoderStateString
[
state_
];
}
protected:
::
FLAC__StreamEncoderState
state_
;
};
Stream
();
virtual
~
Stream
();
bool
is_valid
()
const
;
inline
operator
bool
()
const
{
return
is_valid
();
}
bool
set_streamable_subset
(
bool
value
);
bool
set_do_mid_side_stereo
(
bool
value
);
bool
set_loose_mid_side_stereo
(
bool
value
);
bool
set_channels
(
unsigned
value
);
bool
set_bits_per_sample
(
unsigned
value
);
bool
set_sample_rate
(
unsigned
value
);
bool
set_blocksize
(
unsigned
value
);
bool
set_max_lpc_order
(
unsigned
value
);
bool
set_qlp_coeff_precision
(
unsigned
value
);
bool
set_do_qlp_coeff_prec_search
(
bool
value
);
bool
set_do_escape_coding
(
bool
value
);
bool
set_do_exhaustive_model_search
(
bool
value
);
bool
set_min_residual_partition_order
(
unsigned
value
);
bool
set_max_residual_partition_order
(
unsigned
value
);
bool
set_rice_parameter_search_dist
(
unsigned
value
);
bool
set_total_samples_estimate
(
FLAC__uint64
value
);
bool
set_seek_table
(
const
FLAC__StreamMetaData_SeekTable
*
value
);
bool
set_padding
(
int
value
);
bool
set_last_metadata_is_last
(
bool
value
);
State
get_state
()
const
;
bool
get_streamable_subset
()
const
;
bool
get_do_mid_side_stereo
()
const
;
bool
get_loose_mid_side_stereo
()
const
;
unsigned
get_channels
()
const
;
unsigned
get_bits_per_sample
()
const
;
unsigned
get_sample_rate
()
const
;
unsigned
get_blocksize
()
const
;
unsigned
get_max_lpc_order
()
const
;
unsigned
get_qlp_coeff_precision
()
const
;
bool
get_do_qlp_coeff_prec_search
()
const
;
bool
get_do_escape_coding
()
const
;
bool
get_do_exhaustive_model_search
()
const
;
unsigned
get_min_residual_partition_order
()
const
;
unsigned
get_max_residual_partition_order
()
const
;
unsigned
get_rice_parameter_search_dist
()
const
;
// Initialize the instance; as with the C interface,
// init() should be called after construction and 'set'
// calls but before any of the 'process' calls.
State
init
();
void
finish
();
bool
process
(
const
FLAC__int32
*
buf
[],
unsigned
samples
);
bool
process_interleaved
(
const
FLAC__int32
buf
[],
unsigned
samples
);
protected:
virtual
::
FLAC__StreamEncoderWriteStatus
write_callback
(
const
FLAC__byte
buffer
[],
unsigned
bytes
,
unsigned
samples
,
unsigned
current_frame
)
=
0
;
virtual
void
metadata_callback
(
const
FLAC__StreamMetaData
*
metadata
)
=
0
;
::
FLAC__StreamEncoder
*
encoder_
;
private:
static
::
FLAC__StreamEncoderWriteStatus
write_callback_
(
const
::
FLAC__StreamEncoder
*
encoder
,
const
FLAC__byte
buffer
[],
unsigned
bytes
,
unsigned
samples
,
unsigned
current_frame
,
void
*
client_data
);
static
void
metadata_callback_
(
const
::
FLAC__StreamEncoder
*
encoder
,
const
::
FLAC__StreamMetaData
*
metadata
,
void
*
client_data
);
// Private and undefined so you can't use them:
Stream
(
const
Stream
&
);
void
operator
=
(
const
Stream
&
);
};
};
};
#endif
src/libFLAC++/file_decoder.cc
0 → 100644
View file @
b04a16e4
/* libFLAC++ - Free Lossless Audio Codec library
* Copyright (C) 2002 Josh Coalson
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#include "FLAC++/decoder.h"
#include "FLAC/assert.h"
namespace
FLAC
{
namespace
Decoder
{
File
::
File
()
:
decoder_
(
::
FLAC__file_decoder_new
())
{
}
File
::~
File
()
{
if
(
0
!=
decoder_
)
{
(
void
)
::
FLAC__file_decoder_finish
(
decoder_
);
::
FLAC__file_decoder_delete
(
decoder_
);
}
}
bool
File
::
is_valid
()
const
{
return
0
!=
decoder_
;
}
bool
File
::
set_md5_checking
(
bool
value
)
{
FLAC__ASSERT
(
0
!=
decoder_
);
return
::
FLAC__file_decoder_set_md5_checking
(
decoder_
,
value
);
}
bool
File
::
set_filename
(
const
char
*
value
)
{
FLAC__ASSERT
(
0
!=
decoder_
);
return
::
FLAC__file_decoder_set_filename
(
decoder_
,
value
);
}
bool
File
::
set_metadata_respond
(
::
FLAC__MetaDataType
type
)
{
FLAC__ASSERT
(
0
!=
decoder_
);
return
::
FLAC__file_decoder_set_metadata_respond
(
decoder_
,
type
);
}
bool
File
::
set_metadata_respond_application
(
const
FLAC__byte
id
[
4
])
{
FLAC__ASSERT
(
0
!=
decoder_
);
return
::
FLAC__file_decoder_set_metadata_respond_application
(
decoder_
,
id
);
}
bool
File
::
set_metadata_respond_all
()
{
FLAC__ASSERT
(
0
!=
decoder_
);
return
::
FLAC__file_decoder_set_metadata_respond_all
(
decoder_
);
}
bool
File
::
set_metadata_ignore
(
::
FLAC__MetaDataType
type
)
{
FLAC__ASSERT
(
0
!=
decoder_
);
return
::
FLAC__file_decoder_set_metadata_ignore
(
decoder_
,
type
);
}
bool
File
::
set_metadata_ignore_application
(
const
FLAC__byte
id
[
4
])
{
FLAC__ASSERT
(
0
!=
decoder_
);
return
::
FLAC__file_decoder_set_metadata_ignore_application
(
decoder_
,
id
);
}
bool
File
::
set_metadata_ignore_all
()
{
FLAC__ASSERT
(
0
!=
decoder_
);
return
::
FLAC__file_decoder_set_metadata_ignore_all
(
decoder_
);
}
File
::
State
File
::
get_state
()
const
{
FLAC__ASSERT
(
0
!=
decoder_
);
return
State
(
::
FLAC__file_decoder_get_state
(
decoder_
));
}
bool
File
::
get_md5_checking
()
const
{
FLAC__ASSERT
(
0
!=
decoder_
);
return
::
FLAC__file_decoder_get_md5_checking
(
decoder_
);
}
File
::
State
File
::
init
()
{
FLAC__ASSERT
(
0
!=
decoder_
);
::
FLAC__file_decoder_set_write_callback
(
decoder_
,
write_callback_
);
::
FLAC__file_decoder_set_metadata_callback
(
decoder_
,
metadata_callback_
);
::
FLAC__file_decoder_set_error_callback
(
decoder_
,
error_callback_
);
::
FLAC__file_decoder_set_client_data
(
decoder_
,
(
void
*
)
this
);
return
State
(
::
FLAC__file_decoder_init
(
decoder_
));
}
bool
File
::
finish
()
{
FLAC__ASSERT
(
0
!=
decoder_
);
return
::
FLAC__file_decoder_finish
(
decoder_
);
}
bool
File
::
process_whole_file
()
{
FLAC__ASSERT
(
0
!=
decoder_
);
return
::
FLAC__file_decoder_process_whole_file
(
decoder_
);
}
bool
File
::
process_metadata
()
{
FLAC__ASSERT
(
0
!=
decoder_
);
return
::
FLAC__file_decoder_process_metadata
(
decoder_
);
}
bool
File
::
process_one_frame
()
{
FLAC__ASSERT
(
0
!=
decoder_
);
return
::
FLAC__file_decoder_process_one_frame
(
decoder_
);
}
bool
File
::
process_remaining_frames
()
{
FLAC__ASSERT
(
0
!=
decoder_
);
return
::
FLAC__file_decoder_process_remaining_frames
(
decoder_
);
}
bool
File
::
seek_absolute
(
FLAC__uint64
sample
)
{
FLAC__ASSERT
(
0
!=
decoder_
);
return
::
FLAC__file_decoder_seek_absolute
(
decoder_
,
sample
);
}
::
FLAC__StreamDecoderWriteStatus
File
::
write_callback_
(
const
::
FLAC__FileDecoder
*
decoder
,
const
::
FLAC__Frame
*
frame
,
const
FLAC__int32
*
buffer
[],
void
*
client_data
)
{
(
void
)
decoder
;
FLAC__ASSERT
(
0
!=
client_data
);
File
*
instance
=
reinterpret_cast
<
File
*>
(
client_data
);
FLAC__ASSERT
(
0
!=
instance
);
return
instance
->
write_callback
(
frame
,
buffer
);
}
void
File
::
metadata_callback_
(
const
::
FLAC__FileDecoder
*
decoder
,
const
::
FLAC__StreamMetaData
*
metadata
,
void
*
client_data
)
{
(
void
)
decoder
;
FLAC__ASSERT
(
0
!=
client_data
);
File
*
instance
=
reinterpret_cast
<
File
*>
(
client_data
);
FLAC__ASSERT
(
0
!=
instance
);
instance
->
metadata_callback
(
metadata
);
}
void
File
::
error_callback_
(
const
::
FLAC__FileDecoder
*
decoder
,
::
FLAC__StreamDecoderErrorStatus
status
,
void
*
client_data
)
{
(
void
)
decoder
;
FLAC__ASSERT
(
0
!=
client_data
);
File
*
instance
=
reinterpret_cast
<
File
*>
(
client_data
);
FLAC__ASSERT
(
0
!=
instance
);
instance
->
error_callback
(
status
);
}
};
};
src/libFLAC++/seekable_stream_decoder.cc
0 → 100644
View file @
b04a16e4
/* libFLAC++ - Free Lossless Audio Codec library
* Copyright (C) 2002 Josh Coalson
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#include "FLAC++/decoder.h"
#include "FLAC/assert.h"
namespace
FLAC
{
namespace
Decoder
{
SeekableStream
::
SeekableStream
()
:
decoder_
(
::
FLAC__seekable_stream_decoder_new
())
{
}
SeekableStream
::~
SeekableStream
()
{
if
(
0
!=
decoder_
)
{
(
void
)
::
FLAC__seekable_stream_decoder_finish
(
decoder_
);
::
FLAC__seekable_stream_decoder_delete
(
decoder_
);
}
}
bool
SeekableStream
::
is_valid
()
const
{
return
0
!=
decoder_
;
}
bool
SeekableStream
::
set_md5_checking
(
bool
value
)
{
FLAC__ASSERT
(
is_valid
());
return
::
FLAC__seekable_stream_decoder_set_md5_checking
(
decoder_
,
value
);
}
bool
SeekableStream
::
set_metadata_respond
(
::
FLAC__MetaDataType
type
)
{
FLAC__ASSERT
(
is_valid
());
return
::
FLAC__seekable_stream_decoder_set_metadata_respond
(
decoder_
,
type
);
}
bool
SeekableStream
::
set_metadata_respond_application
(
const
FLAC__byte
id
[
4
])