Changeset 117 for libmpcdec/branches/zorg
- Timestamp:
- 11/11/06 18:22:26 (18 years ago)
- Location:
- libmpcdec/branches/zorg
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
libmpcdec/branches/zorg/include/mpcdec/streaminfo.h
r104 r117 65 65 mpc_int64_t pcm_samples; ///< Approximate number of pcm samples in stream 66 66 mpc_uint32_t max_band; ///< Maximum band-index used in stream (0...31) 67 mpc_uint32_t is; ///< Intensity stereo (0: off, 1: on)68 67 mpc_uint32_t ms; ///< Mid/side stereo (0: off, 1: on) 69 mpc_uint32_t block_size; ///< Only needed for SV4...SV6 -> not supported 70 mpc_uint32_t profile; ///< Quality profile of stream 71 const char* profile_name; ///< Name of profile used by stream 72 mpc_uint32_t fast_seek; ///< True if stream supports fast-seeking 68 mpc_uint32_t fast_seek; ///< True if stream supports fast-seeking (sv7) 69 mpc_uint32_t frames_per_block; ///< Number of frames in a block (sv8) 73 70 //@} 74 71 … … 84 81 //@{ 85 82 mpc_uint32_t is_true_gapless; ///< True gapless? (0: no, 1: yes) 86 mpc_uint32_t last_frame_samples; ///< Number of valid samples within last frame 83 mpc_uint32_t last_frame_samples; ///< Number of valid samples within last frame 84 //@} 87 85 86 /// @name Encoder informations 87 //@{ 88 88 mpc_uint32_t encoder_version; ///< Version of encoder used 89 89 char encoder[256]; ///< Encoder name 90 mpc_bool_t pns; ///< pns used 91 mpc_uint32_t profile; ///< Quality profile of stream 92 const char* profile_name; ///< Name of profile used by stream 93 //@} 90 94 91 95 mpc_streaminfo_off_t tag_offset; ///< Offset to file tags 92 96 mpc_streaminfo_off_t total_file_length; ///< Total length of underlying file 93 //@}94 97 } mpc_streaminfo; 95 98 -
libmpcdec/branches/zorg/src/mpc_demux.c
r108 r117 45 45 mpc_status streaminfo_read_header_sv8(mpc_streaminfo* si, const mpc_bits_reader * r_in); 46 46 mpc_status streaminfo_read_header_sv7(mpc_streaminfo* si, mpc_bits_reader * r_in); 47 void streaminfo_encoder_info(mpc_streaminfo* si, const mpc_bits_reader * r_in); 48 void streaminfo_gain(mpc_streaminfo* si, const mpc_bits_reader * r_in); 47 49 48 50 #define MAX_FRAME_SIZE 4352 … … 133 135 if (memcmp(b.key, "SI", 2) == 0) 134 136 streaminfo_read_header_sv8(&d->si, &d->bits_reader); 137 else if (memcmp(b.key, "EI", 2) == 0) 138 streaminfo_encoder_info(&d->si, &d->bits_reader); 139 else if (memcmp(b.key, "RG", 2) == 0) 140 streaminfo_gain(&d->si, &d->bits_reader); 135 141 d->bits_reader.buff += b.size; 136 142 size = mpc_bits_get_block(&d->bits_reader, &b); -
libmpcdec/branches/zorg/src/streaminfo.c
r104 r117 60 60 mpc_get_encoder_string(mpc_streaminfo* si) 61 61 { 62 if (si->encoder_version == 0) { 63 sprintf(si->encoder, "Buschmann 1.7.0...9, Klemm 0.90...1.05"); 62 if (si->stream_version < 8) { 63 if (si->encoder_version == 0) { 64 sprintf(si->encoder, "Buschmann 1.7.0...9, Klemm 0.90...1.05"); 65 } else { 66 switch (si->encoder_version % 10) { 67 case 0: 68 sprintf(si->encoder, "Release %u.%u", si->encoder_version / 100, 69 si->encoder_version / 10 % 10); 70 break; 71 case 2: case 4: case 6: case 8: 72 sprintf(si->encoder, "Beta %u.%02u", si->encoder_version / 100, 73 si->encoder_version % 100); 74 break; 75 default: 76 sprintf(si->encoder, "--Alpha-- %u.%02u", 77 si->encoder_version / 100, si->encoder_version % 100); 78 break; 79 } 80 } 64 81 } else { 65 switch (si->encoder_version % 10) { 66 case 0: 67 sprintf(si->encoder, "Release %u.%u", si->encoder_version / 100, 68 si->encoder_version / 10 % 10); 69 break; 70 case 2: case 4: case 6: case 8: 71 sprintf(si->encoder, "Beta %u.%02u", si->encoder_version / 100, 72 si->encoder_version % 100); 73 break; 74 default: 75 sprintf(si->encoder, "--Alpha-- %u.%02u", 76 si->encoder_version / 100, si->encoder_version % 100); 77 break; 78 } 82 int major = si->encoder_version >> 24; 83 int minor = (si->encoder_version >> 16) & 0xFF; 84 int impl = (si->encoder_version >> 8) & 0xFF; 85 int build = si->encoder_version & 0xFF; 86 char * tmp = "--Stable--"; 87 88 if (minor & 1) 89 tmp = "--Unstable--"; 90 91 sprintf(si->encoder, "%s %u.%u.%u build %u", tmp, major, minor, impl, 92 build); 79 93 } 80 94 } … … 87 101 88 102 si->bitrate = 0; 89 si->block_size = 1;90 103 si->frames = mpc_bits_read(r, 32); 91 si->is = mpc_bits_read(r, 1); //should be 0104 mpc_bits_read(r, 1); // intensity stereo : should be 0 92 105 si->ms = mpc_bits_read(r, 1); 93 106 si->max_band = mpc_bits_read(r, 6); … … 138 151 si->channels = mpc_bits_read(&r, 4) + 1; 139 152 si->max_band = mpc_bits_read(&r, 5) + 1; 140 // FIXME : this flag will be removed, must be 0141 si->is = mpc_bits_read(&r, 1);142 153 si->ms = mpc_bits_read(&r, 1); 143 144 si->bitrate = 0; 145 si->b lock_size = 1;154 si->frames_per_block = 1 << mpc_bits_read(&r, 4); 155 156 si->bitrate = 0; 146 157 147 158 si->pcm_samples = sampleCount; … … 152 163 153 164 return MPC_STATUS_OK; 165 } 166 167 /// Reads encoder informations 168 void streaminfo_encoder_info(mpc_streaminfo* si, const mpc_bits_reader * r_in) 169 { 170 mpc_bits_reader r = *r_in; 171 172 si->profile = mpc_bits_read(&r, 4); 173 si->profile_name = mpc_get_version_string(si->profile); 174 si->pns = mpc_bits_read(&r, 1); 175 mpc_bits_read(&r, 3); // unused 176 si->encoder_version = mpc_bits_read(&r, 4) << 24; // major 177 si->encoder_version |= mpc_bits_read(&r, 8) << 16; // minor 178 si->encoder_version |= mpc_bits_read(&r, 4) << 8; // implementation 179 si->encoder_version |= mpc_bits_read(&r, 8); // build 180 181 mpc_get_encoder_string(si); 182 } 183 184 /// Reads replay gain datas 185 void streaminfo_gain(mpc_streaminfo* si, const mpc_bits_reader * r_in) 186 { 187 mpc_bits_reader r = *r_in; 188 189 mpc_bits_read(&r, 8); // gain version 190 // FIXME : add gain conversion 191 si->gain_title = (mpc_uint16_t) mpc_bits_read(&r, 16); 192 si->peak_title = (mpc_uint16_t) mpc_bits_read(&r, 16); 193 si->gain_album = (mpc_uint16_t) mpc_bits_read(&r, 16); 194 si->peak_album = (mpc_uint16_t) mpc_bits_read(&r, 16); 154 195 } 155 196
Note: See TracChangeset
for help on using the changeset viewer.