/*************************************************************************** * __________ __ ___. * Open \______ \ ____ ____ | | _\_ |__ _______ ___ * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ * \/ \/ \/ \/ \/ * $Id$ * * Copyright (C) 2002 Robert E. Hak * * All files in this archive are subject to the GNU General Public License. * See the file COPYING in the source tree root for full license agreement. * * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY * KIND, either express or implied. * ****************************************************************************/ /* 2005 Kevin Ferrare : - Multi screen support - Rewrote/removed a lot of code now useless with the new gui API */ #include #include #include "plugin.h" #include "oldmenuapi.h" struct plugin_api *rb = NULL; struct menu { struct menu_item* items; int (*callback)(int, int); struct gui_synclist synclist; }; #define MAX_MENUS 6 static struct menu menus[MAX_MENUS]; static bool inuse[MAX_MENUS] = { false }; static char * menu_get_itemname(int selected_item, void * data, char *buffer) { struct menu *local_menus=(struct menu *)data; (void)buffer; return(local_menus->items[selected_item].desc); } static int menu_find_free(void) { int i; /* Tries to find an unused slot to put the new menu */ for ( i=0; igui_synclist_init(&(menus[menu].synclist), &menu_get_itemname, &menus[menu], false, 1); rb->gui_synclist_set_icon_callback(&(menus[menu].synclist), NULL); rb->gui_synclist_set_nb_items(&(menus[menu].synclist), count); menus[menu].callback = callback; (void)button1; (void)button2; (void)button3; return menu; } void menu_exit(int m) { inuse[m] = false; } int menu_show(int m) { bool exit = false; int key; rb->gui_synclist_draw(&(menus[m].synclist)); rb->gui_syncstatusbar_draw(rb->statusbars, true); while (!exit) { key = rb->get_action(CONTEXT_MAINMENU,HZ/2); /* * "short-circuit" the default keypresses by running the * callback function * The callback may return a new key value, often this will be * BUTTON_NONE or the same key value, but it's perfectly legal * to "simulate" key presses by returning another value. */ if( menus[m].callback != NULL ) key = menus[m].callback(key, m); rb->gui_synclist_do_button(&(menus[m].synclist), key,LIST_WRAP_UNLESS_HELD); switch( key ) { case ACTION_STD_OK: return rb->gui_synclist_get_sel_pos(&(menus[m].synclist)); case ACTION_STD_CANCEL: case ACTION_STD_MENU: case SYS_POWEROFF: exit = true; break; default: if(rb->default_event_handler(key) == SYS_USB_CONNECTED) return MENU_ATTACHED_USB; break; } rb->gui_syncstatusbar_draw(rb->statusbars, false); } return MENU_SELECTED_EXIT; } bool menu_run(int m) { int selected; while (1) { switch (selected=menu_show(m)) { case MENU_SELECTED_EXIT: return false; case MENU_ATTACHED_USB: return true; default: { if (menus[m].items[selected].function && menus[m].items[selected].function()) return true; rb->gui_syncstatusbar_draw(rb->statusbars, true); } } } return false; } /* * Property function - return the current cursor for "menu" */ int menu_cursor(int menu) { return rb->gui_synclist_get_sel_pos(&(menus[menu].synclist)); } /* * Property function - return the "menu" description at "position" */ char* menu_description(int menu, int position) { return menus[menu].items[position].desc; } /* * Delete the element "position" from the menu items in "menu" */ void menu_delete(int menu, int position) { int i; int nb_items=rb->gui_synclist_get_nb_items(&(menus[menu].synclist)); /* copy the menu item from the one below */ for( i = position; i < nb_items - 1; i++) menus[menu].items[i] = menus[menu].items[i + 1]; rb->gui_synclist_del_item(&(menus[menu].synclist)); } void menu_insert(int menu, int position, char *desc, bool (*function) (void)) { int i; int nb_items=rb->gui_synclist_get_nb_items(&(menus[menu].synclist)); if(position < 0) position = nb_items; /* Move the items below one position forward */ for( i = nb_items; i > position; i--) menus[menu].items[i] = menus[menu].items[i - 1]; /* Update the current item */ menus[menu].items[position].desc = (unsigned char *)desc; menus[menu].items[position].function = function; rb->gui_synclist_add_item(&(menus[menu].synclist)); } /* * Property function - return the "count" of menu items in "menu" */ int menu_count(int menu) { return rb->gui_synclist_get_nb_items(&(menus[menu].synclist)); } /* * Allows to set the cursor position. Doesn't redraw by itself. */ void menu_set_cursor(int menu, int position) { rb->gui_synclist_select_item(&(menus[menu].synclist), position); } #if 0 void menu_talk_selected(int m) { if(rb->global_settings->talk_menu) { int selected=rb->gui_synclist_get_sel_pos(&(menus[m].synclist)); int voice_id = P2ID(menus[m].items[selected].desc); if (voice_id >= 0) /* valid ID given? */ talk_id(voice_id, false); /* say it */ } } #endif void menu_draw(int m) { rb->gui_synclist_draw(&(menus[m].synclist)); } a> 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 2 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
**
** Any non-GPL usage of this software or parts of this software is strictly
** forbidden.
**
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
** $Id$
**/

