2003-02-07 09:41:57 +00:00
|
|
|
/***************************************************************************
|
|
|
|
* __________ __ ___.
|
|
|
|
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
|
|
|
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
|
|
|
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
|
|
|
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
|
|
|
* \/ \/ \/ \/ \/
|
|
|
|
* $Id$
|
|
|
|
*
|
|
|
|
* Copyright (C) 2002 by Linus Nielsen Feltzing
|
|
|
|
*
|
|
|
|
* All files in this archive are subject to the GNU General Public License.
|
|
|
|
* See the file COPYING in the source tree root for full license agreement.
|
|
|
|
*
|
|
|
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
|
|
|
* KIND, either express or implied.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
#ifndef _MPEG_H_
|
|
|
|
#define _MPEG_H_
|
|
|
|
|
|
|
|
#include <stdbool.h>
|
|
|
|
|
|
|
|
#define MPEG_SWAP_CHUNKSIZE 0x2000
|
|
|
|
#define MPEG_HIGH_WATER 2 /* We leave 2 bytes empty because otherwise we
|
|
|
|
wouldn't be able to see the difference between
|
|
|
|
an empty buffer and a full one. */
|
|
|
|
#define MPEG_LOW_WATER 0x60000
|
2003-04-15 08:16:27 +00:00
|
|
|
#define MPEG_RECORDING_LOW_WATER 0x80000
|
2003-02-07 09:41:57 +00:00
|
|
|
#define MPEG_LOW_WATER_CHUNKSIZE 0x40000
|
|
|
|
#define MPEG_LOW_WATER_SWAP_CHUNKSIZE 0x10000
|
|
|
|
#define MPEG_PLAY_PENDING_THRESHOLD 0x10000
|
|
|
|
#define MPEG_PLAY_PENDING_SWAPSIZE 0x10000
|
|
|
|
|
2003-12-31 03:13:29 +00:00
|
|
|
#define MPEG_MAX_PRERECORD_SECONDS 30
|
|
|
|
|
2003-04-20 22:00:30 +00:00
|
|
|
/* For ID3 info and VBR header */
|
|
|
|
#define MPEG_RESERVED_HEADER_SPACE (4096 + 1500)
|
|
|
|
|
2003-02-07 09:41:57 +00:00
|
|
|
struct mpeg_debug
|
|
|
|
{
|
|
|
|
int mp3buflen;
|
|
|
|
int mp3buf_write;
|
|
|
|
int mp3buf_swapwrite;
|
|
|
|
int mp3buf_read;
|
|
|
|
|
|
|
|
int last_dma_chunk_size;
|
|
|
|
|
|
|
|
bool dma_on;
|
|
|
|
bool playing;
|
|
|
|
bool play_pending;
|
|
|
|
bool is_playing;
|
|
|
|
bool filling;
|
|
|
|
bool dma_underrun;
|
|
|
|
|
|
|
|
int unplayed_space;
|
|
|
|
int playable_space;
|
|
|
|
int unswapped_space;
|
|
|
|
|
|
|
|
int low_watermark_level;
|
|
|
|
int lowest_watermark_level;
|
|
|
|
};
|
|
|
|
|
2004-01-05 20:42:51 +00:00
|
|
|
void mpeg_init(void);
|
2003-02-07 09:41:57 +00:00
|
|
|
void mpeg_play(int offset);
|
|
|
|
void mpeg_stop(void);
|
|
|
|
void mpeg_pause(void);
|
|
|
|
void mpeg_resume(void);
|
|
|
|
void mpeg_next(void);
|
|
|
|
void mpeg_prev(void);
|
2003-08-29 04:36:35 +00:00
|
|
|
void mpeg_ff_rewind(int newtime);
|
2003-02-07 09:41:57 +00:00
|
|
|
void mpeg_flush_and_reload_tracks(void);
|
|
|
|
struct mp3entry* mpeg_current_track(void);
|
2004-01-15 15:32:49 +00:00
|
|
|
struct mp3entry* mpeg_next_track(void);
|
2003-02-07 09:41:57 +00:00
|
|
|
bool mpeg_has_changed_track(void);
|
|
|
|
int mpeg_status(void);
|
|
|
|
#if defined(HAVE_MAS3587F) || defined(SIMULATOR)
|
|
|
|
void mpeg_init_recording(void);
|
|
|
|
void mpeg_init_playback(void);
|
2004-08-16 23:37:23 +00:00
|
|
|
void mpeg_record(const char *filename);
|
|
|
|
void mpeg_new_file(const char *filename);
|
2003-02-07 09:41:57 +00:00
|
|
|
void mpeg_set_recording_options(int frequency, int quality,
|
2003-04-20 22:00:30 +00:00
|
|
|
int source, int channel_mode,
|
2003-12-31 03:13:29 +00:00
|
|
|
bool editable, int prerecord_time);
|
2003-07-22 18:34:23 +00:00
|
|
|
void mpeg_set_recording_gain(int left, int right, bool use_mic);
|
2003-02-14 02:48:12 +00:00
|
|
|
unsigned long mpeg_recorded_time(void);
|
2003-02-07 09:41:57 +00:00
|
|
|
unsigned long mpeg_num_recorded_bytes(void);
|
2004-06-03 12:10:40 +00:00
|
|
|
void mpeg_pause_recording(void);
|
|
|
|
void mpeg_resume_recording(void);
|
2003-02-07 09:41:57 +00:00
|
|
|
#endif
|
|
|
|
void mpeg_get_debugdata(struct mpeg_debug *dbgdata);
|
|
|
|
void mpeg_set_buffer_margin(int seconds);
|
2003-06-19 12:08:22 +00:00
|
|
|
unsigned int mpeg_error(void);
|
|
|
|
void mpeg_error_clear(void);
|
2004-07-29 13:58:16 +00:00
|
|
|
int mpeg_get_file_pos(void);
|
|
|
|
unsigned long mpeg_get_last_header(void);
|
2003-02-07 09:41:57 +00:00
|
|
|
|
2004-01-10 15:39:56 +00:00
|
|
|
/* in order to keep the recording here, I have to expose this */
|
|
|
|
void rec_tick(void);
|
|
|
|
void playback_tick(void); /* FixMe: get rid of this, use mp3_get_playtime() */
|
2004-07-27 14:10:48 +00:00
|
|
|
void mpeg_id3_options(bool _v1first);
|
2004-01-10 15:39:56 +00:00
|
|
|
|
2003-02-07 09:41:57 +00:00
|
|
|
#define MPEG_STATUS_PLAY 1
|
|
|
|
#define MPEG_STATUS_PAUSE 2
|
|
|
|
#define MPEG_STATUS_RECORD 4
|
2003-12-31 03:13:29 +00:00
|
|
|
#define MPEG_STATUS_PRERECORD 8
|
|
|
|
#define MPEG_STATUS_ERROR 16
|
2003-06-19 12:08:22 +00:00
|
|
|
|
|
|
|
#define MPEGERR_DISK_FULL 1
|
2003-02-07 09:41:57 +00:00
|
|
|
|
|
|
|
#endif
|