annotate libmpcodecs/ad_realaud.c @ 9398:d709935c512d

optional loader/ (currently it does nothing until the win32 support on cygwin is disabled)
author alex
date Tue, 11 Feb 2003 18:56:17 +0000
parents 2d651a218031
children d447d6403faf
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
6367
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
1
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
2 #include <stdio.h>
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
3 #include <stdlib.h>
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
4 #include <unistd.h>
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
5
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
6 #include "config.h"
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
7
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
8 #ifdef USE_REALCODECS
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
9
9395
2d651a218031 windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents: 8094
diff changeset
10 //#include <stddef.h>
6367
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
11 #include <dlfcn.h>
9395
2d651a218031 windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents: 8094
diff changeset
12 #include "help_mp.h"
6367
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
13
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
14 #include "ad_internal.h"
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
15
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
16 static ad_info_t info = {
6380
947d6a639c5a fixed copyright
arpi
parents: 6377
diff changeset
17 "RealAudio decoder",
7174
7672615cc811 sync driver names with codec-cfg
arpi
parents: 7172
diff changeset
18 "realaud",
9395
2d651a218031 windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents: 8094
diff changeset
19 "A'rpi", // win32 dlls support by alex
6380
947d6a639c5a fixed copyright
arpi
parents: 6377
diff changeset
20 "Florian Schneider",
947d6a639c5a fixed copyright
arpi
parents: 6377
diff changeset
21 "binary real audio codecs"
6367
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
22 };
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
23
7174
7672615cc811 sync driver names with codec-cfg
arpi
parents: 7172
diff changeset
24 LIBAD_EXTERN(realaud)
6367
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
25
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
26 static void *handle=NULL;
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
27
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
28 void *__builtin_new(unsigned long size) {
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
29 return malloc(size);
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
30 }
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
31
6404
83b3315c679b Implement Nilmoni's and Bernd Ernesti's patches for:
atmos4
parents: 6380
diff changeset
32 #if defined(__FreeBSD__) || defined(__NetBSD__)
83b3315c679b Implement Nilmoni's and Bernd Ernesti's patches for:
atmos4
parents: 6380
diff changeset
33 void *__ctype_b=NULL;
6377
203128bcc6be FreeBSD hack
nexus
parents: 6376
diff changeset
34 #endif
6367
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
35
7472
c4434bdf6e51 tons of warning fixes, also some 10l bugfixes, including Dominik's PVA bug
arpi
parents: 7180
diff changeset
36 static unsigned long (*raCloseCodec)(void*);
7557
f296ff05bcd0 warning fixes
arpi
parents: 7472
diff changeset
37 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
38 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
39 static unsigned long (*raFreeDecoder)(void*);
7557
f296ff05bcd0 warning fixes
arpi
parents: 7472
diff changeset
40 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
41 //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
42 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
43 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
44 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
45 static unsigned long (*raSetFlavor)(void*,unsigned long);
7752
18f8233094da tell the codec wrapper the codec path (fixes realaudio Sipr)
arpi
parents: 7557
diff changeset
46 static void (*raSetDLLAccessPath)(char*);
7086
f0886fe4be89 support for 'sipr' codec - descrambling/reorder not yet fixed.
arpi
parents: 6745
diff changeset
47 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
48 #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
49 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
50 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
51 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
52 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
53 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
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
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
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
2d651a218031 windows support and eleminating some 10ls. Win32 ATRC has audio 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 *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
64
2d651a218031 windows support and eleminating some 10ls. Win32 ATRC has audio 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 #if 0
6367
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
66 typedef struct {
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
67 int samplerate;
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
68 short bits;
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
69 short channels;
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
70 int unk1;
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
71 int unk2;
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
72 int packetsize;
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
73 int unk3;
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
74 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
75 } 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
76 #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
77
2d651a218031 windows support and eleminating some 10ls. Win32 ATRC has audio 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 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
80 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
81 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
82
2d651a218031 windows support and eleminating some 10ls. Win32 ATRC has audio 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 -- 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
84 */
2d651a218031 windows support and eleminating some 10ls. Win32 ATRC has audio 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 /* 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
87 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
88 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
89 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
90 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
91 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
92 /* 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
93 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
94 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
95 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
96 void* extradata;
6367
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
97 } ra_init_t;
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
98
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
99 /* 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
100 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
101 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
102 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
103 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
104 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
105 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
106 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
107 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
108 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
109 } 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
110 #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
111
2d651a218031 windows support and eleminating some 10ls. Win32 ATRC has audio 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 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
113 {
2d651a218031 windows support and eleminating some 10ls. Win32 ATRC has audio 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 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
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 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
117 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
118 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
119 {
2d651a218031 windows support and eleminating some 10ls. Win32 ATRC has audio 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 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
121 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
122 }
2d651a218031 windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents: 8094
diff changeset
123
2d651a218031 windows support and eleminating some 10ls. Win32 ATRC has audio 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 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
125 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
126 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
127 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
128 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
129 raOpenCodec = dlsym(handle, "RAOpenCodec");
2d651a218031 windows support and eleminating some 10ls. Win32 ATRC has audio 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 // raOpenCodec2 = dlsym(handle, "RAOpenCodec2");
2d651a218031 windows support and eleminating some 10ls. Win32 ATRC has audio 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
2d651a218031 windows support and eleminating some 10ls. Win32 ATRC has audio 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 if (raCloseCodec && raDecode && raFlush && 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
137 raGetFlavorProperty && raOpenCodec/*2*/ && 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
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;
2d651a218031 windows support and eleminating some 10ls. Win32 ATRC has audio 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 }
2d651a218031 windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents: 8094
diff changeset
148
2d651a218031 windows support and eleminating some 10ls. Win32 ATRC has audio 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 #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
150
2d651a218031 windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents: 8094
diff changeset
151 #include "../loader/ldt_keeper.h"
2d651a218031 windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents: 8094
diff changeset
152 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
153 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
154 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
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 static int load_sysm_windows(char *path)
2d651a218031 windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents: 8094
diff changeset
157 {
2d651a218031 windows support and eleminating some 10ls. Win32 ATRC has audio 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 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
159
2d651a218031 windows support and eleminating some 10ls. Win32 ATRC has audio 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 mp_msg(MSGT_DECVIDEO, MSGL_INFO, "opening win32 dll '%s'\n", path);
2d651a218031 windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents: 8094
diff changeset
161 Setup_LDT_Keeper();
2d651a218031 windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents: 8094
diff changeset
162 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
163 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
164 {
2d651a218031 windows support and eleminating some 10ls. Win32 ATRC has audio 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 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
166 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
167 }
2d651a218031 windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents: 8094
diff changeset
168
2d651a218031 windows support and eleminating some 10ls. Win32 ATRC has audio 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 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
170 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
171 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
172 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
173 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
174 wraOpenCodec = GetProcAddress(handle, "RAOpenCodec");
2d651a218031 windows support and eleminating some 10ls. Win32 ATRC has audio 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 // wraOpenCodec2 = GetProcAddress(handle, "RAOpenCodec2");
2d651a218031 windows support and eleminating some 10ls. Win32 ATRC has audio 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 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
177 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
178 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
179 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
180
2d651a218031 windows support and eleminating some 10ls. Win32 ATRC has audio 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 if (wraCloseCodec && wraDecode && wraFlush && wraFreeDecoder &&
2d651a218031 windows support and eleminating some 10ls. Win32 ATRC has audio 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 wraGetFlavorProperty && wraOpenCodec/*2*/ && wraSetFlavor &&
2d651a218031 windows support and eleminating some 10ls. Win32 ATRC has audio 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 /*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
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 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
186 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
187 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
188 }
2d651a218031 windows support and eleminating some 10ls. Win32 ATRC has audio 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
2d651a218031 windows support and eleminating some 10ls. Win32 ATRC has audio 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 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
191 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
192 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
193
2d651a218031 windows support and eleminating some 10ls. Win32 ATRC has audio 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 }
2d651a218031 windows support and eleminating some 10ls. Win32 ATRC has audio 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 #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
196
6367
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
197 static int preinit(sh_audio_t *sh){
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
198 // let's check if the driver is available, return 0 if not.
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
199 // (you should do that if you use external lib(s) which is optional)
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
200 unsigned int result;
7472
c4434bdf6e51 tons of warning fixes, also some 10l bugfixes, including Dominik's PVA bug
arpi
parents: 7180
diff changeset
201 int len=0;
6380
947d6a639c5a fixed copyright
arpi
parents: 6377
diff changeset
202 void* prop;
6376
e3c74c01a3a2 use path & dllname from config
arpi
parents: 6373
diff changeset
203 char path[4096];
9395
2d651a218031 windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents: 8094
diff changeset
204
6404
83b3315c679b Implement Nilmoni's and Bernd Ernesti's patches for:
atmos4
parents: 6380
diff changeset
205 sprintf(path, REALCODEC_PATH "/%s", sh->codec->dll);
6367
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
206
9395
2d651a218031 windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents: 8094
diff changeset
207 /* 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
208 then try to load the windows ones */
2d651a218031 windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents: 8094
diff changeset
209 if (!load_syms_linux(path))
2d651a218031 windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents: 8094
diff changeset
210 #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
211 if (!load_sysm_windows(path))
2d651a218031 windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents: 8094
diff changeset
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 {
2d651a218031 windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents: 8094
diff changeset
214 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
215 mp_msg(MSGT_DECVIDEO, MSGL_HINT, "Read the RealAudio section of the DOCS!\n");
2d651a218031 windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents: 8094
diff changeset
216 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
217 }
6367
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
218
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 #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
220 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
221 #else
7752
18f8233094da tell the codec wrapper the codec path (fixes realaudio Sipr)
arpi
parents: 7557
diff changeset
222 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
223 #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
224 // used by 'SIPR'
7752
18f8233094da tell the codec wrapper the codec path (fixes realaudio Sipr)
arpi
parents: 7557
diff changeset
225 sprintf(path, "DT_Codecs=" REALCODEC_PATH);
18f8233094da tell the codec wrapper the codec path (fixes realaudio Sipr)
arpi
parents: 7557
diff changeset
226 if(path[strlen(path)-1]!='/'){
18f8233094da tell the codec wrapper the codec path (fixes realaudio Sipr)
arpi
parents: 7557
diff changeset
227 path[strlen(path)+1]=0;
18f8233094da tell the codec wrapper the codec path (fixes realaudio Sipr)
arpi
parents: 7557
diff changeset
228 path[strlen(path)]='/';
18f8233094da tell the codec wrapper the codec path (fixes realaudio Sipr)
arpi
parents: 7557
diff changeset
229 }
18f8233094da tell the codec wrapper the codec path (fixes realaudio Sipr)
arpi
parents: 7557
diff changeset
230 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
231 #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
232 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
233 wraSetDLLAccessPath(path);
2d651a218031 windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents: 8094
diff changeset
234 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
235 #endif
7752
18f8233094da tell the codec wrapper the codec path (fixes realaudio Sipr)
arpi
parents: 7557
diff changeset
236 raSetDLLAccessPath(path);
18f8233094da tell the codec wrapper the codec path (fixes realaudio Sipr)
arpi
parents: 7557
diff changeset
237 }
18f8233094da tell the codec wrapper the codec path (fixes realaudio Sipr)
arpi
parents: 7557
diff changeset
238
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
239 #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
240 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
241 // result=wraOpenCodec2(&sh->context,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
242 result=wraOpenCodec(&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
243 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
244 #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
245 // result=raOpenCodec2(&sh->context,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
246 result=raOpenCodec(&sh->context);
6367
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
247 if(result){
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
248 mp_msg(MSGT_DECAUDIO,MSGL_WARN,"Decoder open failed, error code: 0x%X\n",result);
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
249 return 0;
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
250 }
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
251 // printf("opencodec ok (result: %x)\n", result);
6367
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
252
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
253 sh->samplerate=sh->wf->nSamplesPerSec;
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
254 sh->samplesize=sh->wf->wBitsPerSample/8;
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
255 sh->channels=sh->wf->nChannels;
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
256
7472
c4434bdf6e51 tons of warning fixes, also some 10l bugfixes, including Dominik's PVA bug
arpi
parents: 7180
diff changeset
257 {
6367
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
258 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
259 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
260 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
261 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
262 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
263 ((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
264 ((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
265 ((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
266 ((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
267 };
2d651a218031 windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents: 8094
diff changeset
268 #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
269 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
270 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
271 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
272 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
273 100, // quality
6373
8d5d339f2944 get matrix w*h from the demuxer
arpi
parents: 6370
diff changeset
274 ((short*)(sh->wf+1))[0], // subpacket size
8094
b8a90a2af611 - realaudio ATRC (sony atrac3) codec support
arpi
parents: 7752
diff changeset
275 ((short*)(sh->wf+1))[3], // coded frame size
b8a90a2af611 - realaudio ATRC (sony atrac3) codec support
arpi
parents: 7752
diff changeset
276 ((short*)(sh->wf+1))[4], // codec data length
b8a90a2af611 - realaudio ATRC (sony atrac3) codec support
arpi
parents: 7752
diff changeset
277 ((char*)(sh->wf+1))+10 // extras
6367
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
278 };
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
279 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
280 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
281 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
282 #endif
6367
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
283 result=raInitDecoder(sh->context,&init_data);
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
284 if(result){
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
285 mp_msg(MSGT_DECAUDIO,MSGL_WARN,"Decoder init failed, error code: 0x%X\n",result);
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
286 return 0;
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
287 }
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 // printf("initdecoder ok (result: %x)\n", result);
6367
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
289 }
7086
f0886fe4be89 support for 'sipr' codec - descrambling/reorder not yet fixed.
arpi
parents: 6745
diff changeset
290
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
291 #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
292 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
293 #else
7086
f0886fe4be89 support for 'sipr' codec - descrambling/reorder not yet fixed.
arpi
parents: 6745
diff changeset
294 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
295 #endif
7086
f0886fe4be89 support for 'sipr' codec - descrambling/reorder not yet fixed.
arpi
parents: 6745
diff changeset
296 // 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
297 #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
298 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
299 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
300 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
301 #endif
7086
f0886fe4be89 support for 'sipr' codec - descrambling/reorder not yet fixed.
arpi
parents: 6745
diff changeset
302 raSetPwd(sh->context,"Ardubancel Quazanga"); // set password... lol.
f0886fe4be89 support for 'sipr' codec - descrambling/reorder not yet fixed.
arpi
parents: 6745
diff changeset
303 }
6367
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
304
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
305 #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
306 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
307 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
308 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
309 #endif
6373
8d5d339f2944 get matrix w*h from the demuxer
arpi
parents: 6370
diff changeset
310 result=raSetFlavor(sh->context,((short*)(sh->wf+1))[2]);
6367
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
311 if(result){
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
312 mp_msg(MSGT_DECAUDIO,MSGL_WARN,"Decoder flavor setup failed, error code: 0x%X\n",result);
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
313 return 0;
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
314 }
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
315
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
316 #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
317 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
318 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
319 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
320 #endif
6380
947d6a639c5a fixed copyright
arpi
parents: 6377
diff changeset
321 prop=raGetFlavorProperty(sh->context,((short*)(sh->wf+1))[2],0,&len);
947d6a639c5a fixed copyright
arpi
parents: 6377
diff changeset
322 mp_msg(MSGT_DECAUDIO,MSGL_INFO,"Audio codec: [%d] %s\n",((short*)(sh->wf+1))[2],prop);
947d6a639c5a fixed copyright
arpi
parents: 6377
diff changeset
323
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
324 #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
325 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
326 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
327 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
328 #endif
6380
947d6a639c5a fixed copyright
arpi
parents: 6377
diff changeset
329 prop=raGetFlavorProperty(sh->context,((short*)(sh->wf+1))[2],1,&len);
947d6a639c5a fixed copyright
arpi
parents: 6377
diff changeset
330 sh->i_bps=((*((int*)prop))+4)/8;
947d6a639c5a fixed copyright
arpi
parents: 6377
diff changeset
331 mp_msg(MSGT_DECAUDIO,MSGL_INFO,"Audio bitrate: %5.3f kbit/s (%d bps) \n",(*((int*)prop))*0.001f,sh->i_bps);
947d6a639c5a fixed copyright
arpi
parents: 6377
diff changeset
332
947d6a639c5a fixed copyright
arpi
parents: 6377
diff changeset
333 // prop=raGetFlavorProperty(sh->context,((short*)(sh->wf+1))[2],0x13,&len);
947d6a639c5a fixed copyright
arpi
parents: 6377
diff changeset
334 // mp_msg(MSGT_DECAUDIO,MSGL_INFO,"Samples/block?: %d \n",(*((int*)prop)));
947d6a639c5a fixed copyright
arpi
parents: 6377
diff changeset
335
947d6a639c5a fixed copyright
arpi
parents: 6377
diff changeset
336 sh->audio_out_minsize=128000; // no idea how to get... :(
6373
8d5d339f2944 get matrix w*h from the demuxer
arpi
parents: 6370
diff changeset
337 sh->audio_in_minsize=((short*)(sh->wf+1))[1]*sh->wf->nBlockAlign;
6367
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
338
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
339 return 1; // return values: 1=OK 0=ERROR
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
340 }
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
341
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
342 static int init(sh_audio_t *sh_audio){
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
343 // initialize the decoder, set tables etc...
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
344
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
345 // you can store HANDLE or private struct pointer at sh->context
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
346 // you can access WAVEFORMATEX header at sh->wf
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
347
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
348 // set sample format/rate parameters if you didn't do it in preinit() yet.
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
349
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
350 return 1; // return values: 1=OK 0=ERROR
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
351 }
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
352
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
353 static void uninit(sh_audio_t *sh){
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
354 // uninit the decoder etc...
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
355 // 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
356 #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
357 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
358 {
2d651a218031 windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents: 8094
diff changeset
359 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
360 if (wraCloseCodec) wraCloseCodec(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
361 } 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
362 #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
363 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
364 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
365
2d651a218031 windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents: 8094
diff changeset
366 #ifdef USE_WIN32DLL
2d651a218031 windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents: 8094
diff changeset
367 if (dll_type == 1)
2d651a218031 windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents: 8094
diff changeset
368 {
2d651a218031 windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents: 8094
diff changeset
369 if (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
370 } 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
371 #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
372 if (rv_handle) dlclose(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
373 rv_handle = NULL;
6367
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
374 }
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
375
7104
6d784b2812b9 'sipr' descrambling implemented, at least for 16*6 matrix
arpi
parents: 7097
diff changeset
376 static unsigned char sipr_swaps[38][2]={
6d784b2812b9 'sipr' descrambling implemented, at least for 16*6 matrix
arpi
parents: 7097
diff changeset
377 {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
378 {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
379 {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
380 {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
381 {77,80} };
6d784b2812b9 'sipr' descrambling implemented, at least for 16*6 matrix
arpi
parents: 7097
diff changeset
382
6367
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
383 static int decode_audio(sh_audio_t *sh,unsigned char *buf,int minlen,int maxlen){
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
384 int result;
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
385 int len=-1;
6373
8d5d339f2944 get matrix w*h from the demuxer
arpi
parents: 6370
diff changeset
386 int sps=((short*)(sh->wf+1))[0];
7086
f0886fe4be89 support for 'sipr' codec - descrambling/reorder not yet fixed.
arpi
parents: 6745
diff changeset
387 int w=sh->wf->nBlockAlign; // 5
6373
8d5d339f2944 get matrix w*h from the demuxer
arpi
parents: 6370
diff changeset
388 int h=((short*)(sh->wf+1))[1];
7104
6d784b2812b9 'sipr' descrambling implemented, at least for 16*6 matrix
arpi
parents: 7097
diff changeset
389
6d784b2812b9 'sipr' descrambling implemented, at least for 16*6 matrix
arpi
parents: 7097
diff changeset
390 // 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
391
6373
8d5d339f2944 get matrix w*h from the demuxer
arpi
parents: 6370
diff changeset
392 #if 1
6368
9511fffdb8c6 yeah, it worx! but needs a big cleanup and removal of hardcoded stuff
arpi
parents: 6367
diff changeset
393 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
394 // fill the buffer!
7104
6d784b2812b9 'sipr' descrambling implemented, at least for 16*6 matrix
arpi
parents: 7097
diff changeset
395 if(!sps){
6d784b2812b9 'sipr' descrambling implemented, at least for 16*6 matrix
arpi
parents: 7097
diff changeset
396 // 'sipr' way
6d784b2812b9 'sipr' descrambling implemented, at least for 16*6 matrix
arpi
parents: 7097
diff changeset
397 int j,n;
6d784b2812b9 'sipr' descrambling implemented, at least for 16*6 matrix
arpi
parents: 7097
diff changeset
398 int bs=h*w*2/96; // nibbles per subpacket
6d784b2812b9 'sipr' descrambling implemented, at least for 16*6 matrix
arpi
parents: 7097
diff changeset
399 unsigned char *p=sh->a_in_buffer;
6d784b2812b9 'sipr' descrambling implemented, at least for 16*6 matrix
arpi
parents: 7097
diff changeset
400 demux_read_data(sh->ds, p, h*w);
6d784b2812b9 'sipr' descrambling implemented, at least for 16*6 matrix
arpi
parents: 7097
diff changeset
401 for(n=0;n<38;n++){
6d784b2812b9 'sipr' descrambling implemented, at least for 16*6 matrix
arpi
parents: 7097
diff changeset
402 int i=bs*sipr_swaps[n][0];
6d784b2812b9 'sipr' descrambling implemented, at least for 16*6 matrix
arpi
parents: 7097
diff changeset
403 int o=bs*sipr_swaps[n][1];
6d784b2812b9 'sipr' descrambling implemented, at least for 16*6 matrix
arpi
parents: 7097
diff changeset
404 // swap nibbles of block 'i' with 'o' TODO: optimize
6d784b2812b9 'sipr' descrambling implemented, at least for 16*6 matrix
arpi
parents: 7097
diff changeset
405 for(j=0;j<bs;j++){
6d784b2812b9 'sipr' descrambling implemented, at least for 16*6 matrix
arpi
parents: 7097
diff changeset
406 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
407 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
408 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
409 else p[(o>>1)]=(p[(o>>1)]&0xF0)|x;
6d784b2812b9 'sipr' descrambling implemented, at least for 16*6 matrix
arpi
parents: 7097
diff changeset
410 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
411 else p[(i>>1)]=(p[(i>>1)]&0xF0)|y;
6d784b2812b9 'sipr' descrambling implemented, at least for 16*6 matrix
arpi
parents: 7097
diff changeset
412 ++i;++o;
6d784b2812b9 'sipr' descrambling implemented, at least for 16*6 matrix
arpi
parents: 7097
diff changeset
413 }
6d784b2812b9 'sipr' descrambling implemented, at least for 16*6 matrix
arpi
parents: 7097
diff changeset
414 }
6d784b2812b9 'sipr' descrambling implemented, at least for 16*6 matrix
arpi
parents: 7097
diff changeset
415 sh->a_in_buffer_size=
6d784b2812b9 'sipr' descrambling implemented, at least for 16*6 matrix
arpi
parents: 7097
diff changeset
416 sh->a_in_buffer_len=w*h;
6d784b2812b9 'sipr' descrambling implemented, at least for 16*6 matrix
arpi
parents: 7097
diff changeset
417 } else {
6d784b2812b9 'sipr' descrambling implemented, at least for 16*6 matrix
arpi
parents: 7097
diff changeset
418 // 'cook' way
6368
9511fffdb8c6 yeah, it worx! but needs a big cleanup and removal of hardcoded stuff
arpi
parents: 6367
diff changeset
419 int x,y;
7104
6d784b2812b9 'sipr' descrambling implemented, at least for 16*6 matrix
arpi
parents: 7097
diff changeset
420 w/=sps;
6373
8d5d339f2944 get matrix w*h from the demuxer
arpi
parents: 6370
diff changeset
421 for(y=0;y<h;y++)
8d5d339f2944 get matrix w*h from the demuxer
arpi
parents: 6370
diff changeset
422 for(x=0;x<w;x++){
6428
88a06ebb3287 audio subpacket reordering fixed for odd matrix height
arpi
parents: 6404
diff changeset
423 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
424 }
6373
8d5d339f2944 get matrix w*h from the demuxer
arpi
parents: 6370
diff changeset
425 sh->a_in_buffer_size=
8d5d339f2944 get matrix w*h from the demuxer
arpi
parents: 6370
diff changeset
426 sh->a_in_buffer_len=w*h*sps;
7104
6d784b2812b9 'sipr' descrambling implemented, at least for 16*6 matrix
arpi
parents: 7097
diff changeset
427 }
6368
9511fffdb8c6 yeah, it worx! but needs a big cleanup and removal of hardcoded stuff
arpi
parents: 6367
diff changeset
428 }
6373
8d5d339f2944 get matrix w*h from the demuxer
arpi
parents: 6370
diff changeset
429
8d5d339f2944 get matrix w*h from the demuxer
arpi
parents: 6370
diff changeset
430 #else
8d5d339f2944 get matrix w*h from the demuxer
arpi
parents: 6370
diff changeset
431 if(sh->a_in_buffer_len<=0){
8d5d339f2944 get matrix w*h from the demuxer
arpi
parents: 6370
diff changeset
432 // fill the buffer!
8d5d339f2944 get matrix w*h from the demuxer
arpi
parents: 6370
diff changeset
433 demux_read_data(sh->ds, sh->a_in_buffer, sh->wf->nBlockAlign);
8d5d339f2944 get matrix w*h from the demuxer
arpi
parents: 6370
diff changeset
434 sh->a_in_buffer_size=
8d5d339f2944 get matrix w*h from the demuxer
arpi
parents: 6370
diff changeset
435 sh->a_in_buffer_len=sh->wf->nBlockAlign;
8d5d339f2944 get matrix w*h from the demuxer
arpi
parents: 6370
diff changeset
436 }
8d5d339f2944 get matrix w*h from the demuxer
arpi
parents: 6370
diff changeset
437 #endif
6367
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
438
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
439 #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
440 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
441 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
442 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
443 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
444 #endif
6373
8d5d339f2944 get matrix w*h from the demuxer
arpi
parents: 6370
diff changeset
445 result=raDecode(sh->context, sh->a_in_buffer+sh->a_in_buffer_size-sh->a_in_buffer_len, sh->wf->nBlockAlign,
6367
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
446 buf, &len, -1);
6368
9511fffdb8c6 yeah, it worx! but needs a big cleanup and removal of hardcoded stuff
arpi
parents: 6367
diff changeset
447 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
448
6376
e3c74c01a3a2 use path & dllname from config
arpi
parents: 6373
diff changeset
449 // printf("radecode: %d bytes, res=0x%X \n",len,result);
6367
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
450
6368
9511fffdb8c6 yeah, it worx! but needs a big cleanup and removal of hardcoded stuff
arpi
parents: 6367
diff changeset
451 return len; // return value: number of _bytes_ written to output buffer,
6367
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
452 // or -1 for EOF (or uncorrectable error)
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
453 }
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
454
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
455 static int control(sh_audio_t *sh,int cmd,void* arg, ...){
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
456 // various optional functions you MAY implement:
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
457 switch(cmd){
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
458 case ADCTRL_RESYNC_STREAM:
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
459 // it is called once after seeking, to resync.
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
460 // Note: sh_audio->a_in_buffer_len=0; is done _before_ this call!
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
461 return CONTROL_TRUE;
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
462 case ADCTRL_SKIP_FRAME:
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
463 // it is called to skip (jump over) small amount (1/10 sec or 1 frame)
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
464 // of audio data - used to sync audio to video after seeking
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
465 // if you don't return CONTROL_TRUE, it will defaults to:
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
466 // ds_fill_buffer(sh_audio->ds); // skip 1 demux packet
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
467 return CONTROL_TRUE;
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
468 }
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
469 return CONTROL_UNKNOWN;
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
470 }
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
471
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
472 #endif