35#define PADDING_BIT (1U << 9)
39 if (
size < 10 || memcmp(buf,
"ID3", 3))
42 return 10 + (buf[5] & 0x10 ? 10 : 0) +
43 ((buf[6] & 0x7f) << 21 | (buf[7] & 0x7f) << 14 |
44 (buf[8] & 0x7f) << 7 | (buf[9] & 0x7f));
50 printf(
"offset=%zu frames=%u header=%08"PRIX32
" layer=%d sample_rate=%d "
51 "bit_rate=%d crc=%d mode=%d mode_ext=%d copyright=%d original=%d "
52 "emphasis=%d private_bit=%d\n",
59int main(
int argc,
char *argv[])
65 unsigned run_frames = 0, total_frames = 0;
69 fprintf(stderr,
"Usage: %s <file>\n", argv[0]);
74 fprintf(stderr,
"Failed to open '%s'\n", argv[1]);
97 if (encoded !=
bits) {
98 printf(
"offset=%zu header=%08"PRIX32
" encoded back as %08"PRIX32
"\n",
115 pos += decoded == 0 ?
header->frame_size : 1;
120 printf(
"frames=%u\n", total_frames);
__device__ int printf(const char *,...)
static const uint8_t bits[8]
static const uint8_t run_bits[7][16]
void av_file_unmap(uint8_t *bufptr, size_t size)
Unmap or free the buffer bufptr created by av_file_map().
int av_file_map(const char *filename, uint8_t **bufptr, size_t *size, int log_offset, void *log_ctx)
Read the file with name filename, and put its content in a newly allocated buffer or map it with mmap...
Memory handling functions.
static const uint8_t header[24]