libmpcdec: include/mpcdec/mpcdec.h File Reference

Main Page | Class List | Directories | File List | Class Members | File Members | Related Pages

# mpcdec.h File Reference

`#include <stdio.h>`
`#include <stdlib.h>`
`#include <string.h>`
`#include "mpcdec/config_types.h"`
`#include "decoder.h"`
`#include "math.h"`
`#include "reader.h"`
`#include "streaminfo.h"`

Go to the source code of this file.

## Defines

#define | ERROR_CODE_OK 0
#define | ERROR_CODE_FILE -1
#define | ERROR_CODE_SV7BETA 1
#define | ERROR_CODE_CBR 2
#define | ERROR_CODE_IS 3
#define | ERROR_CODE_BLOCKSIZE 4
#define | ERROR_CODE_INVALIDSV 5

## Enumerations

enum | { MPC_FRAME_LENGTH = (36 * 32), MPC_DECODER_BUFFER_LENGTH = 4 * MPC_FRAME_LENGTH }

## Functions

void | mpc_streaminfo_init (mpc_streaminfo *si)
mpc_int32_t | mpc_streaminfo_read (mpc_streaminfo *si, mpc_reader *r)
double | mpc_streaminfo_get_length (mpc_streaminfo *si)
mpc_int64_t | mpc_streaminfo_get_length_samples (mpc_streaminfo *si)
void | mpc_decoder_setup (mpc_decoder *d, mpc_reader *r)
mpc_bool_t | mpc_decoder_initialize (mpc_decoder *d, mpc_streaminfo *si)
void | mpc_decoder_set_streaminfo (mpc_decoder *d, mpc_streaminfo *si)
void | mpc_decoder_scale_output (mpc_decoder *d, double scale_factor)
mpc_uint32_t | mpc_decoder_decode (mpc_decoder *d, MPC_SAMPLE_FORMAT *buffer, mpc_uint32_t *vbr_update_acc, mpc_uint32_t *vbr_update_bits)
mpc_uint32_t | mpc_decoder_decode_frame (mpc_decoder *d, mpc_uint32_t *in_buffer, mpc_uint32_t in_len, MPC_SAMPLE_FORMAT *out_buffer)
mpc_bool_t | mpc_decoder_seek_sample (mpc_decoder *d, mpc_int64_t destsample)
| Seeks to the specified sample in the source stream.
mpc_bool_t | mpc_decoder_seek_seconds (mpc_decoder *d, double seconds)
| Seeks to specified position in seconds in the source stream.

## Detailed Description

Top level include file for libmpcdec.

Definition in file mpcdec.h.

## Enumeration Type Documentation

anonymous enum

Enumerator:

  MPC_DECODER_BUFFER_LENGTH | samples per mpc frame

Definition at line 60 of file mpcdec.h.

## Function Documentation

mpc_uint32_t mpc_decoder_decode | ( | mpc_decoder * | d,
|  | MPC_SAMPLE_FORMAT * | buffer,
|  | mpc_uint32_t * | vbr_update_acc,
|  | mpc_uint32_t * | vbr_update_bits
| ) |

Actually reads data from previously initialized stream. Call this iteratively to decode the mpc stream.

Parameters:

  | buffer | destination buffer for decoded samples
  | vbr_update_acc\xrefitem | todo 1

Definition at line 453 of file mpc_decoder.c.

References mpc_decoder_t::FrameWasValid, mpc_decoder_update_buffer(), mpc_decoder_t::pos, and mpc_decoder_t::Zaehler.

mpc_bool_t mpc_decoder_initialize | ( | mpc_decoder * | d,
|  | mpc_streaminfo * | si
| ) |

Initializes mpc decoder with the supplied stream info parameters. Call this next after calling mpc_decoder_setup.

Parameters:

  | si | streaminfo structure indicating format of source stream

Returns:
  TRUE if decoder was initalized successfully, FALSE otherwise

Definition at line 1225 of file mpc_decoder.c.

References mpc_decoder_t::dword, mpc_decoder_set_streaminfo(), mpc_decoder_t::MPCHeaderPos, mpc_decoder_t::pos, mpc_decoder_t::Speicher, mpc_decoder_t::StreamVersion, and mpc_decoder_t::Zaehler.

