diff options
author | Steve Bavin <pondlife@pondlife.me> | 2008-03-28 11:24:24 +0000 |
---|---|---|
committer | Steve Bavin <pondlife@pondlife.me> | 2008-03-28 11:24:24 +0000 |
commit | c9df8fd87ba80a3c0d719e76ca68cb829a505b11 (patch) | |
tree | cf4493629cd7e960d60f19fa1fc87b2e5b4945b3 /apps | |
parent | f54def9dd59db89a0a7cd304cbcd78d9c6a209ee (diff) | |
download | rockbox-c9df8fd87ba80a3c0d719e76ca68cb829a505b11.tar.gz rockbox-c9df8fd87ba80a3c0d719e76ca68cb829a505b11.zip |
The const police raid playback.c, should be no change to behaviour.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16860 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps')
-rw-r--r-- | apps/buffering.c | 63 | ||||
-rw-r--r-- | apps/codecs.h | 20 | ||||
-rw-r--r-- | apps/debug_menu.c | 1 | ||||
-rw-r--r-- | apps/gui/gwps-common.c | 3 | ||||
-rw-r--r-- | apps/menus/playback_menu.c | 6 | ||||
-rw-r--r-- | apps/menus/settings_menu.c | 5 | ||||
-rw-r--r-- | apps/pcmbuf.c | 6 | ||||
-rw-r--r-- | apps/pcmbuf.h | 2 | ||||
-rw-r--r-- | apps/playback.c | 99 | ||||
-rw-r--r-- | apps/playback.h | 22 | ||||
-rw-r--r-- | apps/plugin.h | 4 | ||||
-rw-r--r-- | apps/plugins/test_codec.c | 16 | ||||
-rw-r--r-- | apps/settings.c | 1 | ||||
-rw-r--r-- | apps/voice_thread.c | 3 |
14 files changed, 144 insertions, 107 deletions
diff --git a/apps/buffering.c b/apps/buffering.c index d49669777b..d891382d81 100644 --- a/apps/buffering.c +++ b/apps/buffering.c | |||
@@ -225,7 +225,7 @@ buf_ridx == buf_widx means the buffer is empty. | |||
225 | only potential side effect is to allocate space for the cur_handle | 225 | only potential side effect is to allocate space for the cur_handle |
226 | if it returns NULL. | 226 | if it returns NULL. |
227 | */ | 227 | */ |
228 | static struct memory_handle *add_handle(size_t data_size, const bool can_wrap, | 228 | static struct memory_handle *add_handle(const size_t data_size, const bool can_wrap, |
229 | const bool alloc_all) | 229 | const bool alloc_all) |
230 | { | 230 | { |
231 | /* gives each handle a unique id */ | 231 | /* gives each handle a unique id */ |
@@ -873,8 +873,10 @@ management functions for all the actual handle management work. | |||
873 | return value: <0 if the file cannot be opened, or one file already | 873 | return value: <0 if the file cannot be opened, or one file already |
874 | queued to be opened, otherwise the handle for the file in the buffer | 874 | queued to be opened, otherwise the handle for the file in the buffer |
875 | */ | 875 | */ |
876 | int bufopen(const char *file, size_t offset, const enum data_type type) | 876 | int bufopen(const char *file, const size_t offset, const enum data_type type) |
877 | { | 877 | { |
878 | size_t adjusted_offset = offset; | ||
879 | |||
878 | int fd = open(file, O_RDONLY); | 880 | int fd = open(file, O_RDONLY); |
879 | if (fd < 0) | 881 | if (fd < 0) |
880 | return ERR_FILE_ERROR; | 882 | return ERR_FILE_ERROR; |
@@ -882,10 +884,10 @@ int bufopen(const char *file, size_t offset, const enum data_type type) | |||
882 | size_t size = filesize(fd); | 884 | size_t size = filesize(fd); |
883 | bool can_wrap = type==TYPE_PACKET_AUDIO || type==TYPE_CODEC; | 885 | bool can_wrap = type==TYPE_PACKET_AUDIO || type==TYPE_CODEC; |
884 | 886 | ||
885 | if (offset > size) | 887 | if (adjusted_offset > size) |
886 | offset = 0; | 888 | adjusted_offset = 0; |
887 | 889 | ||
888 | struct memory_handle *h = add_handle(size-offset, can_wrap, false); | 890 | struct memory_handle *h = add_handle(size-adjusted_offset, can_wrap, false); |
889 | if (!h) | 891 | if (!h) |
890 | { | 892 | { |
891 | DEBUGF("bufopen: failed to add handle\n"); | 893 | DEBUGF("bufopen: failed to add handle\n"); |
@@ -894,7 +896,7 @@ int bufopen(const char *file, size_t offset, const enum data_type type) | |||
894 | } | 896 | } |
895 | 897 | ||
896 | strncpy(h->path, file, MAX_PATH); | 898 | strncpy(h->path, file, MAX_PATH); |
897 | h->offset = offset; | 899 | h->offset = adjusted_offset; |
898 | h->ridx = buf_widx; | 900 | h->ridx = buf_widx; |
899 | h->data = buf_widx; | 901 | h->data = buf_widx; |
900 | h->type = type; | 902 | h->type = type; |
@@ -923,7 +925,7 @@ int bufopen(const char *file, size_t offset, const enum data_type type) | |||
923 | else | 925 | else |
924 | #endif | 926 | #endif |
925 | { | 927 | { |
926 | h->filerem = size - offset; | 928 | h->filerem = size - adjusted_offset; |
927 | h->filesize = size; | 929 | h->filesize = size; |
928 | h->available = 0; | 930 | h->available = 0; |
929 | h->widx = buf_widx; | 931 | h->widx = buf_widx; |
@@ -1094,27 +1096,28 @@ static struct memory_handle *prep_bufdata(const int handle_id, size_t *size, | |||
1094 | Return the number of bytes copied or < 0 for failure (handle not found). | 1096 | Return the number of bytes copied or < 0 for failure (handle not found). |
1095 | The caller is blocked until the requested amount of data is available. | 1097 | The caller is blocked until the requested amount of data is available. |
1096 | */ | 1098 | */ |
1097 | ssize_t bufread(const int handle_id, size_t size, void *dest) | 1099 | ssize_t bufread(const int handle_id, const size_t size, void *dest) |
1098 | { | 1100 | { |
1099 | const struct memory_handle *h; | 1101 | const struct memory_handle *h; |
1102 | size_t adjusted_size = size; | ||
1100 | 1103 | ||
1101 | h = prep_bufdata(handle_id, &size, false); | 1104 | h = prep_bufdata(handle_id, &adjusted_size, false); |
1102 | if (!h) | 1105 | if (!h) |
1103 | return ERR_HANDLE_NOT_FOUND; | 1106 | return ERR_HANDLE_NOT_FOUND; |
1104 | 1107 | ||
1105 | if (h->ridx + size > buffer_len) | 1108 | if (h->ridx + adjusted_size > buffer_len) |
1106 | { | 1109 | { |
1107 | /* the data wraps around the end of the buffer */ | 1110 | /* the data wraps around the end of the buffer */ |
1108 | size_t read = buffer_len - h->ridx; | 1111 | size_t read = buffer_len - h->ridx; |
1109 | memcpy(dest, &buffer[h->ridx], read); | 1112 | memcpy(dest, &buffer[h->ridx], read); |
1110 | memcpy(dest+read, buffer, size - read); | 1113 | memcpy(dest+read, buffer, adjusted_size - read); |
1111 | } | 1114 | } |
1112 | else | 1115 | else |
1113 | { | 1116 | { |
1114 | memcpy(dest, &buffer[h->ridx], size); | 1117 | memcpy(dest, &buffer[h->ridx], adjusted_size); |
1115 | } | 1118 | } |
1116 | 1119 | ||
1117 | return size; | 1120 | return adjusted_size; |
1118 | } | 1121 | } |
1119 | 1122 | ||
1120 | /* Update the "data" pointer to make the handle's data available to the caller. | 1123 | /* Update the "data" pointer to make the handle's data available to the caller. |
@@ -1126,20 +1129,21 @@ ssize_t bufread(const int handle_id, size_t size, void *dest) | |||
1126 | The guard buffer may be used to provide the requested size. This means it's | 1129 | The guard buffer may be used to provide the requested size. This means it's |
1127 | unsafe to request more than the size of the guard buffer. | 1130 | unsafe to request more than the size of the guard buffer. |
1128 | */ | 1131 | */ |
1129 | ssize_t bufgetdata(const int handle_id, size_t size, void **data) | 1132 | ssize_t bufgetdata(const int handle_id, const size_t size, void **data) |
1130 | { | 1133 | { |
1131 | const struct memory_handle *h; | 1134 | const struct memory_handle *h; |
1135 | size_t adjusted_size = size; | ||
1132 | 1136 | ||
1133 | h = prep_bufdata(handle_id, &size, true); | 1137 | h = prep_bufdata(handle_id, &adjusted_size, true); |
1134 | if (!h) | 1138 | if (!h) |
1135 | return ERR_HANDLE_NOT_FOUND; | 1139 | return ERR_HANDLE_NOT_FOUND; |
1136 | 1140 | ||
1137 | if (h->ridx + size > buffer_len) | 1141 | if (h->ridx + adjusted_size > buffer_len) |
1138 | { | 1142 | { |
1139 | /* the data wraps around the end of the buffer : | 1143 | /* the data wraps around the end of the buffer : |
1140 | use the guard buffer to provide the requested amount of data. */ | 1144 | use the guard buffer to provide the requested amount of data. */ |
1141 | size_t copy_n = h->ridx + size - buffer_len; | 1145 | size_t copy_n = h->ridx + adjusted_size - buffer_len; |
1142 | /* prep_bufdata ensures size <= buffer_len - h->ridx + GUARD_BUFSIZE, | 1146 | /* prep_bufdata ensures adjusted_size <= buffer_len - h->ridx + GUARD_BUFSIZE, |
1143 | so copy_n <= GUARD_BUFSIZE */ | 1147 | so copy_n <= GUARD_BUFSIZE */ |
1144 | memcpy(guard_buffer, (const unsigned char *)buffer, copy_n); | 1148 | memcpy(guard_buffer, (const unsigned char *)buffer, copy_n); |
1145 | } | 1149 | } |
@@ -1147,7 +1151,7 @@ ssize_t bufgetdata(const int handle_id, size_t size, void **data) | |||
1147 | if (data) | 1151 | if (data) |
1148 | *data = &buffer[h->ridx]; | 1152 | *data = &buffer[h->ridx]; |
1149 | 1153 | ||
1150 | return size; | 1154 | return adjusted_size; |
1151 | } | 1155 | } |
1152 | 1156 | ||
1153 | ssize_t bufgettail(const int handle_id, const size_t size, void **data) | 1157 | ssize_t bufgettail(const int handle_id, const size_t size, void **data) |
@@ -1180,9 +1184,10 @@ ssize_t bufgettail(const int handle_id, const size_t size, void **data) | |||
1180 | return size; | 1184 | return size; |
1181 | } | 1185 | } |
1182 | 1186 | ||
1183 | ssize_t bufcuttail(const int handle_id, size_t size) | 1187 | ssize_t bufcuttail(const int handle_id, const size_t size) |
1184 | { | 1188 | { |
1185 | struct memory_handle *h; | 1189 | struct memory_handle *h; |
1190 | size_t adjusted_size = size; | ||
1186 | 1191 | ||
1187 | h = find_handle(handle_id); | 1192 | h = find_handle(handle_id); |
1188 | 1193 | ||
@@ -1192,16 +1197,16 @@ ssize_t bufcuttail(const int handle_id, size_t size) | |||
1192 | if (h->filerem) | 1197 | if (h->filerem) |
1193 | return ERR_HANDLE_NOT_DONE; | 1198 | return ERR_HANDLE_NOT_DONE; |
1194 | 1199 | ||
1195 | if (h->available < size) | 1200 | if (h->available < adjusted_size) |
1196 | size = h->available; | 1201 | adjusted_size = h->available; |
1197 | 1202 | ||
1198 | h->available -= size; | 1203 | h->available -= adjusted_size; |
1199 | h->filesize -= size; | 1204 | h->filesize -= adjusted_size; |
1200 | h->widx = RINGBUF_SUB(h->widx, size); | 1205 | h->widx = RINGBUF_SUB(h->widx, adjusted_size); |
1201 | if (h == cur_handle) | 1206 | if (h == cur_handle) |
1202 | buf_widx = h->widx; | 1207 | buf_widx = h->widx; |
1203 | 1208 | ||
1204 | return size; | 1209 | return adjusted_size; |
1205 | } | 1210 | } |
1206 | 1211 | ||
1207 | 1212 | ||
diff --git a/apps/codecs.h b/apps/codecs.h index fb5675fd84..85b73a4953 100644 --- a/apps/codecs.h +++ b/apps/codecs.h | |||
@@ -126,28 +126,28 @@ struct codec_api { | |||
126 | void* (*get_codec_memory)(size_t *size); | 126 | void* (*get_codec_memory)(size_t *size); |
127 | /* Insert PCM data into audio buffer for playback. Playback will start | 127 | /* Insert PCM data into audio buffer for playback. Playback will start |
128 | automatically. */ | 128 | automatically. */ |
129 | bool (*pcmbuf_insert)(const void *ch1, const void *ch2, int count); | 129 | bool (*pcmbuf_insert)(const void *ch1, const void *ch2, const int count); |
130 | /* Set song position in WPS (value in ms). */ | 130 | /* Set song position in WPS (value in ms). */ |
131 | void (*set_elapsed)(unsigned int value); | 131 | void (*set_elapsed)(const unsigned int value); |
132 | 132 | ||
133 | /* Read next <size> amount bytes from file buffer to <ptr>. | 133 | /* Read next <size> amount bytes from file buffer to <ptr>. |
134 | Will return number of bytes read or 0 if end of file. */ | 134 | Will return number of bytes read or 0 if end of file. */ |
135 | size_t (*read_filebuf)(void *ptr, size_t size); | 135 | size_t (*read_filebuf)(void *ptr, const size_t size); |
136 | /* Request pointer to file buffer which can be used to read | 136 | /* Request pointer to file buffer which can be used to read |
137 | <realsize> amount of data. <reqsize> tells the buffer system | 137 | <realsize> amount of data. <reqsize> tells the buffer system |
138 | how much data it should try to allocate. If <realsize> is 0, | 138 | how much data it should try to allocate. If <realsize> is 0, |
139 | end of file is reached. */ | 139 | end of file is reached. */ |
140 | void* (*request_buffer)(size_t *realsize, size_t reqsize); | 140 | void* (*request_buffer)(size_t *realsize, const size_t reqsize); |
141 | /* Advance file buffer position by <amount> amount of bytes. */ | 141 | /* Advance file buffer position by <amount> amount of bytes. */ |
142 | void (*advance_buffer)(size_t amount); | 142 | void (*advance_buffer)(const size_t amount); |
143 | /* Advance file buffer to a pointer location inside file buffer. */ | 143 | /* Advance file buffer to a pointer location inside file buffer. */ |
144 | void (*advance_buffer_loc)(void *ptr); | 144 | void (*advance_buffer_loc)(void *ptr); |
145 | /* Seek file buffer to position <newpos> beginning of file. */ | 145 | /* Seek file buffer to position <newpos> beginning of file. */ |
146 | bool (*seek_buffer)(size_t newpos); | 146 | bool (*seek_buffer)(const size_t newpos); |
147 | /* Codec should call this function when it has done the seeking. */ | 147 | /* Codec should call this function when it has done the seeking. */ |
148 | void (*seek_complete)(void); | 148 | void (*seek_complete)(void); |
149 | /* Calculate mp3 seek position from given time data in ms. */ | 149 | /* Calculate mp3 seek position from given time data in ms. */ |
150 | off_t (*mp3_get_filepos)(int newtime); | 150 | off_t (*mp3_get_filepos)(const int newtime); |
151 | /* Request file change from file buffer. Returns true is next | 151 | /* Request file change from file buffer. Returns true is next |
152 | track is available and changed. If return value is false, | 152 | track is available and changed. If return value is false, |
153 | codec should exit immediately with PLUGIN_OK status. */ | 153 | codec should exit immediately with PLUGIN_OK status. */ |
@@ -155,12 +155,12 @@ struct codec_api { | |||
155 | /* Free the buffer area of the current codec after its loaded */ | 155 | /* Free the buffer area of the current codec after its loaded */ |
156 | void (*discard_codec)(void); | 156 | void (*discard_codec)(void); |
157 | 157 | ||
158 | void (*set_offset)(size_t value); | 158 | void (*set_offset)(const size_t value); |
159 | /* Configure different codec buffer parameters. */ | 159 | /* Configure different codec buffer parameters. */ |
160 | void (*configure)(int setting, intptr_t value); | 160 | void (*configure)(const int setting, const intptr_t value); |
161 | 161 | ||
162 | /* kernel/ system */ | 162 | /* kernel/ system */ |
163 | void (*PREFIX(sleep))(int ticks); | 163 | void (*PREFIX(sleep))(const int ticks); |
164 | void (*yield)(void); | 164 | void (*yield)(void); |
165 | 165 | ||
166 | #if NUM_CORES > 1 | 166 | #if NUM_CORES > 1 |
diff --git a/apps/debug_menu.c b/apps/debug_menu.c index d21dc032a8..5c8a7f965f 100644 --- a/apps/debug_menu.c +++ b/apps/debug_menu.c | |||
@@ -77,6 +77,7 @@ | |||
77 | #if CONFIG_CODEC == SWCODEC | 77 | #if CONFIG_CODEC == SWCODEC |
78 | #include "pcmbuf.h" | 78 | #include "pcmbuf.h" |
79 | #include "buffering.h" | 79 | #include "buffering.h" |
80 | #include "playback.h" | ||
80 | #if defined(HAVE_SPDIF_OUT) || defined(HAVE_SPDIF_IN) | 81 | #if defined(HAVE_SPDIF_OUT) || defined(HAVE_SPDIF_IN) |
81 | #include "spdif.h" | 82 | #include "spdif.h" |
82 | #endif | 83 | #endif |
diff --git a/apps/gui/gwps-common.c b/apps/gui/gwps-common.c index a6bb917a5a..234cd62a64 100644 --- a/apps/gui/gwps-common.c +++ b/apps/gui/gwps-common.c | |||
@@ -54,6 +54,9 @@ | |||
54 | #include "action.h" | 54 | #include "action.h" |
55 | #include "cuesheet.h" | 55 | #include "cuesheet.h" |
56 | #include "playlist.h" | 56 | #include "playlist.h" |
57 | #if CONFIG_CODEC == SWCODEC | ||
58 | #include "playback.h" | ||
59 | #endif | ||
57 | 60 | ||
58 | #if (LCD_DEPTH > 1) || (defined(HAVE_LCD_REMOTE) && (LCD_REMOTE_DEPTH > 1)) | 61 | #if (LCD_DEPTH > 1) || (defined(HAVE_LCD_REMOTE) && (LCD_REMOTE_DEPTH > 1)) |
59 | #include "backdrop.h" | 62 | #include "backdrop.h" |
diff --git a/apps/menus/playback_menu.c b/apps/menus/playback_menu.c index b7aa1ae47f..1e07ef3781 100644 --- a/apps/menus/playback_menu.c +++ b/apps/menus/playback_menu.c | |||
@@ -33,7 +33,11 @@ | |||
33 | #include "dsp.h" | 33 | #include "dsp.h" |
34 | #include "scrobbler.h" | 34 | #include "scrobbler.h" |
35 | #include "audio.h" | 35 | #include "audio.h" |
36 | #include "cuesheet.h" | 36 | #include "cuesheet.h" |
37 | #if CONFIG_CODEC == SWCODEC | ||
38 | #include "playback.h" | ||
39 | #endif | ||
40 | |||
37 | 41 | ||
38 | #if CONFIG_CODEC == SWCODEC | 42 | #if CONFIG_CODEC == SWCODEC |
39 | int setcrossfadeonexit_callback(int action,const struct menu_item_ex *this_item) | 43 | int setcrossfadeonexit_callback(int action,const struct menu_item_ex *this_item) |
diff --git a/apps/menus/settings_menu.c b/apps/menus/settings_menu.c index c55695333c..9d816c99b1 100644 --- a/apps/menus/settings_menu.c +++ b/apps/menus/settings_menu.c | |||
@@ -34,7 +34,10 @@ | |||
34 | #include "splash.h" | 34 | #include "splash.h" |
35 | #include "talk.h" | 35 | #include "talk.h" |
36 | #include "sprintf.h" | 36 | #include "sprintf.h" |
37 | #include "powermgmt.h" | 37 | #include "powermgmt.h" |
38 | #if CONFIG_CODEC == SWCODEC | ||
39 | #include "playback.h" | ||
40 | #endif | ||
38 | #ifdef HAVE_RTC_ALARM | 41 | #ifdef HAVE_RTC_ALARM |
39 | #include "alarm_menu.h" | 42 | #include "alarm_menu.h" |
40 | #endif | 43 | #endif |
diff --git a/apps/pcmbuf.c b/apps/pcmbuf.c index 8f16c90523..b9587d08dd 100644 --- a/apps/pcmbuf.c +++ b/apps/pcmbuf.c | |||
@@ -82,7 +82,7 @@ static char *fadebuf IDATA_ATTR; | |||
82 | static char *voicebuf IDATA_ATTR; | 82 | static char *voicebuf IDATA_ATTR; |
83 | 83 | ||
84 | static void (*pcmbuf_event_handler)(void) IDATA_ATTR; | 84 | static void (*pcmbuf_event_handler)(void) IDATA_ATTR; |
85 | static void (*position_callback)(size_t size) IDATA_ATTR; | 85 | static void (*position_callback)(const size_t size) IDATA_ATTR; |
86 | 86 | ||
87 | /* Crossfade related state */ | 87 | /* Crossfade related state */ |
88 | static bool crossfade_enabled; | 88 | static bool crossfade_enabled; |
@@ -188,7 +188,7 @@ static void pcmbuf_callback(unsigned char** start, size_t* size) | |||
188 | } | 188 | } |
189 | } | 189 | } |
190 | 190 | ||
191 | void pcmbuf_set_position_callback(void (*callback)(size_t size)) | 191 | void pcmbuf_set_position_callback(void (*callback)(const size_t size)) |
192 | { | 192 | { |
193 | position_callback = callback; | 193 | position_callback = callback; |
194 | } | 194 | } |
@@ -938,7 +938,7 @@ void pcmbuf_write_complete(int count) | |||
938 | } | 938 | } |
939 | 939 | ||
940 | #if 0 | 940 | #if 0 |
941 | bool pcmbuf_insert_buffer(char *buf, int count) | 941 | bool pcmbuf_insert_buffer(char *buf, const int count) |
942 | { | 942 | { |
943 | size_t length = (size_t)(unsigned int)count << 2; | 943 | size_t length = (size_t)(unsigned int)count << 2; |
944 | 944 | ||
diff --git a/apps/pcmbuf.h b/apps/pcmbuf.h index 06362452c0..9263285a6b 100644 --- a/apps/pcmbuf.h +++ b/apps/pcmbuf.h | |||
@@ -63,7 +63,7 @@ bool pcmbuf_is_lowdata(void); | |||
63 | void pcmbuf_play_start(void); | 63 | void pcmbuf_play_start(void); |
64 | bool pcmbuf_crossfade_init(bool manual_skip); | 64 | bool pcmbuf_crossfade_init(bool manual_skip); |
65 | void pcmbuf_set_event_handler(void (*callback)(void)); | 65 | void pcmbuf_set_event_handler(void (*callback)(void)); |
66 | void pcmbuf_set_position_callback(void (*callback)(size_t size)); | 66 | void pcmbuf_set_position_callback(void (*callback)(const size_t size)); |
67 | size_t pcmbuf_free(void); | 67 | size_t pcmbuf_free(void); |
68 | unsigned int pcmbuf_get_latency(void); | 68 | unsigned int pcmbuf_get_latency(void); |
69 | void pcmbuf_set_low_latency(bool state); | 69 | void pcmbuf_set_low_latency(bool state); |
diff --git a/apps/playback.c b/apps/playback.c index 421783e0f7..4fd27ce72e 100644 --- a/apps/playback.c +++ b/apps/playback.c | |||
@@ -249,7 +249,7 @@ static size_t buffer_margin = 0; /* Buffer margin aka anti-skip buffer (A/C-) * | |||
249 | 249 | ||
250 | /* Multiple threads */ | 250 | /* Multiple threads */ |
251 | /* Set the watermark to trigger buffer fill (A/C) FIXME */ | 251 | /* Set the watermark to trigger buffer fill (A/C) FIXME */ |
252 | static void set_filebuf_watermark(int seconds, size_t max); | 252 | static void set_filebuf_watermark(const int seconds, const size_t max); |
253 | 253 | ||
254 | /* Audio thread */ | 254 | /* Audio thread */ |
255 | static struct event_queue audio_queue NOCACHEBSS_ATTR; | 255 | static struct event_queue audio_queue NOCACHEBSS_ATTR; |
@@ -277,7 +277,7 @@ static struct event_queue pcmbuf_queue NOCACHEBSS_ATTR; | |||
277 | /* Function to be called by pcm buffer callbacks. | 277 | /* Function to be called by pcm buffer callbacks. |
278 | * Permissible Context(s): Audio interrupt | 278 | * Permissible Context(s): Audio interrupt |
279 | */ | 279 | */ |
280 | static void pcmbuf_callback_queue_post(long id, intptr_t data) | 280 | static void pcmbuf_callback_queue_post(const long id, intptr_t data) |
281 | { | 281 | { |
282 | /* No lock since we're already in audio interrupt context */ | 282 | /* No lock since we're already in audio interrupt context */ |
283 | queue_post(&pcmbuf_queue, id, data); | 283 | queue_post(&pcmbuf_queue, id, data); |
@@ -313,7 +313,7 @@ static void pcmbuf_queue_clear(void) | |||
313 | 313 | ||
314 | /* --- Helper functions --- */ | 314 | /* --- Helper functions --- */ |
315 | 315 | ||
316 | static struct mp3entry *bufgetid3(int handle_id) | 316 | static struct mp3entry *bufgetid3(const int handle_id) |
317 | { | 317 | { |
318 | if (handle_id < 0) | 318 | if (handle_id < 0) |
319 | return NULL; | 319 | return NULL; |
@@ -384,7 +384,7 @@ void audio_hard_stop(void) | |||
384 | #endif | 384 | #endif |
385 | } | 385 | } |
386 | 386 | ||
387 | bool audio_restore_playback(int type) | 387 | bool audio_restore_playback(const int type) |
388 | { | 388 | { |
389 | switch (type) | 389 | switch (type) |
390 | { | 390 | { |
@@ -401,7 +401,7 @@ bool audio_restore_playback(int type) | |||
401 | } | 401 | } |
402 | } | 402 | } |
403 | 403 | ||
404 | unsigned char *audio_get_buffer(bool talk_buf, size_t *buffer_size) | 404 | unsigned char *audio_get_buffer(const bool talk_buf, size_t *buffer_size) |
405 | { | 405 | { |
406 | unsigned char *buf, *end; | 406 | unsigned char *buf, *end; |
407 | 407 | ||
@@ -621,7 +621,7 @@ bool audio_has_changed_track(void) | |||
621 | return false; | 621 | return false; |
622 | } | 622 | } |
623 | 623 | ||
624 | void audio_play(long offset) | 624 | void audio_play(const long offset) |
625 | { | 625 | { |
626 | logf("audio_play"); | 626 | logf("audio_play"); |
627 | 627 | ||
@@ -710,7 +710,7 @@ void audio_pre_ff_rewind(void) | |||
710 | queue_post(&audio_queue, Q_AUDIO_PRE_FF_REWIND, 0); | 710 | queue_post(&audio_queue, Q_AUDIO_PRE_FF_REWIND, 0); |
711 | } | 711 | } |
712 | 712 | ||
713 | void audio_ff_rewind(long newpos) | 713 | void audio_ff_rewind(const long newpos) |
714 | { | 714 | { |
715 | LOGFQUEUE("audio > audio Q_AUDIO_FF_REWIND"); | 715 | LOGFQUEUE("audio > audio Q_AUDIO_FF_REWIND"); |
716 | queue_post(&audio_queue, Q_AUDIO_FF_REWIND, newpos); | 716 | queue_post(&audio_queue, Q_AUDIO_FF_REWIND, newpos); |
@@ -753,7 +753,7 @@ int audio_get_file_pos(void) | |||
753 | } | 753 | } |
754 | 754 | ||
755 | #ifndef HAVE_FLASH_STORAGE | 755 | #ifndef HAVE_FLASH_STORAGE |
756 | void audio_set_buffer_margin(int setting) | 756 | void audio_set_buffer_margin(const int setting) |
757 | { | 757 | { |
758 | static const int lookup[] = {5, 15, 30, 60, 120, 180, 300, 600}; | 758 | static const int lookup[] = {5, 15, 30, 60, 120, 180, 300, 600}; |
759 | buffer_margin = lookup[setting]; | 759 | buffer_margin = lookup[setting]; |
@@ -762,8 +762,8 @@ void audio_set_buffer_margin(int setting) | |||
762 | } | 762 | } |
763 | #endif | 763 | #endif |
764 | 764 | ||
765 | /* Take nescessary steps to enable or disable the crossfade setting */ | 765 | /* Take necessary steps to enable or disable the crossfade setting */ |
766 | void audio_set_crossfade(int enable) | 766 | void audio_set_crossfade(const int enable) |
767 | { | 767 | { |
768 | size_t offset; | 768 | size_t offset; |
769 | bool was_playing; | 769 | bool was_playing; |
@@ -805,7 +805,7 @@ void audio_set_crossfade(int enable) | |||
805 | 805 | ||
806 | /* --- Routines called from multiple threads --- */ | 806 | /* --- Routines called from multiple threads --- */ |
807 | 807 | ||
808 | static void set_filebuf_watermark(int seconds, size_t max) | 808 | static void set_filebuf_watermark(const int seconds, const size_t max) |
809 | { | 809 | { |
810 | size_t bytes; | 810 | size_t bytes; |
811 | 811 | ||
@@ -817,7 +817,7 @@ static void set_filebuf_watermark(int seconds, size_t max) | |||
817 | buf_set_watermark(bytes); | 817 | buf_set_watermark(bytes); |
818 | } | 818 | } |
819 | 819 | ||
820 | const char * get_codec_filename(int cod_spec) | 820 | const char *get_codec_filename(const int cod_spec) |
821 | { | 821 | { |
822 | const char *fname; | 822 | const char *fname; |
823 | 823 | ||
@@ -849,13 +849,14 @@ const char * get_codec_filename(int cod_spec) | |||
849 | 849 | ||
850 | /* --- Codec thread --- */ | 850 | /* --- Codec thread --- */ |
851 | static bool codec_pcmbuf_insert_callback( | 851 | static bool codec_pcmbuf_insert_callback( |
852 | const void *ch1, const void *ch2, int count) | 852 | const void *ch1, const void *ch2, const int count) |
853 | { | 853 | { |
854 | const char *src[2] = { ch1, ch2 }; | 854 | const char *src[2] = { ch1, ch2 }; |
855 | 855 | ||
856 | while (count > 0) | 856 | int remaining = count; |
857 | while (remaining > 0) | ||
857 | { | 858 | { |
858 | int out_count = dsp_output_count(ci.dsp, count); | 859 | int out_count = dsp_output_count(ci.dsp, remaining); |
859 | int inp_count; | 860 | int inp_count; |
860 | char *dest; | 861 | char *dest; |
861 | 862 | ||
@@ -879,8 +880,8 @@ static bool codec_pcmbuf_insert_callback( | |||
879 | return true; | 880 | return true; |
880 | 881 | ||
881 | /* Input size has grown, no error, just don't write more than length */ | 882 | /* Input size has grown, no error, just don't write more than length */ |
882 | if (inp_count > count) | 883 | if (inp_count > remaining) |
883 | inp_count = count; | 884 | inp_count = remaining; |
884 | 885 | ||
885 | out_count = dsp_process(ci.dsp, dest, src, inp_count); | 886 | out_count = dsp_process(ci.dsp, dest, src, inp_count); |
886 | 887 | ||
@@ -889,7 +890,7 @@ static bool codec_pcmbuf_insert_callback( | |||
889 | 890 | ||
890 | pcmbuf_write_complete(out_count); | 891 | pcmbuf_write_complete(out_count); |
891 | 892 | ||
892 | count -= inp_count; | 893 | remaining -= inp_count; |
893 | } | 894 | } |
894 | 895 | ||
895 | return true; | 896 | return true; |
@@ -905,8 +906,8 @@ static void* codec_get_memory_callback(size_t *size) | |||
905 | "elapsed" value of the previous (to the codec, but current to the | 906 | "elapsed" value of the previous (to the codec, but current to the |
906 | user/PCM/WPS) track, so that the progressbar reaches the end. | 907 | user/PCM/WPS) track, so that the progressbar reaches the end. |
907 | During that transition, the WPS will display prevtrack_id3. */ | 908 | During that transition, the WPS will display prevtrack_id3. */ |
908 | static void codec_pcmbuf_position_callback(size_t size) ICODE_ATTR; | 909 | static void codec_pcmbuf_position_callback(const size_t size) ICODE_ATTR; |
909 | static void codec_pcmbuf_position_callback(size_t size) | 910 | static void codec_pcmbuf_position_callback(const size_t size) |
910 | { | 911 | { |
911 | /* This is called from an ISR, so be quick */ | 912 | /* This is called from an ISR, so be quick */ |
912 | unsigned int time = size * 1000 / 4 / NATIVE_FREQUENCY + | 913 | unsigned int time = size * 1000 / 4 / NATIVE_FREQUENCY + |
@@ -921,7 +922,7 @@ static void codec_pcmbuf_position_callback(size_t size) | |||
921 | prevtrack_id3.elapsed = time; | 922 | prevtrack_id3.elapsed = time; |
922 | } | 923 | } |
923 | 924 | ||
924 | static void codec_set_elapsed_callback(unsigned int value) | 925 | static void codec_set_elapsed_callback(const unsigned int value) |
925 | { | 926 | { |
926 | unsigned int latency; | 927 | unsigned int latency; |
927 | if (ci.seek_time) | 928 | if (ci.seek_time) |
@@ -941,7 +942,7 @@ static void codec_set_elapsed_callback(unsigned int value) | |||
941 | } | 942 | } |
942 | } | 943 | } |
943 | 944 | ||
944 | static void codec_set_offset_callback(size_t value) | 945 | static void codec_set_offset_callback(const size_t value) |
945 | { | 946 | { |
946 | unsigned int latency; | 947 | unsigned int latency; |
947 | 948 | ||
@@ -955,14 +956,14 @@ static void codec_set_offset_callback(size_t value) | |||
955 | curtrack_id3.offset = value - latency; | 956 | curtrack_id3.offset = value - latency; |
956 | } | 957 | } |
957 | 958 | ||
958 | static void codec_advance_buffer_counters(size_t amount) | 959 | static void codec_advance_buffer_counters(const size_t amount) |
959 | { | 960 | { |
960 | bufadvance(CUR_TI->audio_hid, amount); | 961 | bufadvance(CUR_TI->audio_hid, amount); |
961 | ci.curpos += amount; | 962 | ci.curpos += amount; |
962 | } | 963 | } |
963 | 964 | ||
964 | /* copy up-to size bytes into ptr and return the actual size copied */ | 965 | /* copy up-to size bytes into ptr and return the actual size copied */ |
965 | static size_t codec_filebuf_callback(void *ptr, size_t size) | 966 | static size_t codec_filebuf_callback(void *ptr, const size_t size) |
966 | { | 967 | { |
967 | ssize_t copy_n; | 968 | ssize_t copy_n; |
968 | 969 | ||
@@ -982,7 +983,7 @@ static size_t codec_filebuf_callback(void *ptr, size_t size) | |||
982 | return copy_n; | 983 | return copy_n; |
983 | } /* codec_filebuf_callback */ | 984 | } /* codec_filebuf_callback */ |
984 | 985 | ||
985 | static void* codec_request_buffer_callback(size_t *realsize, size_t reqsize) | 986 | static void* codec_request_buffer_callback(size_t *realsize, const size_t reqsize) |
986 | { | 987 | { |
987 | size_t copy_n = reqsize; | 988 | size_t copy_n = reqsize; |
988 | ssize_t ret; | 989 | ssize_t ret; |
@@ -1021,7 +1022,7 @@ static int get_codec_base_type(int type) | |||
1021 | return type; | 1022 | return type; |
1022 | } | 1023 | } |
1023 | 1024 | ||
1024 | static void codec_advance_buffer_callback(size_t amount) | 1025 | static void codec_advance_buffer_callback(const size_t amount) |
1025 | { | 1026 | { |
1026 | codec_advance_buffer_counters(amount); | 1027 | codec_advance_buffer_counters(amount); |
1027 | codec_set_offset_callback(ci.curpos); | 1028 | codec_set_offset_callback(ci.curpos); |
@@ -1088,7 +1089,7 @@ static int codec_get_file_pos(void) | |||
1088 | return pos; | 1089 | return pos; |
1089 | } | 1090 | } |
1090 | 1091 | ||
1091 | static off_t codec_mp3_get_filepos_callback(int newtime) | 1092 | static off_t codec_mp3_get_filepos_callback(const int newtime) |
1092 | { | 1093 | { |
1093 | off_t newpos; | 1094 | off_t newpos; |
1094 | 1095 | ||
@@ -1114,7 +1115,7 @@ static void codec_seek_complete_callback(void) | |||
1114 | ci.seek_time = 0; | 1115 | ci.seek_time = 0; |
1115 | } | 1116 | } |
1116 | 1117 | ||
1117 | static bool codec_seek_buffer_callback(size_t newpos) | 1118 | static bool codec_seek_buffer_callback(const size_t newpos) |
1118 | { | 1119 | { |
1119 | logf("codec_seek_buffer_callback"); | 1120 | logf("codec_seek_buffer_callback"); |
1120 | 1121 | ||
@@ -1128,7 +1129,7 @@ static bool codec_seek_buffer_callback(size_t newpos) | |||
1128 | } | 1129 | } |
1129 | } | 1130 | } |
1130 | 1131 | ||
1131 | static void codec_configure_callback(int setting, intptr_t value) | 1132 | static void codec_configure_callback(const int setting, const intptr_t value) |
1132 | { | 1133 | { |
1133 | switch (setting) { | 1134 | switch (setting) { |
1134 | case CODEC_SET_FILEBUF_WATERMARK: | 1135 | case CODEC_SET_FILEBUF_WATERMARK: |
@@ -1178,7 +1179,7 @@ static inline void codec_crossfade_track_change(void) | |||
1178 | codec_track_changed(); | 1179 | codec_track_changed(); |
1179 | } | 1180 | } |
1180 | 1181 | ||
1181 | static void codec_track_skip_done(bool was_manual) | 1182 | static void codec_track_skip_done(const bool was_manual) |
1182 | { | 1183 | { |
1183 | /* Manual track change (always crossfade or flush audio). */ | 1184 | /* Manual track change (always crossfade or flush audio). */ |
1184 | if (was_manual) | 1185 | if (was_manual) |
@@ -1485,7 +1486,7 @@ static void audio_update_trackinfo(void) | |||
1485 | ci.taginfo_ready = &CUR_TI->taginfo_ready; | 1486 | ci.taginfo_ready = &CUR_TI->taginfo_ready; |
1486 | } | 1487 | } |
1487 | 1488 | ||
1488 | static void buffering_audio_callback(enum callback_event ev, int value) | 1489 | static void buffering_audio_callback(const enum callback_event ev, const int value) |
1489 | { | 1490 | { |
1490 | (void)value; | 1491 | (void)value; |
1491 | logf("buffering_audio_callback"); | 1492 | logf("buffering_audio_callback"); |
@@ -1549,7 +1550,7 @@ static bool audio_release_tracks(void) | |||
1549 | return true; | 1550 | return true; |
1550 | } | 1551 | } |
1551 | 1552 | ||
1552 | static bool audio_loadcodec(bool start_play) | 1553 | static bool audio_loadcodec(const bool start_play) |
1553 | { | 1554 | { |
1554 | int prev_track; | 1555 | int prev_track; |
1555 | char codec_path[MAX_PATH]; /* Full path to codec */ | 1556 | char codec_path[MAX_PATH]; /* Full path to codec */ |
@@ -1667,7 +1668,7 @@ static void audio_set_elapsed(struct mp3entry* id3) | |||
1667 | 1668 | ||
1668 | /* Load one track by making the appropriate bufopen calls. Return true if | 1669 | /* Load one track by making the appropriate bufopen calls. Return true if |
1669 | everything required was loaded correctly, false if not. */ | 1670 | everything required was loaded correctly, false if not. */ |
1670 | static bool audio_load_track(int offset, bool start_play) | 1671 | static bool audio_load_track(const int offset, const bool start_play) |
1671 | { | 1672 | { |
1672 | const char *trackname; | 1673 | const char *trackname; |
1673 | char msgbuf[80]; | 1674 | char msgbuf[80]; |
@@ -1714,8 +1715,9 @@ static bool audio_load_track(int offset, bool start_play) | |||
1714 | 1715 | ||
1715 | tracks[track_widx].filesize = filesize(fd); | 1716 | tracks[track_widx].filesize = filesize(fd); |
1716 | 1717 | ||
1717 | if ((unsigned)offset > tracks[track_widx].filesize) | 1718 | int adjusted_offset = offset; |
1718 | offset = 0; | 1719 | if ((unsigned)adjusted_offset > tracks[track_widx].filesize) |
1720 | adjusted_offset = 0; | ||
1719 | 1721 | ||
1720 | /* Set default values */ | 1722 | /* Set default values */ |
1721 | if (start_play) | 1723 | if (start_play) |
@@ -1827,17 +1829,17 @@ static bool audio_load_track(int offset, bool start_play) | |||
1827 | case AFMT_MPA_L1: | 1829 | case AFMT_MPA_L1: |
1828 | case AFMT_MPA_L2: | 1830 | case AFMT_MPA_L2: |
1829 | case AFMT_MPA_L3: | 1831 | case AFMT_MPA_L3: |
1830 | if (offset > 0) { | 1832 | if (adjusted_offset > 0) { |
1831 | file_offset = offset; | 1833 | file_offset = adjusted_offset; |
1832 | track_id3->offset = offset; | 1834 | track_id3->offset = adjusted_offset; |
1833 | audio_set_elapsed(track_id3); | 1835 | audio_set_elapsed(track_id3); |
1834 | } | 1836 | } |
1835 | break; | 1837 | break; |
1836 | 1838 | ||
1837 | case AFMT_WAVPACK: | 1839 | case AFMT_WAVPACK: |
1838 | if (offset > 0) { | 1840 | if (offset > 0) { |
1839 | file_offset = offset; | 1841 | file_offset = adjusted_offset; |
1840 | track_id3->offset = offset; | 1842 | track_id3->offset = adjusted_offset; |
1841 | track_id3->elapsed = track_id3->length / 2; | 1843 | track_id3->elapsed = track_id3->length / 2; |
1842 | } | 1844 | } |
1843 | break; | 1845 | break; |
@@ -1850,8 +1852,8 @@ static bool audio_load_track(int offset, bool start_play) | |||
1850 | case AFMT_AAC: | 1852 | case AFMT_AAC: |
1851 | case AFMT_MPC: | 1853 | case AFMT_MPC: |
1852 | case AFMT_APE: | 1854 | case AFMT_APE: |
1853 | if (offset > 0) | 1855 | if (adjusted_offset > 0) |
1854 | track_id3->offset = offset; | 1856 | track_id3->offset = adjusted_offset; |
1855 | break; | 1857 | break; |
1856 | 1858 | ||
1857 | case AFMT_NSF: | 1859 | case AFMT_NSF: |
@@ -1890,7 +1892,7 @@ static bool audio_load_track(int offset, bool start_play) | |||
1890 | return true; | 1892 | return true; |
1891 | } | 1893 | } |
1892 | 1894 | ||
1893 | static void audio_fill_file_buffer(bool start_play, size_t offset) | 1895 | static void audio_fill_file_buffer(const bool start_play, const size_t offset) |
1894 | { | 1896 | { |
1895 | struct queue_event ev; | 1897 | struct queue_event ev; |
1896 | bool had_next_track = audio_next_track() != NULL; | 1898 | bool had_next_track = audio_next_track() != NULL; |
@@ -1914,10 +1916,8 @@ static void audio_fill_file_buffer(bool start_play, size_t offset) | |||
1914 | /* Save the current resume position once. */ | 1916 | /* Save the current resume position once. */ |
1915 | playlist_update_resume_info(audio_current_track()); | 1917 | playlist_update_resume_info(audio_current_track()); |
1916 | 1918 | ||
1919 | continue_buffering = audio_load_track(offset, start_play); | ||
1917 | do { | 1920 | do { |
1918 | continue_buffering = audio_load_track(offset, start_play); | ||
1919 | start_play = false; | ||
1920 | offset = 0; | ||
1921 | sleep(1); | 1921 | sleep(1); |
1922 | if (queue_peek(&audio_queue, &ev)) { | 1922 | if (queue_peek(&audio_queue, &ev)) { |
1923 | if (ev.id != Q_AUDIO_FILL_BUFFER) | 1923 | if (ev.id != Q_AUDIO_FILL_BUFFER) |
@@ -1929,6 +1929,7 @@ static void audio_fill_file_buffer(bool start_play, size_t offset) | |||
1929 | } | 1929 | } |
1930 | break; | 1930 | break; |
1931 | } | 1931 | } |
1932 | continue_buffering = audio_load_track(0, false); | ||
1932 | } while (continue_buffering); | 1933 | } while (continue_buffering); |
1933 | 1934 | ||
1934 | if (!had_next_track && audio_next_track()) | 1935 | if (!had_next_track && audio_next_track()) |
@@ -2193,7 +2194,7 @@ static void audio_stop_playback(void) | |||
2193 | memset(&curtrack_id3, 0, sizeof(struct mp3entry)); | 2194 | memset(&curtrack_id3, 0, sizeof(struct mp3entry)); |
2194 | } | 2195 | } |
2195 | 2196 | ||
2196 | static void audio_play_start(size_t offset) | 2197 | static void audio_play_start(const size_t offset) |
2197 | { | 2198 | { |
2198 | int i; | 2199 | int i; |
2199 | 2200 | ||
@@ -2286,7 +2287,7 @@ static void audio_new_playlist(void) | |||
2286 | } | 2287 | } |
2287 | 2288 | ||
2288 | /* Called on manual track skip */ | 2289 | /* Called on manual track skip */ |
2289 | static void audio_initiate_track_change(long direction) | 2290 | static void audio_initiate_track_change(const long direction) |
2290 | { | 2291 | { |
2291 | logf("audio_initiate_track_change(%ld)", direction); | 2292 | logf("audio_initiate_track_change(%ld)", direction); |
2292 | 2293 | ||
@@ -2298,7 +2299,7 @@ static void audio_initiate_track_change(long direction) | |||
2298 | } | 2299 | } |
2299 | 2300 | ||
2300 | /* Called on manual dir skip */ | 2301 | /* Called on manual dir skip */ |
2301 | static void audio_initiate_dir_change(long direction) | 2302 | static void audio_initiate_dir_change(const long direction) |
2302 | { | 2303 | { |
2303 | playlist_end = false; | 2304 | playlist_end = false; |
2304 | dir_skip = true; | 2305 | dir_skip = true; |
diff --git a/apps/playback.h b/apps/playback.h index 748a4fe871..b65c572145 100644 --- a/apps/playback.h +++ b/apps/playback.h | |||
@@ -38,14 +38,32 @@ | |||
38 | #define MAX_TRACK_MASK (MAX_TRACK-1) | 38 | #define MAX_TRACK_MASK (MAX_TRACK-1) |
39 | 39 | ||
40 | /* Functions */ | 40 | /* Functions */ |
41 | const char * get_codec_filename(int cod_spec); | 41 | const char *get_codec_filename(const int cod_spec); |
42 | void voice_wait(void); | 42 | void voice_wait(void); |
43 | void audio_wait_for_init(void); | ||
44 | int audio_track_count(void); | ||
45 | long audio_filebufused(void); | ||
46 | void audio_pre_ff_rewind(void); | ||
47 | void audio_set_crossfade(const int type); | ||
48 | |||
49 | void audio_hard_stop(void); /* Stops audio from serving playback */ | ||
50 | |||
51 | enum | ||
52 | { | ||
53 | AUDIO_WANT_PLAYBACK = 0, | ||
54 | AUDIO_WANT_VOICE, | ||
55 | }; | ||
56 | bool audio_restore_playback(const int type); /* Restores the audio buffer to handle the requested playback */ | ||
57 | |||
58 | #ifdef HAVE_ALBUMART | ||
59 | int audio_current_aa_hid(void); | ||
60 | #endif | ||
43 | 61 | ||
44 | #if CONFIG_CODEC == SWCODEC /* This #ifdef is better here than gui/gwps.c */ | 62 | #if CONFIG_CODEC == SWCODEC /* This #ifdef is better here than gui/gwps.c */ |
45 | extern void audio_next_dir(void); | 63 | extern void audio_next_dir(void); |
46 | extern void audio_prev_dir(void); | 64 | extern void audio_prev_dir(void); |
47 | #else | 65 | #else |
48 | # define audio_next_dir() | 66 | #define audio_next_dir() |
49 | #define audio_prev_dir() | 67 | #define audio_prev_dir() |
50 | #endif | 68 | #endif |
51 | 69 | ||
diff --git a/apps/plugin.h b/apps/plugin.h index 27fcffb69c..d6aed5d4c7 100644 --- a/apps/plugin.h +++ b/apps/plugin.h | |||
@@ -521,13 +521,13 @@ struct plugin_api { | |||
521 | int (*playlist_amount)(void); | 521 | int (*playlist_amount)(void); |
522 | int (*playlist_resume)(void); | 522 | int (*playlist_resume)(void); |
523 | int (*playlist_start)(int start_index, int offset); | 523 | int (*playlist_start)(int start_index, int offset); |
524 | void (*PREFIX(audio_play))(long offset); | 524 | void (*PREFIX(audio_play))(const long offset); |
525 | void (*audio_stop)(void); | 525 | void (*audio_stop)(void); |
526 | void (*audio_pause)(void); | 526 | void (*audio_pause)(void); |
527 | void (*audio_resume)(void); | 527 | void (*audio_resume)(void); |
528 | void (*audio_next)(void); | 528 | void (*audio_next)(void); |
529 | void (*audio_prev)(void); | 529 | void (*audio_prev)(void); |
530 | void (*audio_ff_rewind)(long newtime); | 530 | void (*audio_ff_rewind)(const long newtime); |
531 | struct mp3entry* (*audio_next_track)(void); | 531 | struct mp3entry* (*audio_next_track)(void); |
532 | int (*audio_status)(void); | 532 | int (*audio_status)(void); |
533 | bool (*audio_has_changed_track)(void); | 533 | bool (*audio_has_changed_track)(void); |
diff --git a/apps/plugins/test_codec.c b/apps/plugins/test_codec.c index f33d83fb15..7390318152 100644 --- a/apps/plugins/test_codec.c +++ b/apps/plugins/test_codec.c | |||
@@ -197,7 +197,7 @@ static void* get_codec_memory(size_t *size) | |||
197 | } | 197 | } |
198 | 198 | ||
199 | /* Null output */ | 199 | /* Null output */ |
200 | static bool pcmbuf_insert_null(const void *ch1, const void *ch2, int count) | 200 | static bool pcmbuf_insert_null(const void *ch1, const void *ch2, const int count) |
201 | { | 201 | { |
202 | /* Always successful - just discard data */ | 202 | /* Always successful - just discard data */ |
203 | (void)ch1; | 203 | (void)ch1; |
@@ -310,7 +310,7 @@ static bool pcmbuf_insert_wav(const void *ch1, const void *ch2, int count) | |||
310 | 310 | ||
311 | 311 | ||
312 | /* Set song position in WPS (value in ms). */ | 312 | /* Set song position in WPS (value in ms). */ |
313 | static void set_elapsed(unsigned int value) | 313 | static void set_elapsed(const unsigned int value) |
314 | { | 314 | { |
315 | elapsed = value; | 315 | elapsed = value; |
316 | } | 316 | } |
@@ -318,7 +318,7 @@ static void set_elapsed(unsigned int value) | |||
318 | 318 | ||
319 | /* Read next <size> amount bytes from file buffer to <ptr>. | 319 | /* Read next <size> amount bytes from file buffer to <ptr>. |
320 | Will return number of bytes read or 0 if end of file. */ | 320 | Will return number of bytes read or 0 if end of file. */ |
321 | static size_t read_filebuf(void *ptr, size_t size) | 321 | static size_t read_filebuf(void *ptr, const size_t size) |
322 | { | 322 | { |
323 | if (ci.curpos > (off_t)track.filesize) | 323 | if (ci.curpos > (off_t)track.filesize) |
324 | { | 324 | { |
@@ -336,7 +336,7 @@ static size_t read_filebuf(void *ptr, size_t size) | |||
336 | <realsize> amount of data. <reqsize> tells the buffer system | 336 | <realsize> amount of data. <reqsize> tells the buffer system |
337 | how much data it should try to allocate. If <realsize> is 0, | 337 | how much data it should try to allocate. If <realsize> is 0, |
338 | end of file is reached. */ | 338 | end of file is reached. */ |
339 | static void* request_buffer(size_t *realsize, size_t reqsize) | 339 | static void* request_buffer(size_t *realsize, const size_t reqsize) |
340 | { | 340 | { |
341 | *realsize = MIN(track.filesize-ci.curpos,reqsize); | 341 | *realsize = MIN(track.filesize-ci.curpos,reqsize); |
342 | 342 | ||
@@ -345,7 +345,7 @@ static void* request_buffer(size_t *realsize, size_t reqsize) | |||
345 | 345 | ||
346 | 346 | ||
347 | /* Advance file buffer position by <amount> amount of bytes. */ | 347 | /* Advance file buffer position by <amount> amount of bytes. */ |
348 | static void advance_buffer(size_t amount) | 348 | static void advance_buffer(const size_t amount) |
349 | { | 349 | { |
350 | ci.curpos += amount; | 350 | ci.curpos += amount; |
351 | } | 351 | } |
@@ -359,7 +359,7 @@ static void advance_buffer_loc(void *ptr) | |||
359 | 359 | ||
360 | 360 | ||
361 | /* Seek file buffer to position <newpos> beginning of file. */ | 361 | /* Seek file buffer to position <newpos> beginning of file. */ |
362 | static bool seek_buffer(size_t newpos) | 362 | static bool seek_buffer(const size_t newpos) |
363 | { | 363 | { |
364 | ci.curpos = newpos; | 364 | ci.curpos = newpos; |
365 | return true; | 365 | return true; |
@@ -374,7 +374,7 @@ static void seek_complete(void) | |||
374 | 374 | ||
375 | 375 | ||
376 | /* Calculate mp3 seek position from given time data in ms. */ | 376 | /* Calculate mp3 seek position from given time data in ms. */ |
377 | static off_t mp3_get_filepos(int newtime) | 377 | static off_t mp3_get_filepos(const int newtime) |
378 | { | 378 | { |
379 | /* We don't ask the codec to seek, so no need to implement this. */ | 379 | /* We don't ask the codec to seek, so no need to implement this. */ |
380 | (void)newtime; | 380 | (void)newtime; |
@@ -399,7 +399,7 @@ static void discard_codec(void) | |||
399 | } | 399 | } |
400 | 400 | ||
401 | 401 | ||
402 | static void set_offset(size_t value) | 402 | static void set_offset(const size_t value) |
403 | { | 403 | { |
404 | /* ??? */ | 404 | /* ??? */ |
405 | (void)value; | 405 | (void)value; |
diff --git a/apps/settings.c b/apps/settings.c index d4f14079b1..6e1aa3eaec 100644 --- a/apps/settings.c +++ b/apps/settings.c | |||
@@ -81,6 +81,7 @@ struct system_status global_status; | |||
81 | #if CONFIG_CODEC == SWCODEC | 81 | #if CONFIG_CODEC == SWCODEC |
82 | #include "pcmbuf.h" | 82 | #include "pcmbuf.h" |
83 | #include "dsp.h" | 83 | #include "dsp.h" |
84 | #include "playback.h" | ||
84 | #ifdef HAVE_RECORDING | 85 | #ifdef HAVE_RECORDING |
85 | #include "enc_config.h" | 86 | #include "enc_config.h" |
86 | #endif | 87 | #endif |
diff --git a/apps/voice_thread.c b/apps/voice_thread.c index 6e70f43cc5..98b9cafc83 100644 --- a/apps/voice_thread.c +++ b/apps/voice_thread.c | |||
@@ -22,7 +22,8 @@ | |||
22 | #include "voice_thread.h" | 22 | #include "voice_thread.h" |
23 | #include "talk.h" | 23 | #include "talk.h" |
24 | #include "dsp.h" | 24 | #include "dsp.h" |
25 | #include "audio.h" | 25 | #include "audio.h" |
26 | #include "playback.h" | ||
26 | #include "pcmbuf.h" | 27 | #include "pcmbuf.h" |
27 | #include "codecs/libspeex/speex/speex.h" | 28 | #include "codecs/libspeex/speex/speex.h" |
28 | 29 | ||