2003-03-10 14:55:31 +00:00
|
|
|
/***************************************************************************
|
|
|
|
* __________ __ ___.
|
|
|
|
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
|
|
|
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
|
|
|
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
|
|
|
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
|
|
|
* \/ \/ \/ \/ \/
|
|
|
|
* $Id$
|
|
|
|
*
|
|
|
|
* Copyright (C) 2002 by Linus Nielsen Feltzing
|
|
|
|
*
|
2008-06-28 18:10:04 +00:00
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
2003-03-10 14:55:31 +00:00
|
|
|
*
|
|
|
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
|
|
|
* KIND, either express or implied.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#ifndef _MP3DATA_H_
|
|
|
|
#define _MP3DATA_H_
|
|
|
|
|
2005-09-10 12:28:16 +00:00
|
|
|
#define MPEG_VERSION1 0
|
|
|
|
#define MPEG_VERSION2 1
|
|
|
|
#define MPEG_VERSION2_5 2
|
2003-03-10 14:55:31 +00:00
|
|
|
|
|
|
|
struct mp3info {
|
|
|
|
/* Standard MP3 frame header fields */
|
|
|
|
int version;
|
|
|
|
int layer;
|
|
|
|
int bitrate;
|
2005-09-10 12:28:16 +00:00
|
|
|
long frequency;
|
2003-03-10 14:55:31 +00:00
|
|
|
int padding;
|
|
|
|
int channel_mode;
|
2005-09-10 12:28:16 +00:00
|
|
|
int frame_size; /* Frame size in bytes */
|
2011-02-27 20:49:08 +00:00
|
|
|
int frame_samples;/* Samples per frame */
|
2005-09-10 12:28:16 +00:00
|
|
|
int ft_num; /* Numerator of frametime in milliseconds */
|
|
|
|
int ft_den; /* Denominator of frametime in milliseconds */
|
2003-03-10 14:55:31 +00:00
|
|
|
|
2005-09-10 12:28:16 +00:00
|
|
|
bool is_vbr; /* True if the file is VBR */
|
|
|
|
bool has_toc; /* True if there is a VBR header in the file */
|
2003-03-10 14:55:31 +00:00
|
|
|
unsigned char toc[100];
|
2005-09-10 12:28:16 +00:00
|
|
|
unsigned long frame_count; /* Number of frames in the file (if VBR) */
|
|
|
|
unsigned long byte_count; /* File size in bytes */
|
|
|
|
unsigned long file_time; /* Length of the whole file in milliseconds */
|
2005-06-12 14:03:31 +00:00
|
|
|
int enc_delay; /* Encoder delay, fetched from LAME header */
|
|
|
|
int enc_padding; /* Padded samples added to last frame. LAME header */
|
2003-03-10 14:55:31 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/* Xing header information */
|
2005-06-12 14:03:31 +00:00
|
|
|
#define VBR_FRAMES_FLAG 0x01
|
|
|
|
#define VBR_BYTES_FLAG 0x02
|
|
|
|
#define VBR_TOC_FLAG 0x04
|
|
|
|
#define VBR_QUALITY_FLAG 0x08
|
2003-03-10 14:55:31 +00:00
|
|
|
|
2005-09-15 05:29:26 +00:00
|
|
|
#define MAX_XING_HEADER_SIZE 576
|
2005-09-04 21:55:15 +00:00
|
|
|
|
2005-09-15 05:29:26 +00:00
|
|
|
unsigned long find_next_frame(int fd, long *offset, long max_offset,
|
|
|
|
unsigned long last_header);
|
2005-01-30 14:11:50 +00:00
|
|
|
unsigned long mem_find_next_frame(int startpos, long *offset, long max_offset,
|
2003-11-02 11:24:38 +00:00
|
|
|
unsigned long last_header);
|
2003-03-10 14:55:31 +00:00
|
|
|
int get_mp3file_info(int fd, struct mp3info *info);
|
|
|
|
int count_mp3_frames(int fd, int startpos, int filesize,
|
|
|
|
void (*progressfunc)(int));
|
2005-09-15 05:29:26 +00:00
|
|
|
int create_xing_header(int fd, long startpos, long filesize,
|
|
|
|
unsigned char *buf, unsigned long num_frames,
|
|
|
|
unsigned long rec_time, unsigned long header_template,
|
2003-03-10 18:05:01 +00:00
|
|
|
void (*progressfunc)(int), bool generate_toc);
|
2003-03-10 14:55:31 +00:00
|
|
|
|
2007-02-15 22:55:22 +00:00
|
|
|
extern unsigned long bytes2int(unsigned long b0,
|
|
|
|
unsigned long b1,
|
|
|
|
unsigned long b2,
|
|
|
|
unsigned long b3);
|
|
|
|
|
2003-03-10 14:55:31 +00:00
|
|
|
#endif
|