History

added option to decode headers only If the 'pcm' parameter to mp3dec_decode_frame() is set to NULL, all bitstream and audio decoding is skipped, but the header is still decoded and frame info is still generated. This is useful for quickly scanning an MP3 file, e.g. to determine the duration or generate a VBR seek index.

Martin Fiedler committed 8 years ago

Commit 7a6445e1 parent 337b2521 file · +5 −0Browse files

Unified · Split

minimp3.h+5−0
@@ -1645,6 +1645,11 @@ int mp3dec_decode_frame(mp3dec_t *dec, const uint8_t *mp3, int mp3_bytes, short · 1644 unmodified lines
1645 info->layer = 4 - HDR_GET_LAYER(hdr);1645 info->layer = 4 - HDR_GET_LAYER(hdr);
1646 info->bitrate_kbps = hdr_bitrate_kbps(hdr);1646 info->bitrate_kbps = hdr_bitrate_kbps(hdr);
1647 1647
1648 if (!pcm)
1649 {
1650 return hdr_frame_samples(hdr);
1651 }
1652
1648 bs_init(bs_frame, hdr + HDR_SIZE, frame_size - HDR_SIZE);1653 bs_init(bs_frame, hdr + HDR_SIZE, frame_size - HDR_SIZE);
1649 if (HDR_IS_CRC(hdr))1654 if (HDR_IS_CRC(hdr))
1650 {1655 {

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t