forked from len0rd/rockbox
rbcodec refactoring: get_audio_base_data_type
This function has been changed to rbcodec_format_is_atomic, which doesn't require an enum from the kernel. Change-Id: I1d537605087fe130a9b545509d7b8a340806dbf2 Reviewed-on: http://gerrit.rockbox.org/141 Reviewed-by: Nils Wallménius <nils@rockbox.org> Tested-by: Nils Wallménius <nils@rockbox.org>
This commit is contained in:
parent
b794cbbdca
commit
fe3d58004c
4 changed files with 10 additions and 15 deletions
|
@ -972,7 +972,7 @@ static void audio_update_filebuf_watermark(int seconds)
|
|||
|
||||
if (id3)
|
||||
{
|
||||
if (get_audio_base_data_type(id3->codectype) == TYPE_PACKET_AUDIO)
|
||||
if (!rbcodec_format_is_atomic(id3->codectype))
|
||||
{
|
||||
bytes = id3->bitrate * (1000/8) * seconds;
|
||||
}
|
||||
|
@ -1897,7 +1897,8 @@ static int audio_finish_load_track(struct track_info *info)
|
|||
calls it again, so we don't save it (and they shouldn't accumulate) */
|
||||
size_t offset = resume_rewind_adjusted_offset(track_id3);
|
||||
|
||||
enum data_type audiotype = get_audio_base_data_type(track_id3->codectype);
|
||||
enum data_type audiotype = rbcodec_format_is_atomic(track_id3->codectype) ?
|
||||
TYPE_ATOMIC_AUDIO : TYPE_PACKET_AUDIO;
|
||||
|
||||
if (audiotype == TYPE_ATOMIC_AUDIO)
|
||||
logf("Loading atomic %d", track_id3->codectype);
|
||||
|
@ -2342,9 +2343,7 @@ static void audio_on_codec_complete(int status)
|
|||
|
||||
struct mp3entry *track_id3 = bufgetid3(info->id3_hid);
|
||||
|
||||
if (track_id3 &&
|
||||
get_audio_base_data_type(track_id3->codectype)
|
||||
== TYPE_PACKET_AUDIO)
|
||||
if (track_id3 && !rbcodec_format_is_atomic(track_id3->codectype))
|
||||
{
|
||||
/* Continue filling after this track */
|
||||
audio_reset_and_rebuffer(TRACK_LIST_KEEP_CURRENT, 1);
|
||||
|
|
|
@ -307,10 +307,10 @@ int get_audio_base_codec_type(int type)
|
|||
}
|
||||
|
||||
/* Get the basic audio type */
|
||||
enum data_type get_audio_base_data_type(int afmt)
|
||||
bool rbcodec_format_is_atomic(int afmt)
|
||||
{
|
||||
if ((unsigned)afmt >= AFMT_NUM_CODECS)
|
||||
return TYPE_UNKNOWN;
|
||||
return false;
|
||||
|
||||
switch (get_audio_base_codec_type(afmt))
|
||||
{
|
||||
|
@ -327,15 +327,11 @@ enum data_type get_audio_base_data_type(int afmt)
|
|||
case AFMT_KSS:
|
||||
/* Type must be allocated and loaded in its entirety onto
|
||||
the buffer */
|
||||
return TYPE_ATOMIC_AUDIO;
|
||||
return true;
|
||||
|
||||
default:
|
||||
/* Assume type may be loaded and discarded incrementally */
|
||||
return TYPE_PACKET_AUDIO;
|
||||
|
||||
case AFMT_UNKNOWN:
|
||||
/* Have no idea at all */
|
||||
return TYPE_UNKNOWN;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -340,7 +340,7 @@ void wipe_mp3entry(struct mp3entry *id3);
|
|||
void fill_metadata_from_path(struct mp3entry *id3, const char *trackname);
|
||||
int get_audio_base_codec_type(int type);
|
||||
void strip_tags(int handle_id);
|
||||
enum data_type get_audio_base_data_type(int afmt);
|
||||
bool rbcodec_format_is_atomic(int afmt);
|
||||
bool format_buffers_with_offset(int afmt);
|
||||
#endif
|
||||
|
||||
|
|
|
@ -475,7 +475,7 @@ static size_t ci_read_filebuf(void *ptr, size_t size)
|
|||
static void *ci_request_buffer(size_t *realsize, size_t reqsize)
|
||||
{
|
||||
free(input_buffer);
|
||||
if (get_audio_base_data_type(ci.id3->codectype) == TYPE_PACKET_AUDIO)
|
||||
if (!rbcodec_format_is_atomic(ci.id3->codectype))
|
||||
reqsize = MIN(reqsize, 32 * 1024);
|
||||
input_buffer = malloc(reqsize);
|
||||
*realsize = read(input_fd, input_buffer, reqsize);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue