Changeset 139


Ignore:
Timestamp:
11/15/06 18:32:43 (17 years ago)
Author:
r2d
Message:
  • added "SE" block check
Location:
libmpc/branches/r2d/libmpcdec
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • libmpc/branches/r2d/libmpcdec/internal.h

    r104 r139  
    7272        mpc_uint32_t bytes_total;
    7373        mpc_bits_reader bits_reader;
    74         mpc_uint32_t block_bits;        // bits remaining in current audio block
     74        mpc_uint32_t block_bits; /// bits remaining in current audio block
     75        mpc_bool_t end; /// end of stream flag
    7576};
    7677
  • libmpc/branches/r2d/libmpcdec/mpc_demux.c

    r138 r139  
    138138                        if (memcmp(b.key, "SI", 2) == 0){
    139139                                int ret = streaminfo_read_header_sv8(&d->si, &d->bits_reader, b.size);
    140                                 if (ret != MPC_STATUS_OK)
    141                                         return ret;
     140                                if (ret != MPC_STATUS_OK) return ret;
    142141                        } else if (memcmp(b.key, "EI", 2) == 0)
    143142                                streaminfo_encoder_info(&d->si, &d->bits_reader);
     
    164163                p_tmp->bits_reader.count = 8;
    165164                p_tmp->block_bits = 0;
     165                p_tmp->end = MPC_FALSE;
    166166                // lire entête
    167167                if (mpc_demux_header(p_tmp) == MPC_STATUS_OK) {
     
    192192        if (d->si.stream_version == 8) {
    193193                mpc_bits_reader r;
    194                 if (d->block_bits < 8 && (d->d->decoded_samples < d->d->samples || d->d->samples == 0)){
     194                if (d->block_bits < 8 && d->end == MPC_FALSE){
    195195                        mpc_block b;
    196196                        d->bits_reader.count &= -8;
     
    198198                        mpc_bits_get_block(&d->bits_reader, &b);
    199199                        while( memcmp(b.key, "AD", 2) != 0 ){ // scan all blocks until audio
     200                                if (memcmp(b.key, "SE", 2) == 0) // end block
     201                                        d->end = MPC_TRUE;
    200202                                mpc_demux_fill(d, 11 + b.size, 0);
    201203                                d->bits_reader.buff += b.size;
     
    218220}
    219221
    220 // static mpc_uint32_t
    221 // mpc_decoder_decode_internal(mpc_decoder *d, MPC_SAMPLE_FORMAT *buffer)
    222 // {
    223 //      mpc_uint32_t output_frame_length = MPC_FRAME_LENGTH;
    224 //      mpc_uint32_t FwdJumpInfo = 0;
    225 //      mpc_uint32_t  FrameBitCnt = 0;
    226 //
    227 //      if (d->decoded_frames >= d->OverallFrames) {
    228 //              return (mpc_uint32_t)(-1);                           // end of file -> abort decoding
    229 //      }
    230 //
    231 //     // add seeking info
    232 //      if (d->seeking_table_frames < d->decoded_frames &&
    233 //                 (d->decoded_frames & ((1 << d->seeking_pwr) - 1)) == 0) {
    234 //              d->seeking_table[d->decoded_frames >> d->seeking_pwr] = mpc_decoder_bits_read(d);
    235 //              d->seeking_table_frames = d->decoded_frames;
    236 //                 }
    237 //
    238 //                 switch (d->StreamVersion) {
    239 //                         case 0x07:
    240 //                         case 0x17:
    241 //              // read jump-info for validity check of frame
    242 //                                 FwdJumpInfo  = mpc_decoder_bitstream_read(d, 20);
    243 //      // decode data and check for validity of frame
    244 //                                 FrameBitCnt = mpc_decoder_bits_read(d);
    245 //
    246 //                                 d->FrameWasValid = mpc_decoder_bits_read(d) - FrameBitCnt == FwdJumpInfo;
    247 //                                 break;
    248 //                         case 0x08:
    249 //                                 if (d->BlockBits < 8){
    250 //                                         mpc_block block;
    251 //                      // trouver le block
    252 //                                         mpc_decoder_bitstream_read(d, d->BlockBits);
    253 //                                         while (1) {
    254 //                                                 mpc_decoder_get_block(d, &block);
    255 //                                                 if (memcmp(block.key, "AD", 2) != 0)
    256 //                                                         mpc_decoder_seek(d, mpc_decoder_bits_read(d) + block.size * 8);
    257 //                                                 else
    258 //                                                         break;
    259 //                                         }
    260 //                                         d->BlockBits = block.size * 8;
    261 //                                 }
    262 //                                 FrameBitCnt = mpc_decoder_bits_read(d);
    263 //                                 mpc_decoder_read_bitstream_sv7(d, FALSE);
    264 //                                 d->BlockBits -= mpc_decoder_bits_read(d) - FrameBitCnt;
    265 //                                 d->FrameWasValid = 1;
    266 //                                 break;
    267 //                         default:
    268 //                                 return (mpc_uint32_t)(-1);
    269 //                 }
    270 //
    271 //                 return output_frame_length;
    272 // }
    273 //
    274 // mpc_uint32_t mpc_decoder_decode(
    275 //              mpc_decoder *d,
    276 //     MPC_SAMPLE_FORMAT *buffer,
    277 //      mpc_uint32_t *vbr_update_acc,
    278 //      mpc_uint32_t *vbr_update_bits)
    279 // {
    280 //      for(;;)
    281 //      {
    282 //         //const mpc_int32_t MaxBrokenFrames = 0; // PluginSettings.MaxBrokenFrames
    283 //
    284 //              mpc_uint32_t RING = d->Zaehler;
    285 //              mpc_int32_t vbr_ring = (RING << 5) + d->pos;
    286 //
    287 //              mpc_uint32_t valid_samples = mpc_decoder_decode_internal(d, buffer);
    288 //
    289 //              if (valid_samples == (mpc_uint32_t)(-1) ) {
    290 //                      return 0;
    291 //              }
    292 //
    293 //              /**************** ERROR CONCEALMENT *****************/
    294 //              if (d->FrameWasValid == 0 ) {
    295 //             // error occurred in bitstream
    296 //                      return (mpc_uint32_t)(-1);
    297 //              }
    298 //              else {
    299 //                      if (vbr_update_acc && vbr_update_bits) {
    300 //                              (*vbr_update_acc) ++;
    301 //                              vbr_ring = (d->Zaehler << 5) + d->pos - vbr_ring;
    302 //                              if (vbr_ring < 0) {
    303 //                                      vbr_ring += 524288;
    304 //                              }
    305 //                              (*vbr_update_bits) += vbr_ring;
    306 //                      }
    307 //
    308 //              }
    309 //              mpc_decoder_update_buffer(d, RING);
    310 //
    311 //              if (valid_samples > 0) {
    312 //                      return valid_samples;
    313 //              }
    314 //      }
    315 // }
    316 
Note: See TracChangeset for help on using the changeset viewer.