forked from len0rd/rockbox
Codecs: mp3: Move strip tags to codec
Another fix for FS#13626 (replacement for 2bd88936f7
)
Change-Id: Ife5f65539457559fd908d0048d4df94649b0b894
This commit is contained in:
parent
78903e9d38
commit
38105860dc
6 changed files with 24 additions and 0 deletions
|
@ -1408,6 +1408,16 @@ ssize_t bufread(int handle_id, size_t size, void *dest)
|
||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
off_t bufstripsize(int handle_id, off_t size)
|
||||||
|
{
|
||||||
|
struct memory_handle *h = find_handle(handle_id);
|
||||||
|
if (!h || h->filesize < size)
|
||||||
|
return ERR_INVALID_VALUE;
|
||||||
|
|
||||||
|
h->filesize = size;
|
||||||
|
return size;
|
||||||
|
}
|
||||||
|
|
||||||
/* Update the "data" pointer to make the handle's data available to the caller.
|
/* Update the "data" pointer to make the handle's data available to the caller.
|
||||||
Return the length of the available linear data or < 0 for failure (handle
|
Return the length of the available linear data or < 0 for failure (handle
|
||||||
not found).
|
not found).
|
||||||
|
|
|
@ -81,6 +81,7 @@ int bufseek(int handle_id, size_t newpos);
|
||||||
int bufadvance(int handle_id, off_t offset);
|
int bufadvance(int handle_id, off_t offset);
|
||||||
off_t bufftell(int handle_id);
|
off_t bufftell(int handle_id);
|
||||||
ssize_t bufread(int handle_id, size_t size, void *dest);
|
ssize_t bufread(int handle_id, size_t size, void *dest);
|
||||||
|
off_t bufstripsize(int handle_id, off_t size);
|
||||||
ssize_t bufgetdata(int handle_id, size_t size, void **data);
|
ssize_t bufgetdata(int handle_id, size_t size, void **data);
|
||||||
|
|
||||||
/***************************************************************************
|
/***************************************************************************
|
||||||
|
|
|
@ -440,6 +440,11 @@ static bool codec_loop_track_callback(void)
|
||||||
return global_settings.repeat_mode == REPEAT_ONE;
|
return global_settings.repeat_mode == REPEAT_ONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void codec_strip_filesize_callback(off_t size)
|
||||||
|
{
|
||||||
|
if (bufstripsize(ci.audio_hid, size) >= 0)
|
||||||
|
ci.filesize = size;
|
||||||
|
}
|
||||||
|
|
||||||
/** --- CODEC THREAD --- **/
|
/** --- CODEC THREAD --- **/
|
||||||
|
|
||||||
|
@ -647,6 +652,7 @@ void INIT_ATTR codec_thread_init(void)
|
||||||
ci.configure = codec_configure_callback;
|
ci.configure = codec_configure_callback;
|
||||||
ci.get_command = codec_get_command_callback;
|
ci.get_command = codec_get_command_callback;
|
||||||
ci.loop_track = codec_loop_track_callback;
|
ci.loop_track = codec_loop_track_callback;
|
||||||
|
ci.strip_filesize = codec_strip_filesize_callback;
|
||||||
|
|
||||||
/* Init threading */
|
/* Init threading */
|
||||||
queue_init(&codec_queue, false);
|
queue_init(&codec_queue, false);
|
||||||
|
|
|
@ -89,6 +89,7 @@ struct codec_api ci = {
|
||||||
NULL, /* configure */
|
NULL, /* configure */
|
||||||
NULL, /* get_command */
|
NULL, /* get_command */
|
||||||
NULL, /* loop_track */
|
NULL, /* loop_track */
|
||||||
|
NULL, /* strip_filesize */
|
||||||
|
|
||||||
/* kernel/ system */
|
/* kernel/ system */
|
||||||
#if defined(ARM_NEED_DIV0)
|
#if defined(ARM_NEED_DIV0)
|
||||||
|
|
|
@ -152,6 +152,7 @@ struct codec_api {
|
||||||
long (*get_command)(intptr_t *param);
|
long (*get_command)(intptr_t *param);
|
||||||
/* Determine whether the track should be looped, if applicable. */
|
/* Determine whether the track should be looped, if applicable. */
|
||||||
bool (*loop_track)(void);
|
bool (*loop_track)(void);
|
||||||
|
void (*strip_filesize)(off_t value);
|
||||||
|
|
||||||
/* kernel/ system */
|
/* kernel/ system */
|
||||||
#if defined(ARM_NEED_DIV0)
|
#if defined(ARM_NEED_DIV0)
|
||||||
|
|
|
@ -448,6 +448,11 @@ enum codec_status codec_run(void)
|
||||||
ci->configure(DSP_SET_FREQUENCY, ci->id3->frequency);
|
ci->configure(DSP_SET_FREQUENCY, ci->id3->frequency);
|
||||||
current_frequency = ci->id3->frequency;
|
current_frequency = ci->id3->frequency;
|
||||||
codec_set_replaygain(ci->id3);
|
codec_set_replaygain(ci->id3);
|
||||||
|
if (!ci->id3->is_asf_stream)
|
||||||
|
{
|
||||||
|
// End of file might contain ID3v1 or APE tags. Strip them from decoding
|
||||||
|
ci->strip_filesize(ci->id3->first_frame_offset + ci->id3->filesize);
|
||||||
|
}
|
||||||
|
|
||||||
if (ci->id3->offset) {
|
if (ci->id3->offset) {
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue