diff options
-rw-r--r-- | apps/playback.c | 9 | ||||
-rw-r--r-- | lib/rbcodec/metadata/metadata.c | 12 | ||||
-rw-r--r-- | lib/rbcodec/metadata/metadata.h | 2 | ||||
-rw-r--r-- | lib/rbcodec/test/warble.c | 2 |
4 files changed, 10 insertions, 15 deletions
diff --git a/apps/playback.c b/apps/playback.c index 100558177e..944775d6e1 100644 --- a/apps/playback.c +++ b/apps/playback.c | |||
@@ -972,7 +972,7 @@ static void audio_update_filebuf_watermark(int seconds) | |||
972 | 972 | ||
973 | if (id3) | 973 | if (id3) |
974 | { | 974 | { |
975 | if (get_audio_base_data_type(id3->codectype) == TYPE_PACKET_AUDIO) | 975 | if (!rbcodec_format_is_atomic(id3->codectype)) |
976 | { | 976 | { |
977 | bytes = id3->bitrate * (1000/8) * seconds; | 977 | bytes = id3->bitrate * (1000/8) * seconds; |
978 | } | 978 | } |
@@ -1897,7 +1897,8 @@ static int audio_finish_load_track(struct track_info *info) | |||
1897 | calls it again, so we don't save it (and they shouldn't accumulate) */ | 1897 | calls it again, so we don't save it (and they shouldn't accumulate) */ |
1898 | size_t offset = resume_rewind_adjusted_offset(track_id3); | 1898 | size_t offset = resume_rewind_adjusted_offset(track_id3); |
1899 | 1899 | ||
1900 | enum data_type audiotype = get_audio_base_data_type(track_id3->codectype); | 1900 | enum data_type audiotype = rbcodec_format_is_atomic(track_id3->codectype) ? |
1901 | TYPE_ATOMIC_AUDIO : TYPE_PACKET_AUDIO; | ||
1901 | 1902 | ||
1902 | if (audiotype == TYPE_ATOMIC_AUDIO) | 1903 | if (audiotype == TYPE_ATOMIC_AUDIO) |
1903 | logf("Loading atomic %d", track_id3->codectype); | 1904 | logf("Loading atomic %d", track_id3->codectype); |
@@ -2342,9 +2343,7 @@ static void audio_on_codec_complete(int status) | |||
2342 | 2343 | ||
2343 | struct mp3entry *track_id3 = bufgetid3(info->id3_hid); | 2344 | struct mp3entry *track_id3 = bufgetid3(info->id3_hid); |
2344 | 2345 | ||
2345 | if (track_id3 && | 2346 | if (track_id3 && !rbcodec_format_is_atomic(track_id3->codectype)) |
2346 | get_audio_base_data_type(track_id3->codectype) | ||
2347 | == TYPE_PACKET_AUDIO) | ||
2348 | { | 2347 | { |
2349 | /* Continue filling after this track */ | 2348 | /* Continue filling after this track */ |
2350 | audio_reset_and_rebuffer(TRACK_LIST_KEEP_CURRENT, 1); | 2349 | audio_reset_and_rebuffer(TRACK_LIST_KEEP_CURRENT, 1); |
diff --git a/lib/rbcodec/metadata/metadata.c b/lib/rbcodec/metadata/metadata.c index b91e00cc4e..6837e97316 100644 --- a/lib/rbcodec/metadata/metadata.c +++ b/lib/rbcodec/metadata/metadata.c | |||
@@ -307,10 +307,10 @@ int get_audio_base_codec_type(int type) | |||
307 | } | 307 | } |
308 | 308 | ||
309 | /* Get the basic audio type */ | 309 | /* Get the basic audio type */ |
310 | enum data_type get_audio_base_data_type(int afmt) | 310 | bool rbcodec_format_is_atomic(int afmt) |
311 | { | 311 | { |
312 | if ((unsigned)afmt >= AFMT_NUM_CODECS) | 312 | if ((unsigned)afmt >= AFMT_NUM_CODECS) |
313 | return TYPE_UNKNOWN; | 313 | return false; |
314 | 314 | ||
315 | switch (get_audio_base_codec_type(afmt)) | 315 | switch (get_audio_base_codec_type(afmt)) |
316 | { | 316 | { |
@@ -327,15 +327,11 @@ enum data_type get_audio_base_data_type(int afmt) | |||
327 | case AFMT_KSS: | 327 | case AFMT_KSS: |
328 | /* Type must be allocated and loaded in its entirety onto | 328 | /* Type must be allocated and loaded in its entirety onto |
329 | the buffer */ | 329 | the buffer */ |
330 | return TYPE_ATOMIC_AUDIO; | 330 | return true; |
331 | 331 | ||
332 | default: | 332 | default: |
333 | /* Assume type may be loaded and discarded incrementally */ | 333 | /* Assume type may be loaded and discarded incrementally */ |
334 | return TYPE_PACKET_AUDIO; | 334 | return false; |
335 | |||
336 | case AFMT_UNKNOWN: | ||
337 | /* Have no idea at all */ | ||
338 | return TYPE_UNKNOWN; | ||
339 | } | 335 | } |
340 | } | 336 | } |
341 | 337 | ||
diff --git a/lib/rbcodec/metadata/metadata.h b/lib/rbcodec/metadata/metadata.h index 55e4d76f25..5a1c17bc11 100644 --- a/lib/rbcodec/metadata/metadata.h +++ b/lib/rbcodec/metadata/metadata.h | |||
@@ -340,7 +340,7 @@ void wipe_mp3entry(struct mp3entry *id3); | |||
340 | void fill_metadata_from_path(struct mp3entry *id3, const char *trackname); | 340 | void fill_metadata_from_path(struct mp3entry *id3, const char *trackname); |
341 | int get_audio_base_codec_type(int type); | 341 | int get_audio_base_codec_type(int type); |
342 | void strip_tags(int handle_id); | 342 | void strip_tags(int handle_id); |
343 | enum data_type get_audio_base_data_type(int afmt); | 343 | bool rbcodec_format_is_atomic(int afmt); |
344 | bool format_buffers_with_offset(int afmt); | 344 | bool format_buffers_with_offset(int afmt); |
345 | #endif | 345 | #endif |
346 | 346 | ||
diff --git a/lib/rbcodec/test/warble.c b/lib/rbcodec/test/warble.c index e3d9456f4d..8dc27da9eb 100644 --- a/lib/rbcodec/test/warble.c +++ b/lib/rbcodec/test/warble.c | |||
@@ -475,7 +475,7 @@ static size_t ci_read_filebuf(void *ptr, size_t size) | |||
475 | static void *ci_request_buffer(size_t *realsize, size_t reqsize) | 475 | static void *ci_request_buffer(size_t *realsize, size_t reqsize) |
476 | { | 476 | { |
477 | free(input_buffer); | 477 | free(input_buffer); |
478 | if (get_audio_base_data_type(ci.id3->codectype) == TYPE_PACKET_AUDIO) | 478 | if (!rbcodec_format_is_atomic(ci.id3->codectype)) |
479 | reqsize = MIN(reqsize, 32 * 1024); | 479 | reqsize = MIN(reqsize, 32 * 1024); |
480 | input_buffer = malloc(reqsize); | 480 | input_buffer = malloc(reqsize); |
481 | *realsize = read(input_fd, input_buffer, reqsize); | 481 | *realsize = read(input_fd, input_buffer, reqsize); |