Mercurial > mplayer.hg
annotate libmpcodecs/ad_realaud.c @ 12662:05d46af5e2bf
JACK audio support through bio2jack by Kamil Strzelecki <esack@o2.pl>
author | alex |
---|---|
date | Fri, 25 Jun 2004 18:11:15 +0000 |
parents | 702b39f72394 |
children | d6f716fdd734 |
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> |
10093 | 11 #ifdef HAVE_LIBDL |
6367 | 12 #include <dlfcn.h> |
10093 | 13 #endif |
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
|
14 #include "help_mp.h" |
6367 | 15 |
16 #include "ad_internal.h" | |
12356
6a61d694f7d3
minimal fix for alex's 1000000000000l compile errors. imo the fix in
rfelker
parents:
10652
diff
changeset
|
17 #include "wine/windef.h" |
6367 | 18 |
12628
985e1813e298
support for realvideo codecs under macosx, original patch by Donnie Smith
alex
parents:
12356
diff
changeset
|
19 #ifdef USE_MACSHLB |
985e1813e298
support for realvideo codecs under macosx, original patch by Donnie Smith
alex
parents:
12356
diff
changeset
|
20 #include <CoreServices/CoreServices.h> |
985e1813e298
support for realvideo codecs under macosx, original patch by Donnie Smith
alex
parents:
12356
diff
changeset
|
21 #endif |
985e1813e298
support for realvideo codecs under macosx, original patch by Donnie Smith
alex
parents:
12356
diff
changeset
|
22 |
6367 | 23 static ad_info_t info = { |
6380 | 24 "RealAudio decoder", |
7174 | 25 "realaud", |
12628
985e1813e298
support for realvideo codecs under macosx, original patch by Donnie Smith
alex
parents:
12356
diff
changeset
|
26 "Alex Beregszaszi", |
985e1813e298
support for realvideo codecs under macosx, original patch by Donnie Smith
alex
parents:
12356
diff
changeset
|
27 "Florian Schneider, Arpad Gereoffy, Alex Beregszaszi, Donnie Smith", |
6380 | 28 "binary real audio codecs" |
6367 | 29 }; |
30 | |
7174 | 31 LIBAD_EXTERN(realaud) |
6367 | 32 |
33 void *__builtin_new(unsigned long size) { | |
34 return malloc(size); | |
35 } | |
36 | |
9551 | 37 // required for cook's uninit: |
38 void __builtin_delete(void* ize) { | |
39 free(ize); | |
40 } | |
41 | |
10142
1031f03eec7e
OpenBSD support by Bjorn Sandell <biorn@dce.chalmers.se>
alex
parents:
10117
diff
changeset
|
42 #if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) |
6404
83b3315c679b
Implement Nilmoni's and Bernd Ernesti's patches for:
atmos4
parents:
6380
diff
changeset
|
43 void *__ctype_b=NULL; |
6377 | 44 #endif |
6367 | 45 |
7472
c4434bdf6e51
tons of warning fixes, also some 10l bugfixes, including Dominik's PVA bug
arpi
parents:
7180
diff
changeset
|
46 static unsigned long (*raCloseCodec)(void*); |
7557 | 47 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
|
48 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
|
49 static unsigned long (*raFreeDecoder)(void*); |
7557 | 50 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
|
51 //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
|
52 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
|
53 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
|
54 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
|
55 static unsigned long (*raSetFlavor)(void*,unsigned long); |
7752
18f8233094da
tell the codec wrapper the codec path (fixes realaudio Sipr)
arpi
parents:
7557
diff
changeset
|
56 static void (*raSetDLLAccessPath)(char*); |
7086
f0886fe4be89
support for 'sipr' codec - descrambling/reorder not yet fixed.
arpi
parents:
6745
diff
changeset
|
57 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
|
58 #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
|
59 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
|
60 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
|
61 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
|
62 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
|
63 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
|
64 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
|
65 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
|
66 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
|
67 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
|
68 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
|
69 static void WINAPI (*wraSetPwd)(char*,char*); |
6367 | 70 |
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
|
71 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
|
72 #endif |
12628
985e1813e298
support for realvideo codecs under macosx, original patch by Donnie Smith
alex
parents:
12356
diff
changeset
|
73 |
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
|
74 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
|
75 |
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
|
76 #if 0 |
6367 | 77 typedef struct { |
78 int samplerate; | |
79 short bits; | |
80 short channels; | |
81 int unk1; | |
82 int unk2; | |
83 int packetsize; | |
84 int unk3; | |
85 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
|
86 } 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
|
87 #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
|
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 /* |
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 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
|
91 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
|
92 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
|
93 |
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 -- 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
|
95 */ |
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 |
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 /* 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
|
98 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
|
99 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
|
100 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
|
101 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
|
102 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
|
103 /* 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
|
104 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
|
105 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
|
106 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
|
107 void* extradata; |
6367 | 108 } ra_init_t; |
109 | |
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
|
110 /* 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
|
111 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
|
112 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
|
113 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
|
114 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
|
115 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
|
116 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
|
117 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
|
118 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
|
119 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
|
120 } 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
|
121 #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
|
122 |
10093 | 123 #ifdef HAVE_LIBDL |
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
|
124 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
|
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 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
|
127 |
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 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
|
129 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
|
130 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
|
131 { |
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 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
|
133 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
|
134 } |
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 |
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 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
|
137 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
|
138 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
|
139 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
|
140 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
|
141 raOpenCodec = dlsym(handle, "RAOpenCodec"); |
9551 | 142 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
|
143 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
|
144 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
|
145 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
|
146 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
|
147 |
10030 | 148 if (raCloseCodec && raDecode && /*raFlush && */raFreeDecoder && |
9551 | 149 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
|
150 /*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
|
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 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
|
153 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
|
154 } |
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 |
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 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
|
157 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
|
158 return 0; |
10093 | 159 } |
160 #endif | |
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
|
161 |
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 #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
|
163 |
10093 | 164 #ifdef WIN32_LOADER |
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
|
165 #include "../loader/ldt_keeper.h" |
10093 | 166 #endif |
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
|
167 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
|
168 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
|
169 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
|
170 |
10652 | 171 static int load_syms_windows(char *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
|
172 { |
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 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
|
174 |
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 mp_msg(MSGT_DECVIDEO, MSGL_INFO, "opening win32 dll '%s'\n", path); |
10093 | 176 #ifdef WIN32_LOADER |
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
|
177 Setup_LDT_Keeper(); |
10093 | 178 #endif |
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 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
|
180 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
|
181 { |
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 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
|
183 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
|
184 } |
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
|
185 |
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 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
|
187 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
|
188 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
|
189 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
|
190 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
|
191 wraOpenCodec = GetProcAddress(handle, "RAOpenCodec"); |
9551 | 192 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
|
193 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
|
194 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
|
195 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
|
196 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
|
197 |
10117 | 198 if (wraCloseCodec && wraDecode && /*wraFlush && */wraFreeDecoder && |
9551 | 199 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
|
200 /*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
|
201 { |
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
|
202 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
|
203 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
|
204 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
|
205 } |
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
|
206 |
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 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
|
208 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
|
209 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
|
210 |
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 } |
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 #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
|
213 |
12628
985e1813e298
support for realvideo codecs under macosx, original patch by Donnie Smith
alex
parents:
12356
diff
changeset
|
214 |
985e1813e298
support for realvideo codecs under macosx, original patch by Donnie Smith
alex
parents:
12356
diff
changeset
|
215 #ifdef USE_MACSHLB |
985e1813e298
support for realvideo codecs under macosx, original patch by Donnie Smith
alex
parents:
12356
diff
changeset
|
216 /* |
985e1813e298
support for realvideo codecs under macosx, original patch by Donnie Smith
alex
parents:
12356
diff
changeset
|
217 Helper function to create a function pointer (from a null terminated (!) |
985e1813e298
support for realvideo codecs under macosx, original patch by Donnie Smith
alex
parents:
12356
diff
changeset
|
218 pascal string) like GetProcAddress(). Some assembler is required due |
985e1813e298
support for realvideo codecs under macosx, original patch by Donnie Smith
alex
parents:
12356
diff
changeset
|
219 to different calling conventions, for further details, see |
985e1813e298
support for realvideo codecs under macosx, original patch by Donnie Smith
alex
parents:
12356
diff
changeset
|
220 http://developer.apple.com/ samplecode/CFM_MachO_CFM/listing1.html . |
985e1813e298
support for realvideo codecs under macosx, original patch by Donnie Smith
alex
parents:
12356
diff
changeset
|
221 |
985e1813e298
support for realvideo codecs under macosx, original patch by Donnie Smith
alex
parents:
12356
diff
changeset
|
222 Caller is expected to DisposePtr(mfp). |
985e1813e298
support for realvideo codecs under macosx, original patch by Donnie Smith
alex
parents:
12356
diff
changeset
|
223 N.B.: Code is used by vd_realaud.c as well. |
985e1813e298
support for realvideo codecs under macosx, original patch by Donnie Smith
alex
parents:
12356
diff
changeset
|
224 */ |
985e1813e298
support for realvideo codecs under macosx, original patch by Donnie Smith
alex
parents:
12356
diff
changeset
|
225 void *load_one_sym_mac(char *symbolName, CFragConnectionID *connID) { |
985e1813e298
support for realvideo codecs under macosx, original patch by Donnie Smith
alex
parents:
12356
diff
changeset
|
226 OSErr err; |
985e1813e298
support for realvideo codecs under macosx, original patch by Donnie Smith
alex
parents:
12356
diff
changeset
|
227 Ptr symbolAddr; |
985e1813e298
support for realvideo codecs under macosx, original patch by Donnie Smith
alex
parents:
12356
diff
changeset
|
228 CFragSymbolClass symbolClass; |
985e1813e298
support for realvideo codecs under macosx, original patch by Donnie Smith
alex
parents:
12356
diff
changeset
|
229 UInt32 *mfp; |
985e1813e298
support for realvideo codecs under macosx, original patch by Donnie Smith
alex
parents:
12356
diff
changeset
|
230 char realname[255]; |
985e1813e298
support for realvideo codecs under macosx, original patch by Donnie Smith
alex
parents:
12356
diff
changeset
|
231 |
985e1813e298
support for realvideo codecs under macosx, original patch by Donnie Smith
alex
parents:
12356
diff
changeset
|
232 if (strlen(symbolName) > 255) |
985e1813e298
support for realvideo codecs under macosx, original patch by Donnie Smith
alex
parents:
12356
diff
changeset
|
233 { |
12633 | 234 mp_msg(MSGT_DECVIDEO, MSGL_V, "FindSymbol symbolname overflow\n"); |
12628
985e1813e298
support for realvideo codecs under macosx, original patch by Donnie Smith
alex
parents:
12356
diff
changeset
|
235 return NULL; |
985e1813e298
support for realvideo codecs under macosx, original patch by Donnie Smith
alex
parents:
12356
diff
changeset
|
236 } |
985e1813e298
support for realvideo codecs under macosx, original patch by Donnie Smith
alex
parents:
12356
diff
changeset
|
237 |
985e1813e298
support for realvideo codecs under macosx, original patch by Donnie Smith
alex
parents:
12356
diff
changeset
|
238 snprintf(realname, 255, "%c%s", strlen(symbolName), symbolName); |
985e1813e298
support for realvideo codecs under macosx, original patch by Donnie Smith
alex
parents:
12356
diff
changeset
|
239 |
985e1813e298
support for realvideo codecs under macosx, original patch by Donnie Smith
alex
parents:
12356
diff
changeset
|
240 if ( (err = FindSymbol( *connID, realname, |
985e1813e298
support for realvideo codecs under macosx, original patch by Donnie Smith
alex
parents:
12356
diff
changeset
|
241 &symbolAddr, &symbolClass )) != noErr ) { |
985e1813e298
support for realvideo codecs under macosx, original patch by Donnie Smith
alex
parents:
12356
diff
changeset
|
242 mp_msg(MSGT_DECVIDEO,MSGL_V,"FindSymbol( \"%s\" ) failed with error code %d.\n", symbolName + 1, err ); |
985e1813e298
support for realvideo codecs under macosx, original patch by Donnie Smith
alex
parents:
12356
diff
changeset
|
243 return NULL; |
985e1813e298
support for realvideo codecs under macosx, original patch by Donnie Smith
alex
parents:
12356
diff
changeset
|
244 } |
985e1813e298
support for realvideo codecs under macosx, original patch by Donnie Smith
alex
parents:
12356
diff
changeset
|
245 |
985e1813e298
support for realvideo codecs under macosx, original patch by Donnie Smith
alex
parents:
12356
diff
changeset
|
246 if ( (mfp = (UInt32 *)NewPtr( 6 * sizeof(UInt32) )) == nil ) |
985e1813e298
support for realvideo codecs under macosx, original patch by Donnie Smith
alex
parents:
12356
diff
changeset
|
247 return NULL; |
985e1813e298
support for realvideo codecs under macosx, original patch by Donnie Smith
alex
parents:
12356
diff
changeset
|
248 |
985e1813e298
support for realvideo codecs under macosx, original patch by Donnie Smith
alex
parents:
12356
diff
changeset
|
249 mfp[0] = 0x3D800000 | ((UInt32)symbolAddr >> 16); |
985e1813e298
support for realvideo codecs under macosx, original patch by Donnie Smith
alex
parents:
12356
diff
changeset
|
250 mfp[1] = 0x618C0000 | ((UInt32)symbolAddr & 0xFFFF); |
985e1813e298
support for realvideo codecs under macosx, original patch by Donnie Smith
alex
parents:
12356
diff
changeset
|
251 mfp[2] = 0x800C0000; |
985e1813e298
support for realvideo codecs under macosx, original patch by Donnie Smith
alex
parents:
12356
diff
changeset
|
252 mfp[3] = 0x804C0004; |
985e1813e298
support for realvideo codecs under macosx, original patch by Donnie Smith
alex
parents:
12356
diff
changeset
|
253 mfp[4] = 0x7C0903A6; |
985e1813e298
support for realvideo codecs under macosx, original patch by Donnie Smith
alex
parents:
12356
diff
changeset
|
254 mfp[5] = 0x4E800420; |
985e1813e298
support for realvideo codecs under macosx, original patch by Donnie Smith
alex
parents:
12356
diff
changeset
|
255 MakeDataExecutable( mfp, 6 * sizeof(UInt32) ); |
985e1813e298
support for realvideo codecs under macosx, original patch by Donnie Smith
alex
parents:
12356
diff
changeset
|
256 |
985e1813e298
support for realvideo codecs under macosx, original patch by Donnie Smith
alex
parents:
12356
diff
changeset
|
257 return( mfp ); |
985e1813e298
support for realvideo codecs under macosx, original patch by Donnie Smith
alex
parents:
12356
diff
changeset
|
258 } |
985e1813e298
support for realvideo codecs under macosx, original patch by Donnie Smith
alex
parents:
12356
diff
changeset
|
259 |
985e1813e298
support for realvideo codecs under macosx, original patch by Donnie Smith
alex
parents:
12356
diff
changeset
|
260 static int load_syms_mac(char *path) |
985e1813e298
support for realvideo codecs under macosx, original patch by Donnie Smith
alex
parents:
12356
diff
changeset
|
261 { |
985e1813e298
support for realvideo codecs under macosx, original patch by Donnie Smith
alex
parents:
12356
diff
changeset
|
262 Ptr mainAddr; |
985e1813e298
support for realvideo codecs under macosx, original patch by Donnie Smith
alex
parents:
12356
diff
changeset
|
263 OSStatus status; |
985e1813e298
support for realvideo codecs under macosx, original patch by Donnie Smith
alex
parents:
12356
diff
changeset
|
264 FSRef fsref; |
985e1813e298
support for realvideo codecs under macosx, original patch by Donnie Smith
alex
parents:
12356
diff
changeset
|
265 FSSpec fsspec; |
985e1813e298
support for realvideo codecs under macosx, original patch by Donnie Smith
alex
parents:
12356
diff
changeset
|
266 OSErr err; |
985e1813e298
support for realvideo codecs under macosx, original patch by Donnie Smith
alex
parents:
12356
diff
changeset
|
267 Str255 errMessage; |
985e1813e298
support for realvideo codecs under macosx, original patch by Donnie Smith
alex
parents:
12356
diff
changeset
|
268 CFragConnectionID *connID; |
985e1813e298
support for realvideo codecs under macosx, original patch by Donnie Smith
alex
parents:
12356
diff
changeset
|
269 |
985e1813e298
support for realvideo codecs under macosx, original patch by Donnie Smith
alex
parents:
12356
diff
changeset
|
270 mp_msg(MSGT_DECVIDEO, MSGL_INFO, "opening mac shlb '%s'\n", path); |
985e1813e298
support for realvideo codecs under macosx, original patch by Donnie Smith
alex
parents:
12356
diff
changeset
|
271 |
985e1813e298
support for realvideo codecs under macosx, original patch by Donnie Smith
alex
parents:
12356
diff
changeset
|
272 if ( (connID = (CFragConnectionID *)NewPtr( sizeof( CFragConnectionID ))) == nil ) { |
985e1813e298
support for realvideo codecs under macosx, original patch by Donnie Smith
alex
parents:
12356
diff
changeset
|
273 mp_msg(MSGT_DECVIDEO,MSGL_WARN,"NewPtr() failed.\n" ); |
985e1813e298
support for realvideo codecs under macosx, original patch by Donnie Smith
alex
parents:
12356
diff
changeset
|
274 return 0; |
985e1813e298
support for realvideo codecs under macosx, original patch by Donnie Smith
alex
parents:
12356
diff
changeset
|
275 } |
985e1813e298
support for realvideo codecs under macosx, original patch by Donnie Smith
alex
parents:
12356
diff
changeset
|
276 |
985e1813e298
support for realvideo codecs under macosx, original patch by Donnie Smith
alex
parents:
12356
diff
changeset
|
277 if ( (status = FSPathMakeRef( path, &fsref, NULL )) != noErr ) { |
985e1813e298
support for realvideo codecs under macosx, original patch by Donnie Smith
alex
parents:
12356
diff
changeset
|
278 mp_msg(MSGT_DECVIDEO,MSGL_WARN,"FSPathMakeRef() failed with error %d.\n", status ); |
985e1813e298
support for realvideo codecs under macosx, original patch by Donnie Smith
alex
parents:
12356
diff
changeset
|
279 return 0; |
985e1813e298
support for realvideo codecs under macosx, original patch by Donnie Smith
alex
parents:
12356
diff
changeset
|
280 } |
985e1813e298
support for realvideo codecs under macosx, original patch by Donnie Smith
alex
parents:
12356
diff
changeset
|
281 |
985e1813e298
support for realvideo codecs under macosx, original patch by Donnie Smith
alex
parents:
12356
diff
changeset
|
282 if ( (status = FSGetCatalogInfo( &fsref, kFSCatInfoNone, NULL, NULL, &fsspec, NULL )) != noErr ) { |
985e1813e298
support for realvideo codecs under macosx, original patch by Donnie Smith
alex
parents:
12356
diff
changeset
|
283 mp_msg(MSGT_DECVIDEO,MSGL_WARN,"FSGetCatalogInfo() failed with error %d.\n", status ); |
985e1813e298
support for realvideo codecs under macosx, original patch by Donnie Smith
alex
parents:
12356
diff
changeset
|
284 return 0; |
985e1813e298
support for realvideo codecs under macosx, original patch by Donnie Smith
alex
parents:
12356
diff
changeset
|
285 } |
985e1813e298
support for realvideo codecs under macosx, original patch by Donnie Smith
alex
parents:
12356
diff
changeset
|
286 |
985e1813e298
support for realvideo codecs under macosx, original patch by Donnie Smith
alex
parents:
12356
diff
changeset
|
287 if ( (err = GetDiskFragment( &fsspec, 0, kCFragGoesToEOF, NULL, kPrivateCFragCopy, connID, &mainAddr, errMessage )) != noErr ) { |
985e1813e298
support for realvideo codecs under macosx, original patch by Donnie Smith
alex
parents:
12356
diff
changeset
|
288 |
985e1813e298
support for realvideo codecs under macosx, original patch by Donnie Smith
alex
parents:
12356
diff
changeset
|
289 p2cstrcpy( errMessage, errMessage ); |
985e1813e298
support for realvideo codecs under macosx, original patch by Donnie Smith
alex
parents:
12356
diff
changeset
|
290 mp_msg(MSGT_DECVIDEO,MSGL_WARN,"GetDiskFragment() failed with error %d: %s\n", err, errMessage ); |
985e1813e298
support for realvideo codecs under macosx, original patch by Donnie Smith
alex
parents:
12356
diff
changeset
|
291 return 0; |
985e1813e298
support for realvideo codecs under macosx, original patch by Donnie Smith
alex
parents:
12356
diff
changeset
|
292 } |
985e1813e298
support for realvideo codecs under macosx, original patch by Donnie Smith
alex
parents:
12356
diff
changeset
|
293 |
985e1813e298
support for realvideo codecs under macosx, original patch by Donnie Smith
alex
parents:
12356
diff
changeset
|
294 raCloseCodec = load_one_sym_mac( "RACloseCodec", connID); |
985e1813e298
support for realvideo codecs under macosx, original patch by Donnie Smith
alex
parents:
12356
diff
changeset
|
295 raDecode = load_one_sym_mac("RADecode", connID); |
985e1813e298
support for realvideo codecs under macosx, original patch by Donnie Smith
alex
parents:
12356
diff
changeset
|
296 raFlush = load_one_sym_mac("RAFlush", connID); |
985e1813e298
support for realvideo codecs under macosx, original patch by Donnie Smith
alex
parents:
12356
diff
changeset
|
297 raFreeDecoder = load_one_sym_mac("RAFreeDecoder", connID); |
12629 | 298 raGetFlavorProperty = load_one_sym_mac("RAGetFlavorProperty", connID); |
12628
985e1813e298
support for realvideo codecs under macosx, original patch by Donnie Smith
alex
parents:
12356
diff
changeset
|
299 raOpenCodec = load_one_sym_mac("RAOpenCodec", connID); |
985e1813e298
support for realvideo codecs under macosx, original patch by Donnie Smith
alex
parents:
12356
diff
changeset
|
300 raOpenCodec2 = load_one_sym_mac("RAOpenCodec2", connID); |
985e1813e298
support for realvideo codecs under macosx, original patch by Donnie Smith
alex
parents:
12356
diff
changeset
|
301 raInitDecoder = load_one_sym_mac("RAInitDecoder", connID); |
985e1813e298
support for realvideo codecs under macosx, original patch by Donnie Smith
alex
parents:
12356
diff
changeset
|
302 raSetFlavor = load_one_sym_mac("RASetFlavor", connID); |
985e1813e298
support for realvideo codecs under macosx, original patch by Donnie Smith
alex
parents:
12356
diff
changeset
|
303 raSetDLLAccessPath = load_one_sym_mac("SetDLLAccessPath", connID); |
985e1813e298
support for realvideo codecs under macosx, original patch by Donnie Smith
alex
parents:
12356
diff
changeset
|
304 raSetPwd = load_one_sym_mac("RASetPwd", connID); // optional, used by SIPR |
985e1813e298
support for realvideo codecs under macosx, original patch by Donnie Smith
alex
parents:
12356
diff
changeset
|
305 |
985e1813e298
support for realvideo codecs under macosx, original patch by Donnie Smith
alex
parents:
12356
diff
changeset
|
306 if (raCloseCodec && raDecode && /*raFlush && */raFreeDecoder && |
985e1813e298
support for realvideo codecs under macosx, original patch by Donnie Smith
alex
parents:
12356
diff
changeset
|
307 raGetFlavorProperty && (raOpenCodec || raOpenCodec2) && raSetFlavor && |
985e1813e298
support for realvideo codecs under macosx, original patch by Donnie Smith
alex
parents:
12356
diff
changeset
|
308 /*raSetDLLAccessPath &&*/ raInitDecoder) |
985e1813e298
support for realvideo codecs under macosx, original patch by Donnie Smith
alex
parents:
12356
diff
changeset
|
309 { |
985e1813e298
support for realvideo codecs under macosx, original patch by Donnie Smith
alex
parents:
12356
diff
changeset
|
310 rv_handle = connID; |
985e1813e298
support for realvideo codecs under macosx, original patch by Donnie Smith
alex
parents:
12356
diff
changeset
|
311 return 1; |
985e1813e298
support for realvideo codecs under macosx, original patch by Donnie Smith
alex
parents:
12356
diff
changeset
|
312 } |
985e1813e298
support for realvideo codecs under macosx, original patch by Donnie Smith
alex
parents:
12356
diff
changeset
|
313 |
985e1813e298
support for realvideo codecs under macosx, original patch by Donnie Smith
alex
parents:
12356
diff
changeset
|
314 mp_msg(MSGT_DECAUDIO,MSGL_WARN,"Cannot resolve symbols - incompatible shlb: %s\n",path); |
985e1813e298
support for realvideo codecs under macosx, original patch by Donnie Smith
alex
parents:
12356
diff
changeset
|
315 (void)CloseConnection(connID); |
985e1813e298
support for realvideo codecs under macosx, original patch by Donnie Smith
alex
parents:
12356
diff
changeset
|
316 return 0; |
985e1813e298
support for realvideo codecs under macosx, original patch by Donnie Smith
alex
parents:
12356
diff
changeset
|
317 } |
985e1813e298
support for realvideo codecs under macosx, original patch by Donnie Smith
alex
parents:
12356
diff
changeset
|
318 |
985e1813e298
support for realvideo codecs under macosx, original patch by Donnie Smith
alex
parents:
12356
diff
changeset
|
319 #endif |
985e1813e298
support for realvideo codecs under macosx, original patch by Donnie Smith
alex
parents:
12356
diff
changeset
|
320 |
6367 | 321 static int preinit(sh_audio_t *sh){ |
322 // let's check if the driver is available, return 0 if not. | |
323 // (you should do that if you use external lib(s) which is optional) | |
324 unsigned int result; | |
7472
c4434bdf6e51
tons of warning fixes, also some 10l bugfixes, including Dominik's PVA bug
arpi
parents:
7180
diff
changeset
|
325 int len=0; |
6380 | 326 void* prop; |
10101
f3f3e25f8149
use dynamic path[] allocation and possible better wraSetDLLAccessPath mechanism :)
alex
parents:
10093
diff
changeset
|
327 char *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
|
328 |
10101
f3f3e25f8149
use dynamic path[] allocation and possible better wraSetDLLAccessPath mechanism :)
alex
parents:
10093
diff
changeset
|
329 path = malloc(strlen(REALCODEC_PATH)+strlen(sh->codec->dll)+2); |
f3f3e25f8149
use dynamic path[] allocation and possible better wraSetDLLAccessPath mechanism :)
alex
parents:
10093
diff
changeset
|
330 if (!path) return 0; |
6404
83b3315c679b
Implement Nilmoni's and Bernd Ernesti's patches for:
atmos4
parents:
6380
diff
changeset
|
331 sprintf(path, REALCODEC_PATH "/%s", sh->codec->dll); |
6367 | 332 |
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
|
333 /* 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
|
334 then try to load the windows ones */ |
12628
985e1813e298
support for realvideo codecs under macosx, original patch by Donnie Smith
alex
parents:
12356
diff
changeset
|
335 |
985e1813e298
support for realvideo codecs under macosx, original patch by Donnie Smith
alex
parents:
12356
diff
changeset
|
336 #ifdef USE_MACSHLB |
985e1813e298
support for realvideo codecs under macosx, original patch by Donnie Smith
alex
parents:
12356
diff
changeset
|
337 if (strstr(sh->codec->dll,".shlb") && !load_syms_mac(path)) |
985e1813e298
support for realvideo codecs under macosx, original patch by Donnie Smith
alex
parents:
12356
diff
changeset
|
338 #endif |
10093 | 339 #ifdef HAVE_LIBDL |
340 if (strstr(sh->codec->dll,".dll") || !load_syms_linux(path)) | |
341 #endif | |
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
|
342 #ifdef USE_WIN32DLL |
10652 | 343 if (!load_syms_windows(sh->codec->dll)) |
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
|
344 #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
|
345 { |
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
|
346 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
|
347 mp_msg(MSGT_DECVIDEO, MSGL_HINT, "Read the RealAudio section of the DOCS!\n"); |
10101
f3f3e25f8149
use dynamic path[] allocation and possible better wraSetDLLAccessPath mechanism :)
alex
parents:
10093
diff
changeset
|
348 free(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
|
349 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
|
350 } |
6367 | 351 |
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
|
352 #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
|
353 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
|
354 #else |
7752
18f8233094da
tell the codec wrapper the codec path (fixes realaudio Sipr)
arpi
parents:
7557
diff
changeset
|
355 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
|
356 #endif |
10101
f3f3e25f8149
use dynamic path[] allocation and possible better wraSetDLLAccessPath mechanism :)
alex
parents:
10093
diff
changeset
|
357 int i; |
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
|
358 // used by 'SIPR' |
10101
f3f3e25f8149
use dynamic path[] allocation and possible better wraSetDLLAccessPath mechanism :)
alex
parents:
10093
diff
changeset
|
359 path = realloc(path, strlen(REALCODEC_PATH) + 12); |
7752
18f8233094da
tell the codec wrapper the codec path (fixes realaudio Sipr)
arpi
parents:
7557
diff
changeset
|
360 sprintf(path, "DT_Codecs=" REALCODEC_PATH); |
18f8233094da
tell the codec wrapper the codec path (fixes realaudio Sipr)
arpi
parents:
7557
diff
changeset
|
361 if(path[strlen(path)-1]!='/'){ |
18f8233094da
tell the codec wrapper the codec path (fixes realaudio Sipr)
arpi
parents:
7557
diff
changeset
|
362 path[strlen(path)+1]=0; |
18f8233094da
tell the codec wrapper the codec path (fixes realaudio Sipr)
arpi
parents:
7557
diff
changeset
|
363 path[strlen(path)]='/'; |
18f8233094da
tell the codec wrapper the codec path (fixes realaudio Sipr)
arpi
parents:
7557
diff
changeset
|
364 } |
18f8233094da
tell the codec wrapper the codec path (fixes realaudio Sipr)
arpi
parents:
7557
diff
changeset
|
365 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
|
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) |
10101
f3f3e25f8149
use dynamic path[] allocation and possible better wraSetDLLAccessPath mechanism :)
alex
parents:
10093
diff
changeset
|
368 { |
f3f3e25f8149
use dynamic path[] allocation and possible better wraSetDLLAccessPath mechanism :)
alex
parents:
10093
diff
changeset
|
369 for (i=0; i < strlen(path); i++) |
f3f3e25f8149
use dynamic path[] allocation and possible better wraSetDLLAccessPath mechanism :)
alex
parents:
10093
diff
changeset
|
370 if (path[i] == '/') path[i] = '\\'; |
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
|
371 wraSetDLLAccessPath(path); |
10101
f3f3e25f8149
use dynamic path[] allocation and possible better wraSetDLLAccessPath mechanism :)
alex
parents:
10093
diff
changeset
|
372 } |
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
|
373 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
|
374 #endif |
7752
18f8233094da
tell the codec wrapper the codec path (fixes realaudio Sipr)
arpi
parents:
7557
diff
changeset
|
375 raSetDLLAccessPath(path); |
18f8233094da
tell the codec wrapper the codec path (fixes realaudio Sipr)
arpi
parents:
7557
diff
changeset
|
376 } |
18f8233094da
tell the codec wrapper the codec path (fixes realaudio Sipr)
arpi
parents:
7557
diff
changeset
|
377 |
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
|
378 #ifdef USE_WIN32DLL |
9551 | 379 if (dll_type == 1){ |
380 if(wraOpenCodec2) | |
381 result=wraOpenCodec2(&sh->context,REALCODEC_PATH "\\"); | |
382 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
|
383 result=wraOpenCodec(&sh->context); |
9551 | 384 } else |
385 #endif | |
386 if(raOpenCodec2) | |
387 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
|
388 else |
9551 | 389 result=raOpenCodec(&sh->context); |
6367 | 390 if(result){ |
391 mp_msg(MSGT_DECAUDIO,MSGL_WARN,"Decoder open failed, error code: 0x%X\n",result); | |
392 return 0; | |
393 } | |
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
|
394 // printf("opencodec ok (result: %x)\n", result); |
10101
f3f3e25f8149
use dynamic path[] allocation and possible better wraSetDLLAccessPath mechanism :)
alex
parents:
10093
diff
changeset
|
395 free(path); /* after this it isn't used anymore */ |
6367 | 396 |
397 sh->samplerate=sh->wf->nSamplesPerSec; | |
398 sh->samplesize=sh->wf->wBitsPerSample/8; | |
399 sh->channels=sh->wf->nChannels; | |
400 | |
7472
c4434bdf6e51
tons of warning fixes, also some 10l bugfixes, including Dominik's PVA bug
arpi
parents:
7180
diff
changeset
|
401 { |
6367 | 402 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
|
403 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
|
404 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
|
405 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
|
406 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
|
407 ((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
|
408 ((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
|
409 ((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
|
410 ((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
|
411 }; |
12628
985e1813e298
support for realvideo codecs under macosx, original patch by Donnie Smith
alex
parents:
12356
diff
changeset
|
412 #if defined(USE_WIN32DLL) || defined(USE_MACSHLB) |
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
|
413 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
|
414 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
|
415 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
|
416 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
|
417 100, // quality |
6373 | 418 ((short*)(sh->wf+1))[0], // subpacket size |
8094 | 419 ((short*)(sh->wf+1))[3], // coded frame size |
420 ((short*)(sh->wf+1))[4], // codec data length | |
421 ((char*)(sh->wf+1))+10 // extras | |
6367 | 422 }; |
12628
985e1813e298
support for realvideo codecs under macosx, original patch by Donnie Smith
alex
parents:
12356
diff
changeset
|
423 #endif |
985e1813e298
support for realvideo codecs under macosx, original patch by Donnie Smith
alex
parents:
12356
diff
changeset
|
424 #ifdef USE_MACSHLB |
985e1813e298
support for realvideo codecs under macosx, original patch by Donnie Smith
alex
parents:
12356
diff
changeset
|
425 result=raInitDecoder(sh->context,&winit_data); |
985e1813e298
support for realvideo codecs under macosx, original patch by Donnie Smith
alex
parents:
12356
diff
changeset
|
426 #else |
985e1813e298
support for realvideo codecs under macosx, original patch by Donnie Smith
alex
parents:
12356
diff
changeset
|
427 #ifdef USE_WIN32DLL |
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
|
428 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
|
429 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
|
430 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
|
431 #endif |
6367 | 432 result=raInitDecoder(sh->context,&init_data); |
12628
985e1813e298
support for realvideo codecs under macosx, original patch by Donnie Smith
alex
parents:
12356
diff
changeset
|
433 #endif |
6367 | 434 if(result){ |
435 mp_msg(MSGT_DECAUDIO,MSGL_WARN,"Decoder init failed, error code: 0x%X\n",result); | |
436 return 0; | |
437 } | |
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
|
438 // printf("initdecoder ok (result: %x)\n", result); |
6367 | 439 } |
7086
f0886fe4be89
support for 'sipr' codec - descrambling/reorder not yet fixed.
arpi
parents:
6745
diff
changeset
|
440 |
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
|
441 #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
|
442 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
|
443 #else |
7086
f0886fe4be89
support for 'sipr' codec - descrambling/reorder not yet fixed.
arpi
parents:
6745
diff
changeset
|
444 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
|
445 #endif |
7086
f0886fe4be89
support for 'sipr' codec - descrambling/reorder not yet fixed.
arpi
parents:
6745
diff
changeset
|
446 // 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
|
447 #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
|
448 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
|
449 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
|
450 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
|
451 #endif |
7086
f0886fe4be89
support for 'sipr' codec - descrambling/reorder not yet fixed.
arpi
parents:
6745
diff
changeset
|
452 raSetPwd(sh->context,"Ardubancel Quazanga"); // set password... lol. |
f0886fe4be89
support for 'sipr' codec - descrambling/reorder not yet fixed.
arpi
parents:
6745
diff
changeset
|
453 } |
6367 | 454 |
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
|
455 #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
|
456 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
|
457 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
|
458 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
|
459 #endif |
6373 | 460 result=raSetFlavor(sh->context,((short*)(sh->wf+1))[2]); |
6367 | 461 if(result){ |
462 mp_msg(MSGT_DECAUDIO,MSGL_WARN,"Decoder flavor setup failed, error code: 0x%X\n",result); | |
463 return 0; | |
464 } | |
465 | |
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
|
466 #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
|
467 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
|
468 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
|
469 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
|
470 #endif |
6380 | 471 prop=raGetFlavorProperty(sh->context,((short*)(sh->wf+1))[2],0,&len); |
472 mp_msg(MSGT_DECAUDIO,MSGL_INFO,"Audio codec: [%d] %s\n",((short*)(sh->wf+1))[2],prop); | |
473 | |
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
|
474 #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
|
475 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
|
476 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
|
477 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
|
478 #endif |
6380 | 479 prop=raGetFlavorProperty(sh->context,((short*)(sh->wf+1))[2],1,&len); |
9551 | 480 if(prop){ |
481 sh->i_bps=((*((int*)prop))+4)/8; | |
482 mp_msg(MSGT_DECAUDIO,MSGL_INFO,"Audio bitrate: %5.3f kbit/s (%d bps) \n",(*((int*)prop))*0.001f,sh->i_bps); | |
483 } else | |
484 sh->i_bps=12000; // dunno :((( [12000 seems to be OK for crash.rmvb too] | |
485 | |
6380 | 486 // prop=raGetFlavorProperty(sh->context,((short*)(sh->wf+1))[2],0x13,&len); |
487 // mp_msg(MSGT_DECAUDIO,MSGL_INFO,"Samples/block?: %d \n",(*((int*)prop))); | |
488 | |
489 sh->audio_out_minsize=128000; // no idea how to get... :( | |
6373 | 490 sh->audio_in_minsize=((short*)(sh->wf+1))[1]*sh->wf->nBlockAlign; |
6367 | 491 |
492 return 1; // return values: 1=OK 0=ERROR | |
493 } | |
494 | |
495 static int init(sh_audio_t *sh_audio){ | |
496 // initialize the decoder, set tables etc... | |
497 | |
498 // you can store HANDLE or private struct pointer at sh->context | |
499 // you can access WAVEFORMATEX header at sh->wf | |
500 | |
501 // set sample format/rate parameters if you didn't do it in preinit() yet. | |
502 | |
503 return 1; // return values: 1=OK 0=ERROR | |
504 } | |
505 | |
506 static void uninit(sh_audio_t *sh){ | |
507 // uninit the decoder etc... | |
508 // 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
|
509 #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
|
510 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
|
511 { |
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
|
512 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
|
513 if (wraCloseCodec) wraCloseCodec(sh->context); |
9551 | 514 } |
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
|
515 #endif |
9551 | 516 |
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
|
517 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
|
518 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
|
519 |
12628
985e1813e298
support for realvideo codecs under macosx, original patch by Donnie Smith
alex
parents:
12356
diff
changeset
|
520 #ifdef USE_MACSHLB |
985e1813e298
support for realvideo codecs under macosx, original patch by Donnie Smith
alex
parents:
12356
diff
changeset
|
521 if (rv_handle){ |
985e1813e298
support for realvideo codecs under macosx, original patch by Donnie Smith
alex
parents:
12356
diff
changeset
|
522 (void)CloseConnection(rv_handle); |
985e1813e298
support for realvideo codecs under macosx, original patch by Donnie Smith
alex
parents:
12356
diff
changeset
|
523 DisposePtr((Ptr)rv_handle); |
985e1813e298
support for realvideo codecs under macosx, original patch by Donnie Smith
alex
parents:
12356
diff
changeset
|
524 } |
985e1813e298
support for realvideo codecs under macosx, original patch by Donnie Smith
alex
parents:
12356
diff
changeset
|
525 if (raCloseCodec) DisposePtr((Ptr)raCloseCodec); |
985e1813e298
support for realvideo codecs under macosx, original patch by Donnie Smith
alex
parents:
12356
diff
changeset
|
526 if (raDecode) DisposePtr((Ptr)raDecode); |
985e1813e298
support for realvideo codecs under macosx, original patch by Donnie Smith
alex
parents:
12356
diff
changeset
|
527 if (raFlush) DisposePtr((Ptr)raFlush); |
985e1813e298
support for realvideo codecs under macosx, original patch by Donnie Smith
alex
parents:
12356
diff
changeset
|
528 if (raFreeDecoder) DisposePtr((Ptr)raFreeDecoder); |
985e1813e298
support for realvideo codecs under macosx, original patch by Donnie Smith
alex
parents:
12356
diff
changeset
|
529 if (raGetFlavorProperty) DisposePtr((Ptr)raGetFlavorProperty); |
985e1813e298
support for realvideo codecs under macosx, original patch by Donnie Smith
alex
parents:
12356
diff
changeset
|
530 if (raOpenCodec) DisposePtr((Ptr)raOpenCodec); |
985e1813e298
support for realvideo codecs under macosx, original patch by Donnie Smith
alex
parents:
12356
diff
changeset
|
531 if (raOpenCodec2) DisposePtr((Ptr)raOpenCodec2); |
985e1813e298
support for realvideo codecs under macosx, original patch by Donnie Smith
alex
parents:
12356
diff
changeset
|
532 if (raInitDecoder) DisposePtr((Ptr)raInitDecoder); |
985e1813e298
support for realvideo codecs under macosx, original patch by Donnie Smith
alex
parents:
12356
diff
changeset
|
533 #endif |
985e1813e298
support for realvideo codecs under macosx, original patch by Donnie Smith
alex
parents:
12356
diff
changeset
|
534 |
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
|
535 #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
|
536 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
|
537 { |
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
|
538 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
|
539 } 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
|
540 #endif |
9551 | 541 // this dlclose() causes some memory corruption, and crashes soon (in caller): |
542 // 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
|
543 rv_handle = NULL; |
6367 | 544 } |
545 | |
7104
6d784b2812b9
'sipr' descrambling implemented, at least for 16*6 matrix
arpi
parents:
7097
diff
changeset
|
546 static unsigned char sipr_swaps[38][2]={ |
6d784b2812b9
'sipr' descrambling implemented, at least for 16*6 matrix
arpi
parents:
7097
diff
changeset
|
547 {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
|
548 {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
|
549 {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
|
550 {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
|
551 {77,80} }; |
6d784b2812b9
'sipr' descrambling implemented, at least for 16*6 matrix
arpi
parents:
7097
diff
changeset
|
552 |
6367 | 553 static int decode_audio(sh_audio_t *sh,unsigned char *buf,int minlen,int maxlen){ |
554 int result; | |
555 int len=-1; | |
6373 | 556 int sps=((short*)(sh->wf+1))[0]; |
7086
f0886fe4be89
support for 'sipr' codec - descrambling/reorder not yet fixed.
arpi
parents:
6745
diff
changeset
|
557 int w=sh->wf->nBlockAlign; // 5 |
6373 | 558 int h=((short*)(sh->wf+1))[1]; |
10030 | 559 int cfs=((short*)(sh->wf+1))[3]; |
7104
6d784b2812b9
'sipr' descrambling implemented, at least for 16*6 matrix
arpi
parents:
7097
diff
changeset
|
560 |
6d784b2812b9
'sipr' descrambling implemented, at least for 16*6 matrix
arpi
parents:
7097
diff
changeset
|
561 // 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
|
562 |
6373 | 563 #if 1 |
6368
9511fffdb8c6
yeah, it worx! but needs a big cleanup and removal of hardcoded stuff
arpi
parents:
6367
diff
changeset
|
564 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
|
565 // fill the buffer! |
10030 | 566 if (sh->format == mmioFOURCC('1','4','_','4')) { |
567 demux_read_data(sh->ds, sh->a_in_buffer, sh->wf->nBlockAlign); | |
568 sh->a_in_buffer_size= | |
569 sh->a_in_buffer_len=sh->wf->nBlockAlign; | |
570 } else | |
571 if (sh->format == mmioFOURCC('2','8','_','8')) { | |
572 int i,j; | |
573 for (j = 0; j < h; j++) | |
574 for (i = 0; i < h/2; i++) | |
575 demux_read_data(sh->ds, sh->a_in_buffer+i*2*w+j*cfs, cfs); | |
576 sh->a_in_buffer_size= | |
577 sh->a_in_buffer_len=sh->wf->nBlockAlign*h; | |
578 } else | |
7104
6d784b2812b9
'sipr' descrambling implemented, at least for 16*6 matrix
arpi
parents:
7097
diff
changeset
|
579 if(!sps){ |
6d784b2812b9
'sipr' descrambling implemented, at least for 16*6 matrix
arpi
parents:
7097
diff
changeset
|
580 // 'sipr' way |
6d784b2812b9
'sipr' descrambling implemented, at least for 16*6 matrix
arpi
parents:
7097
diff
changeset
|
581 int j,n; |
6d784b2812b9
'sipr' descrambling implemented, at least for 16*6 matrix
arpi
parents:
7097
diff
changeset
|
582 int bs=h*w*2/96; // nibbles per subpacket |
6d784b2812b9
'sipr' descrambling implemented, at least for 16*6 matrix
arpi
parents:
7097
diff
changeset
|
583 unsigned char *p=sh->a_in_buffer; |
6d784b2812b9
'sipr' descrambling implemented, at least for 16*6 matrix
arpi
parents:
7097
diff
changeset
|
584 demux_read_data(sh->ds, p, h*w); |
6d784b2812b9
'sipr' descrambling implemented, at least for 16*6 matrix
arpi
parents:
7097
diff
changeset
|
585 for(n=0;n<38;n++){ |
6d784b2812b9
'sipr' descrambling implemented, at least for 16*6 matrix
arpi
parents:
7097
diff
changeset
|
586 int i=bs*sipr_swaps[n][0]; |
6d784b2812b9
'sipr' descrambling implemented, at least for 16*6 matrix
arpi
parents:
7097
diff
changeset
|
587 int o=bs*sipr_swaps[n][1]; |
6d784b2812b9
'sipr' descrambling implemented, at least for 16*6 matrix
arpi
parents:
7097
diff
changeset
|
588 // swap nibbles of block 'i' with 'o' TODO: optimize |
6d784b2812b9
'sipr' descrambling implemented, at least for 16*6 matrix
arpi
parents:
7097
diff
changeset
|
589 for(j=0;j<bs;j++){ |
6d784b2812b9
'sipr' descrambling implemented, at least for 16*6 matrix
arpi
parents:
7097
diff
changeset
|
590 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
|
591 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
|
592 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
|
593 else p[(o>>1)]=(p[(o>>1)]&0xF0)|x; |
6d784b2812b9
'sipr' descrambling implemented, at least for 16*6 matrix
arpi
parents:
7097
diff
changeset
|
594 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
|
595 else p[(i>>1)]=(p[(i>>1)]&0xF0)|y; |
6d784b2812b9
'sipr' descrambling implemented, at least for 16*6 matrix
arpi
parents:
7097
diff
changeset
|
596 ++i;++o; |
6d784b2812b9
'sipr' descrambling implemented, at least for 16*6 matrix
arpi
parents:
7097
diff
changeset
|
597 } |
6d784b2812b9
'sipr' descrambling implemented, at least for 16*6 matrix
arpi
parents:
7097
diff
changeset
|
598 } |
6d784b2812b9
'sipr' descrambling implemented, at least for 16*6 matrix
arpi
parents:
7097
diff
changeset
|
599 sh->a_in_buffer_size= |
6d784b2812b9
'sipr' descrambling implemented, at least for 16*6 matrix
arpi
parents:
7097
diff
changeset
|
600 sh->a_in_buffer_len=w*h; |
6d784b2812b9
'sipr' descrambling implemented, at least for 16*6 matrix
arpi
parents:
7097
diff
changeset
|
601 } else { |
6d784b2812b9
'sipr' descrambling implemented, at least for 16*6 matrix
arpi
parents:
7097
diff
changeset
|
602 // 'cook' way |
6368
9511fffdb8c6
yeah, it worx! but needs a big cleanup and removal of hardcoded stuff
arpi
parents:
6367
diff
changeset
|
603 int x,y; |
7104
6d784b2812b9
'sipr' descrambling implemented, at least for 16*6 matrix
arpi
parents:
7097
diff
changeset
|
604 w/=sps; |
6373 | 605 for(y=0;y<h;y++) |
606 for(x=0;x<w;x++){ | |
6428
88a06ebb3287
audio subpacket reordering fixed for odd matrix height
arpi
parents:
6404
diff
changeset
|
607 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
|
608 } |
6373 | 609 sh->a_in_buffer_size= |
610 sh->a_in_buffer_len=w*h*sps; | |
7104
6d784b2812b9
'sipr' descrambling implemented, at least for 16*6 matrix
arpi
parents:
7097
diff
changeset
|
611 } |
6368
9511fffdb8c6
yeah, it worx! but needs a big cleanup and removal of hardcoded stuff
arpi
parents:
6367
diff
changeset
|
612 } |
6373 | 613 |
614 #else | |
615 if(sh->a_in_buffer_len<=0){ | |
616 // fill the buffer! | |
617 demux_read_data(sh->ds, sh->a_in_buffer, sh->wf->nBlockAlign); | |
618 sh->a_in_buffer_size= | |
619 sh->a_in_buffer_len=sh->wf->nBlockAlign; | |
620 } | |
621 #endif | |
6367 | 622 |
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
|
623 #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
|
624 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
|
625 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
|
626 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
|
627 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
|
628 #endif |
6373 | 629 result=raDecode(sh->context, sh->a_in_buffer+sh->a_in_buffer_size-sh->a_in_buffer_len, sh->wf->nBlockAlign, |
6367 | 630 buf, &len, -1); |
6368
9511fffdb8c6
yeah, it worx! but needs a big cleanup and removal of hardcoded stuff
arpi
parents:
6367
diff
changeset
|
631 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
|
632 |
6376 | 633 // printf("radecode: %d bytes, res=0x%X \n",len,result); |
6367 | 634 |
6368
9511fffdb8c6
yeah, it worx! but needs a big cleanup and removal of hardcoded stuff
arpi
parents:
6367
diff
changeset
|
635 return len; // return value: number of _bytes_ written to output buffer, |
6367 | 636 // or -1 for EOF (or uncorrectable error) |
637 } | |
638 | |
639 static int control(sh_audio_t *sh,int cmd,void* arg, ...){ | |
640 // various optional functions you MAY implement: | |
641 switch(cmd){ | |
642 case ADCTRL_RESYNC_STREAM: | |
643 // it is called once after seeking, to resync. | |
644 // Note: sh_audio->a_in_buffer_len=0; is done _before_ this call! | |
645 return CONTROL_TRUE; | |
646 case ADCTRL_SKIP_FRAME: | |
647 // it is called to skip (jump over) small amount (1/10 sec or 1 frame) | |
648 // of audio data - used to sync audio to video after seeking | |
649 // if you don't return CONTROL_TRUE, it will defaults to: | |
650 // ds_fill_buffer(sh_audio->ds); // skip 1 demux packet | |
651 return CONTROL_TRUE; | |
652 } | |
653 return CONTROL_UNKNOWN; | |
654 } | |
655 | |
656 #endif |