1
0
Fork 0
forked from len0rd/rockbox

mpegplayer: Get A-V synchronized. Improve frame sync and dropping logic and take advantage of decoder's ability to assist. Straighten out some threading problems. Clean it up a bit. Added some plugin API functions and decided it was a good time to do a good sorting on them so your next update from this build should be a full replacement.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@13094 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Michael Sevakis 2007-04-10 14:18:30 +00:00
parent 536c5d9e74
commit 6689cb0f9b
4 changed files with 1139 additions and 534 deletions

View file

@ -233,6 +233,9 @@ static const struct plugin_api rockbox_api = {
/* kernel/ system */ /* kernel/ system */
PREFIX(sleep), PREFIX(sleep),
yield, yield,
#ifdef HAVE_PRIORITY_SCHEDULING
priority_yield,
#endif
&current_tick, &current_tick,
default_event_handler, default_event_handler,
default_event_handler_ex, default_event_handler_ex,
@ -306,6 +309,9 @@ static const struct plugin_api rockbox_api = {
utf8seek, utf8seek,
/* sound */ /* sound */
#if CONFIG_CODEC == SWCODEC && defined(HAVE_RECORDING)
sound_default,
#endif
sound_set, sound_set,
set_sound, set_sound,
@ -321,17 +327,40 @@ static const struct plugin_api rockbox_api = {
#endif #endif
#endif #endif
#if CONFIG_CODEC == SWCODEC #if CONFIG_CODEC == SWCODEC
&audio_master_sampr_list[0],
&hw_freq_sampr[0],
#ifndef SIMULATOR
pcm_apply_settings,
#endif
pcm_play_data, pcm_play_data,
pcm_play_stop, pcm_play_stop,
pcm_set_frequency, pcm_set_frequency,
pcm_is_playing, pcm_is_playing,
pcm_is_paused,
pcm_play_pause, pcm_play_pause,
#endif pcm_get_bytes_waiting,
#if CONFIG_CODEC == SWCODEC
pcm_calculate_peaks, pcm_calculate_peaks,
#ifdef HAVE_RECORDING
&rec_freq_sampr[0],
#ifndef SIMULATOR
pcm_init_recording,
pcm_close_recording,
pcm_record_data,
pcm_record_more,
pcm_stop_recording,
pcm_calculate_rec_peaks,
audio_set_recording_gain,
audio_set_output_source,
rec_set_source,
#endif
#endif /* HAVE_RECORDING */
#endif #endif
/* playback control */ /* playback control */
playlist_amount,
playlist_resume,
playlist_start,
PREFIX(audio_play), PREFIX(audio_play),
audio_stop, audio_stop,
audio_pause, audio_pause,
@ -340,7 +369,6 @@ static const struct plugin_api rockbox_api = {
audio_prev, audio_prev,
audio_ff_rewind, audio_ff_rewind,
audio_next_track, audio_next_track,
playlist_amount,
audio_status, audio_status,
audio_has_changed_track, audio_has_changed_track,
audio_current_track, audio_current_track,
@ -414,6 +442,9 @@ static const struct plugin_api rockbox_api = {
plugin_get_buffer, plugin_get_buffer,
plugin_get_audio_buffer, plugin_get_audio_buffer,
plugin_tsr, plugin_tsr,
#ifdef IRAM_STEAL
plugin_iram_init,
#endif
#if defined(DEBUG) || defined(SIMULATOR) #if defined(DEBUG) || defined(SIMULATOR)
debugf, debugf,
#endif #endif
@ -421,6 +452,7 @@ static const struct plugin_api rockbox_api = {
_logf, _logf,
#endif #endif
&global_settings, &global_settings,
&global_status,
mp3info, mp3info,
count_mp3_frames, count_mp3_frames,
create_xing_header, create_xing_header,
@ -444,52 +476,15 @@ static const struct plugin_api rockbox_api = {
#if LCD_DEPTH > 1 #if LCD_DEPTH > 1
lcd_get_backdrop, lcd_get_backdrop,
#endif #endif
/* new stuff at the end, sort into place next time /* new stuff at the end, sort into place next time
the API gets incompatible */ the API gets incompatible */
/* Keep these at the bottom till fully proven */
#if CONFIG_CODEC == SWCODEC
&audio_master_sampr_list[0],
&hw_freq_sampr[0],
#ifndef SIMULATOR
pcm_apply_settings,
#endif
#ifdef HAVE_RECORDING
&rec_freq_sampr[0],
#ifndef SIMULATOR
pcm_init_recording,
pcm_close_recording,
pcm_record_data,
pcm_stop_recording,
pcm_calculate_rec_peaks,
audio_set_recording_gain,
audio_set_output_source,
rec_set_source,
#endif
#endif /* HAVE_RECORDING */
#endif /* CONFIG_CODEC == SWCODEC */
#ifdef IRAM_STEAL
plugin_iram_init,
#endif
#if CONFIG_CODEC == SWCODEC && defined(HAVE_RECORDING) && !defined(SIMULATOR)
sound_default,
pcm_record_more,
#endif
#ifdef IRIVER_H100_SERIES #ifdef IRIVER_H100_SERIES
/* Routines for the iriver_flash -plugin. */ /* Routines for the iriver_flash -plugin. */
detect_original_firmware, detect_original_firmware,
detect_flashed_ramimage, detect_flashed_ramimage,
detect_flashed_romimage, detect_flashed_romimage,
#endif
playlist_resume,
playlist_start,
&global_status,
#if CONFIG_CODEC == SWCODEC
pcm_get_bytes_waiting,
#endif #endif
}; };

View file

@ -110,12 +110,12 @@
#define PLUGIN_MAGIC 0x526F634B /* RocK */ #define PLUGIN_MAGIC 0x526F634B /* RocK */
/* increase this every time the api struct changes */ /* increase this every time the api struct changes */
#define PLUGIN_API_VERSION 51 #define PLUGIN_API_VERSION 52
/* update this to latest version if a change to the api struct breaks /* update this to latest version if a change to the api struct breaks
backwards compatibility (and please take the opportunity to sort in any backwards compatibility (and please take the opportunity to sort in any
new function which are "waiting" at the end of the function table) */ new function which are "waiting" at the end of the function table) */
#define PLUGIN_MIN_API_VERSION 51 #define PLUGIN_MIN_API_VERSION 52
/* plugin return codes */ /* plugin return codes */
enum plugin_status { enum plugin_status {
@ -322,6 +322,9 @@ struct plugin_api {
/* kernel/ system */ /* kernel/ system */
void (*PREFIX(sleep))(int ticks); void (*PREFIX(sleep))(int ticks);
void (*yield)(void); void (*yield)(void);
#ifdef HAVE_PRIORITY_SCHEDULING
void (*priority_yield)(void);
#endif
long* current_tick; long* current_tick;
long (*default_event_handler)(long event); long (*default_event_handler)(long event);
long (*default_event_handler_ex)(long event, void (*callback)(void *), void *parameter); long (*default_event_handler_ex)(long event, void (*callback)(void *), void *parameter);
@ -401,6 +404,9 @@ struct plugin_api {
int (*utf8seek)(const unsigned char* utf8, int offset); int (*utf8seek)(const unsigned char* utf8, int offset);
/* sound */ /* sound */
#if CONFIG_CODEC == SWCODEC && defined(HAVE_RECORDING)
int (*sound_default)(int setting);
#endif
void (*sound_set)(int setting, int value); void (*sound_set)(int setting, int value);
bool (*set_sound)(const unsigned char * string, bool (*set_sound)(const unsigned char * string,
int* variable, int setting); int* variable, int setting);
@ -416,18 +422,42 @@ struct plugin_api {
#endif #endif
#endif /* !SIMULATOR */ #endif /* !SIMULATOR */
#if CONFIG_CODEC == SWCODEC #if CONFIG_CODEC == SWCODEC
const unsigned long *audio_master_sampr_list;
const unsigned long *hw_freq_sampr;
#ifndef SIMULATOR
void (*pcm_apply_settings)(void);
#endif
void (*pcm_play_data)(pcm_more_callback_type get_more, void (*pcm_play_data)(pcm_more_callback_type get_more,
unsigned char* start, size_t size); unsigned char* start, size_t size);
void (*pcm_play_stop)(void); void (*pcm_play_stop)(void);
void (*pcm_set_frequency)(unsigned int frequency); void (*pcm_set_frequency)(unsigned int frequency);
bool (*pcm_is_playing)(void); bool (*pcm_is_playing)(void);
bool (*pcm_is_paused)(void);
void (*pcm_play_pause)(bool play); void (*pcm_play_pause)(bool play);
#endif size_t (*pcm_get_bytes_waiting)(void);
#if CONFIG_CODEC == SWCODEC
void (*pcm_calculate_peaks)(int *left, int *right); void (*pcm_calculate_peaks)(int *left, int *right);
#ifdef HAVE_RECORDING
const unsigned long *rec_freq_sampr;
#ifndef SIMULATOR
void (*pcm_init_recording)(void);
void (*pcm_close_recording)(void);
void (*pcm_record_data)(pcm_more_callback_type2 more_ready,
void *start, size_t size);
void (*pcm_record_more)(void *start, size_t size);
void (*pcm_stop_recording)(void);
void (*pcm_calculate_rec_peaks)(int *left, int *right);
void (*audio_set_recording_gain)(int left, int right, int type);
void (*audio_set_output_source)(int monitor);
void (*rec_set_source)(int source, unsigned flags);
#endif
#endif /* HAVE_RECORDING */
#endif #endif
/* playback control */ /* playback control */
int (*playlist_amount)(void);
int (*playlist_resume)(void);
int (*playlist_start)(int start_index, int offset);
void (*PREFIX(audio_play))(long offset); void (*PREFIX(audio_play))(long offset);
void (*audio_stop)(void); void (*audio_stop)(void);
void (*audio_pause)(void); void (*audio_pause)(void);
@ -436,7 +466,6 @@ struct plugin_api {
void (*audio_prev)(void); void (*audio_prev)(void);
void (*audio_ff_rewind)(long newtime); void (*audio_ff_rewind)(long newtime);
struct mp3entry* (*audio_next_track)(void); struct mp3entry* (*audio_next_track)(void);
int (*playlist_amount)(void);
int (*audio_status)(void); int (*audio_status)(void);
bool (*audio_has_changed_track)(void); bool (*audio_has_changed_track)(void);
struct mp3entry* (*audio_current_track)(void); struct mp3entry* (*audio_current_track)(void);
@ -519,6 +548,10 @@ struct plugin_api {
void* (*plugin_get_buffer)(int* buffer_size); void* (*plugin_get_buffer)(int* buffer_size);
void* (*plugin_get_audio_buffer)(int* buffer_size); void* (*plugin_get_audio_buffer)(int* buffer_size);
void (*plugin_tsr)(bool (*exit_callback)(bool reenter)); void (*plugin_tsr)(bool (*exit_callback)(bool reenter));
#ifdef IRAM_STEAL
void (*plugin_iram_init)(char *iramstart, char *iramcopy, size_t iram_size,
char *iedata, size_t iedata_size);
#endif
#if defined(DEBUG) || defined(SIMULATOR) #if defined(DEBUG) || defined(SIMULATOR)
void (*debugf)(const char *fmt, ...) ATTRIBUTE_PRINTF(1, 2); void (*debugf)(const char *fmt, ...) ATTRIBUTE_PRINTF(1, 2);
#endif #endif
@ -526,6 +559,7 @@ struct plugin_api {
void (*logf)(const char *fmt, ...) ATTRIBUTE_PRINTF(1, 2); void (*logf)(const char *fmt, ...) ATTRIBUTE_PRINTF(1, 2);
#endif #endif
struct user_settings* global_settings; struct user_settings* global_settings;
struct system_status *global_status;
bool (*mp3info)(struct mp3entry *entry, const char *filename, bool v1first); bool (*mp3info)(struct mp3entry *entry, const char *filename, bool v1first);
int (*count_mp3_frames)(int fd, int startpos, int filesize, int (*count_mp3_frames)(int fd, int startpos, int filesize,
void (*progressfunc)(int)); void (*progressfunc)(int));
@ -560,51 +594,11 @@ struct plugin_api {
/* new stuff at the end, sort into place next time /* new stuff at the end, sort into place next time
the API gets incompatible */ the API gets incompatible */
/* Keep these at the bottom till fully proven */
#if CONFIG_CODEC == SWCODEC
const unsigned long *audio_master_sampr_list;
const unsigned long *hw_freq_sampr;
#ifndef SIMULATOR
void (*pcm_apply_settings)(void);
#endif
#ifdef HAVE_RECORDING
const unsigned long *rec_freq_sampr;
#ifndef SIMULATOR
void (*pcm_init_recording)(void);
void (*pcm_close_recording)(void);
void (*pcm_record_data)(pcm_more_callback_type2 more_ready,
void *start, size_t size);
void (*pcm_stop_recording)(void);
void (*pcm_calculate_rec_peaks)(int *left, int *right);
void (*audio_set_recording_gain)(int left, int right, int type);
void (*audio_set_output_source)(int monitor);
void (*rec_set_source)(int source, unsigned flags);
#endif
#endif /* HAVE_RECORDING */
#endif /* CONFIG_CODEC == SWCODEC */
#ifdef IRAM_STEAL
void (*plugin_iram_init)(char *iramstart, char *iramcopy, size_t iram_size,
char *iedata, size_t iedata_size);
#endif
#if CONFIG_CODEC == SWCODEC && defined(HAVE_RECORDING) && !defined(SIMULATOR)
int (*sound_default)(int setting);
void (*pcm_record_more)(void *start, size_t size);
#endif
#ifdef IRIVER_H100_SERIES #ifdef IRIVER_H100_SERIES
/* Routines for the iriver_flash -plugin. */ /* Routines for the iriver_flash -plugin. */
bool (*detect_original_firmware)(void); bool (*detect_original_firmware)(void);
bool (*detect_flashed_ramimage)(void); bool (*detect_flashed_ramimage)(void);
bool (*detect_flashed_romimage)(void); bool (*detect_flashed_romimage)(void);
#endif
int (*playlist_resume)(void);
int (*playlist_start)(int start_index, int offset);
struct system_status *global_status;
#if CONFIG_CODEC == SWCODEC
size_t (*pcm_get_bytes_waiting)(void);
#endif #endif
}; };

File diff suppressed because it is too large Load diff

View file

@ -40,6 +40,13 @@
: /* %0 */ "d"(mask), \ : /* %0 */ "d"(mask), \
/* %1 */ "a"(address)) /* %1 */ "a"(address))
#define add_l(addend, address) \
asm \
("add.l %0, (%1)" \
: \
: /* %0 */ "r"(addend), \
/* %1 */ "a"(address))
#define EMAC_ROUND 0x10 #define EMAC_ROUND 0x10
#define EMAC_FRACTIONAL 0x20 #define EMAC_FRACTIONAL 0x20
#define EMAC_SATURATE 0x80 #define EMAC_SATURATE 0x80