Remove hosted_get_volume(), as event data is available in button_get_data().
[maemo-rb.git] / apps / playback.h
blobea8718089fcae17046f40ada454b7a69fb757ec3
1 /***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
10 * Copyright (C) 2005 Miika Pekkarinen
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
20 ****************************************************************************/
22 #ifndef _PLAYBACK_H
23 #define _PLAYBACK_H
25 #include <stdbool.h>
26 #include <stdlib.h>
27 #include "config.h"
29 #if CONFIG_CODEC == SWCODEC
30 /* Including the code for fast previews is entirely optional since it
31 does add two more mp3entry's - for certain targets it may be less
32 beneficial such as flash-only storage */
33 #if MEMORYSIZE > 2
34 #define AUDIO_FAST_SKIP_PREVIEW
35 #endif
37 #endif /* CONFIG_CODEC == SWCODEC */
39 #ifdef HAVE_ALBUMART
41 #include "bmp.h"
42 #include "metadata.h"
44 * Returns the handle id of the buffered albumart for the given slot id
45 **/
46 int playback_current_aa_hid(int slot);
49 * Hands out an albumart slot for buffering albumart using the size
50 * int the passed dim struct, it copies the data of dim in order to
51 * be safe to be reused for other code
53 * The slot may be reused if other code calls this with the same dimensions
54 * in dim, so if you change dim release and claim a new slot
56 * Save to call from other threads */
57 int playback_claim_aa_slot(struct dim *dim);
60 * Releases the albumart slot with given id
62 * Save to call from other threads */
63 void playback_release_aa_slot(int slot);
65 struct bufopen_bitmap_data {
66 struct dim *dim;
67 struct mp3_albumart *embedded_albumart;
70 #endif
72 /* Functions */
73 bool audio_is_thread_ready(void);
74 int audio_track_count(void);
75 long audio_filebufused(void);
76 void audio_pre_ff_rewind(void);
77 void audio_skip(int direction);
78 void audio_hard_stop(void); /* Stops audio from serving playback */
80 void audio_set_cuesheet(int enable);
81 #ifdef HAVE_CROSSFADE
82 void audio_set_crossfade(int enable);
83 #endif
85 enum
87 AUDIO_WANT_PLAYBACK = 0,
88 AUDIO_WANT_VOICE,
90 bool audio_restore_playback(int type); /* Restores the audio buffer to handle the requested playback */
91 size_t audio_get_filebuflen(void);
92 bool audio_buffer_state_trashed(void);
94 /* Automatic transition? Only valid to call during the track change events,
95 otherwise the result is undefined. */
96 bool audio_automatic_skip(void);
98 /* Define one constant that includes recording related functionality */
99 #if defined(HAVE_RECORDING) && !defined(SIMULATOR)
100 #define AUDIO_HAVE_RECORDING
101 #endif
103 enum {
104 Q_NULL = 0, /* reserved */
106 /* -> audio */
107 Q_AUDIO_PLAY = 1,
108 Q_AUDIO_STOP,
109 Q_AUDIO_PAUSE,
110 Q_AUDIO_SKIP,
111 Q_AUDIO_PRE_FF_REWIND,
112 Q_AUDIO_FF_REWIND,
113 Q_AUDIO_FLUSH,
114 Q_AUDIO_DIR_SKIP,
116 /* pcmbuf -> audio */
117 Q_AUDIO_TRACK_CHANGED,
119 /* audio -> audio */
120 Q_AUDIO_FILL_BUFFER, /* continue buffering next track */
122 /* buffering -> audio */
123 Q_AUDIO_BUFFERING, /* some buffer event */
124 Q_AUDIO_FINISH_LOAD_TRACK, /* metadata is buffered */
125 Q_AUDIO_HANDLE_FINISHED, /* some other type is buffered */
127 /* codec -> audio (*) */
128 Q_AUDIO_CODEC_SEEK_COMPLETE,
129 Q_AUDIO_CODEC_COMPLETE,
131 /* audio -> codec */
132 Q_CODEC_LOAD,
133 Q_CODEC_RUN,
134 Q_CODEC_PAUSE,
135 Q_CODEC_SEEK,
136 Q_CODEC_STOP,
137 Q_CODEC_UNLOAD,
140 /*- miscellanous -*/
141 #ifdef AUDIO_HAVE_RECORDING
142 /* -> codec */
143 Q_AUDIO_LOAD_ENCODER, /* load an encoder for recording */
144 #endif
145 /* -> codec */
146 Q_CODEC_DO_CALLBACK,
149 /*- settings -*/
151 #ifdef HAVE_DISK_STORAGE
152 /* -> audio */
153 Q_AUDIO_UPDATE_WATERMARK, /* buffering watermark needs updating */
154 #endif
155 /* -> audio */
156 Q_AUDIO_REMAKE_AUDIO_BUFFER, /* buffer needs to be reinitialized */
159 /* (*) If you change these, you must check audio_clear_track_notifications
160 in playback.c for correctness */
162 #endif /* _PLAYBACK_H */