Mercurial > mplayer.hg
annotate libmpcodecs/ad_realaud.c @ 27321:2c0abab6b9b7
Use GetTimerMS() instead of time() with srand.
This is more portable and avoids generating the same random numbers
for a whole second (and on MinGW for some unexplainable reason for
almost 10 seconds).
author | reimar |
---|---|
date | Sat, 26 Jul 2008 21:58:00 +0000 |
parents | 055f06fadc0c |
children | e7c989f7a7c9 |
rev | line source |
---|---|
6367 | 1 |
2 #include <stdio.h> | |
3 #include <stdlib.h> | |
4 #include <unistd.h> | |
5 | |
6 #include "config.h" | |
7 | |
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
|
8 //#include <stddef.h> |
10093 | 9 #ifdef HAVE_LIBDL |
6367 | 10 #include <dlfcn.h> |
10093 | 11 #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
|
12 #include "help_mp.h" |
6367 | 13 |
14 #include "ad_internal.h" | |
22577
a033e5519802
Include loader/ prefix in #include path everywhere.
diego
parents:
21466
diff
changeset
|
15 #include "loader/wine/windef.h" |
6367 | 16 |
17 static ad_info_t info = { | |
6380 | 18 "RealAudio decoder", |
7174 | 19 "realaud", |
12628
985e1813e298
support for realvideo codecs under macosx, original patch by Donnie Smith
alex
parents:
12356
diff
changeset
|
20 "Alex Beregszaszi", |
985e1813e298
support for realvideo codecs under macosx, original patch by Donnie Smith
alex
parents:
12356
diff
changeset
|
21 "Florian Schneider, Arpad Gereoffy, Alex Beregszaszi, Donnie Smith", |
6380 | 22 "binary real audio codecs" |
6367 | 23 }; |
24 | |
7174 | 25 LIBAD_EXTERN(realaud) |
6367 | 26 |
27 void *__builtin_new(unsigned long size) { | |
28 return malloc(size); | |
29 } | |
30 | |
9551 | 31 // required for cook's uninit: |
32 void __builtin_delete(void* ize) { | |
33 free(ize); | |
34 } | |
35 | |
15566 | 36 #if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__) |
6404
83b3315c679b
Implement Nilmoni's and Bernd Ernesti's patches for:
atmos4
parents:
6380
diff
changeset
|
37 void *__ctype_b=NULL; |
6377 | 38 #endif |
6367 | 39 |
7472
c4434bdf6e51
tons of warning fixes, also some 10l bugfixes, including Dominik's PVA bug
arpi
parents:
7180
diff
changeset
|
40 static unsigned long (*raCloseCodec)(void*); |
7557 | 41 static unsigned long (*raDecode)(void*, char*,unsigned long,char*,unsigned int*,long); |
7472
c4434bdf6e51
tons of warning fixes, also some 10l bugfixes, including Dominik's PVA bug
arpi
parents:
7180
diff
changeset
|
42 static unsigned long (*raFreeDecoder)(void*); |
6745
9734bfbb200a
Avoid ulong typedef clash and replace if by unsigned long, patch by Joey Parrish.
atmos4
parents:
6428
diff
changeset
|
43 //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
|
44 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
|
45 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
|
46 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
|
47 static unsigned long (*raSetFlavor)(void*,unsigned long); |
7752
18f8233094da
tell the codec wrapper the codec path (fixes realaudio Sipr)
arpi
parents:
7557
diff
changeset
|
48 static void (*raSetDLLAccessPath)(char*); |
7086
f0886fe4be89
support for 'sipr' codec - descrambling/reorder not yet fixed.
arpi
parents:
6745
diff
changeset
|
49 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
|
50 #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
|
51 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
|
52 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
|
53 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
|
54 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
|
55 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
|
56 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
|
57 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
|
58 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
|
59 static void WINAPI (*wraSetPwd)(char*,char*); |
6367 | 60 |
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
|
61 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
|
62 #endif |
12628
985e1813e298
support for realvideo codecs under macosx, original patch by Donnie Smith
alex
parents:
12356
diff
changeset
|
63 |
9395
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
64 static 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
|
65 |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio 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 #if 0 |
6367 | 67 typedef struct { |
68 int samplerate; | |
69 short bits; | |
70 short channels; | |
71 int unk1; | |
72 int unk2; | |
73 int packetsize; | |
74 int unk3; | |
75 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
|
76 } 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
|
77 #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
|
78 |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
79 /* |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
80 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
|
81 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
|
82 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
|
83 |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
84 -- 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
|
85 */ |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
86 |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio 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 /* 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
|
88 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
|
89 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
|
90 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
|
91 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
|
92 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
|
93 /* 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
|
94 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
|
95 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
|
96 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
|
97 void* extradata; |
6367 | 98 } ra_init_t; |
99 | |
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
|
100 /* 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
|
101 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
|
102 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
|
103 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
|
104 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
|
105 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
|
106 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
|
107 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
|
108 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
|
109 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
|
110 } 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
|
111 #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
|
112 |
10093 | 113 #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
|
114 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
|
115 { |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio 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 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
|
117 |
17721
7b336a5585e4
Reduce Real DLL/so loading verbosity, OKed by Roberto.
diego
parents:
17149
diff
changeset
|
118 mp_msg(MSGT_DECVIDEO, MSGL_V, "opening shared obj '%s'\n", 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
|
119 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
|
120 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
|
121 { |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio 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 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
|
123 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
|
124 } |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio 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 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
|
127 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
|
128 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
|
129 raOpenCodec = dlsym(handle, "RAOpenCodec"); |
9551 | 130 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
|
131 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
|
132 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
|
133 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
|
134 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
|
135 |
21466
abfc5854e80a
Remove unused function pointers, they probably had incorrect prototypes
reimar
parents:
19135
diff
changeset
|
136 if (raCloseCodec && raDecode && raFreeDecoder && |
abfc5854e80a
Remove unused function pointers, they probably had incorrect prototypes
reimar
parents:
19135
diff
changeset
|
137 (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
|
138 /*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
|
139 { |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio 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 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
|
141 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
|
142 } |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
143 |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio 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 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
|
145 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
|
146 return 0; |
10093 | 147 } |
148 #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
|
149 |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio 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 #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
|
151 |
10093 | 152 #ifdef WIN32_LOADER |
17012 | 153 #include "loader/ldt_keeper.h" |
10093 | 154 #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
|
155 void* WINAPI LoadLibraryA(char* name); |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
156 void* WINAPI GetProcAddress(void* handle,char *func); |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
157 int WINAPI FreeLibrary(void *handle); |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
158 |
10652 | 159 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
|
160 { |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
161 void *handle; |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
162 |
17721
7b336a5585e4
Reduce Real DLL/so loading verbosity, OKed by Roberto.
diego
parents:
17149
diff
changeset
|
163 mp_msg(MSGT_DECVIDEO, MSGL_V, "opening win32 dll '%s'\n", path); |
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 Setup_LDT_Keeper(); |
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 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
|
168 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
|
169 { |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio 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 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
|
171 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
|
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 |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio 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 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
|
175 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
|
176 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
|
177 wraOpenCodec = GetProcAddress(handle, "RAOpenCodec"); |
9551 | 178 wraOpenCodec2 = GetProcAddress(handle, "RAOpenCodec2"); |
9395
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
179 wraInitDecoder = GetProcAddress(handle, "RAInitDecoder"); |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
180 wraSetFlavor = GetProcAddress(handle, "RASetFlavor"); |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
181 wraSetDLLAccessPath = GetProcAddress(handle, "SetDLLAccessPath"); |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
182 wraSetPwd = GetProcAddress(handle, "RASetPwd"); // optional, used by SIPR |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
183 |
21466
abfc5854e80a
Remove unused function pointers, they probably had incorrect prototypes
reimar
parents:
19135
diff
changeset
|
184 if (wraCloseCodec && wraDecode && wraFreeDecoder && |
abfc5854e80a
Remove unused function pointers, they probably had incorrect prototypes
reimar
parents:
19135
diff
changeset
|
185 (wraOpenCodec || wraOpenCodec2) && wraSetFlavor && |
9395
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
186 /*wraSetDLLAccessPath &&*/ wraInitDecoder) |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
187 { |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
188 rv_handle = handle; |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
189 dll_type = 1; |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
190 return 1; |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
191 } |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
192 |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
193 mp_msg(MSGT_DECAUDIO,MSGL_WARN,"Cannot resolve symbols - incompatible dll: %s\n",path); |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
194 FreeLibrary(handle); |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
195 return 0; |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
196 |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
197 } |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
198 #endif |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
199 |
12628
985e1813e298
support for realvideo codecs under macosx, original patch by Donnie Smith
alex
parents:
12356
diff
changeset
|
200 |
6367 | 201 static int preinit(sh_audio_t *sh){ |
202 // let's check if the driver is available, return 0 if not. | |
203 // (you should do that if you use external lib(s) which is optional) | |
204 unsigned int result; | |
10101
f3f3e25f8149
use dynamic path[] allocation and possible better wraSetDLLAccessPath mechanism :)
alex
parents:
10093
diff
changeset
|
205 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
|
206 |
10101
f3f3e25f8149
use dynamic path[] allocation and possible better wraSetDLLAccessPath mechanism :)
alex
parents:
10093
diff
changeset
|
207 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
|
208 if (!path) return 0; |
6404
83b3315c679b
Implement Nilmoni's and Bernd Ernesti's patches for:
atmos4
parents:
6380
diff
changeset
|
209 sprintf(path, REALCODEC_PATH "/%s", sh->codec->dll); |
6367 | 210 |
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
|
211 /* 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
|
212 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
|
213 |
10093 | 214 #ifdef HAVE_LIBDL |
215 if (strstr(sh->codec->dll,".dll") || !load_syms_linux(path)) | |
216 #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
|
217 #ifdef USE_WIN32DLL |
10652 | 218 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
|
219 #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
|
220 { |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
221 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
|
222 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
|
223 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
|
224 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
|
225 } |
6367 | 226 |
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
|
227 #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
|
228 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
|
229 #else |
7752
18f8233094da
tell the codec wrapper the codec path (fixes realaudio Sipr)
arpi
parents:
7557
diff
changeset
|
230 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
|
231 #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
|
232 // used by 'SIPR' |
16037 | 233 path = realloc(path, strlen(REALCODEC_PATH) + 13); |
7752
18f8233094da
tell the codec wrapper the codec path (fixes realaudio Sipr)
arpi
parents:
7557
diff
changeset
|
234 sprintf(path, "DT_Codecs=" REALCODEC_PATH); |
18f8233094da
tell the codec wrapper the codec path (fixes realaudio Sipr)
arpi
parents:
7557
diff
changeset
|
235 if(path[strlen(path)-1]!='/'){ |
18f8233094da
tell the codec wrapper the codec path (fixes realaudio Sipr)
arpi
parents:
7557
diff
changeset
|
236 path[strlen(path)+1]=0; |
18f8233094da
tell the codec wrapper the codec path (fixes realaudio Sipr)
arpi
parents:
7557
diff
changeset
|
237 path[strlen(path)]='/'; |
18f8233094da
tell the codec wrapper the codec path (fixes realaudio Sipr)
arpi
parents:
7557
diff
changeset
|
238 } |
18f8233094da
tell the codec wrapper the codec path (fixes realaudio Sipr)
arpi
parents:
7557
diff
changeset
|
239 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
|
240 #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
|
241 if (dll_type == 1) |
10101
f3f3e25f8149
use dynamic path[] allocation and possible better wraSetDLLAccessPath mechanism :)
alex
parents:
10093
diff
changeset
|
242 { |
23631
055f06fadc0c
Move variable into the block where it actually used
reimar
parents:
23379
diff
changeset
|
243 int i; |
10101
f3f3e25f8149
use dynamic path[] allocation and possible better wraSetDLLAccessPath mechanism :)
alex
parents:
10093
diff
changeset
|
244 for (i=0; i < strlen(path); i++) |
f3f3e25f8149
use dynamic path[] allocation and possible better wraSetDLLAccessPath mechanism :)
alex
parents:
10093
diff
changeset
|
245 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
|
246 wraSetDLLAccessPath(path); |
10101
f3f3e25f8149
use dynamic path[] allocation and possible better wraSetDLLAccessPath mechanism :)
alex
parents:
10093
diff
changeset
|
247 } |
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
|
248 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
|
249 #endif |
7752
18f8233094da
tell the codec wrapper the codec path (fixes realaudio Sipr)
arpi
parents:
7557
diff
changeset
|
250 raSetDLLAccessPath(path); |
18f8233094da
tell the codec wrapper the codec path (fixes realaudio Sipr)
arpi
parents:
7557
diff
changeset
|
251 } |
18f8233094da
tell the codec wrapper the codec path (fixes realaudio Sipr)
arpi
parents:
7557
diff
changeset
|
252 |
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
|
253 #ifdef USE_WIN32DLL |
9551 | 254 if (dll_type == 1){ |
255 if(wraOpenCodec2) | |
256 result=wraOpenCodec2(&sh->context,REALCODEC_PATH "\\"); | |
257 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
|
258 result=wraOpenCodec(&sh->context); |
9551 | 259 } else |
260 #endif | |
261 if(raOpenCodec2) | |
262 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
|
263 else |
9551 | 264 result=raOpenCodec(&sh->context); |
6367 | 265 if(result){ |
266 mp_msg(MSGT_DECAUDIO,MSGL_WARN,"Decoder open failed, error code: 0x%X\n",result); | |
267 return 0; | |
268 } | |
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
|
269 // printf("opencodec ok (result: %x)\n", result); |
10101
f3f3e25f8149
use dynamic path[] allocation and possible better wraSetDLLAccessPath mechanism :)
alex
parents:
10093
diff
changeset
|
270 free(path); /* after this it isn't used anymore */ |
6367 | 271 |
272 sh->samplerate=sh->wf->nSamplesPerSec; | |
273 sh->samplesize=sh->wf->wBitsPerSample/8; | |
274 sh->channels=sh->wf->nChannels; | |
275 | |
7472
c4434bdf6e51
tons of warning fixes, also some 10l bugfixes, including Dominik's PVA bug
arpi
parents:
7180
diff
changeset
|
276 { |
6367 | 277 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
|
278 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
|
279 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
|
280 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
|
281 100, // quality |
17149
9a0a376a54b1
Move audio packets reordering from codec interface to demuxers for real
rtognimp
parents:
17012
diff
changeset
|
282 sh->wf->nBlockAlign, // subpacket size |
9a0a376a54b1
Move audio packets reordering from codec interface to demuxers for real
rtognimp
parents:
17012
diff
changeset
|
283 sh->wf->nBlockAlign, // coded frame size |
9a0a376a54b1
Move audio packets reordering from codec interface to demuxers for real
rtognimp
parents:
17012
diff
changeset
|
284 sh->wf->cbSize, // codec data length |
9a0a376a54b1
Move audio packets reordering from codec interface to demuxers for real
rtognimp
parents:
17012
diff
changeset
|
285 (char*)(sh->wf+1) // extras |
9395
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
286 }; |
13860
d6f716fdd734
remove mac shlb support to use new helix codec for realvideo support on osx
nplourde
parents:
12633
diff
changeset
|
287 #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
|
288 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
|
289 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
|
290 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
|
291 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
|
292 100, // quality |
17149
9a0a376a54b1
Move audio packets reordering from codec interface to demuxers for real
rtognimp
parents:
17012
diff
changeset
|
293 sh->wf->nBlockAlign, // subpacket size |
9a0a376a54b1
Move audio packets reordering from codec interface to demuxers for real
rtognimp
parents:
17012
diff
changeset
|
294 sh->wf->nBlockAlign, // coded frame size |
9a0a376a54b1
Move audio packets reordering from codec interface to demuxers for real
rtognimp
parents:
17012
diff
changeset
|
295 sh->wf->cbSize, // codec data length |
9a0a376a54b1
Move audio packets reordering from codec interface to demuxers for real
rtognimp
parents:
17012
diff
changeset
|
296 (char*)(sh->wf+1) // extras |
6367 | 297 }; |
12628
985e1813e298
support for realvideo codecs under macosx, original patch by Donnie Smith
alex
parents:
12356
diff
changeset
|
298 #endif |
985e1813e298
support for realvideo codecs under macosx, original patch by Donnie Smith
alex
parents:
12356
diff
changeset
|
299 #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
|
300 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
|
301 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
|
302 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
|
303 #endif |
6367 | 304 result=raInitDecoder(sh->context,&init_data); |
13860
d6f716fdd734
remove mac shlb support to use new helix codec for realvideo support on osx
nplourde
parents:
12633
diff
changeset
|
305 |
6367 | 306 if(result){ |
307 mp_msg(MSGT_DECAUDIO,MSGL_WARN,"Decoder init failed, error code: 0x%X\n",result); | |
308 return 0; | |
309 } | |
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
|
310 // printf("initdecoder ok (result: %x)\n", result); |
6367 | 311 } |
7086
f0886fe4be89
support for 'sipr' codec - descrambling/reorder not yet fixed.
arpi
parents:
6745
diff
changeset
|
312 |
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
|
313 #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
|
314 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
|
315 #else |
7086
f0886fe4be89
support for 'sipr' codec - descrambling/reorder not yet fixed.
arpi
parents:
6745
diff
changeset
|
316 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
|
317 #endif |
7086
f0886fe4be89
support for 'sipr' codec - descrambling/reorder not yet fixed.
arpi
parents:
6745
diff
changeset
|
318 // 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
|
319 #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
|
320 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
|
321 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
|
322 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
|
323 #endif |
7086
f0886fe4be89
support for 'sipr' codec - descrambling/reorder not yet fixed.
arpi
parents:
6745
diff
changeset
|
324 raSetPwd(sh->context,"Ardubancel Quazanga"); // set password... lol. |
f0886fe4be89
support for 'sipr' codec - descrambling/reorder not yet fixed.
arpi
parents:
6745
diff
changeset
|
325 } |
6367 | 326 |
17149
9a0a376a54b1
Move audio packets reordering from codec interface to demuxers for real
rtognimp
parents:
17012
diff
changeset
|
327 if (sh->format == mmioFOURCC('s','i','p','r')) { |
9a0a376a54b1
Move audio packets reordering from codec interface to demuxers for real
rtognimp
parents:
17012
diff
changeset
|
328 short flavor; |
9a0a376a54b1
Move audio packets reordering from codec interface to demuxers for real
rtognimp
parents:
17012
diff
changeset
|
329 |
9a0a376a54b1
Move audio packets reordering from codec interface to demuxers for real
rtognimp
parents:
17012
diff
changeset
|
330 if (sh->wf->nAvgBytesPerSec > 1531) |
9a0a376a54b1
Move audio packets reordering from codec interface to demuxers for real
rtognimp
parents:
17012
diff
changeset
|
331 flavor = 3; |
9a0a376a54b1
Move audio packets reordering from codec interface to demuxers for real
rtognimp
parents:
17012
diff
changeset
|
332 else if (sh->wf->nAvgBytesPerSec > 937) |
9a0a376a54b1
Move audio packets reordering from codec interface to demuxers for real
rtognimp
parents:
17012
diff
changeset
|
333 flavor = 1; |
9a0a376a54b1
Move audio packets reordering from codec interface to demuxers for real
rtognimp
parents:
17012
diff
changeset
|
334 else if (sh->wf->nAvgBytesPerSec > 719) |
9a0a376a54b1
Move audio packets reordering from codec interface to demuxers for real
rtognimp
parents:
17012
diff
changeset
|
335 flavor = 0; |
9a0a376a54b1
Move audio packets reordering from codec interface to demuxers for real
rtognimp
parents:
17012
diff
changeset
|
336 else |
9a0a376a54b1
Move audio packets reordering from codec interface to demuxers for real
rtognimp
parents:
17012
diff
changeset
|
337 flavor = 2; |
9a0a376a54b1
Move audio packets reordering from codec interface to demuxers for real
rtognimp
parents:
17012
diff
changeset
|
338 mp_msg(MSGT_DECAUDIO,MSGL_V,"Got sipr flavor %d from bitrate %d\n",flavor, sh->wf->nAvgBytesPerSec); |
9a0a376a54b1
Move audio packets reordering from codec interface to demuxers for real
rtognimp
parents:
17012
diff
changeset
|
339 |
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
|
340 #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
|
341 if (dll_type == 1) |
17149
9a0a376a54b1
Move audio packets reordering from codec interface to demuxers for real
rtognimp
parents:
17012
diff
changeset
|
342 result=wraSetFlavor(sh->context,flavor); |
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
|
343 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
|
344 #endif |
17149
9a0a376a54b1
Move audio packets reordering from codec interface to demuxers for real
rtognimp
parents:
17012
diff
changeset
|
345 result=raSetFlavor(sh->context,flavor); |
6367 | 346 if(result){ |
347 mp_msg(MSGT_DECAUDIO,MSGL_WARN,"Decoder flavor setup failed, error code: 0x%X\n",result); | |
348 return 0; | |
349 } | |
17149
9a0a376a54b1
Move audio packets reordering from codec interface to demuxers for real
rtognimp
parents:
17012
diff
changeset
|
350 } // sipr flavor |
6380 | 351 |
17149
9a0a376a54b1
Move audio packets reordering from codec interface to demuxers for real
rtognimp
parents:
17012
diff
changeset
|
352 sh->i_bps=sh->wf->nAvgBytesPerSec; |
9551 | 353 |
6380 | 354 sh->audio_out_minsize=128000; // no idea how to get... :( |
17149
9a0a376a54b1
Move audio packets reordering from codec interface to demuxers for real
rtognimp
parents:
17012
diff
changeset
|
355 sh->audio_in_minsize = sh->wf->nBlockAlign; |
6367 | 356 |
357 return 1; // return values: 1=OK 0=ERROR | |
358 } | |
359 | |
360 static int init(sh_audio_t *sh_audio){ | |
361 // initialize the decoder, set tables etc... | |
362 | |
363 // you can store HANDLE or private struct pointer at sh->context | |
364 // you can access WAVEFORMATEX header at sh->wf | |
365 | |
366 // set sample format/rate parameters if you didn't do it in preinit() yet. | |
367 | |
368 return 1; // return values: 1=OK 0=ERROR | |
369 } | |
370 | |
371 static void uninit(sh_audio_t *sh){ | |
372 // uninit the decoder etc... | |
373 // 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
|
374 #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
|
375 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
|
376 { |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
377 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
|
378 if (wraCloseCodec) wraCloseCodec(sh->context); |
9551 | 379 } |
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
|
380 #endif |
9551 | 381 |
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
|
382 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
|
383 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
|
384 |
12628
985e1813e298
support for realvideo codecs under macosx, original patch by Donnie Smith
alex
parents:
12356
diff
changeset
|
385 |
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
|
386 #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
|
387 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
|
388 { |
2d651a218031
windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents:
8094
diff
changeset
|
389 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
|
390 } 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
|
391 #endif |
9551 | 392 // this dlclose() causes some memory corruption, and crashes soon (in caller): |
393 // 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
|
394 rv_handle = NULL; |
6367 | 395 } |
396 | |
397 static int decode_audio(sh_audio_t *sh,unsigned char *buf,int minlen,int maxlen){ | |
398 int result; | |
399 int len=-1; | |
7104
6d784b2812b9
'sipr' descrambling implemented, at least for 16*6 matrix
arpi
parents:
7097
diff
changeset
|
400 |
6373 | 401 if(sh->a_in_buffer_len<=0){ |
402 // fill the buffer! | |
19135 | 403 if (sh->ds->eof) |
404 return 0; | |
6373 | 405 demux_read_data(sh->ds, sh->a_in_buffer, sh->wf->nBlockAlign); |
406 sh->a_in_buffer_size= | |
407 sh->a_in_buffer_len=sh->wf->nBlockAlign; | |
408 } | |
6367 | 409 |
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
|
410 #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
|
411 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
|
412 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
|
413 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
|
414 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
|
415 #endif |
6373 | 416 result=raDecode(sh->context, sh->a_in_buffer+sh->a_in_buffer_size-sh->a_in_buffer_len, sh->wf->nBlockAlign, |
6367 | 417 buf, &len, -1); |
6368
9511fffdb8c6
yeah, it worx! but needs a big cleanup and removal of hardcoded stuff
arpi
parents:
6367
diff
changeset
|
418 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
|
419 |
6376 | 420 // printf("radecode: %d bytes, res=0x%X \n",len,result); |
6367 | 421 |
6368
9511fffdb8c6
yeah, it worx! but needs a big cleanup and removal of hardcoded stuff
arpi
parents:
6367
diff
changeset
|
422 return len; // return value: number of _bytes_ written to output buffer, |
6367 | 423 // or -1 for EOF (or uncorrectable error) |
424 } | |
425 | |
426 static int control(sh_audio_t *sh,int cmd,void* arg, ...){ | |
427 // various optional functions you MAY implement: | |
428 switch(cmd){ | |
429 case ADCTRL_RESYNC_STREAM: | |
430 // it is called once after seeking, to resync. | |
431 // Note: sh_audio->a_in_buffer_len=0; is done _before_ this call! | |
432 return CONTROL_TRUE; | |
433 case ADCTRL_SKIP_FRAME: | |
434 // it is called to skip (jump over) small amount (1/10 sec or 1 frame) | |
435 // of audio data - used to sync audio to video after seeking | |
436 // if you don't return CONTROL_TRUE, it will defaults to: | |
437 // ds_fill_buffer(sh_audio->ds); // skip 1 demux packet | |
438 return CONTROL_TRUE; | |
439 } | |
440 return CONTROL_UNKNOWN; | |
441 } |