Ignore:
Timestamp:
02/08/07 21:36:52 (17 years ago)
Author:
r2d
Message:
  • file length should be OK for all files
  • seems there is a bug at end of file
File:
1 edited

Legend:

Unmodified
Added
Removed
  • libmpc/branches/r2d/mpc2sv8/mpc2sv8.c

    r203 r204  
    8080        mpc_status err;
    8181        mpc_encoder_t e;
     82        mpc_uint_t si_size;
    8283
    8384    printf("mpc2sv8 - musepack (mpc) sv7 to sv8 converter\n");
     
    105106        writeStreamInfo( &e, si.max_band, si.ms > 0, si.samples, si.sample_freq,
    106107                                          si.channels); // FIXME : convert replay gain info
    107         writeBlock(&e, "SI", MPC_TRUE);
     108        si_size = writeBlock(&e, "SI", MPC_TRUE, 0);
    108109        writeEncoderInfo(&e, si.profile, si.pns, 0, 0, 0, 0); // FIXME : convert encoder information
    109         writeBlock(&e, "EI", MPC_FALSE);
     110        writeBlock(&e, "EI", MPC_FALSE, 0);
    110111        e.seek_ptr = ftell(e.outputFile);
    111112        writeBits (&e, 0, 8);
    112113        writeBits (&e, 0, 32); // jump 40 bits for seek table pointer
    113         writeBlock(&e, "SP", MPC_FALSE); // reserve space for seek pointer
     114        writeBlock(&e, "SP", MPC_FALSE, 0); // reserve space for seek pointer
    114115        while(MPC_TRUE)
    115116        {
     
    130131                e.seek_pos++;
    131132        }
    132         writeBlock(&e, "AD", MPC_FALSE);
     133        writeBlock(&e, "AD", MPC_FALSE, 0);
    133134        writeSeekTable(&e);
    134         writeBlock(&e, "ST", MPC_FALSE); // write seek table block
    135         writeBlock(&e, "SE", MPC_FALSE); // write end of stream block
    136         // FIXME : put correct stream length in SI block
     135        writeBlock(&e, "ST", MPC_FALSE, 0); // write seek table block
     136        writeBlock(&e, "SE", MPC_FALSE, 0); // write end of stream block
     137        if (demux->d->samples != si.samples) {
     138                fseek(e.outputFile, e.seek_ref + 4, SEEK_SET);
     139                writeStreamInfo( &e, si.max_band, si.ms > 0, demux->d->samples,
     140                                                  si.sample_freq, si.channels);
     141                writeBlock(&e, "SI", MPC_TRUE, si_size);
     142                fseek(e.outputFile, 0, SEEK_END);
     143        }
    137144
    138145        // copie fin fichier
Note: See TracChangeset for help on using the changeset viewer.