annotate mp3lib/mpg123.h @ 32794:77d81e27a176

Fix stream_write_buffer to make sure all requested bytes are written None of the calling sites to stream_write_buffer are checking the return value to see if all bytes got written. This was causing (very occasionally) problems with mencoder when using output pipes AND running under a sandbox or when being straced (ptrace is the culprit) Theoretically this problem can happen without pipes or ptrace. Only stream_file, stream_smb and stream_ffmpeg implement write_buffer and ffmpeg already handles this internally. Original patch by Sang-Uok Kum. Signed-off-by: Tobias Diedrich <ranma@google.com>
author ranma
date Thu, 10 Feb 2011 21:25:38 +0000
parents 0ad2da052b2e
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
15167
07e7a572bd84 Mark modified imported files as such to comply with (L)GPL ¡ø2a.
diego
parents: 12131
diff changeset
1 /*
18783
0783dd397f74 CVS --> Subversion in copyright notices
diego
parents: 16989
diff changeset
2 * Modified for use with MPlayer, for details see the changelog at
0783dd397f74 CVS --> Subversion in copyright notices
diego
parents: 16989
diff changeset
3 * http://svn.mplayerhq.hu/mplayer/trunk/
15167
07e7a572bd84 Mark modified imported files as such to comply with (L)GPL ¡ø2a.
diego
parents: 12131
diff changeset
4 * $Id$
07e7a572bd84 Mark modified imported files as such to comply with (L)GPL ¡ø2a.
diego
parents: 12131
diff changeset
5 */
07e7a572bd84 Mark modified imported files as such to comply with (L)GPL ¡ø2a.
diego
parents: 12131
diff changeset
6
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
7 /*
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
8 * mpg123 defines
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
9 * used source: musicout.h from mpegaudio package
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
10 */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
11
30163
257ef2adfd66 Add multiple inclusion guards to all mp3lib headers.
diego
parents: 28051
diff changeset
12 #ifndef MPLAYER_MP3LIB_MPG123_H
257ef2adfd66 Add multiple inclusion guards to all mp3lib headers.
diego
parents: 28051
diff changeset
13 #define MPLAYER_MP3LIB_MPG123_H
257ef2adfd66 Add multiple inclusion guards to all mp3lib headers.
diego
parents: 28051
diff changeset
14
16989
e7a129082fda Unify include paths, -I.. is in CFLAGS.
diego
parents: 16852
diff changeset
15 #include "config.h"
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
16
1256
a738eae695cc #ifndef M_PI and M_SQRT2 added while fearing from redefining :)
alex
parents: 1245
diff changeset
17 #ifndef M_PI
30990
0ad2da052b2e the great MPlayer tab removal: part I
diego
parents: 30682
diff changeset
18 #define M_PI 3.141592653589793238462
1256
a738eae695cc #ifndef M_PI and M_SQRT2 added while fearing from redefining :)
alex
parents: 1245
diff changeset
19 #endif
a738eae695cc #ifndef M_PI and M_SQRT2 added while fearing from redefining :)
alex
parents: 1245
diff changeset
20 #ifndef M_SQRT2
30990
0ad2da052b2e the great MPlayer tab removal: part I
diego
parents: 30682
diff changeset
21 #define M_SQRT2 1.414213562373095048802
1256
a738eae695cc #ifndef M_PI and M_SQRT2 added while fearing from redefining :)
alex
parents: 1245
diff changeset
22 #endif
a738eae695cc #ifndef M_PI and M_SQRT2 added while fearing from redefining :)
alex
parents: 1245
diff changeset
23 #define REAL_IS_FLOAT
a738eae695cc #ifndef M_PI and M_SQRT2 added while fearing from redefining :)
alex
parents: 1245
diff changeset
24 #define NEW_DCT9
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
25
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
26 #undef MPG123_REMOTE /* Get rid of this stuff for Win32 */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
27
30167
347d152a5cfa Refactor real --> float #define to a typedef in a common header.
diego
parents: 30163
diff changeset
28 typedef float real;
347d152a5cfa Refactor real --> float #define to a typedef in a common header.
diego
parents: 30163
diff changeset
29
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
30 /*
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
31 # define real float
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
32 # define real long double
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
33 # define real double
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
34 #include "audio.h"
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
35
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
36 // #define AUDIOBUFSIZE 4096
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
37 */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
38
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
39 #define FALSE 0
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
40 #define TRUE 1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
41
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
42 #define MAX_NAME_SIZE 81
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
43 #define SBLIMIT 32
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
44 #define SCALE_BLOCK 12
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
45 #define SSLIMIT 18
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
46
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
47 #define MPG_MD_STEREO 0
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
48 #define MPG_MD_JOINT_STEREO 1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
49 #define MPG_MD_DUAL_CHANNEL 2
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
50 #define MPG_MD_MONO 3
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
51
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
52 /* #define MAXOUTBURST 32768 */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
53
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
54 /* Pre Shift fo 16 to 8 bit converter table */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
55 #define AUSHIFT (3)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
56
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
57 struct al_table
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
58 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
59 short bits;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
60 short d;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
61 };
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
62
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
63 struct frame {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
64 struct al_table *alloc;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
65 int (*synth)(real *,int,unsigned char *,int *);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
66 int (*synth_mono)(real *,unsigned char *,int *);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
67 int stereo;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
68 int jsbound;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
69 int single;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
70 int II_sblimit;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
71 int down_sample_sblimit;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
72 int lsf;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
73 int mpeg25;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
74 int down_sample;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
75 int header_change;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
76 int lay;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
77 int error_protection;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
78 int bitrate_index;
23434
d986b47f1451 Use int and uint32_t instead of long and unsigned long, when appropriate.
zuxy
parents: 18783
diff changeset
79 int sampling_frequency;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
80 int padding;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
81 int extension;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
82 int mode;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
83 int mode_ext;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
84 int copyright;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
85 int original;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
86 int emphasis;
23434
d986b47f1451 Use int and uint32_t instead of long and unsigned long, when appropriate.
zuxy
parents: 18783
diff changeset
87 int framesize; /* computed framesize */
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
88 };
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
89
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
90
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
91 struct gr_info_s {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
92 int scfsi;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
93 unsigned part2_3_length;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
94 unsigned big_values;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
95 unsigned scalefac_compress;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
96 unsigned block_type;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
97 unsigned mixed_block_flag;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
98 unsigned table_select[3];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
99 unsigned subblock_gain[3];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
100 unsigned maxband[3];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
101 unsigned maxbandl;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
102 unsigned maxb;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
103 unsigned region1start;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
104 unsigned region2start;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
105 unsigned preflag;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
106 unsigned scalefac_scale;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
107 unsigned count1table_select;
10343
b277842a74a2 merged with mpg123 0.59s-pre
arpi
parents: 8560
diff changeset
108 real *full_gain[3];
b277842a74a2 merged with mpg123 0.59s-pre
arpi
parents: 8560
diff changeset
109 real *pow2gain;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
110 };
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
111
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
112 struct III_sideinfo
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
113 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
114 unsigned main_data_begin;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
115 unsigned private_bits;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
116 struct {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
117 struct gr_info_s gr[2];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
118 } ch[2];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
119 };
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
120
8560
1320f1b3229d fixing that f*cking linker 'bug' e.g. naming config with libmp3lame
alex
parents: 1256
diff changeset
121 extern real mp3lib_decwin[(512+32)];
12131
d155623271e3 fix symbol clashes when linking with libmp3lame including mp3 decoder, man, mp3lib is so much bloated
alex
parents: 10343
diff changeset
122 extern real *mp3lib_pnts[];
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
123
28051
9e739bdb049c Get rid of pointless 'extern' keywords.
diego
parents: 23435
diff changeset
124 int synth_1to1_pent( real *, int, short * );
9e739bdb049c Get rid of pointless 'extern' keywords.
diego
parents: 23435
diff changeset
125 int synth_1to1_MMX( real *, int, short * );
9e739bdb049c Get rid of pointless 'extern' keywords.
diego
parents: 23435
diff changeset
126 int synth_1to1_MMX_s(real *, int, short *, short *, int *);
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
127
28051
9e739bdb049c Get rid of pointless 'extern' keywords.
diego
parents: 23435
diff changeset
128 void dct36_3dnow(real *, real *, real *, real *, real *);
9e739bdb049c Get rid of pointless 'extern' keywords.
diego
parents: 23435
diff changeset
129 void dct36_3dnowex(real *, real *, real *, real *, real *);
9e739bdb049c Get rid of pointless 'extern' keywords.
diego
parents: 23435
diff changeset
130 void dct36_sse(real *, real *, real *, real *, real *);
787
9bc104531aec mp3lib sse support - disabled by default
arpi_esp
parents: 736
diff changeset
131
30658
fbb18bfa2dfe Declare all public mp3lib functions in mpg123.h.
diego
parents: 30167
diff changeset
132 void dct64_MMX(short *, short *, real *);
fbb18bfa2dfe Declare all public mp3lib functions in mpg123.h.
diego
parents: 30167
diff changeset
133 void dct64_MMX_3dnow(short *, short *, real *);
fbb18bfa2dfe Declare all public mp3lib functions in mpg123.h.
diego
parents: 30167
diff changeset
134 void dct64_MMX_3dnowex(short *, short *, real *);
fbb18bfa2dfe Declare all public mp3lib functions in mpg123.h.
diego
parents: 30167
diff changeset
135 void dct64_sse(short *, short *, real *);
fbb18bfa2dfe Declare all public mp3lib functions in mpg123.h.
diego
parents: 30167
diff changeset
136 void dct64_altivec(real *, real *, real *);
30682
5fdc3c62cf76 Fix compilation: the dct64_MMX_func variable should be declared only once,
reimar
parents: 30658
diff changeset
137 extern void (*dct64_MMX_func)(short *, short *, real *);
30658
fbb18bfa2dfe Declare all public mp3lib functions in mpg123.h.
diego
parents: 30167
diff changeset
138
fbb18bfa2dfe Declare all public mp3lib functions in mpg123.h.
diego
parents: 30167
diff changeset
139 void mp3lib_dct64(real *, real *, real *);
fbb18bfa2dfe Declare all public mp3lib functions in mpg123.h.
diego
parents: 30167
diff changeset
140
1245
03b7e2955a20 Added newest MMX-optimized decore which speedups decoding at least on 13% for any cpu.
nick
parents: 787
diff changeset
141 typedef int (*synth_func_t)( real *,int,short * );
03b7e2955a20 Added newest MMX-optimized decore which speedups decoding at least on 13% for any cpu.
nick
parents: 787
diff changeset
142 typedef void (*dct36_func_t)(real *,real *,real *,real *,real *);
30163
257ef2adfd66 Add multiple inclusion guards to all mp3lib headers.
diego
parents: 28051
diff changeset
143
257ef2adfd66 Add multiple inclusion guards to all mp3lib headers.
diego
parents: 28051
diff changeset
144 #endif /* MPLAYER_MP3LIB_MPG123_H */