Ignore:
Timestamp:
10/06/06 18:51:07 (16 years ago)
Author:
zorg
Message:

Added primitive mpcdec

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libmpcdec/branches/zorg/src/mpc_decoder.c

    r68 r70  
    7979static mpc_int32_t f_read(mpc_decoder *d, void *ptr, mpc_int32_t size)
    8080{
    81     return d->r->read(d->r->data, ptr, size);
     81    return d->r->read(d->r, ptr, size);
    8282}
    8383
    8484static mpc_bool_t f_seek(mpc_decoder *d, mpc_int32_t offset)
    8585{
    86     return d->r->seek(d->r->data, offset);
     86    return d->r->seek(d->r, offset);
    8787}
    8888
     
    861861  mpc_decoder_reset_bitstream_decode(d);
    862862  mpc_decoder_initialisiere_quantisierungstabellen(d, 1.0f);
    863 #if 0
    864   mpc_decoder_init_huffman_sv6(d);
    865   mpc_decoder_init_huffman_sv7(d);
    866 #endif
    867863}
    868864
     
    896892}
    897893
    898 mpc_bool_t mpc_decoder_initialize(mpc_decoder *d, mpc_streaminfo *si)
    899 {
    900     mpc_decoder_set_streaminfo(d, si);
     894mpc_status mpc_decoder_init(mpc_decoder **d, mpc_reader *r, mpc_streaminfo *si)
     895{
     896    mpc_decoder* p_tmp;
     897   
     898    p_tmp = malloc(sizeof *p_tmp);
     899    memset(p_tmp, 0, sizeof *p_tmp);
     900    mpc_decoder_setup(p_tmp, r);
     901
     902    mpc_decoder_set_streaminfo(p_tmp, si);
    901903
    902904    // AB: setting position to the beginning of the data-bitstream
    903     mpc_decoder_seek(d, get_initial_fpos(d));
    904 
    905     d->seeking_pwr = 0;
    906     while (d->OverallFrames > (SEEKING_TABLE_SIZE << d->seeking_pwr))
    907         d->seeking_pwr++;
    908     d->seeking_table_frames = 0;
    909     d->seeking_table[0] = get_initial_fpos(d);
    910 
    911     return TRUE;
     905    mpc_decoder_seek(p_tmp, get_initial_fpos(p_tmp));
     906
     907    p_tmp->seeking_pwr = 0;
     908    while (p_tmp->OverallFrames > (SEEKING_TABLE_SIZE << p_tmp->seeking_pwr))
     909        p_tmp->seeking_pwr++;
     910    p_tmp->seeking_table_frames = 0;
     911    p_tmp->seeking_table[0] = get_initial_fpos(p_tmp);
     912
     913    *d = p_tmp;
     914    return MPC_STATUS_OK;
     915}
     916
     917void mpc_decoder_exit(mpc_decoder *d)
     918{
     919    free(d);
    912920}
    913921
Note: See TracChangeset for help on using the changeset viewer.