New upstream version 2.9.2
Fabian Greffrath
3 years ago
0 | 2.9.2: | |
1 | [ Michał Janiszewski ] | |
2 | * Only use x86-assembly when explicitly on x86 | |
3 | * Use unsigned integers correctly | |
4 | * Initialize pointers that might otherwise not be | |
5 | ||
6 | [ Fabian Greffrath ] | |
7 | * update README esp. WRT directory structure | |
8 | ||
9 | [ Rosen Penev ] | |
10 | * fix compilation without SBR/PS_DEC (#48) | |
11 | * fix compilation with LC_ONLY_DECODER (#47) | |
12 | ||
13 | [ Fabian Greffrath ] | |
14 | * fix "inline function 'cfftf1' declared but never defined" compiler warning | |
15 | * fix some inconsistencies in the frontend output | |
16 | * mp4read_open: add check for failed frame buffer allocation | |
17 | * stszin: add check for allocation error and integer overflow | |
18 | * add a pkg-config file | |
19 | ||
20 | [ Stefan Pöschel ] | |
21 | * frontend: address compile warning + add missing LF (#50) | |
22 | ||
23 | [ François Cartegnie ] | |
24 | * library name is faad (#52) | |
25 | * Unbreak PS audio (#51) | |
26 | ||
0 | 27 | 2.9.1: |
1 | 28 | [ Fabian Greffrath ] |
2 | 29 | * Include stdio.h in libfaad/ps_dec.c for stderr (Michael Fink) |
47 | 47 | ACTIONS! |
48 | 48 | |
49 | 49 | |
50 | ______ | |
51 | PEOPLE | |
52 | ||
53 | FAAD2 is written by: | |
54 | - M. Bakker (mbakker(at)nero.com). | |
55 | ||
56 | ||
57 | _______________ | |
58 | VERSION HISTORY | |
59 | ||
60 | Sorry, try building a ChangeLog from CVS. | |
61 | ||
62 | 50 | ___________________ |
63 | 51 | DIRECTORY STRUCTURE |
64 | 52 | |
65 | 53 | faad2 - top level directory. |
66 | 54 | |
67 | aacDECdrop - windows decoder/player with drag'n'drop functionality | |
55 | aacDECdrop - windows decoder/player with drag'n'drop functionality. | |
68 | 56 | |
69 | common - generally used libraries and code. | |
57 | docs - API documentation. | |
70 | 58 | |
71 | faad - general common functions like filereading and streaming | |
72 | as well as getting info from aac files. | |
73 | ||
74 | mp4ff - Small MP4 file format library (includes tagging abilities). | |
75 | ||
76 | 59 | frontend - command line frontend to the FAAD2 library, also supports |
77 | 60 | MPEG-4 file decoding. |
78 | 61 | |
79 | 62 | include - inlude file for the FAAD2 library. |
80 | 63 | |
81 | 64 | libfaad - the FAAD2 AAC decoder library including SBR. |
82 | ||
83 | codebook - Huffman codebooks | |
65 | ||
66 | codebook - Huffman codebooks. | |
84 | 67 | |
85 | 68 | plugins - plugins for all kinds of pograms. |
86 | ||
87 | in_mp4 - winamp MPEG-4 AAC file input plugin. | |
88 | ||
69 | ||
70 | mpeg4ip - plugin for the mpeg4ip player. | |
71 | ||
89 | 72 | QCD - Quintessential player AAC plugin. |
90 | 73 | |
91 | 74 | QCDMp4 - Quintessential player MP4 plugin. |
92 | 75 | |
93 | xmms - xmms AAC plugin | |
76 | xmms - xmms AAC plugin. | |
94 | 77 | |
95 | mpeg4ip - plugin for the mpeg4ip player | |
78 | project/msvc - Visual Studio 2017 project files. | |
96 | 79 | |
80 | utils/win32 - generate "win32_ver.h" from "configure.h". |
7 | 7 | dnl - mpeg4ip plugin (requires mpeg4ip's libmp4v2 to be installed) |
8 | 8 | |
9 | 9 | AC_PREREQ(2.50) |
10 | AC_INIT(faad2, 2.9.1) | |
10 | AC_INIT(faad2, 2.9.2) | |
11 | 11 | AC_CONFIG_AUX_DIR(.) |
12 | 12 | AM_INIT_AUTOMAKE([subdir-objects]) |
13 | 13 | |
158 | 158 | fi |
159 | 159 | |
160 | 160 | AC_CONFIG_FILES(libfaad/Makefile) |
161 | AC_CONFIG_FILES(libfaad/faad2.pc) | |
161 | 162 | AC_CONFIG_FILES(plugins/Makefile) |
162 | 163 | AC_CONFIG_FILES(plugins/xmms/Makefile) |
163 | 164 | AC_CONFIG_FILES(plugins/xmms/src/Makefile) |
461 | 461 | unsigned char channels; |
462 | 462 | void *sample_buffer; |
463 | 463 | |
464 | audio_file *aufile; | |
465 | ||
466 | FILE *adtsFile; | |
464 | audio_file *aufile = NULL; | |
465 | ||
466 | FILE *adtsFile = NULL; | |
467 | 467 | unsigned char *adtsData; |
468 | 468 | int adtsDataSize; |
469 | 469 | |
795 | 795 | |
796 | 796 | long sampleId, startSampleId; |
797 | 797 | |
798 | audio_file *aufile; | |
799 | ||
800 | FILE *adtsFile; | |
798 | audio_file *aufile = NULL; | |
799 | ||
800 | FILE *adtsFile = NULL; | |
801 | 801 | unsigned char *adtsData; |
802 | 802 | int adtsDataSize; |
803 | 803 | |
1046 | 1046 | char *adtsFileName = NULL; |
1047 | 1047 | float seekTo = 0; |
1048 | 1048 | unsigned char header[8]; |
1049 | int bread; | |
1049 | 1050 | float length = 0; |
1050 | 1051 | FILE *hMP4File; |
1051 | 1052 | char *faad_id_string; |
1299 | 1300 | } |
1300 | 1301 | } |
1301 | 1302 | |
1302 | fread(header, 1, 8, hMP4File); | |
1303 | bread = fread(header, 1, 8, hMP4File); | |
1303 | 1304 | |
1304 | 1305 | if (! readFromStdin ) |
1305 | 1306 | fclose(hMP4File); |
1306 | 1307 | |
1308 | if (bread != 8) { | |
1309 | faad_fprintf(stderr, "Error reading file.\n"); | |
1310 | return 1; | |
1311 | } | |
1312 | ||
1307 | 1313 | if (header[4] == 'f' && header[5] == 't' && header[6] == 'y' && header[7] == 'p') |
1308 | 1314 | mp4file = 1; |
1309 | 1315 | |
1310 | 1316 | if (!mp4file && seekTo != 0) { |
1311 | faad_fprintf(stderr, "Warning: can only seek in MP4 files"); | |
1317 | faad_fprintf(stderr, "Warning: can only seek in MP4 files\n"); | |
1312 | 1318 | } |
1313 | 1319 | |
1314 | 1320 | if (mp4file) |
1350 | 1356 | float dec_length = (float)(clock() - begin)/(float)CLOCKS_PER_SEC; |
1351 | 1357 | #endif |
1352 | 1358 | faad_fprintf(stderr, "Decoding %s took: %5.2f sec. %5.2fx real-time.\n", aacFileName, |
1353 | dec_length, length/dec_length); | |
1359 | dec_length, (dec_length > 0.01) ? (length/dec_length) : 0.); | |
1354 | 1360 | } |
1355 | 1361 | |
1356 | 1362 | if (aacFileName != NULL) |
342 | 342 | u32in(); |
343 | 343 | // Number of entries |
344 | 344 | mp4config.frame.ents = u32in(); |
345 | // fixme error checking | |
346 | 345 | // fixme: check atom size |
347 | 346 | mp4config.frame.data = malloc(sizeof(*mp4config.frame.data) |
348 | 347 | * (mp4config.frame.ents + 1)); |
348 | ||
349 | if (!mp4config.frame.data) | |
350 | return ERR_FAIL; | |
351 | ||
349 | 352 | ofs = 0; |
350 | 353 | mp4config.frame.data[0] = ofs; |
351 | 354 | for (cnt = 0; cnt < mp4config.frame.ents; cnt++) |
357 | 360 | mp4config.frame.maxsize = fsize; |
358 | 361 | |
359 | 362 | mp4config.frame.data[cnt + 1] = ofs; |
363 | ||
364 | if (ofs < mp4config.frame.data[cnt]) | |
365 | return ERR_FAIL; | |
360 | 366 | } |
361 | 367 | |
362 | 368 | return size; |
950 | 956 | |
951 | 957 | static void mp4info(void) |
952 | 958 | { |
953 | fprintf(stderr, "Modification Time:\t\t%s", mp4time(mp4config.mtime)); | |
959 | fprintf(stderr, "Modification Time:\t\t%s\n", mp4time(mp4config.mtime)); | |
954 | 960 | fprintf(stderr, "Samplerate:\t\t%d\n", mp4config.samplerate); |
955 | 961 | fprintf(stderr, "Total samples:\t\t%d\n", mp4config.samples); |
956 | 962 | fprintf(stderr, "Total channels:\t\t%d\n", mp4config.channels); |
1001 | 1007 | } |
1002 | 1008 | |
1003 | 1009 | // alloc frame buffer |
1004 | // fixme: error checking | |
1005 | 1010 | mp4config.bitbuf.data = malloc(mp4config.frame.maxsize); |
1011 | ||
1012 | if (!mp4config.bitbuf.data) | |
1013 | goto err; | |
1006 | 1014 | |
1007 | 1015 | if (mp4config.verbose.header) |
1008 | 1016 | { |
31 | 31 | |
32 | 32 | libfaad_drm_la_LDFLAGS = ${libfaad_la_LDFLAGS} |
33 | 33 | libfaad_drm_la_LIBADD = ${libfaad_la_LIBADD} |
34 | libfaad_drm_la_CFLAGS = ${libfaad_la_CFLAGS} -DDRM -DDRM_PS | |
34 | libfaad_drm_la_CFLAGS = ${libfaad_la_CFLAGS} -DDRM_SUPPORT | |
35 | 35 | libfaad_drm_la_SOURCES = ${libfaad_la_SOURCES} |
36 | ||
37 | pkgconfigdir = $(libdir)/pkgconfig | |
38 | pkgconfig_DATA = faad2.pc | |
39 | ||
40 | EXTRA_DIST = faad2.pc.in |
59 | 59 | static void passf5(const uint16_t ido, const uint16_t l1, const complex_t *cc, complex_t *ch, |
60 | 60 | const complex_t *wa1, const complex_t *wa2, const complex_t *wa3, |
61 | 61 | const complex_t *wa4, const int8_t isign); |
62 | INLINE void cfftf1(uint16_t n, complex_t *c, complex_t *ch, | |
63 | const uint16_t *ifac, const complex_t *wa, const int8_t isign); | |
64 | 62 | static void cffti1(uint16_t n, complex_t *wa, uint16_t *ifac); |
65 | 63 | |
66 | 64 |
90 | 90 | /* Allow decoding of LD profile AAC */ |
91 | 91 | #define LD_DEC |
92 | 92 | /* Allow decoding of Digital Radio Mondiale (DRM) */ |
93 | //#define DRM | |
94 | //#define DRM_PS | |
93 | #ifdef DRM_SUPPORT | |
94 | #define DRM | |
95 | #define DRM_PS | |
96 | #endif | |
95 | 97 | |
96 | 98 | /* LD can't do without LTP */ |
97 | 99 | #ifdef LD_DEC |
114 | 116 | #undef MAIN_DEC |
115 | 117 | #undef SSR_DEC |
116 | 118 | #undef DRM |
119 | #undef DRM_PS | |
117 | 120 | #undef ALLOW_SMALL_FRAMELENGTH |
118 | 121 | #undef ERROR_RESILIENCE |
119 | 122 | #endif |
312 | 315 | } |
313 | 316 | |
314 | 317 | |
315 | #if defined(_WIN32) && !defined(_WIN64) && !defined(__MINGW32__) | |
318 | #if defined(_WIN32) && defined(_M_IX86) && !defined(__MINGW32__) | |
316 | 319 | #ifndef HAVE_LRINTF |
317 | 320 | #define HAS_LRINTF |
318 | 321 | static INLINE int lrintf(float f) |
238 | 238 | while (ld->bytes_left) |
239 | 239 | { |
240 | 240 | bits = faad_latm_frame(latm, ld); |
241 | if(bits==-1U) | |
241 | if(bits==0xFFFFFFFF) | |
242 | 242 | bad++; |
243 | 243 | else |
244 | 244 | { |
0 | prefix=@prefix@ | |
1 | exec_prefix=@exec_prefix@ | |
2 | libdir=@libdir@ | |
3 | includedir=@includedir@ | |
4 | ||
5 | Name: FAAD2 | |
6 | Description: Freeware Advanced Audio (AAC) Decoder | |
7 | Version: @VERSION@ | |
8 | Libs: -L${libdir} -lfaad | |
9 | Libs.private: -lm | |
10 | Cflags: -I${includedir} |
32 | 32 | |
33 | 33 | #include <stdlib.h> |
34 | 34 | |
35 | #include "bits.h" | |
36 | 35 | #include "mp4.h" |
37 | 36 | #include "syntax.h" |
38 | 37 |
34 | 34 | extern "C" { |
35 | 35 | #endif |
36 | 36 | |
37 | #include "bits.h" | |
37 | 38 | #include "neaacdec.h" |
38 | 39 | |
39 | 40 | int8_t AudioSpecificConfig2(uint8_t *pBuffer, |
914 | 914 | /* element_output_channels not set yet */ |
915 | 915 | hDecoder->element_output_channels[hDecoder->fr_ch_ele] = output_channels; |
916 | 916 | } else if (hDecoder->element_output_channels[hDecoder->fr_ch_ele] != output_channels) { |
917 | /* element inconsistency | |
918 | * this only happens if PS is actually found but not in the first frame | |
917 | /* element inconsistency */ | |
918 | ||
919 | /* this only happens if PS is actually found but not in the first frame | |
919 | 920 | * this means that there is only 1 bitstream element! |
920 | 921 | */ |
921 | 922 | |
922 | if (hDecoder->fr_channels == 1) { | |
923 | /* reset the allocation */ | |
924 | hDecoder->element_alloced[hDecoder->fr_ch_ele] = 0; | |
925 | hDecoder->element_output_channels[hDecoder->fr_ch_ele] = output_channels; | |
926 | } else { | |
927 | return 21; | |
928 | } | |
923 | /* reset the allocation */ | |
924 | hDecoder->element_alloced[hDecoder->fr_ch_ele] = 0; | |
925 | ||
926 | hDecoder->element_output_channels[hDecoder->fr_ch_ele] = output_channels; | |
927 | ||
928 | //return 21; | |
929 | 929 | } |
930 | 930 | |
931 | 931 | if (hDecoder->element_alloced[hDecoder->fr_ch_ele] == 0) |
937 | 937 | hDecoder->element_alloced[hDecoder->fr_ch_ele] = 1; |
938 | 938 | } |
939 | 939 | |
940 | /* sanity check, CVE-2018-20199, CVE-2018-20360 */ | |
941 | if(!hDecoder->time_out[sce->channel]) | |
942 | return 15; | |
940 | 943 | |
941 | 944 | /* dequantisation and scaling */ |
942 | 945 | retval = quant_to_spec(hDecoder, ics, spec_data, spec_coef, hDecoder->frameLength); |
1116 | 1119 | |
1117 | 1120 | hDecoder->element_alloced[hDecoder->fr_ch_ele] = 2; |
1118 | 1121 | } |
1122 | ||
1123 | /* sanity check, CVE-2018-20199, CVE-2018-20360 */ | |
1124 | if(!hDecoder->time_out[cpe->channel]) | |
1125 | return 15; | |
1119 | 1126 | |
1120 | 1127 | /* dequantisation and scaling */ |
1121 | 1128 | retval = quant_to_spec(hDecoder, ics1, spec_data1, spec_coef1, hDecoder->frameLength); |