void mpc_decoder_scale_output | ( | mpc_decoder * | d,
|  | double | scale_factor
| ) |

Sets decoder sample scaling factor. All decoded samples will be multiplied by this factor.

Parameters:

  | scale_factor | multiplicative scaling factor

Definition at line 89 of file requant.c.

References MPC_FIXED_POINT_SHIFT, and SET_SCF.

Referenced by mpc_decoder_initialisiere_quantisierungstabellen().

void mpc_decoder_setup | ( | mpc_decoder * | d,
|  | mpc_reader * | r
| ) |

Sets up decoder library. Call this first when preparing to decode an mpc stream.

Parameters:

  | r | reader that will supply raw data to the decoder

Definition at line 1139 of file mpc_decoder.c.

References mpc_decoder_t::__r1, mpc_decoder_t::__r2, mpc_decoder_t::ActDecodePos, mpc_decoder_t::DecodedFrames, mpc_decoder_t::dword, mpc_decoder_t::Entropie_1, mpc_decoder_t::Entropie_2, mpc_decoder_t::Entropie_3, mpc_decoder_t::Entropie_4, mpc_decoder_t::Entropie_5, mpc_decoder_t::Entropie_6, mpc_decoder_t::Entropie_7, mpc_decoder_t::EQ_activated, mpc_decoder_t::FrameWasValid, mpc_decoder_t::FwdJumpInfo, mpc_decoder_t::HuffQ, mpc_decoder_t::HuffQ1, mpc_decoder_t::HuffQ2, mpc_decoder_t::HuffQ3, mpc_decoder_t::HuffQ4, mpc_decoder_t::HuffQ5, mpc_decoder_t::HuffQ6, mpc_decoder_t::HuffQ7, mpc_decoder_t::LastValidSamples, mpc_decoder_t::Max_Band, mpc_decoder_init_huffman_sv6(), mpc_decoder_init_huffman_sv7(), mpc_decoder_initialisiere_quantisierungstabellen(), mpc_decoder_t::MPCHeaderPos, mpc_decoder_t::MS_used, mpc_decoder_t::OverallFrames, mpc_decoder_t::pos, mpc_decoder_t::r, mpc_decoder_t::SampleHuff, mpc_decoder_t::SampleRate, mpc_decoder_t::StreamVersion, mpc_decoder_t::TrueGaplessPresent, mpc_decoder_t::WordsRead, and mpc_decoder_t::Zaehler.

double mpc_streaminfo_get_length | ( | mpc_streaminfo * | si | ) |

Gets length of stream si, in seconds.

Returns:
  length of stream in seconds

Definition at line 265 of file streaminfo.c.

References mpc_streaminfo_get_length_samples().

mpc_int64_t mpc_streaminfo_get_length_samples | ( | mpc_streaminfo * | si | ) |

Returns length of stream si, in samples.

Returns:
  length of stream in samples

Definition at line 272 of file streaminfo.c.

References mpc_streaminfo::frames, mpc_streaminfo::is_true_gapless, and mpc_streaminfo::last_frame_samples.

Referenced by mpc_streaminfo_get_length().

void mpc_streaminfo_init | ( | mpc_streaminfo * | si | ) |

Initializes a streaminfo structure.

Parameters:

  | si | streaminfo structure to initialize

Definition at line 56 of file streaminfo.c.

mpc_int32_t mpc_streaminfo_read | ( | mpc_streaminfo * | si,
|  | mpc_reader * | r
| ) |

Reads streaminfo header from the mpc stream supplied by r.

Parameters:

  | si | streaminfo pointer to which info will be written
  | r | stream reader to supply raw data

Returns:
  error code

Definition at line 204 of file streaminfo.c.

References mpc_streaminfo::average_bitrate, mpc_reader_t::data, ERROR_CODE_FILE, mpc_streaminfo::frames, mpc_reader_t::get_size, mpc_streaminfo::header_position, JumpID3v2(), mpc_streaminfo::pcm_samples, mpc_reader_t::read, mpc_streaminfo::sample_freq, mpc_reader_t::seek, mpc_streaminfo::stream_version, mpc_streaminfo::tag_offset, and mpc_streaminfo::total_file_length.