diff options
author | Jeffrey Goode <jeffg7@gmail.com> | 2009-11-09 05:43:19 +0000 |
---|---|---|
committer | Jeffrey Goode <jeffg7@gmail.com> | 2009-11-09 05:43:19 +0000 |
commit | 20db9cc39e3019343ef94527c6d98414a55efd79 (patch) | |
tree | 77b43f61afb97b433557020d39e8201acec7e14f | |
parent | 4cd805cfaf88cee4b725b38f6a44b870f4c653e3 (diff) | |
download | rockbox-20db9cc39e3019343ef94527c6d98414a55efd79.tar.gz rockbox-20db9cc39e3019343ef94527c6d98414a55efd79.zip |
Playback: removed duplicate functions
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23576 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r-- | apps/codec_thread.c | 17 | ||||
-rw-r--r-- | apps/playback.c | 10 | ||||
-rw-r--r-- | apps/playback.h | 2 |
3 files changed, 9 insertions, 20 deletions
diff --git a/apps/codec_thread.c b/apps/codec_thread.c index e3f190e69c..acb0a5d646 100644 --- a/apps/codec_thread.c +++ b/apps/codec_thread.c | |||
@@ -262,7 +262,7 @@ static size_t codec_filebuf_callback(void *ptr, size_t size) | |||
262 | { | 262 | { |
263 | ssize_t copy_n; | 263 | ssize_t copy_n; |
264 | 264 | ||
265 | if (ci.stop_codec || !audio_is_playing()) | 265 | if (ci.stop_codec || !(audio_status() & AUDIO_STATUS_PLAY)) |
266 | return 0; | 266 | return 0; |
267 | 267 | ||
268 | copy_n = bufread(get_audio_hid(), size, ptr); | 268 | copy_n = bufread(get_audio_hid(), size, ptr); |
@@ -284,7 +284,7 @@ static void* codec_request_buffer_callback(size_t *realsize, size_t reqsize) | |||
284 | ssize_t ret; | 284 | ssize_t ret; |
285 | void *ptr; | 285 | void *ptr; |
286 | 286 | ||
287 | if (!audio_is_playing()) | 287 | if (!(audio_status() & AUDIO_STATUS_PLAY)) |
288 | { | 288 | { |
289 | *realsize = 0; | 289 | *realsize = 0; |
290 | return NULL; | 290 | return NULL; |
@@ -335,16 +335,17 @@ static void codec_seek_complete_callback(void) | |||
335 | { | 335 | { |
336 | logf("seek_complete"); | 336 | logf("seek_complete"); |
337 | /* If seeking-while-playing, pcm_is_paused() is true. | 337 | /* If seeking-while-playing, pcm_is_paused() is true. |
338 | * If seeking-while-paused, audio_is_paused() is true. | 338 | * If seeking-while-paused, audio_status PAUSE is true. |
339 | * A seamless seek skips this section. */ | 339 | * A seamless seek skips this section. */ |
340 | if (pcm_is_paused() || audio_is_paused()) | 340 | bool audio_paused = audio_status() & AUDIO_STATUS_PAUSE; |
341 | if (pcm_is_paused() || audio_paused) | ||
341 | { | 342 | { |
342 | /* Clear the buffer */ | 343 | /* Clear the buffer */ |
343 | pcmbuf_play_stop(); | 344 | pcmbuf_play_stop(); |
344 | dsp_configure(ci.dsp, DSP_FLUSH, 0); | 345 | dsp_configure(ci.dsp, DSP_FLUSH, 0); |
345 | 346 | ||
346 | /* If seeking-while-playing, resume pcm playback */ | 347 | /* If seeking-while-playing, resume pcm playback */ |
347 | if (!audio_is_paused()) | 348 | if (!audio_paused) |
348 | pcmbuf_pause(false); | 349 | pcmbuf_pause(false); |
349 | } | 350 | } |
350 | ci.seek_time = 0; | 351 | ci.seek_time = 0; |
@@ -364,7 +365,7 @@ static bool codec_request_next_track_callback(void) | |||
364 | { | 365 | { |
365 | int prev_codectype; | 366 | int prev_codectype; |
366 | 367 | ||
367 | if (ci.stop_codec || !audio_is_playing()) | 368 | if (ci.stop_codec || !(audio_status() & AUDIO_STATUS_PLAY)) |
368 | return false; | 369 | return false; |
369 | 370 | ||
370 | prev_codectype = get_codec_base_type(thistrack_id3->codectype); | 371 | prev_codectype = get_codec_base_type(thistrack_id3->codectype); |
@@ -542,7 +543,7 @@ static void codec_thread(void) | |||
542 | if (ci.stop_codec) | 543 | if (ci.stop_codec) |
543 | { | 544 | { |
544 | status = CODEC_OK; | 545 | status = CODEC_OK; |
545 | if (!audio_is_playing()) | 546 | if (!(audio_status() & AUDIO_STATUS_PLAY)) |
546 | pcmbuf_play_stop(); | 547 | pcmbuf_play_stop(); |
547 | 548 | ||
548 | } | 549 | } |
@@ -553,7 +554,7 @@ static void codec_thread(void) | |||
553 | case Q_CODEC_LOAD_DISK: | 554 | case Q_CODEC_LOAD_DISK: |
554 | case Q_CODEC_LOAD: | 555 | case Q_CODEC_LOAD: |
555 | LOGFQUEUE("codec < Q_CODEC_LOAD"); | 556 | LOGFQUEUE("codec < Q_CODEC_LOAD"); |
556 | if (audio_is_playing()) | 557 | if (audio_status() & AUDIO_STATUS_PLAY) |
557 | { | 558 | { |
558 | if (ci.new_track || status != CODEC_OK) | 559 | if (ci.new_track || status != CODEC_OK) |
559 | { | 560 | { |
diff --git a/apps/playback.c b/apps/playback.c index fbaaa5c974..312a1c8165 100644 --- a/apps/playback.c +++ b/apps/playback.c | |||
@@ -2126,13 +2126,3 @@ int *get_codec_hid() | |||
2126 | { | 2126 | { |
2127 | return &tracks[track_ridx].codec_hid; | 2127 | return &tracks[track_ridx].codec_hid; |
2128 | } | 2128 | } |
2129 | |||
2130 | bool audio_is_playing(void) | ||
2131 | { | ||
2132 | return playing; | ||
2133 | } | ||
2134 | |||
2135 | bool audio_is_paused(void) | ||
2136 | { | ||
2137 | return paused; | ||
2138 | } | ||
diff --git a/apps/playback.h b/apps/playback.h index c0fd15e590..b40638247b 100644 --- a/apps/playback.h +++ b/apps/playback.h | |||
@@ -74,8 +74,6 @@ void audio_post_track_change(bool pcmbuf); | |||
74 | int get_audio_hid(void); | 74 | int get_audio_hid(void); |
75 | int *get_codec_hid(void); | 75 | int *get_codec_hid(void); |
76 | void audio_set_prev_elapsed(unsigned long setting); | 76 | void audio_set_prev_elapsed(unsigned long setting); |
77 | bool audio_is_playing(void); | ||
78 | bool audio_is_paused(void); | ||
79 | 77 | ||
80 | /* Define one constant that includes recording related functionality */ | 78 | /* Define one constant that includes recording related functionality */ |
81 | #if defined(HAVE_RECORDING) && !defined(SIMULATOR) | 79 | #if defined(HAVE_RECORDING) && !defined(SIMULATOR) |