summaryrefslogtreecommitdiff
path: root/lib/rbcodec
diff options
context:
space:
mode:
Diffstat (limited to 'lib/rbcodec')
-rw-r--r--lib/rbcodec/metadata/metadata.c12
-rw-r--r--lib/rbcodec/metadata/metadata.h2
-rw-r--r--lib/rbcodec/test/warble.c2
3 files changed, 6 insertions, 10 deletions
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 */
310enum data_type get_audio_base_data_type(int afmt) 310bool 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);
340void fill_metadata_from_path(struct mp3entry *id3, const char *trackname); 340void fill_metadata_from_path(struct mp3entry *id3, const char *trackname);
341int get_audio_base_codec_type(int type); 341int get_audio_base_codec_type(int type);
342void strip_tags(int handle_id); 342void strip_tags(int handle_id);
343enum data_type get_audio_base_data_type(int afmt); 343bool rbcodec_format_is_atomic(int afmt);
344bool format_buffers_with_offset(int afmt); 344bool 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)
475static void *ci_request_buffer(size_t *realsize, size_t reqsize) 475static 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);