summaryrefslogtreecommitdiff
path: root/apps/codecs/libfaad/decoder.h
blob: 2b2eb8bc0ce6bac88aede13ee600c814c9849c30 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
/*
** 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 __DECODER_H__
#define __DECODER_H__

#ifdef __cplusplus
extern "C" {
#endif

#ifdef _WIN32
  #pragma pack(push, 8)
  #ifndef NEAACDECAPI
    #define NEAACDECAPI __cdecl
  #endif
#else
  #ifndef NEAACDECAPI
    #define NEAACDECAPI
  #endif
#endif


/* library output formats */
#define FAAD_FMT_16BIT  1
#define FAAD_FMT_24BIT  2
#define FAAD_FMT_32BIT  3
#define FAAD_FMT_FLOAT  4
#define FAAD_FMT_FIXED  FAAD_FMT_FLOAT
#define FAAD_FMT_DOUBLE 5

#define LC_DEC_CAP            (1<<0)
#define MAIN_DEC_CAP          (1<<1)
#define LTP_DEC_CAP           (1<<2)
#define LD_DEC_CAP            (1<<3)
#define ERROR_RESILIENCE_CAP  (1<<4)
#define FIXED_POINT_CAP       (1<<5)

#define FRONT_CHANNEL_CENTER (1)
#define FRONT_CHANNEL_LEFT   (2)
#define FRONT_CHANNEL_RIGHT  (3)
#define SIDE_CHANNEL_LEFT    (4)
#define SIDE_CHANNEL_RIGHT   (5)
#define BACK_CHANNEL_LEFT    (6)
#define BACK_CHANNEL_RIGHT   (7)
#define BACK_CHANNEL_CENTER  (8)
#define LFE_CHANNEL          (9)
#define UNKNOWN_CHANNEL      (0)

char* NEAACDECAPI NeAACDecGetErrorMessage(uint8_t errcode);

uint32_t NEAACDECAPI NeAACDecGetCapabilities(void);

NeAACDecHandle NEAACDECAPI NeAACDecOpen(void);

NeAACDecConfigurationPtr NEAACDECAPI NeAACDecGetCurrentConfiguration(NeAACDecHandle hDecoder);

uint8_t NEAACDECAPI NeAACDecSetConfiguration(NeAACDecHandle hDecoder,
                                             NeAACDecConfigurationPtr config);

/* Init the library based on info from the AAC file (ADTS/ADIF) */
int32_t NEAACDECAPI NeAACDecInit(NeAACDecHandle hDecoder,
                                 uint8_t *buffer,
                                 uint32_t buffer_size,
                                 uint32_t *samplerate,
                                 uint8_t *channels);

/* Init the library using a DecoderSpecificInfo */
int8_t NEAACDECAPI NeAACDecInit2(NeAACDecHandle hDecoder, uint8_t *pBuffer,
                                 uint32_t SizeOfDecoderSpecificInfo,
                                 uint32_t *samplerate, uint8_t *channels);

/* Init the library for DRM */
int8_t NEAACDECAPI NeAACDecInitDRM(NeAACDecHandle *hDecoder, uint32_t samplerate,
                                   uint8_t channels);

void NEAACDECAPI NeAACDecClose(NeAACDecHandle hDecoder);

void NEAACDECAPI NeAACDecPostSeekReset(NeAACDecHandle hDecoder, int32_t frame);

void* NEAACDECAPI NeAACDecDecode(NeAACDecHandle hDecoder,
                                 NeAACDecFrameInfo *hInfo,
                                 uint8_t *buffer,
                                 uint32_t buffer_size);

void* NEAACDECAPI NeAACDecDecode2(NeAACDecHandle hDecoder,
                                  NeAACDecFrameInfo *hInfo,
                                  uint8_t *buffer, uint32_t buffer_size,
                                  void **sample_buffer, uint32_t sample_buffer_size);

#ifdef _WIN32
  #pragma pack(pop)
#endif