#ifndef __STRUCTS_H__
#define __STRUCTS_H__

#ifdef __cplusplus
extern "C" {
#endif

//#include "cfft.h"
#ifdef SBR_DEC
#include "sbr_dec.h"
#endif

#define MAX_CHANNELS        64
#define MAX_SYNTAX_ELEMENTS 48
#define MAX_WINDOW_GROUPS    8
#define MAX_SFB             51
#define MAX_LTP_SFB         40
#define MAX_LTP_SFB_S        8

/* used to save the prediction state */
typedef struct {
    int16_t r[2];
    int16_t COR[2];
    int16_t VAR[2];
} pred_state;

typedef struct {
    uint16_t N;
    //cfft_info *cfft;
    complex_t *sincos;
#ifdef PROFILE
    int64_t cycles;
    int64_t fft_cycles;
#endif
} mdct_info;

typedef struct
{
    const real_t *long_window[2];
    const real_t *short_window[2];
#ifdef LD_DEC
    const real_t *ld_window[2];
#endif

    mdct_info *mdct256;
#ifdef LD_DEC
    mdct_info *mdct1024;
#endif
    mdct_info *mdct2048;
#ifdef PROFILE
    int64_t cycles;
#endif
} fb_info;

typedef struct
{
    uint8_t present;

    uint8_t num_bands;
    uint8_t pce_instance_tag;
    uint8_t excluded_chns_present;
    uint8_t band_top[17];
    uint8_t prog_ref_level;
    uint8_t dyn_rng_sgn[17];
    uint8_t dyn_rng_ctl[17];
    uint8_t exclude_mask[MAX_CHANNELS];
    uint8_t additional_excluded_chns[MAX_CHANNELS];

    real_t ctrl1;
    real_t ctrl2;
} drc_info;

typedef struct
{
    uint8_t element_instance_tag;
    uint8_t object_type;
    uint8_t sf_index;
    uint8_t num_front_channel_elements;
    uint8_t num_side_channel_elements;
    uint8_t num_back_channel_elements;
    uint8_t num_lfe_channel_elements;
    uint8_t num_assoc_data_elements;
    uint8_t num_valid_cc_elements;
    uint8_t mono_mixdown_present;
    uint8_t mono_mixdown_element_number;
    uint8_t stereo_mixdown_present;
    uint8_t stereo_mixdown_element_number;
    uint8_t matrix_mixdown_idx_present;
    uint8_t pseudo_surround_enable;
    uint8_t matrix_mixdown_idx;
    uint8_t front_element_is_cpe[16];
    uint8_t front_element_tag_select[16];
    uint8_t side_element_is_cpe[16];
    uint8_t side_element_tag_select[16];
    uint8_t back_element_is_cpe[16];
    uint8_t back_element_tag_select[16];
    uint8_t lfe_element_tag_select[16];
    uint8_t assoc_data_element_tag_select[16];
    uint8_t cc_element_is_ind_sw[16];
    uint8_t valid_cc_element_tag_select[16];

    uint8_t channels;

    uint8_t comment_field_bytes;
    uint8_t comment_field_data[257];

    /* extra added values */
    uint8_t num_front_channels;
    uint8_t num_side_channels;
    uint8_t num_back_channels;
    uint8_t num_lfe_channels;
    uint8_t sce_channel[16];
    uint8_t cpe_channel[16];
} program_config;

typedef struct
{
    uint16_t syncword;
    uint8_t id;
    uint8_t layer;
    uint8_t protection_absent;
    uint8_t profile;
    uint8_t sf_index;
    uint8_t private_bit;
    uint8_t channel_configuration;
    uint8_t original;
    uint8_t home;
    uint8_t emphasis;
    uint8_t copyright_identification_bit;
    uint8_t copyright_identification_start;
    uint16_t aac_frame_length;
    uint16_t adts_buffer_fullness;
    uint8_t no_raw_data_blocks_in_frame;
    uint16_t crc_check;

    /* control param */
    uint8_t old_format;
} adts_header;

typedef struct
{
    uint8_t copyright_id_present;
    int8_t copyright_id[10];
    uint8_t original_copy;
    uint8_t home;
    uint8_t bitstream_type;
    uint32_t bitrate;
    uint8_t num_program_config_elements;
    uint32_t adif_buffer_fullness;