Mercurial > mplayer.hg
annotate libmpcodecs/ad_realaud.c @ 9649:0650fe13f36c
ome fixes, like css styles - now ../default.css
author | mpt |
---|---|
date | Sat, 22 Mar 2003 17:29:45 +0000 |
parents | d447d6403faf |
children | a5396aaf128d |
rev | line source |
---|---|
6367 | 1 |
2 #include <stdio.h> | |
3 #include <stdlib.h> | |
4 #include <unistd.h> | |
5 | |
6 #include "config.h" | |
7 | |
8 #ifdef USE_REALCODECS | |
9 | |
9395
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
10 //#include <stddef.h> |
6367 | 11 #include <dlfcn.h> |
9395
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
12 #include "help_mp.h" |
6367 | 13 |
14 #include "ad_internal.h" | |
15 | |
16 static ad_info_t info = { | |
6380 | 17 "RealAudio decoder", |
7174 | 18 "realaud", |
9395
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
19 "A'rpi", // win32 dlls support by alex |
6380 | 20 "Florian Schneider", |
21 "binary real audio codecs" | |
6367 | 22 }; |
23 | |
7174 | 24 LIBAD_EXTERN(realaud) |
6367 | 25 |
26 void *__builtin_new(unsigned long size) { | |
27 return malloc(size); | |
28 } | |
29 | |
9551 | 30 // required for cook's uninit: |
31 void __builtin_delete(void* ize) { | |
32 free(ize); | |
33 } | |
34 | |
6404
83b3315c679b
Implement Nilmoni's and Bernd Ernesti's patches for:
atmos4
parents:
6380
diff
changeset
|
35 #if defined(__FreeBSD__) || defined(__NetBSD__) |
83b3315c679b
Implement Nilmoni's and Bernd Ernesti's patches for:
atmos4
parents:
6380
diff
changeset
|
36 void *__ctype_b=NULL; |
6377 | 37 #endif |
6367 | 38 |
7472
c4434bdf6e51
tons of warning fixes, also some 10l bugfixes, including Dominik's PVA bug
arpi
parents:
7180
diff
changeset
|
39 static unsigned long (*raCloseCodec)(void*); |
7557 | 40 static unsigned long (*raDecode)(void*, char*,unsigned long,char*,unsigned int*,long); |
6745
9734bfbb200a
Avoid ulong typedef clash and replace if by unsigned long, patch by Joey Parrish.
atmos4
parents:
6428
diff
changeset
|
41 static unsigned long (*raFlush)(unsigned long,unsigned long,unsigned long); |
7472
c4434bdf6e51
tons of warning fixes, also some 10l bugfixes, including Dominik's PVA bug
arpi
parents:
7180
diff
changeset
|
42 static unsigned long (*raFreeDecoder)(void*); |
7557 | 43 static void* (*raGetFlavorProperty)(void*,unsigned long,unsigned long,int*); |
6745
9734bfbb200a
Avoid ulong typedef clash and replace if by unsigned long, patch by Joey Parrish.
atmos4
parents:
6428
diff
changeset
|
44 //static unsigned long (*raGetNumberOfFlavors2)(void); |
7472
c4434bdf6e51
tons of warning fixes, also some 10l bugfixes, including Dominik's PVA bug
arpi
parents:
7180
diff
changeset
|
45 static unsigned long (*raInitDecoder)(void*, void*); |
9395
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
46 static unsigned long (*raOpenCodec)(void*); |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
47 static unsigned long (*raOpenCodec2)(void*, void*); |
7472
c4434bdf6e51
tons of warning fixes, also some 10l bugfixes, including Dominik's PVA bug
arpi
parents:
7180
diff
changeset
|
48 static unsigned long (*raSetFlavor)(void*,unsigned long); |
7752
18f8233094da
tell the codec wrapper the codec path (fixes realaudio Sipr)
arpi
parents:
7557
diff
changeset
|
49 static void (*raSetDLLAccessPath)(char*); |
7086
f0886fe4be89
support for 'sipr' codec - descrambling/reorder not yet fixed.
arpi
parents:
6745
diff
changeset
|
50 static void (*raSetPwd)(char*,char*); |
9395
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
51 #ifdef USE_WIN32DLL |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
52 static unsigned long WINAPI (*wraCloseCodec)(void*); |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
53 static unsigned long WINAPI (*wraDecode)(void*, char*,unsigned long,char*,unsigned int*,long); |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
54 static unsigned long WINAPI (*wraFlush)(unsigned long,unsigned long,unsigned long); |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
55 static unsigned long WINAPI (*wraFreeDecoder)(void*); |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
56 static void* WINAPI (*wraGetFlavorProperty)(void*,unsigned long,unsigned long,int*); |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
57 static unsigned long WINAPI (*wraInitDecoder)(void*, void*); |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
58 static unsigned long WINAPI (*wraOpenCodec)(void*); |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
59 static unsigned long WINAPI (*wraOpenCodec2)(void*, void*); |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
60 static unsigned long WINAPI (*wraSetFlavor)(void*,unsigned long); |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
61 static void WINAPI (*wraSetDLLAccessPath)(char*); |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
62 static void WINAPI (*wraSetPwd)(char*,char*); |
6367 | 63 |
9395
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
64 static int dll_type = 0; /* 0 = unix dlopen, 1 = win32 dll */ |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
65 #endif |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
66 static void *rv_handle = NULL; |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
67 |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
68 #if 0 |
6367 | 69 typedef struct { |
70 int samplerate; | |
71 short bits; | |
72 short channels; | |
73 int unk1; | |
74 int unk2; | |
75 int packetsize; | |
76 int unk3; | |
77 void* unk4; | |
9395
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
78 } ra_init_t ; |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
79 #else |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
80 |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
81 /* |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
82 Probably the linux .so-s were compiled with old GCC without setting |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
83 packing, so it adds 2 bytes padding after the quality field. |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
84 In windows it seems that there's no padding in it. |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
85 |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
86 -- alex |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
87 */ |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
88 |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
89 /* linux dlls doesn't need packing */ |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
90 typedef struct /*__attribute__((__packed__))*/ { |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
91 int samplerate; |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
92 short bits; |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
93 short channels; |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
94 short quality; |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
95 /* 2bytes padding here, by gcc */ |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
96 int bits_per_frame; |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
97 int packetsize; |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
98 int extradata_len; |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
99 void* extradata; |
6367 | 100 } ra_init_t; |
101 | |
9395
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
102 /* windows dlls need packed structs (no padding) */ |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
103 typedef struct __attribute__((__packed__)) { |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
104 int samplerate; |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
105 short bits; |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
106 short channels; |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
107 short quality; |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
108 int bits_per_frame; |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
109 int packetsize; |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
110 int extradata_len; |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
111 void* extradata; |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
112 } wra_init_t; |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
113 #endif |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
114 |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
115 static int load_syms_linux(char *path) |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
116 { |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
117 void *handle; |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
118 |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
119 mp_msg(MSGT_DECVIDEO, MSGL_INFO, "opening shared obj '%s'\n", path); |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
120 handle = dlopen(path, RTLD_LAZY); |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
121 if (!handle) |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
122 { |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
123 mp_msg(MSGT_DECVIDEO, MSGL_WARN, "Error: %s\n", dlerror()); |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
124 return 0; |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
125 } |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
126 |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
127 raCloseCodec = dlsym(handle, "RACloseCodec"); |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
128 raDecode = dlsym(handle, "RADecode"); |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
129 raFlush = dlsym(handle, "RAFlush"); |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
130 raFreeDecoder = dlsym(handle, "RAFreeDecoder"); |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
131 raGetFlavorProperty = dlsym(handle, "RAGetFlavorProperty"); |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
132 raOpenCodec = dlsym(handle, "RAOpenCodec"); |
9551 | 133 raOpenCodec2 = dlsym(handle, "RAOpenCodec2"); |
9395
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
134 raInitDecoder = dlsym(handle, "RAInitDecoder"); |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
135 raSetFlavor = dlsym(handle, "RASetFlavor"); |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
136 raSetDLLAccessPath = dlsym(handle, "SetDLLAccessPath"); |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
137 raSetPwd = dlsym(handle, "RASetPwd"); // optional, used by SIPR |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
138 |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
139 if (raCloseCodec && raDecode && raFlush && raFreeDecoder && |
9551 | 140 raGetFlavorProperty && (raOpenCodec||raOpenCodec2) && raSetFlavor && |
9395
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
141 /*raSetDLLAccessPath &&*/ raInitDecoder) |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
142 { |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
143 rv_handle = handle; |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
144 return 1; |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
145 } |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
146 |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
147 mp_msg(MSGT_DECAUDIO,MSGL_WARN,"Cannot resolve symbols - incompatible dll: %s\n",path); |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
148 dlclose(handle); |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
149 return 0; |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
150 } |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
151 |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
152 #ifdef USE_WIN32DLL |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
153 |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
154 #include "../loader/ldt_keeper.h" |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
155 void* WINAPI LoadLibraryA(char* name); |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
156 void* WINAPI GetProcAddress(void* handle,char *func); |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
157 int WINAPI FreeLibrary(void *handle); |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
158 |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
159 static int load_sysm_windows(char *path) |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
160 { |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
161 void *handle; |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
162 |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
163 mp_msg(MSGT_DECVIDEO, MSGL_INFO, "opening win32 dll '%s'\n", path); |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
164 Setup_LDT_Keeper(); |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
165 handle = LoadLibraryA(path); |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
166 if (!handle) |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
167 { |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
168 mp_msg(MSGT_DECVIDEO, MSGL_WARN, "Error loading dll\n"); |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
169 return 0; |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
170 } |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
171 |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
172 wraCloseCodec = GetProcAddress(handle, "RACloseCodec"); |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
173 wraDecode = GetProcAddress(handle, "RADecode"); |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
174 wraFlush = GetProcAddress(handle, "RAFlush"); |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
175 wraFreeDecoder = GetProcAddress(handle, "RAFreeDecoder"); |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
176 wraGetFlavorProperty = GetProcAddress(handle, "RAGetFlavorProperty"); |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
177 wraOpenCodec = GetProcAddress(handle, "RAOpenCodec"); |
9551 | 178 wraOpenCodec2 = GetProcAddress(handle, "RAOpenCodec2"); |
9395
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
179 wraInitDecoder = GetProcAddress(handle, "RAInitDecoder"); |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
180 wraSetFlavor = GetProcAddress(handle, "RASetFlavor"); |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
181 wraSetDLLAccessPath = GetProcAddress(handle, "SetDLLAccessPath"); |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
182 wraSetPwd = GetProcAddress(handle, "RASetPwd"); // optional, used by SIPR |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
183 |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
184 if (wraCloseCodec && wraDecode && wraFlush && wraFreeDecoder && |
9551 | 185 wraGetFlavorProperty && (wraOpenCodec || wraOpenCodec2) && wraSetFlavor && |
9395
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
186 /*wraSetDLLAccessPath &&*/ wraInitDecoder) |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
187 { |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
188 rv_handle = handle; |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
189 dll_type = 1; |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
190 return 1; |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
191 } |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
192 |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
193 mp_msg(MSGT_DECAUDIO,MSGL_WARN,"Cannot resolve symbols - incompatible dll: %s\n",path); |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
194 FreeLibrary(handle); |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
195 return 0; |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
196 |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
197 } |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
198 #endif |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
199 |
6367 | 200 static int preinit(sh_audio_t *sh){ |
201 // let's check if the driver is available, return 0 if not. | |
202 // (you should do that if you use external lib(s) which is optional) | |
203 unsigned int result; | |
7472
c4434bdf6e51
tons of warning fixes, also some 10l bugfixes, including Dominik's PVA bug
arpi
parents:
7180
diff
changeset
|
204 int len=0; |
6380 | 205 void* prop; |
6376 | 206 char path[4096]; |
9395
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
207 |
6404
83b3315c679b
Implement Nilmoni's and Bernd Ernesti's patches for:
atmos4
parents:
6380
diff
changeset
|
208 sprintf(path, REALCODEC_PATH "/%s", sh->codec->dll); |
6367 | 209 |
9395
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
210 /* first try to load linux dlls, if failed and we're supporting win32 dlls, |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
211 then try to load the windows ones */ |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
212 if (!load_syms_linux(path)) |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
213 #ifdef USE_WIN32DLL |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
214 if (!load_sysm_windows(path)) |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
215 #endif |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
216 { |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
217 mp_msg(MSGT_DECVIDEO, MSGL_ERR, MSGTR_MissingDLLcodec, sh->codec->dll); |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
218 mp_msg(MSGT_DECVIDEO, MSGL_HINT, "Read the RealAudio section of the DOCS!\n"); |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
219 return 0; |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
220 } |
6367 | 221 |
9395
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
222 #ifdef USE_WIN32DLL |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
223 if((raSetDLLAccessPath && dll_type == 0) || (wraSetDLLAccessPath && dll_type == 1)){ |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
224 #else |
7752
18f8233094da
tell the codec wrapper the codec path (fixes realaudio Sipr)
arpi
parents:
7557
diff
changeset
|
225 if(raSetDLLAccessPath){ |
9395
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
226 #endif |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
227 // used by 'SIPR' |
7752
18f8233094da
tell the codec wrapper the codec path (fixes realaudio Sipr)
arpi
parents:
7557
diff
changeset
|
228 sprintf(path, "DT_Codecs=" REALCODEC_PATH); |
18f8233094da
tell the codec wrapper the codec path (fixes realaudio Sipr)
arpi
parents:
7557
diff
changeset
|
229 if(path[strlen(path)-1]!='/'){ |
18f8233094da
tell the codec wrapper the codec path (fixes realaudio Sipr)
arpi
parents:
7557
diff
changeset
|
230 path[strlen(path)+1]=0; |
18f8233094da
tell the codec wrapper the codec path (fixes realaudio Sipr)
arpi
parents:
7557
diff
changeset
|
231 path[strlen(path)]='/'; |
18f8233094da
tell the codec wrapper the codec path (fixes realaudio Sipr)
arpi
parents:
7557
diff
changeset
|
232 } |
18f8233094da
tell the codec wrapper the codec path (fixes realaudio Sipr)
arpi
parents:
7557
diff
changeset
|
233 path[strlen(path)+1]=0; |
9395
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
234 #ifdef USE_WIN32DLL |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
235 if (dll_type == 1) |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
236 wraSetDLLAccessPath(path); |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
237 else |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
238 #endif |
7752
18f8233094da
tell the codec wrapper the codec path (fixes realaudio Sipr)
arpi
parents:
7557
diff
changeset
|
239 raSetDLLAccessPath(path); |
18f8233094da
tell the codec wrapper the codec path (fixes realaudio Sipr)
arpi
parents:
7557
diff
changeset
|
240 } |
18f8233094da
tell the codec wrapper the codec path (fixes realaudio Sipr)
arpi
parents:
7557
diff
changeset
|
241 |
9395
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
242 #ifdef USE_WIN32DLL |
9551 | 243 if (dll_type == 1){ |
244 if(wraOpenCodec2) | |
245 result=wraOpenCodec2(&sh->context,REALCODEC_PATH "\\"); | |
246 else | |
9395
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
247 result=wraOpenCodec(&sh->context); |
9551 | 248 } else |
249 #endif | |
250 if(raOpenCodec2) | |
251 result=raOpenCodec2(&sh->context,REALCODEC_PATH "/"); | |
9395
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
252 else |
9551 | 253 result=raOpenCodec(&sh->context); |
6367 | 254 if(result){ |
255 mp_msg(MSGT_DECAUDIO,MSGL_WARN,"Decoder open failed, error code: 0x%X\n",result); | |
256 return 0; | |
257 } | |
9395
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
258 // printf("opencodec ok (result: %x)\n", result); |
6367 | 259 |
260 sh->samplerate=sh->wf->nSamplesPerSec; | |
261 sh->samplesize=sh->wf->wBitsPerSample/8; | |
262 sh->channels=sh->wf->nChannels; | |
263 | |
7472
c4434bdf6e51
tons of warning fixes, also some 10l bugfixes, including Dominik's PVA bug
arpi
parents:
7180
diff
changeset
|
264 { |
6367 | 265 ra_init_t init_data={ |
9395
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
266 sh->wf->nSamplesPerSec, |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
267 sh->wf->wBitsPerSample, |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
268 sh->wf->nChannels, |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
269 100, // quality |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
270 ((short*)(sh->wf+1))[0], // subpacket size |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
271 ((short*)(sh->wf+1))[3], // coded frame size |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
272 ((short*)(sh->wf+1))[4], // codec data length |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
273 ((char*)(sh->wf+1))+10 // extras |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
274 }; |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
275 #ifdef USE_WIN32DLL |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
276 wra_init_t winit_data={ |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
277 sh->wf->nSamplesPerSec, |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
278 sh->wf->wBitsPerSample, |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
279 sh->wf->nChannels, |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
280 100, // quality |
6373 | 281 ((short*)(sh->wf+1))[0], // subpacket size |
8094 | 282 ((short*)(sh->wf+1))[3], // coded frame size |
283 ((short*)(sh->wf+1))[4], // codec data length | |
284 ((char*)(sh->wf+1))+10 // extras | |
6367 | 285 }; |
9395
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
286 if (dll_type == 1) |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
287 result=wraInitDecoder(sh->context,&winit_data); |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
288 else |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
289 #endif |
6367 | 290 result=raInitDecoder(sh->context,&init_data); |
291 if(result){ | |
292 mp_msg(MSGT_DECAUDIO,MSGL_WARN,"Decoder init failed, error code: 0x%X\n",result); | |
293 return 0; | |
294 } | |
9395
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
295 // printf("initdecoder ok (result: %x)\n", result); |
6367 | 296 } |
7086
f0886fe4be89
support for 'sipr' codec - descrambling/reorder not yet fixed.
arpi
parents:
6745
diff
changeset
|
297 |
9395
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
298 #ifdef USE_WIN32DLL |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
299 if((raSetPwd && dll_type == 0) || (wraSetPwd && dll_type == 1)){ |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
300 #else |
7086
f0886fe4be89
support for 'sipr' codec - descrambling/reorder not yet fixed.
arpi
parents:
6745
diff
changeset
|
301 if(raSetPwd){ |
9395
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
302 #endif |
7086
f0886fe4be89
support for 'sipr' codec - descrambling/reorder not yet fixed.
arpi
parents:
6745
diff
changeset
|
303 // used by 'SIPR' |
9395
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
304 #ifdef USE_WIN32DLL |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
305 if (dll_type == 1) |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
306 wraSetPwd(sh->context,"Ardubancel Quazanga"); |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
307 else |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
308 #endif |
7086
f0886fe4be89
support for 'sipr' codec - descrambling/reorder not yet fixed.
arpi
parents:
6745
diff
changeset
|
309 raSetPwd(sh->context,"Ardubancel Quazanga"); // set password... lol. |
f0886fe4be89
support for 'sipr' codec - descrambling/reorder not yet fixed.
arpi
parents:
6745
diff
changeset
|
310 } |
6367 | 311 |
9395
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
312 #ifdef USE_WIN32DLL |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
313 if (dll_type == 1) |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
314 result=wraSetFlavor(sh->context,((short*)(sh->wf+1))[2]); |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
315 else |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
316 #endif |
6373 | 317 result=raSetFlavor(sh->context,((short*)(sh->wf+1))[2]); |
6367 | 318 if(result){ |
319 mp_msg(MSGT_DECAUDIO,MSGL_WARN,"Decoder flavor setup failed, error code: 0x%X\n",result); | |
320 return 0; | |
321 } | |
322 | |
9395
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
323 #ifdef USE_WIN32DLL |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
324 if (dll_type == 1) |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
325 prop=wraGetFlavorProperty(sh->context,((short*)(sh->wf+1))[2],0,&len); |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
326 else |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
327 #endif |
6380 | 328 prop=raGetFlavorProperty(sh->context,((short*)(sh->wf+1))[2],0,&len); |
329 mp_msg(MSGT_DECAUDIO,MSGL_INFO,"Audio codec: [%d] %s\n",((short*)(sh->wf+1))[2],prop); | |
330 | |
9395
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
331 #ifdef USE_WIN32DLL |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
332 if (dll_type == 1) |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
333 prop=wraGetFlavorProperty(sh->context,((short*)(sh->wf+1))[2],1,&len); |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
334 else |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
335 #endif |
6380 | 336 prop=raGetFlavorProperty(sh->context,((short*)(sh->wf+1))[2],1,&len); |
9551 | 337 if(prop){ |
338 sh->i_bps=((*((int*)prop))+4)/8; | |
339 mp_msg(MSGT_DECAUDIO,MSGL_INFO,"Audio bitrate: %5.3f kbit/s (%d bps) \n",(*((int*)prop))*0.001f,sh->i_bps); | |
340 } else | |
341 sh->i_bps=12000; // dunno :((( [12000 seems to be OK for crash.rmvb too] | |
342 | |
6380 | 343 // prop=raGetFlavorProperty(sh->context,((short*)(sh->wf+1))[2],0x13,&len); |
344 // mp_msg(MSGT_DECAUDIO,MSGL_INFO,"Samples/block?: %d \n",(*((int*)prop))); | |
345 | |
346 sh->audio_out_minsize=128000; // no idea how to get... :( | |
6373 | 347 sh->audio_in_minsize=((short*)(sh->wf+1))[1]*sh->wf->nBlockAlign; |
6367 | 348 |
349 return 1; // return values: 1=OK 0=ERROR | |
350 } | |
351 | |
352 static int init(sh_audio_t *sh_audio){ | |
353 // initialize the decoder, set tables etc... | |
354 | |
355 // you can store HANDLE or private struct pointer at sh->context | |
356 // you can access WAVEFORMATEX header at sh->wf | |
357 | |
358 // set sample format/rate parameters if you didn't do it in preinit() yet. | |
359 | |
360 return 1; // return values: 1=OK 0=ERROR | |
361 } | |
362 | |
363 static void uninit(sh_audio_t *sh){ | |
364 // uninit the decoder etc... | |
365 // again: you don't have to free() a_in_buffer here! it's done by the core. | |
9395
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
366 #ifdef USE_WIN32DLL |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
367 if (dll_type == 1) |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
368 { |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
369 if (wraFreeDecoder) wraFreeDecoder(sh->context); |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
370 if (wraCloseCodec) wraCloseCodec(sh->context); |
9551 | 371 } |
9395
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
372 #endif |
9551 | 373 |
9395
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
374 if (raFreeDecoder) raFreeDecoder(sh->context); |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
375 if (raCloseCodec) raCloseCodec(sh->context); |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
376 |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
377 #ifdef USE_WIN32DLL |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
378 if (dll_type == 1) |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
379 { |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
380 if (rv_handle) FreeLibrary(rv_handle); |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
381 } else |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
382 #endif |
9551 | 383 // this dlclose() causes some memory corruption, and crashes soon (in caller): |
384 // if (rv_handle) dlclose(rv_handle); | |
9395
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
385 rv_handle = NULL; |
6367 | 386 } |
387 | |
7104
6d784b2812b9
'sipr' descrambling implemented, at least for 16*6 matrix
arpi
parents:
7097
diff
changeset
|
388 static unsigned char sipr_swaps[38][2]={ |
6d784b2812b9
'sipr' descrambling implemented, at least for 16*6 matrix
arpi
parents:
7097
diff
changeset
|
389 {0,63},{1,22},{2,44},{3,90},{5,81},{7,31},{8,86},{9,58},{10,36},{12,68}, |
6d784b2812b9
'sipr' descrambling implemented, at least for 16*6 matrix
arpi
parents:
7097
diff
changeset
|
390 {13,39},{14,73},{15,53},{16,69},{17,57},{19,88},{20,34},{21,71},{24,46}, |
6d784b2812b9
'sipr' descrambling implemented, at least for 16*6 matrix
arpi
parents:
7097
diff
changeset
|
391 {25,94},{26,54},{28,75},{29,50},{32,70},{33,92},{35,74},{38,85},{40,56}, |
6d784b2812b9
'sipr' descrambling implemented, at least for 16*6 matrix
arpi
parents:
7097
diff
changeset
|
392 {42,87},{43,65},{45,59},{48,79},{49,93},{51,89},{55,95},{61,76},{67,83}, |
6d784b2812b9
'sipr' descrambling implemented, at least for 16*6 matrix
arpi
parents:
7097
diff
changeset
|
393 {77,80} }; |
6d784b2812b9
'sipr' descrambling implemented, at least for 16*6 matrix
arpi
parents:
7097
diff
changeset
|
394 |
6367 | 395 static int decode_audio(sh_audio_t *sh,unsigned char *buf,int minlen,int maxlen){ |
396 int result; | |
397 int len=-1; | |
6373 | 398 int sps=((short*)(sh->wf+1))[0]; |
7086
f0886fe4be89
support for 'sipr' codec - descrambling/reorder not yet fixed.
arpi
parents:
6745
diff
changeset
|
399 int w=sh->wf->nBlockAlign; // 5 |
6373 | 400 int h=((short*)(sh->wf+1))[1]; |
7104
6d784b2812b9
'sipr' descrambling implemented, at least for 16*6 matrix
arpi
parents:
7097
diff
changeset
|
401 |
6d784b2812b9
'sipr' descrambling implemented, at least for 16*6 matrix
arpi
parents:
7097
diff
changeset
|
402 // printf("bs=%d sps=%d w=%d h=%d \n",sh->wf->nBlockAlign,sps,w,h); |
7086
f0886fe4be89
support for 'sipr' codec - descrambling/reorder not yet fixed.
arpi
parents:
6745
diff
changeset
|
403 |
6373 | 404 #if 1 |
6368
9511fffdb8c6
yeah, it worx! but needs a big cleanup and removal of hardcoded stuff
arpi
parents:
6367
diff
changeset
|
405 if(sh->a_in_buffer_len<=0){ |
9511fffdb8c6
yeah, it worx! but needs a big cleanup and removal of hardcoded stuff
arpi
parents:
6367
diff
changeset
|
406 // fill the buffer! |
7104
6d784b2812b9
'sipr' descrambling implemented, at least for 16*6 matrix
arpi
parents:
7097
diff
changeset
|
407 if(!sps){ |
6d784b2812b9
'sipr' descrambling implemented, at least for 16*6 matrix
arpi
parents:
7097
diff
changeset
|
408 // 'sipr' way |
6d784b2812b9
'sipr' descrambling implemented, at least for 16*6 matrix
arpi
parents:
7097
diff
changeset
|
409 int j,n; |
6d784b2812b9
'sipr' descrambling implemented, at least for 16*6 matrix
arpi
parents:
7097
diff
changeset
|
410 int bs=h*w*2/96; // nibbles per subpacket |
6d784b2812b9
'sipr' descrambling implemented, at least for 16*6 matrix
arpi
parents:
7097
diff
changeset
|
411 unsigned char *p=sh->a_in_buffer; |
6d784b2812b9
'sipr' descrambling implemented, at least for 16*6 matrix
arpi
parents:
7097
diff
changeset
|
412 demux_read_data(sh->ds, p, h*w); |
6d784b2812b9
'sipr' descrambling implemented, at least for 16*6 matrix
arpi
parents:
7097
diff
changeset
|
413 for(n=0;n<38;n++){ |
6d784b2812b9
'sipr' descrambling implemented, at least for 16*6 matrix
arpi
parents:
7097
diff
changeset
|
414 int i=bs*sipr_swaps[n][0]; |
6d784b2812b9
'sipr' descrambling implemented, at least for 16*6 matrix
arpi
parents:
7097
diff
changeset
|
415 int o=bs*sipr_swaps[n][1]; |
6d784b2812b9
'sipr' descrambling implemented, at least for 16*6 matrix
arpi
parents:
7097
diff
changeset
|
416 // swap nibbles of block 'i' with 'o' TODO: optimize |
6d784b2812b9
'sipr' descrambling implemented, at least for 16*6 matrix
arpi
parents:
7097
diff
changeset
|
417 for(j=0;j<bs;j++){ |
6d784b2812b9
'sipr' descrambling implemented, at least for 16*6 matrix
arpi
parents:
7097
diff
changeset
|
418 int x=(i&1) ? (p[(i>>1)]>>4) : (p[(i>>1)]&15); |
6d784b2812b9
'sipr' descrambling implemented, at least for 16*6 matrix
arpi
parents:
7097
diff
changeset
|
419 int y=(o&1) ? (p[(o>>1)]>>4) : (p[(o>>1)]&15); |
6d784b2812b9
'sipr' descrambling implemented, at least for 16*6 matrix
arpi
parents:
7097
diff
changeset
|
420 if(o&1) p[(o>>1)]=(p[(o>>1)]&0x0F)|(x<<4); |
6d784b2812b9
'sipr' descrambling implemented, at least for 16*6 matrix
arpi
parents:
7097
diff
changeset
|
421 else p[(o>>1)]=(p[(o>>1)]&0xF0)|x; |
6d784b2812b9
'sipr' descrambling implemented, at least for 16*6 matrix
arpi
parents:
7097
diff
changeset
|
422 if(i&1) p[(i>>1)]=(p[(i>>1)]&0x0F)|(y<<4); |
6d784b2812b9
'sipr' descrambling implemented, at least for 16*6 matrix
arpi
parents:
7097
diff
changeset
|
423 else p[(i>>1)]=(p[(i>>1)]&0xF0)|y; |
6d784b2812b9
'sipr' descrambling implemented, at least for 16*6 matrix
arpi
parents:
7097
diff
changeset
|
424 ++i;++o; |
6d784b2812b9
'sipr' descrambling implemented, at least for 16*6 matrix
arpi
parents:
7097
diff
changeset
|
425 } |
6d784b2812b9
'sipr' descrambling implemented, at least for 16*6 matrix
arpi
parents:
7097
diff
changeset
|
426 } |
6d784b2812b9
'sipr' descrambling implemented, at least for 16*6 matrix
arpi
parents:
7097
diff
changeset
|
427 sh->a_in_buffer_size= |
6d784b2812b9
'sipr' descrambling implemented, at least for 16*6 matrix
arpi
parents:
7097
diff
changeset
|
428 sh->a_in_buffer_len=w*h; |
6d784b2812b9
'sipr' descrambling implemented, at least for 16*6 matrix
arpi
parents:
7097
diff
changeset
|
429 } else { |
6d784b2812b9
'sipr' descrambling implemented, at least for 16*6 matrix
arpi
parents:
7097
diff
changeset
|
430 // 'cook' way |
6368
9511fffdb8c6
yeah, it worx! but needs a big cleanup and removal of hardcoded stuff
arpi
parents:
6367
diff
changeset
|
431 int x,y; |
7104
6d784b2812b9
'sipr' descrambling implemented, at least for 16*6 matrix
arpi
parents:
7097
diff
changeset
|
432 w/=sps; |
6373 | 433 for(y=0;y<h;y++) |
434 for(x=0;x<w;x++){ | |
6428
88a06ebb3287
audio subpacket reordering fixed for odd matrix height
arpi
parents:
6404
diff
changeset
|
435 demux_read_data(sh->ds, sh->a_in_buffer+sps*(h*x+((h+1)/2)*(y&1)+(y>>1)), sps); |
6368
9511fffdb8c6
yeah, it worx! but needs a big cleanup and removal of hardcoded stuff
arpi
parents:
6367
diff
changeset
|
436 } |
6373 | 437 sh->a_in_buffer_size= |
438 sh->a_in_buffer_len=w*h*sps; | |
7104
6d784b2812b9
'sipr' descrambling implemented, at least for 16*6 matrix
arpi
parents:
7097
diff
changeset
|
439 } |
6368
9511fffdb8c6
yeah, it worx! but needs a big cleanup and removal of hardcoded stuff
arpi
parents:
6367
diff
changeset
|
440 } |
6373 | 441 |
442 #else | |
443 if(sh->a_in_buffer_len<=0){ | |
444 // fill the buffer! | |
445 demux_read_data(sh->ds, sh->a_in_buffer, sh->wf->nBlockAlign); | |
446 sh->a_in_buffer_size= | |
447 sh->a_in_buffer_len=sh->wf->nBlockAlign; | |
448 } | |
449 #endif | |
6367 | 450 |
9395
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
451 #ifdef USE_WIN32DLL |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
452 if (dll_type == 1) |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
453 result=wraDecode(sh->context, sh->a_in_buffer+sh->a_in_buffer_size-sh->a_in_buffer_len, sh->wf->nBlockAlign, |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
454 buf, &len, -1); |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
455 else |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
456 #endif |
6373 | 457 result=raDecode(sh->context, sh->a_in_buffer+sh->a_in_buffer_size-sh->a_in_buffer_len, sh->wf->nBlockAlign, |
6367 | 458 buf, &len, -1); |
6368
9511fffdb8c6
yeah, it worx! but needs a big cleanup and removal of hardcoded stuff
arpi
parents:
6367
diff
changeset
|
459 sh->a_in_buffer_len-=sh->wf->nBlockAlign; |
9511fffdb8c6
yeah, it worx! but needs a big cleanup and removal of hardcoded stuff
arpi
parents:
6367
diff
changeset
|
460 |
6376 | 461 // printf("radecode: %d bytes, res=0x%X \n",len,result); |
6367 | 462 |
6368
9511fffdb8c6
yeah, it worx! but needs a big cleanup and removal of hardcoded stuff
arpi
parents:
6367
diff
changeset
|
463 return len; // return value: number of _bytes_ written to output buffer, |
6367 | 464 // or -1 for EOF (or uncorrectable error) |
465 } | |
466 | |
467 static int control(sh_audio_t *sh,int cmd,void* arg, ...){ | |
468 // various optional functions you MAY implement: | |
469 switch(cmd){ | |
470 case ADCTRL_RESYNC_STREAM: | |
471 // it is called once after seeking, to resync. | |
472 // Note: sh_audio->a_in_buffer_len=0; is done _before_ this call! | |
473 return CONTROL_TRUE; | |
474 case ADCTRL_SKIP_FRAME: | |
475 // it is called to skip (jump over) small amount (1/10 sec or 1 frame) | |
476 // of audio data - used to sync audio to video after seeking | |
477 // if you don't return CONTROL_TRUE, it will defaults to: | |
478 // ds_fill_buffer(sh_audio->ds); // skip 1 demux packet | |
479 return CONTROL_TRUE; | |
480 } | |
481 return CONTROL_UNKNOWN; | |
482 } | |
483 | |
484 #endif |