annotate libmpcodecs/ad.c @ 29385:f9ae25067fe0

Fix 24bit audio playback. The reordering channels code had reoccurring bug where in switch(samplesize) block the case 3 (3 bytes) doesn't end with break; leading to execution of the next case 4 too. This mangles the already processed data and causes massive memory corruption.
author iive
date Sun, 19 Jul 2009 09:55:29 +0000
parents d5d66bff938a
children 5ba6784f6574
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
28924
d5d66bff938a cosmetics: Remove file names from file header, it only causes trouble.
diego
parents: 27363
diff changeset
1 /* audio decoder interface */
5344
7198d3eba09f ok, use ad_* stuff
arpi
parents:
diff changeset
2
7198d3eba09f ok, use ad_* stuff
arpi
parents:
diff changeset
3 #include <stdio.h>
7198d3eba09f ok, use ad_* stuff
arpi
parents:
diff changeset
4 #include <stdlib.h>
7198d3eba09f ok, use ad_* stuff
arpi
parents:
diff changeset
5 #include <string.h>
7198d3eba09f ok, use ad_* stuff
arpi
parents:
diff changeset
6
7198d3eba09f ok, use ad_* stuff
arpi
parents:
diff changeset
7 #include "config.h"
7198d3eba09f ok, use ad_* stuff
arpi
parents:
diff changeset
8
22599
4faee1254928 Add explicit location for headers from the stream/ directory.
diego
parents: 18765
diff changeset
9 #include "stream/stream.h"
22601
ed8f90096c65 Add explicit location for headers from the libmpdemux/ directory.
diego
parents: 22599
diff changeset
10 #include "libmpdemux/demuxer.h"
ed8f90096c65 Add explicit location for headers from the libmpdemux/ directory.
diego
parents: 22599
diff changeset
11 #include "libmpdemux/stheader.h"
5344
7198d3eba09f ok, use ad_* stuff
arpi
parents:
diff changeset
12 #include "ad.h"
7198d3eba09f ok, use ad_* stuff
arpi
parents:
diff changeset
13
7198d3eba09f ok, use ad_* stuff
arpi
parents:
diff changeset
14 /* Missed vorbis, mad, dshow */
7198d3eba09f ok, use ad_* stuff
arpi
parents:
diff changeset
15
7198d3eba09f ok, use ad_* stuff
arpi
parents:
diff changeset
16 //extern ad_functions_t mpcodecs_ad_null;
7198d3eba09f ok, use ad_* stuff
arpi
parents:
diff changeset
17 extern ad_functions_t mpcodecs_ad_mp3lib;
7198d3eba09f ok, use ad_* stuff
arpi
parents:
diff changeset
18 extern ad_functions_t mpcodecs_ad_ffmpeg;
7198d3eba09f ok, use ad_* stuff
arpi
parents:
diff changeset
19 extern ad_functions_t mpcodecs_ad_liba52;
7198d3eba09f ok, use ad_* stuff
arpi
parents:
diff changeset
20 extern ad_functions_t mpcodecs_ad_hwac3;
17397
2e20dd653147 ad_hwmpa: pass-through fake audio codec for hardware mpeg decoders
nicodvb
parents: 17151
diff changeset
21 extern ad_functions_t mpcodecs_ad_hwmpa;
5344
7198d3eba09f ok, use ad_* stuff
arpi
parents:
diff changeset
22 extern ad_functions_t mpcodecs_ad_pcm;
7198d3eba09f ok, use ad_* stuff
arpi
parents:
diff changeset
23 extern ad_functions_t mpcodecs_ad_dvdpcm;
7198d3eba09f ok, use ad_* stuff
arpi
parents:
diff changeset
24 extern ad_functions_t mpcodecs_ad_alaw;
7198d3eba09f ok, use ad_* stuff
arpi
parents:
diff changeset
25 extern ad_functions_t mpcodecs_ad_imaadpcm;
7198d3eba09f ok, use ad_* stuff
arpi
parents:
diff changeset
26 extern ad_functions_t mpcodecs_ad_msadpcm;
7198d3eba09f ok, use ad_* stuff
arpi
parents:
diff changeset
27 extern ad_functions_t mpcodecs_ad_dk3adpcm;
5519
868c13f78f08 vf control codes added, autoq support
arpi
parents: 5479
diff changeset
28 extern ad_functions_t mpcodecs_ad_dk4adpcm;
5344
7198d3eba09f ok, use ad_* stuff
arpi
parents:
diff changeset
29 extern ad_functions_t mpcodecs_ad_dshow;
8326
4849a0cfc2aa DMO audio support (including 6ch support too)
arpi
parents: 8160
diff changeset
30 extern ad_functions_t mpcodecs_ad_dmo;
5344
7198d3eba09f ok, use ad_* stuff
arpi
parents:
diff changeset
31 extern ad_functions_t mpcodecs_ad_acm;
5345
81071ffb7b22 ad_msgsm added
arpi
parents: 5344
diff changeset
32 extern ad_functions_t mpcodecs_ad_msgsm;
5356
739cad21c32c Port dec_audio.c faad aac decoder to libmpcodecs, cleaned up code, improved buffering scheme.
atmos4
parents: 5345
diff changeset
33 extern ad_functions_t mpcodecs_ad_faad;
7174
7672615cc811 sync driver names with codec-cfg
arpi
parents: 6927
diff changeset
34 extern ad_functions_t mpcodecs_ad_libvorbis;
16915
6b1d1e4adaea Speex support. Seeking and pts generation does not work.
reimar
parents: 15958
diff changeset
35 extern ad_functions_t mpcodecs_ad_speex;
5479
22b289d7f87f libmad support, rewritten from scratch using Xine decoder as sample
arpi
parents: 5454
diff changeset
36 extern ad_functions_t mpcodecs_ad_libmad;
7174
7672615cc811 sync driver names with codec-cfg
arpi
parents: 6927
diff changeset
37 extern ad_functions_t mpcodecs_ad_realaud;
6927
0145bba6e201 native DV audio/video decoders using libdv
arpi
parents: 6367
diff changeset
38 extern ad_functions_t mpcodecs_ad_libdv;
8008
35d663ad0d95 qtaudio - audio decoder using win32 quicktime 5 dlls
arpi
parents: 7174
diff changeset
39 extern ad_functions_t mpcodecs_ad_qtaudio;
14276
fa80ed52127b TwinVQ decoder and demuxer
rtognimp
parents: 12827
diff changeset
40 extern ad_functions_t mpcodecs_ad_twin;
15958
087142ef3a2d musepack demuxing and decoding support (demuxing is v7 bitstream only).
reimar
parents: 14276
diff changeset
41 extern ad_functions_t mpcodecs_ad_libmusepack;
23821
46b21d6fb61d DTS decoding via libdca
rtogni
parents: 22601
diff changeset
42 extern ad_functions_t mpcodecs_ad_libdca;
5344
7198d3eba09f ok, use ad_* stuff
arpi
parents:
diff changeset
43
7198d3eba09f ok, use ad_* stuff
arpi
parents:
diff changeset
44 ad_functions_t* mpcodecs_ad_drivers[] =
7198d3eba09f ok, use ad_* stuff
arpi
parents:
diff changeset
45 {
7198d3eba09f ok, use ad_* stuff
arpi
parents:
diff changeset
46 // &mpcodecs_ad_null,
27341
e7c989f7a7c9 Start unifying names of internal preprocessor directives.
diego
parents: 26206
diff changeset
47 #ifdef CONFIG_MP3LIB
5344
7198d3eba09f ok, use ad_* stuff
arpi
parents:
diff changeset
48 &mpcodecs_ad_mp3lib,
8026
b465ba5897a3 usage of libmpeg2, liba52, mp3lib & svq1 can be disabled
arpi
parents: 8008
diff changeset
49 #endif
27341
e7c989f7a7c9 Start unifying names of internal preprocessor directives.
diego
parents: 26206
diff changeset
50 #ifdef CONFIG_LIBA52
5344
7198d3eba09f ok, use ad_* stuff
arpi
parents:
diff changeset
51 &mpcodecs_ad_liba52,
7198d3eba09f ok, use ad_* stuff
arpi
parents:
diff changeset
52 &mpcodecs_ad_hwac3,
8026
b465ba5897a3 usage of libmpeg2, liba52, mp3lib & svq1 can be disabled
arpi
parents: 8008
diff changeset
53 #endif
17397
2e20dd653147 ad_hwmpa: pass-through fake audio codec for hardware mpeg decoders
nicodvb
parents: 17151
diff changeset
54 &mpcodecs_ad_hwmpa,
27341
e7c989f7a7c9 Start unifying names of internal preprocessor directives.
diego
parents: 26206
diff changeset
55 #ifdef CONFIG_LIBAVCODEC
5344
7198d3eba09f ok, use ad_* stuff
arpi
parents:
diff changeset
56 &mpcodecs_ad_ffmpeg,
7198d3eba09f ok, use ad_* stuff
arpi
parents:
diff changeset
57 #endif
7198d3eba09f ok, use ad_* stuff
arpi
parents:
diff changeset
58 &mpcodecs_ad_pcm,
7198d3eba09f ok, use ad_* stuff
arpi
parents:
diff changeset
59 &mpcodecs_ad_dvdpcm,
7198d3eba09f ok, use ad_* stuff
arpi
parents:
diff changeset
60 &mpcodecs_ad_alaw,
7198d3eba09f ok, use ad_* stuff
arpi
parents:
diff changeset
61 &mpcodecs_ad_imaadpcm,
7198d3eba09f ok, use ad_* stuff
arpi
parents:
diff changeset
62 &mpcodecs_ad_msadpcm,
7198d3eba09f ok, use ad_* stuff
arpi
parents:
diff changeset
63 &mpcodecs_ad_dk3adpcm,
5345
81071ffb7b22 ad_msgsm added
arpi
parents: 5344
diff changeset
64 &mpcodecs_ad_msgsm,
27341
e7c989f7a7c9 Start unifying names of internal preprocessor directives.
diego
parents: 26206
diff changeset
65 #ifdef CONFIG_WIN32DLL
5344
7198d3eba09f ok, use ad_* stuff
arpi
parents:
diff changeset
66 &mpcodecs_ad_dshow,
8326
4849a0cfc2aa DMO audio support (including 6ch support too)
arpi
parents: 8160
diff changeset
67 &mpcodecs_ad_dmo,
5344
7198d3eba09f ok, use ad_* stuff
arpi
parents:
diff changeset
68 &mpcodecs_ad_acm,
14276
fa80ed52127b TwinVQ decoder and demuxer
rtognimp
parents: 12827
diff changeset
69 &mpcodecs_ad_twin,
8160
2be30233c532 qt video dll codecs support
arpi
parents: 8026
diff changeset
70 #endif
27341
e7c989f7a7c9 Start unifying names of internal preprocessor directives.
diego
parents: 26206
diff changeset
71 #ifdef CONFIG_QTX_CODECS
8008
35d663ad0d95 qtaudio - audio decoder using win32 quicktime 5 dlls
arpi
parents: 7174
diff changeset
72 &mpcodecs_ad_qtaudio,
5344
7198d3eba09f ok, use ad_* stuff
arpi
parents:
diff changeset
73 #endif
27363
40057010b1fa Change a bunch of codec-specific preprocessor directives from a HAVE_
diego
parents: 27341
diff changeset
74 #ifdef CONFIG_FAAD
5454
c6252cfb68e2 ehh. vorbis support...
arpi
parents: 5408
diff changeset
75 &mpcodecs_ad_faad,
c6252cfb68e2 ehh. vorbis support...
arpi
parents: 5408
diff changeset
76 #endif
27363
40057010b1fa Change a bunch of codec-specific preprocessor directives from a HAVE_
diego
parents: 27341
diff changeset
77 #ifdef CONFIG_OGGVORBIS
7174
7672615cc811 sync driver names with codec-cfg
arpi
parents: 6927
diff changeset
78 &mpcodecs_ad_libvorbis,
5356
739cad21c32c Port dec_audio.c faad aac decoder to libmpcodecs, cleaned up code, improved buffering scheme.
atmos4
parents: 5345
diff changeset
79 #endif
27363
40057010b1fa Change a bunch of codec-specific preprocessor directives from a HAVE_
diego
parents: 27341
diff changeset
80 #ifdef CONFIG_SPEEX
16915
6b1d1e4adaea Speex support. Seeking and pts generation does not work.
reimar
parents: 15958
diff changeset
81 &mpcodecs_ad_speex,
6b1d1e4adaea Speex support. Seeking and pts generation does not work.
reimar
parents: 15958
diff changeset
82 #endif
27341
e7c989f7a7c9 Start unifying names of internal preprocessor directives.
diego
parents: 26206
diff changeset
83 #ifdef CONFIG_LIBMAD
5479
22b289d7f87f libmad support, rewritten from scratch using Xine decoder as sample
arpi
parents: 5454
diff changeset
84 &mpcodecs_ad_libmad,
22b289d7f87f libmad support, rewritten from scratch using Xine decoder as sample
arpi
parents: 5454
diff changeset
85 #endif
27341
e7c989f7a7c9 Start unifying names of internal preprocessor directives.
diego
parents: 26206
diff changeset
86 #ifdef CONFIG_REALCODECS
7174
7672615cc811 sync driver names with codec-cfg
arpi
parents: 6927
diff changeset
87 &mpcodecs_ad_realaud,
6367
489c4bcbda13 readaudio decoder - not yet working
arpi
parents: 5519
diff changeset
88 #endif
27363
40057010b1fa Change a bunch of codec-specific preprocessor directives from a HAVE_
diego
parents: 27341
diff changeset
89 #ifdef CONFIG_LIBDV095
6927
0145bba6e201 native DV audio/video decoders using libdv
arpi
parents: 6367
diff changeset
90 &mpcodecs_ad_libdv,
0145bba6e201 native DV audio/video decoders using libdv
arpi
parents: 6367
diff changeset
91 #endif
27363
40057010b1fa Change a bunch of codec-specific preprocessor directives from a HAVE_
diego
parents: 27341
diff changeset
92 #ifdef CONFIG_MUSEPACK
15958
087142ef3a2d musepack demuxing and decoding support (demuxing is v7 bitstream only).
reimar
parents: 14276
diff changeset
93 &mpcodecs_ad_libmusepack,
087142ef3a2d musepack demuxing and decoding support (demuxing is v7 bitstream only).
reimar
parents: 14276
diff changeset
94 #endif
27341
e7c989f7a7c9 Start unifying names of internal preprocessor directives.
diego
parents: 26206
diff changeset
95 #ifdef CONFIG_LIBDCA
23821
46b21d6fb61d DTS decoding via libdca
rtogni
parents: 22601
diff changeset
96 &mpcodecs_ad_libdca,
46b21d6fb61d DTS decoding via libdca
rtogni
parents: 22601
diff changeset
97 #endif
5344
7198d3eba09f ok, use ad_* stuff
arpi
parents:
diff changeset
98 NULL
7198d3eba09f ok, use ad_* stuff
arpi
parents:
diff changeset
99 };