#ifdef __cplusplus
}
#endif
#endif
ss="hl opt">, 0x04, 0x0e, 0x1F, 0x1F, 0x1F, 0x0e, /* (+28)Cerise */ 0x00, 0x04, 0x04, 0x1F, 0x04, 0x0E, 0x1F, /* (+35)Carreau */ 0x04, 0x0E, 0x15, 0x04, 0x0A, 0x0A, 0x11, /* (+42)Homme */ 0x00, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x00, /* (+49)Carre */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* (+56)Empty */ 0x00, 0x0A, 0x1F, 0x1F, 0x1F, 0x0e, 0x04 /* (+63)Coeur */ }; static unsigned char str[12]; /*Containt the first line*/ static unsigned char h1,h2,h3; /*Handle for the pattern*/ /* here is a global api struct pointer. while not strictly necessary, it's nice not to have to pass the api pointer in all function calls in the plugin */ static struct plugin_api* rb; /*Display the first line*/ static void display_first_line(int g) { rb->snprintf(str,sizeof(str),"[ ]$%d",g); rb->lcd_puts(0,0,str); rb->lcd_putc(1,0, h1); rb->lcd_putc(2,0, h2); rb->lcd_putc(3,0, h3); } /*Call when the program exit*/ static void jackpot_exit(void *parameter) { (void)parameter; /* Restore the old pattern (i don't find another way to do this. Any idea?) */ rb->lcd_unlock_pattern(h1); rb->lcd_unlock_pattern(h2); rb->lcd_unlock_pattern(h3); /* Clear the screen */ rb->lcd_clear_display(); } /* this is the plugin entry point */ enum plugin_status plugin_start(struct plugin_api* api, void* parameter) { int i,button,w,j; int s[3]; int n[3]; int g=20; bool exit=false; bool go; /* if you don't use the parameter, you can do like this to avoid the compiler warning about it */ (void)parameter; /* if you are using a global api pointer, don't forget to copy it! otherwise you will get lovely "I04: IllInstr" errors... :-) */ rb = api; rb->srand(*rb->current_tick); /*Get the pattern handle*/ h1=rb->lcd_get_locked_pattern(); h2=rb->lcd_get_locked_pattern(); h3=rb->lcd_get_locked_pattern(); /*Init message*/ rb->lcd_define_pattern(h1, pattern); rb->lcd_define_pattern(h2, pattern+7); rb->lcd_define_pattern(h3, pattern+28); rb->snprintf(str,sizeof(str),"%c%cJackpot%c%c",h1,h2,h2,h1); rb->lcd_puts(0,0,str); rb->snprintf(str,sizeof(str)," %c V1.1 %c",h3,h3); rb->lcd_puts(0,1,str); rb->sleep(HZ*2); rb->lcd_clear_display(); /*First display*/ rb->snprintf(str,sizeof(str),"[ ]$%d",g); rb->lcd_puts(0,0,str); rb->lcd_puts_scroll(0,1,"PLAY to begin"); /*Empty the event queue*/ rb->button_clear_queue(); /* Define the start pattern */ s[0]=(rb->rand()%9)*7; s[1]=(rb->rand()%9)*7; s[2]=(rb->rand()%9)*7; /*Main loop*/ while (!exit) { /*Keyboard loop*/ go=false; while (!go) { button = rb->button_get(true); switch ( button ) { case BUTTON_STOP|BUTTON_REL: exit = true; go = true; break; case BUTTON_PLAY|BUTTON_REL: exit = false; if (g>0) { go = true; g--; } break; default: if (rb->default_event_handler_ex(button, jackpot_exit, NULL) == SYS_USB_CONNECTED) return PLUGIN_USB_CONNECTED; break; } } /*Clear the Second line*/ rb->lcd_puts_scroll(0,1,"Good luck"); /*GO !!!!*/ if ( go && !exit ) { /* How many pattern? */ n[0]=(rb->rand()%15+5)*7; n[1]=(rb->rand()%15+5)*7; n[2]=(rb->rand()%15+5)*7; display_first_line(g); /* Jackpot Animation */ while((n[0]>=0) || (n[1]>=0) || (n[2]>=0)) { if (n[0]>=0) rb->lcd_define_pattern(h1, pattern+s[0]); if (n[1]>=0) rb->lcd_define_pattern(h2, pattern+s[1]); if (n[2]>=0) rb->lcd_define_pattern(h3, pattern+s[2]); rb->sleep(HZ/24); rb->lcd_putc(1,0, h1); rb->lcd_putc(2,0, h2); rb->lcd_putc(3,0, h3); for(i=0;i<3;i++) { if (n[i]>=0) { n[i]--; s[i]++; if (s[i]>=63) s[i]=0; } } } /* You won? */ s[0]--; s[1]--; s[2]--; w=(s[0]/7)*100+(s[1]/7)*10+(s[2]/7); j=0; switch (w) { case 111 : j=20; break; case 000 : j=15; break; case 333 : j=10; break; case 222 : j=8; break; case 555 : j=5; break; case 777 : j=4; break; case 251 : j=4; break; case 510 : j=4; break; case 686 : j=3; break; case 585 : j=3; break; case 282 : j=3; break; case 484 : j=3; break; case 787 : j=2; break; case 383 : j=2; break; case 80 : j=2; break; } if (j==0) { rb->lcd_puts(0,1,"None..."); if (g<=0) rb->lcd_puts_scroll(0,1,"You lose...STOP to quit"); } else { g+=j; display_first_line(g); rb->snprintf(str,sizeof(str),"You win %d$",j); rb->lcd_puts(0,1,str); } } } /* This is the end */ jackpot_exit(NULL); /* Bye */ return PLUGIN_OK; } #endif