summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Sevakis <jethead71@rockbox.org>2006-11-11 05:11:05 +0000
committerMichael Sevakis <jethead71@rockbox.org>2006-11-11 05:11:05 +0000
commit806d8f3505ef7e477f9af4d1b07fe30cd1f28fb3 (patch)
tree538a760ad845a6bac321ce06a1213537b04884db
parent8d2711b7d2d9f19dc2375bd9395359ed725375ab (diff)
downloadrockbox-806d8f3505ef7e477f9af4d1b07fe30cd1f28fb3.tar.gz
rockbox-806d8f3505ef7e477f9af4d1b07fe30cd1f28fb3.zip
Added recording functions to plugin API per request of Thom Johansen. Cleaned up includes in plugin.c and grouped them a bit better in plugin.h while at it.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@11508 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/plugin.c62
-rw-r--r--apps/plugin.h47
2 files changed, 60 insertions, 49 deletions
diff --git a/apps/plugin.c b/apps/plugin.c
index 3a893fc537..1fbae6284a 100644
--- a/apps/plugin.c
+++ b/apps/plugin.c
@@ -7,7 +7,7 @@
7 * \/ \/ \/ \/ \/ 7 * \/ \/ \/ \/ \/
8 * $Id$ 8 * $Id$
9 * 9 *
10 * Copyright (C) 2002 Bj�n Stenberg 10 * Copyright (C) 2002 Björn Stenberg
11 * 11 *
12 * All files in this archive are subject to the GNU General Public License. 12 * All files in this archive are subject to the GNU General Public License.
13 * See the file COPYING in the source tree root for full license agreement. 13 * See the file COPYING in the source tree root for full license agreement.
@@ -16,63 +16,30 @@
16 * KIND, either express or implied. 16 * KIND, either express or implied.
17 * 17 *
18 ****************************************************************************/ 18 ****************************************************************************/
19#include <stdbool.h> 19#include "plugin.h"
20#include <ctype.h>
20#include <string.h> 21#include <string.h>
21#include <stdio.h> 22#include <sprintf.h>
22#include <atoi.h> 23#include <atoi.h>
23#include <timefuncs.h>
24#include <ctype.h>
25#include "debug.h" 24#include "debug.h"
26#include "button.h"
27#include "lcd.h"
28#include "dir.h"
29#include "file.h"
30#include "kernel.h"
31#include "usb.h"
32#include "sprintf.h"
33#include "logf.h"
34#include "screens.h"
35#include "misc.h"
36#include "i2c.h"
37#include "mas.h"
38#include "plugin.h"
39#include "lang.h" 25#include "lang.h"
40#include "keyboard.h" 26#include "keyboard.h"
41#include "mpeg.h"
42#include "buffer.h" 27#include "buffer.h"
43#include "mp3_playback.h"
44#include "backlight.h" 28#include "backlight.h"
45#include "ata.h"
46#include "talk.h"
47#include "sound_menu.h" 29#include "sound_menu.h"
48#include "mp3data.h" 30#include "mp3data.h"
49#include "powermgmt.h" 31#include "powermgmt.h"
50#include "system.h"
51#include "timer.h"
52#include "sound.h"
53#include "database.h"
54#include "splash.h" 32#include "splash.h"
55#include "list.h"
56#if (CONFIG_CODEC == SWCODEC)
57#include "pcm_playback.h"
58#include "dsp.h"
59#endif
60 33
61#ifdef CONFIG_CHARGING 34#ifdef CONFIG_CHARGING
62#include "power.h" 35#include "power.h"
63#endif 36#endif
64 37
65#ifdef HAVE_LCD_BITMAP 38#ifdef HAVE_LCD_BITMAP
66#include "peakmeter.h"
67#include "widgets.h"
68#include "bmp.h" 39#include "bmp.h"
69#include "bidi.h" 40#include "bidi.h"
70#endif 41#endif
71 42
72#ifdef HAVE_REMOTE_LCD
73#include "lcd-remote.h"
74#endif
75
76#ifdef SIMULATOR 43#ifdef SIMULATOR
77static unsigned char pluginbuf[PLUGIN_BUFFER_SIZE]; 44static unsigned char pluginbuf[PLUGIN_BUFFER_SIZE];
78void *sim_plugin_load(char *plugin, void **pd); 45void *sim_plugin_load(char *plugin, void **pd);
@@ -475,6 +442,27 @@ static const struct plugin_api rockbox_api = {
475 /* new stuff at the end, sort into place next time 442 /* new stuff at the end, sort into place next time
476 the API gets incompatible */ 443 the API gets incompatible */
477 444
445/* Keep these at the bottom till fully proven */
446#if CONFIG_CODEC == SWCODEC
447 &audio_master_sampr_list[0],
448 &hw_freq_sampr[0],
449#ifndef SIMULATOR
450 pcm_apply_settings,
451#endif
452#ifdef HAVE_RECORDING
453 &rec_freq_sampr[0],
454#ifndef SIMULATOR
455 pcm_set_monitor,
456 pcm_set_rec_source,
457 pcm_init_recording,
458 pcm_close_recording,
459 pcm_record_data,
460 pcm_stop_recording,
461 pcm_calculate_rec_peaks,
462 rec_set_source,
463#endif
464#endif /* HAVE_RECORDING */
465#endif /* CONFIG_CODEC == SWCODEC */
478}; 466};
479 467
480int plugin_load(const char* plugin, void* parameter) 468int plugin_load(const char* plugin, void* parameter)
diff --git a/apps/plugin.h b/apps/plugin.h
index 54d2702017..bfb02b9e67 100644
--- a/apps/plugin.h
+++ b/apps/plugin.h
@@ -29,47 +29,49 @@
29#define MEM 2 29#define MEM 2
30#endif 30#endif
31 31
32#include <stdarg.h>
33#include <stdbool.h> 32#include <stdbool.h>
33#include <sys/types.h>
34#include <stdarg.h>
34#include <stdio.h> 35#include <stdio.h>
35#include <stdlib.h> 36#include <stdlib.h>
36#include <sys/types.h>
37#include "config.h" 37#include "config.h"
38#include "system.h"
38#include "dir.h" 39#include "dir.h"
39#include "kernel.h" 40#include "kernel.h"
41#include "thread.h"
40#include "button.h" 42#include "button.h"
41#include "action.h" 43#include "action.h"
42#include "usb.h" 44#include "usb.h"
43#include "font.h" 45#include "font.h"
44#include "system.h"
45#include "lcd.h" 46#include "lcd.h"
46#include "id3.h" 47#include "id3.h"
48#include "sound.h"
47#include "mpeg.h" 49#include "mpeg.h"
48#include "audio.h" 50#include "audio.h"
49#include "mp3_playback.h" 51#include "mp3_playback.h"
50#include "tree.h" 52#include "talk.h"
51#ifdef RB_PROFILE 53#ifdef RB_PROFILE
52#include "profile.h" 54#include "profile.h"
53#endif 55#endif
54#include "misc.h" 56#include "misc.h"
55#if (CONFIG_CODEC == SWCODEC) 57#if (CONFIG_CODEC == SWCODEC)
56#include "pcm_playback.h"
57#include "dsp.h" 58#include "dsp.h"
59#ifdef HAVE_RECORDING
60#include "recording.h"
61#endif
58#else 62#else
59#include "mas.h" 63#include "mas.h"
60#endif 64#endif /* CONFIG_CODEC == SWCODEC */
61#include "settings.h" 65#include "settings.h"
62#include "timer.h" 66#include "timer.h"
63#include "thread.h"
64#include "playlist.h" 67#include "playlist.h"
65#ifdef HAVE_LCD_BITMAP 68#ifdef HAVE_LCD_BITMAP
66#include "widgets.h" 69#include "widgets.h"
67#endif 70#endif
68#include "sound.h"
69#include "menu.h" 71#include "menu.h"
70#include "rbunicode.h" 72#include "rbunicode.h"
71#include "list.h" 73#include "list.h"
72#include "talk.h" 74#include "tree.h"
73 75
74#ifdef HAVE_REMOTE_LCD 76#ifdef HAVE_REMOTE_LCD
75#include "lcd-remote.h" 77#include "lcd-remote.h"
@@ -105,7 +107,7 @@
105#define PLUGIN_MAGIC 0x526F634B /* RocK */ 107#define PLUGIN_MAGIC 0x526F634B /* RocK */
106 108
107/* increase this every time the api struct changes */ 109/* increase this every time the api struct changes */
108#define PLUGIN_API_VERSION 34 110#define PLUGIN_API_VERSION 35
109 111
110/* update this to latest version if a change to the api struct breaks 112/* update this to latest version if a change to the api struct breaks
111 backwards compatibility (and please take the opportunity to sort in any 113 backwards compatibility (and please take the opportunity to sort in any
@@ -405,7 +407,7 @@ struct plugin_api {
405 void (*bitswap)(unsigned char *data, int length); 407 void (*bitswap)(unsigned char *data, int length);
406#endif 408#endif
407#if CONFIG_CODEC == SWCODEC 409#if CONFIG_CODEC == SWCODEC
408 void (*pcm_play_data)(void (*get_more)(unsigned char** start, size_t*size), 410 void (*pcm_play_data)(pcm_more_callback_type get_more,
409 unsigned char* start, size_t size); 411 unsigned char* start, size_t size);
410 void (*pcm_play_stop)(void); 412 void (*pcm_play_stop)(void);
411 void (*pcm_set_frequency)(unsigned int frequency); 413 void (*pcm_set_frequency)(unsigned int frequency);
@@ -554,7 +556,28 @@ struct plugin_api {
554 /* new stuff at the end, sort into place next time 556 /* new stuff at the end, sort into place next time
555 the API gets incompatible */ 557 the API gets incompatible */
556 558
557 559/* Keep these at the bottom till fully proven */
560#if CONFIG_CODEC == SWCODEC
561 const unsigned long *audio_master_sampr_list;
562 const unsigned long *hw_freq_sampr;
563#ifndef SIMULATOR
564 void (*pcm_apply_settings)(bool reset);
565#endif
566#ifdef HAVE_RECORDING
567 const unsigned long *rec_freq_sampr;
568#ifndef SIMULATOR
569 void (*pcm_set_monitor)(int monitor);
570 void (*pcm_set_rec_source)(int source);
571 void (*pcm_init_recording)(void);
572 void (*pcm_close_recording)(void);
573 void (*pcm_record_data)(pcm_more_callback_type more_ready,
574 unsigned char *start, size_t size);
575 void (*pcm_stop_recording)(void);
576 void (*pcm_calculate_rec_peaks)(int *left, int *right);
577 void (*rec_set_source)(int source, unsigned flags);
578#endif
579#endif /* HAVE_RECORDING */
580#endif /* CONFIG_CODEC == SWCODEC */
558}; 581};
559 582
560/* plugin header */ 583/* plugin header */