annotate libmpcodecs/ad_realaud.c @ 34195:5affa2074131

build: fix compilation on Solaris due to missing alloca.h #include patch by Granville Moore, gvm nemesys com, fixes Bugzilla #1999
author diego
date Mon, 31 Oct 2011 13:18:45 +0000
parents a93891202051
children d75b3dce7851
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
30421
bbb6ebec87a0 Add missing license headers to all files in the libmpcodecs directory.
diego
parents: 29263
diff changeset
1 /*
bbb6ebec87a0 Add missing license headers to all files in the libmpcodecs directory.
diego
parents: 29263
diff changeset
2 * This file is part of MPlayer.
bbb6ebec87a0 Add missing license headers to all files in the libmpcodecs directory.
diego
parents: 29263
diff changeset
3 *
bbb6ebec87a0 Add missing license headers to all files in the libmpcodecs directory.
diego
parents: 29263
diff changeset
4 * MPlayer is free software; you can redistribute it and/or modify
bbb6ebec87a0 Add missing license headers to all files in the libmpcodecs directory.
diego
parents: 29263
diff changeset
5 * it under the terms of the GNU General Public License as published by
bbb6ebec87a0 Add missing license headers to all files in the libmpcodecs directory.
diego
parents: 29263
diff changeset
6 * the Free Software Foundation; either version 2 of the License, or
bbb6ebec87a0 Add missing license headers to all files in the libmpcodecs directory.
diego
parents: 29263
diff changeset
7 * (at your option) any later version.
bbb6ebec87a0 Add missing license headers to all files in the libmpcodecs directory.
diego
parents: 29263
diff changeset
8 *
bbb6ebec87a0 Add missing license headers to all files in the libmpcodecs directory.
diego
parents: 29263
diff changeset
9 * MPlayer is distributed in the hope that it will be useful,
bbb6ebec87a0 Add missing license headers to all files in the libmpcodecs directory.
diego
parents: 29263
diff changeset
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
bbb6ebec87a0 Add missing license headers to all files in the libmpcodecs directory.
diego
parents: 29263
diff changeset
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
bbb6ebec87a0 Add missing license headers to all files in the libmpcodecs directory.
diego
parents: 29263
diff changeset
12 * GNU General Public License for more details.
bbb6ebec87a0 Add missing license headers to all files in the libmpcodecs directory.
diego
parents: 29263
diff changeset
13 *
bbb6ebec87a0 Add missing license headers to all files in the libmpcodecs directory.
diego
parents: 29263
diff changeset
14 * You should have received a copy of the GNU General Public License along
bbb6ebec87a0 Add missing license headers to all files in the libmpcodecs directory.
diego
parents: 29263
diff changeset
15 * with MPlayer; if not, write to the Free Software Foundation, Inc.,
bbb6ebec87a0 Add missing license headers to all files in the libmpcodecs directory.
diego
parents: 29263
diff changeset
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
bbb6ebec87a0 Add missing license headers to all files in the libmpcodecs directory.
diego
parents: 29263
diff changeset
17 */
6367
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
18
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
19 #include <stdio.h>
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
20 #include <stdlib.h>
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
21 #include <unistd.h>
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
22
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
23 #include "config.h"
34174
a93891202051 Add missing mp_msg.h #includes, remove some unnecessary ones.
diego
parents: 31160
diff changeset
24 #include "mp_msg.h"
6367
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
25
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
26 //#include <stddef.h>
10093
ad83de1c0038 cygwin/mingw32 support by Sascha Sommer
alex
parents: 10030
diff changeset
27 #ifdef HAVE_LIBDL
6367
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
28 #include <dlfcn.h>
10093
ad83de1c0038 cygwin/mingw32 support by Sascha Sommer
alex
parents: 10030
diff changeset
29 #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
30 #include "help_mp.h"
30906
a34f16fb8823 Real binary loader code should respect the binary codec path.
diego
parents: 30846
diff changeset
31 #include "path.h"
6367
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
32
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
33 #include "ad_internal.h"
22577
a033e5519802 Include loader/ prefix in #include path everywhere.
diego
parents: 21466
diff changeset
34 #include "loader/wine/windef.h"
6367
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
35
31160
5beb6c13ac7b whitespace cosmetics
diego
parents: 30908
diff changeset
36 static const ad_info_t info = {
6380
947d6a639c5a fixed copyright
arpi
parents: 6377
diff changeset
37 "RealAudio decoder",
7174
7672615cc811 sync driver names with codec-cfg
arpi
parents: 7172
diff changeset
38 "realaud",
12628
985e1813e298 support for realvideo codecs under macosx, original patch by Donnie Smith
alex
parents: 12356
diff changeset
39 "Alex Beregszaszi",
985e1813e298 support for realvideo codecs under macosx, original patch by Donnie Smith
alex
parents: 12356
diff changeset
40 "Florian Schneider, Arpad Gereoffy, Alex Beregszaszi, Donnie Smith",
6380
947d6a639c5a fixed copyright
arpi
parents: 6377
diff changeset
41 "binary real audio codecs"
6367
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
42 };
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
43
7174
7672615cc811 sync driver names with codec-cfg
arpi
parents: 7172
diff changeset
44 LIBAD_EXTERN(realaud)
6367
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
45
30564
2b9abdf8f6bf Revert marking seemingly unused RealAudio/RealVideo-related functions as static.
diego
parents: 30555
diff changeset
46 /* These functions are required for loading Real binary libs.
2b9abdf8f6bf Revert marking seemingly unused RealAudio/RealVideo-related functions as static.
diego
parents: 30555
diff changeset
47 * Add forward declarations to avoid warnings with -Wmissing-prototypes. */
2b9abdf8f6bf Revert marking seemingly unused RealAudio/RealVideo-related functions as static.
diego
parents: 30555
diff changeset
48 void *__builtin_new(unsigned long size);
2b9abdf8f6bf Revert marking seemingly unused RealAudio/RealVideo-related functions as static.
diego
parents: 30555
diff changeset
49 void __builtin_delete(void *ize);
2b9abdf8f6bf Revert marking seemingly unused RealAudio/RealVideo-related functions as static.
diego
parents: 30555
diff changeset
50 void *__builtin_vec_new(unsigned long size);
2b9abdf8f6bf Revert marking seemingly unused RealAudio/RealVideo-related functions as static.
diego
parents: 30555
diff changeset
51 void __builtin_vec_delete(void *mem);
2b9abdf8f6bf Revert marking seemingly unused RealAudio/RealVideo-related functions as static.
diego
parents: 30555
diff changeset
52 void __pure_virtual(void);
2b9abdf8f6bf Revert marking seemingly unused RealAudio/RealVideo-related functions as static.
diego
parents: 30555
diff changeset
53
2b9abdf8f6bf Revert marking seemingly unused RealAudio/RealVideo-related functions as static.
diego
parents: 30555
diff changeset
54 void *__builtin_new(unsigned long size)
30555
ad6740b58b0d libmpcodecs: Mark functions not used outside of their files as static.
diego
parents: 30504
diff changeset
55 {
6367
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
56 return malloc(size);
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
57 }
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
58
30564
2b9abdf8f6bf Revert marking seemingly unused RealAudio/RealVideo-related functions as static.
diego
parents: 30555
diff changeset
59 void __builtin_delete(void* ize)
30555
ad6740b58b0d libmpcodecs: Mark functions not used outside of their files as static.
diego
parents: 30504
diff changeset
60 {
9551
d447d6403faf - removed unused global 'handle'
arpi
parents: 9395
diff changeset
61 free(ize);
d447d6403faf - removed unused global 'handle'
arpi
parents: 9395
diff changeset
62 }
d447d6403faf - removed unused global 'handle'
arpi
parents: 9395
diff changeset
63
30564
2b9abdf8f6bf Revert marking seemingly unused RealAudio/RealVideo-related functions as static.
diego
parents: 30555
diff changeset
64 void *__builtin_vec_new(unsigned long size)
2b9abdf8f6bf Revert marking seemingly unused RealAudio/RealVideo-related functions as static.
diego
parents: 30555
diff changeset
65 {
2b9abdf8f6bf Revert marking seemingly unused RealAudio/RealVideo-related functions as static.
diego
parents: 30555
diff changeset
66 return malloc(size);
2b9abdf8f6bf Revert marking seemingly unused RealAudio/RealVideo-related functions as static.
diego
parents: 30555
diff changeset
67 }
2b9abdf8f6bf Revert marking seemingly unused RealAudio/RealVideo-related functions as static.
diego
parents: 30555
diff changeset
68
2b9abdf8f6bf Revert marking seemingly unused RealAudio/RealVideo-related functions as static.
diego
parents: 30555
diff changeset
69 void __builtin_vec_delete(void *mem)
2b9abdf8f6bf Revert marking seemingly unused RealAudio/RealVideo-related functions as static.
diego
parents: 30555
diff changeset
70 {
2b9abdf8f6bf Revert marking seemingly unused RealAudio/RealVideo-related functions as static.
diego
parents: 30555
diff changeset
71 free(mem);
2b9abdf8f6bf Revert marking seemingly unused RealAudio/RealVideo-related functions as static.
diego
parents: 30555
diff changeset
72 }
2b9abdf8f6bf Revert marking seemingly unused RealAudio/RealVideo-related functions as static.
diego
parents: 30555
diff changeset
73
2b9abdf8f6bf Revert marking seemingly unused RealAudio/RealVideo-related functions as static.
diego
parents: 30555
diff changeset
74 void __pure_virtual(void)
2b9abdf8f6bf Revert marking seemingly unused RealAudio/RealVideo-related functions as static.
diego
parents: 30555
diff changeset
75 {
2b9abdf8f6bf Revert marking seemingly unused RealAudio/RealVideo-related functions as static.
diego
parents: 30555
diff changeset
76 printf("FATAL: __pure_virtual() called!\n");
2b9abdf8f6bf Revert marking seemingly unused RealAudio/RealVideo-related functions as static.
diego
parents: 30555
diff changeset
77 // exit(1);
2b9abdf8f6bf Revert marking seemingly unused RealAudio/RealVideo-related functions as static.
diego
parents: 30555
diff changeset
78 }
2b9abdf8f6bf Revert marking seemingly unused RealAudio/RealVideo-related functions as static.
diego
parents: 30555
diff changeset
79
15566
3758536dcef3 DragonFly BSD support
diego
parents: 14596
diff changeset
80 #if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__)
30564
2b9abdf8f6bf Revert marking seemingly unused RealAudio/RealVideo-related functions as static.
diego
parents: 30555
diff changeset
81 void ___brk_addr(void);
2b9abdf8f6bf Revert marking seemingly unused RealAudio/RealVideo-related functions as static.
diego
parents: 30555
diff changeset
82 void ___brk_addr(void) {exit(0);}
2b9abdf8f6bf Revert marking seemingly unused RealAudio/RealVideo-related functions as static.
diego
parents: 30555
diff changeset
83 char **__environ={NULL};
2b9abdf8f6bf Revert marking seemingly unused RealAudio/RealVideo-related functions as static.
diego
parents: 30555
diff changeset
84 #undef stderr
2b9abdf8f6bf Revert marking seemingly unused RealAudio/RealVideo-related functions as static.
diego
parents: 30555
diff changeset
85 FILE *stderr=NULL;
6404
83b3315c679b Implement Nilmoni's and Bernd Ernesti's patches for:
atmos4
parents: 6380
diff changeset
86 void *__ctype_b=NULL;
6377
203128bcc6be FreeBSD hack
nexus
parents: 6376
diff changeset
87 #endif
6367
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
88
7472
c4434bdf6e51 tons of warning fixes, also some 10l bugfixes, including Dominik's PVA bug
arpi
parents: 7180
diff changeset
89 static unsigned long (*raCloseCodec)(void*);
7557
f296ff05bcd0 warning fixes
arpi
parents: 7472
diff changeset
90 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
91 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
92 //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
93 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
94 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
95 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
96 static unsigned long (*raSetFlavor)(void*,unsigned long);
7752
18f8233094da tell the codec wrapper the codec path (fixes realaudio Sipr)
arpi
parents: 7557
diff changeset
97 static void (*raSetDLLAccessPath)(char*);
7086
f0886fe4be89 support for 'sipr' codec - descrambling/reorder not yet fixed.
arpi
parents: 6745
diff changeset
98 static void (*raSetPwd)(char*,char*);
27341
e7c989f7a7c9 Start unifying names of internal preprocessor directives.
diego
parents: 23631
diff changeset
99 #ifdef CONFIG_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
100 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
101 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
102 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
103 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
104 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
105 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
106 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
107 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
108 static void WINAPI (*wraSetPwd)(char*,char*);
6367
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
109
9395
2d651a218031 windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents: 8094
diff changeset
110 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
111 #endif
12628
985e1813e298 support for realvideo codecs under macosx, original patch by Donnie Smith
alex
parents: 12356
diff changeset
112
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
113 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
114
2d651a218031 windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents: 8094
diff changeset
115 #if 0
6367
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
116 typedef struct {
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
117 int samplerate;
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
118 short bits;
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
119 short channels;
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
120 int unk1;
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
121 int unk2;
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
122 int packetsize;
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
123 int unk3;
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
124 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
125 } 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
126 #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
127
2d651a218031 windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents: 8094
diff changeset
128 /*
2d651a218031 windows support and eleminating some 10ls. Win32 ATRC has audio 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 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
130 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
131 In windows it seems that there's no padding in it.
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 27341
diff changeset
132
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
133 -- 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
134 */
2d651a218031 windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents: 8094
diff changeset
135
2d651a218031 windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents: 8094
diff changeset
136 /* 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
137 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
138 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
139 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
140 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
141 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
142 /* 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
143 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
144 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
145 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
146 void* extradata;
6367
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
147 } ra_init_t;
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
148
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 /* 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
150 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
151 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
152 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
153 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
154 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
155 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
156 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
157 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
158 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
159 } 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
160 #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
161
10093
ad83de1c0038 cygwin/mingw32 support by Sascha Sommer
alex
parents: 10030
diff changeset
162 #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
163 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
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 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
166
17721
7b336a5585e4 Reduce Real DLL/so loading verbosity, OKed by Roberto.
diego
parents: 17149
diff changeset
167 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
168 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
169 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
170 {
2d651a218031 windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents: 8094
diff changeset
171 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
172 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
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
2d651a218031 windows support and eleminating some 10ls. Win32 ATRC has audio 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 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
176 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
177 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
178 raOpenCodec = dlsym(handle, "RAOpenCodec");
9551
d447d6403faf - removed unused global 'handle'
arpi
parents: 9395
diff changeset
179 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
180 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
181 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
182 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
183 raSetPwd = dlsym(handle, "RASetPwd"); // optional, used by SIPR
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 27341
diff changeset
184
21466
abfc5854e80a Remove unused function pointers, they probably had incorrect prototypes
reimar
parents: 19135
diff changeset
185 if (raCloseCodec && raDecode && raFreeDecoder &&
abfc5854e80a Remove unused function pointers, they probably had incorrect prototypes
reimar
parents: 19135
diff changeset
186 (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
187 /*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
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 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
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 }
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 27341
diff changeset
192
9395
2d651a218031 windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents: 8094
diff changeset
193 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 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
195 return 0;
10093
ad83de1c0038 cygwin/mingw32 support by Sascha Sommer
alex
parents: 10030
diff changeset
196 }
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 27341
diff changeset
197 #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
198
27341
e7c989f7a7c9 Start unifying names of internal preprocessor directives.
diego
parents: 23631
diff changeset
199 #ifdef CONFIG_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
200
10093
ad83de1c0038 cygwin/mingw32 support by Sascha Sommer
alex
parents: 10030
diff changeset
201 #ifdef WIN32_LOADER
17012
6ff3379a0862 Unify include path handling, -I.. is in CFLAGS.
diego
parents: 16624
diff changeset
202 #include "loader/ldt_keeper.h"
10093
ad83de1c0038 cygwin/mingw32 support by Sascha Sommer
alex
parents: 10030
diff changeset
203 #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
204 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
205 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
206 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
207
10652
b04560162c1f sysm --> syms typo fix by Joey Parrish
diego
parents: 10444
diff changeset
208 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
209 {
2d651a218031 windows support and eleminating some 10ls. Win32 ATRC has audio 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 void *handle;
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 27341
diff changeset
211
17721
7b336a5585e4 Reduce Real DLL/so loading verbosity, OKed by Roberto.
diego
parents: 17149
diff changeset
212 mp_msg(MSGT_DECVIDEO, MSGL_V, "opening win32 dll '%s'\n", path);
10093
ad83de1c0038 cygwin/mingw32 support by Sascha Sommer
alex
parents: 10030
diff changeset
213 #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
214 Setup_LDT_Keeper();
10093
ad83de1c0038 cygwin/mingw32 support by Sascha Sommer
alex
parents: 10030
diff changeset
215 #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
216 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
217 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
218 {
2d651a218031 windows support and eleminating some 10ls. Win32 ATRC has audio 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 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
220 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
221 }
2d651a218031 windows support and eleminating some 10ls. Win32 ATRC has audio 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
2d651a218031 windows support and eleminating some 10ls. Win32 ATRC has audio 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 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
224 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
225 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
226 wraOpenCodec = GetProcAddress(handle, "RAOpenCodec");
9551
d447d6403faf - removed unused global 'handle'
arpi
parents: 9395
diff changeset
227 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
228 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
229 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
230 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
231 wraSetPwd = GetProcAddress(handle, "RASetPwd"); // optional, used by SIPR
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 27341
diff changeset
232
21466
abfc5854e80a Remove unused function pointers, they probably had incorrect prototypes
reimar
parents: 19135
diff changeset
233 if (wraCloseCodec && wraDecode && wraFreeDecoder &&
abfc5854e80a Remove unused function pointers, they probably had incorrect prototypes
reimar
parents: 19135
diff changeset
234 (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
235 /*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
236 {
2d651a218031 windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents: 8094
diff changeset
237 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
238 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
239 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
240 }
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 27341
diff changeset
241
9395
2d651a218031 windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents: 8094
diff changeset
242 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
243 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
244 return 0;
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 27341
diff changeset
245
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 }
2d651a218031 windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents: 8094
diff changeset
247 #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
248
12628
985e1813e298 support for realvideo codecs under macosx, original patch by Donnie Smith
alex
parents: 12356
diff changeset
249
6367
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
250 static int preinit(sh_audio_t *sh){
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
251 // let's check if the driver is available, return 0 if not.
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
252 // (you should do that if you use external lib(s) which is optional)
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
253 unsigned int result;
10101
f3f3e25f8149 use dynamic path[] allocation and possible better wraSetDLLAccessPath mechanism :)
alex
parents: 10093
diff changeset
254 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
255
30908
fbb65a2153c6 Fix build due to codecs_path vs. codec_path typo.
diego
parents: 30907
diff changeset
256 path = malloc(strlen(codec_path) + strlen(sh->codec->dll) + 2);
10101
f3f3e25f8149 use dynamic path[] allocation and possible better wraSetDLLAccessPath mechanism :)
alex
parents: 10093
diff changeset
257 if (!path) return 0;
30908
fbb65a2153c6 Fix build due to codecs_path vs. codec_path typo.
diego
parents: 30907
diff changeset
258 sprintf(path, "%s/%s", codec_path, sh->codec->dll);
6367
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
259
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
260 /* 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
261 then try to load the windows ones */
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 27341
diff changeset
262
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 27341
diff changeset
263 #ifdef HAVE_LIBDL
10093
ad83de1c0038 cygwin/mingw32 support by Sascha Sommer
alex
parents: 10030
diff changeset
264 if (strstr(sh->codec->dll,".dll") || !load_syms_linux(path))
ad83de1c0038 cygwin/mingw32 support by Sascha Sommer
alex
parents: 10030
diff changeset
265 #endif
27341
e7c989f7a7c9 Start unifying names of internal preprocessor directives.
diego
parents: 23631
diff changeset
266 #ifdef CONFIG_WIN32DLL
10652
b04560162c1f sysm --> syms typo fix by Joey Parrish
diego
parents: 10444
diff changeset
267 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
268 #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
269 {
2d651a218031 windows support and eleminating some 10ls. Win32 ATRC has audio 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 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
271 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
272 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
273 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
274 }
6367
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
275
27341
e7c989f7a7c9 Start unifying names of internal preprocessor directives.
diego
parents: 23631
diff changeset
276 #ifdef CONFIG_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
277 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
278 #else
7752
18f8233094da tell the codec wrapper the codec path (fixes realaudio Sipr)
arpi
parents: 7557
diff changeset
279 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
280 #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
281 // used by 'SIPR'
30908
fbb65a2153c6 Fix build due to codecs_path vs. codec_path typo.
diego
parents: 30907
diff changeset
282 path = realloc(path, strlen(codec_path) + 13);
fbb65a2153c6 Fix build due to codecs_path vs. codec_path typo.
diego
parents: 30907
diff changeset
283 sprintf(path, "DT_Codecs=%s", codec_path);
7752
18f8233094da tell the codec wrapper the codec path (fixes realaudio Sipr)
arpi
parents: 7557
diff changeset
284 if(path[strlen(path)-1]!='/'){
18f8233094da tell the codec wrapper the codec path (fixes realaudio Sipr)
arpi
parents: 7557
diff changeset
285 path[strlen(path)+1]=0;
18f8233094da tell the codec wrapper the codec path (fixes realaudio Sipr)
arpi
parents: 7557
diff changeset
286 path[strlen(path)]='/';
18f8233094da tell the codec wrapper the codec path (fixes realaudio Sipr)
arpi
parents: 7557
diff changeset
287 }
18f8233094da tell the codec wrapper the codec path (fixes realaudio Sipr)
arpi
parents: 7557
diff changeset
288 path[strlen(path)+1]=0;
27341
e7c989f7a7c9 Start unifying names of internal preprocessor directives.
diego
parents: 23631
diff changeset
289 #ifdef CONFIG_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
290 if (dll_type == 1)
10101
f3f3e25f8149 use dynamic path[] allocation and possible better wraSetDLLAccessPath mechanism :)
alex
parents: 10093
diff changeset
291 {
23631
055f06fadc0c Move variable into the block where it actually used
reimar
parents: 23379
diff changeset
292 int i;
10101
f3f3e25f8149 use dynamic path[] allocation and possible better wraSetDLLAccessPath mechanism :)
alex
parents: 10093
diff changeset
293 for (i=0; i < strlen(path); i++)
f3f3e25f8149 use dynamic path[] allocation and possible better wraSetDLLAccessPath mechanism :)
alex
parents: 10093
diff changeset
294 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
295 wraSetDLLAccessPath(path);
10101
f3f3e25f8149 use dynamic path[] allocation and possible better wraSetDLLAccessPath mechanism :)
alex
parents: 10093
diff changeset
296 }
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 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
298 #endif
7752
18f8233094da tell the codec wrapper the codec path (fixes realaudio Sipr)
arpi
parents: 7557
diff changeset
299 raSetDLLAccessPath(path);
18f8233094da tell the codec wrapper the codec path (fixes realaudio Sipr)
arpi
parents: 7557
diff changeset
300 }
18f8233094da tell the codec wrapper the codec path (fixes realaudio Sipr)
arpi
parents: 7557
diff changeset
301
27341
e7c989f7a7c9 Start unifying names of internal preprocessor directives.
diego
parents: 23631
diff changeset
302 #ifdef CONFIG_WIN32DLL
9551
d447d6403faf - removed unused global 'handle'
arpi
parents: 9395
diff changeset
303 if (dll_type == 1){
30906
a34f16fb8823 Real binary loader code should respect the binary codec path.
diego
parents: 30846
diff changeset
304 if (wraOpenCodec2) {
30908
fbb65a2153c6 Fix build due to codecs_path vs. codec_path typo.
diego
parents: 30907
diff changeset
305 sprintf(path, "%s\\", codec_path);
30906
a34f16fb8823 Real binary loader code should respect the binary codec path.
diego
parents: 30846
diff changeset
306 result = wraOpenCodec2(&sh->context, path);
a34f16fb8823 Real binary loader code should respect the binary codec path.
diego
parents: 30846
diff changeset
307 } 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
308 result=wraOpenCodec(&sh->context);
9551
d447d6403faf - removed unused global 'handle'
arpi
parents: 9395
diff changeset
309 } else
d447d6403faf - removed unused global 'handle'
arpi
parents: 9395
diff changeset
310 #endif
30906
a34f16fb8823 Real binary loader code should respect the binary codec path.
diego
parents: 30846
diff changeset
311 if (raOpenCodec2) {
30908
fbb65a2153c6 Fix build due to codecs_path vs. codec_path typo.
diego
parents: 30907
diff changeset
312 sprintf(path, "%s/", codec_path);
30906
a34f16fb8823 Real binary loader code should respect the binary codec path.
diego
parents: 30846
diff changeset
313 result = raOpenCodec2(&sh->context, path);
a34f16fb8823 Real binary loader code should respect the binary codec path.
diego
parents: 30846
diff changeset
314 } else
9551
d447d6403faf - removed unused global 'handle'
arpi
parents: 9395
diff changeset
315 result=raOpenCodec(&sh->context);
6367
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
316 if(result){
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
317 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
318 return 0;
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
319 }
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
320 // printf("opencodec ok (result: %x)\n", result);
10101
f3f3e25f8149 use dynamic path[] allocation and possible better wraSetDLLAccessPath mechanism :)
alex
parents: 10093
diff changeset
321 free(path); /* after this it isn't used anymore */
6367
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
322
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
323 sh->samplerate=sh->wf->nSamplesPerSec;
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
324 sh->samplesize=sh->wf->wBitsPerSample/8;
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
325 sh->channels=sh->wf->nChannels;
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
326
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 27341
diff changeset
327 {
6367
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
328 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
329 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
330 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
331 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
332 100, // quality
17149
9a0a376a54b1 Move audio packets reordering from codec interface to demuxers for real
rtognimp
parents: 17012
diff changeset
333 sh->wf->nBlockAlign, // subpacket size
9a0a376a54b1 Move audio packets reordering from codec interface to demuxers for real
rtognimp
parents: 17012
diff changeset
334 sh->wf->nBlockAlign, // coded frame size
9a0a376a54b1 Move audio packets reordering from codec interface to demuxers for real
rtognimp
parents: 17012
diff changeset
335 sh->wf->cbSize, // codec data length
9a0a376a54b1 Move audio packets reordering from codec interface to demuxers for real
rtognimp
parents: 17012
diff changeset
336 (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
337 };
27341
e7c989f7a7c9 Start unifying names of internal preprocessor directives.
diego
parents: 23631
diff changeset
338 #ifdef CONFIG_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
339 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
340 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
341 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
342 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
343 100, // quality
17149
9a0a376a54b1 Move audio packets reordering from codec interface to demuxers for real
rtognimp
parents: 17012
diff changeset
344 sh->wf->nBlockAlign, // subpacket size
9a0a376a54b1 Move audio packets reordering from codec interface to demuxers for real
rtognimp
parents: 17012
diff changeset
345 sh->wf->nBlockAlign, // coded frame size
9a0a376a54b1 Move audio packets reordering from codec interface to demuxers for real
rtognimp
parents: 17012
diff changeset
346 sh->wf->cbSize, // codec data length
9a0a376a54b1 Move audio packets reordering from codec interface to demuxers for real
rtognimp
parents: 17012
diff changeset
347 (char*)(sh->wf+1) // extras
6367
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
348 };
12628
985e1813e298 support for realvideo codecs under macosx, original patch by Donnie Smith
alex
parents: 12356
diff changeset
349 #endif
27341
e7c989f7a7c9 Start unifying names of internal preprocessor directives.
diego
parents: 23631
diff changeset
350 #ifdef CONFIG_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
351 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
352 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
353 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
354 #endif
6367
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
355 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
356
6367
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
357 if(result){
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
358 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
359 return 0;
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
360 }
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
361 // printf("initdecoder ok (result: %x)\n", result);
6367
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
362 }
7086
f0886fe4be89 support for 'sipr' codec - descrambling/reorder not yet fixed.
arpi
parents: 6745
diff changeset
363
27341
e7c989f7a7c9 Start unifying names of internal preprocessor directives.
diego
parents: 23631
diff changeset
364 #ifdef CONFIG_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
365 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
366 #else
7086
f0886fe4be89 support for 'sipr' codec - descrambling/reorder not yet fixed.
arpi
parents: 6745
diff changeset
367 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
368 #endif
7086
f0886fe4be89 support for 'sipr' codec - descrambling/reorder not yet fixed.
arpi
parents: 6745
diff changeset
369 // used by 'SIPR'
27341
e7c989f7a7c9 Start unifying names of internal preprocessor directives.
diego
parents: 23631
diff changeset
370 #ifdef CONFIG_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
371 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
372 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
373 else
2d651a218031 windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents: 8094
diff changeset
374 #endif
7086
f0886fe4be89 support for 'sipr' codec - descrambling/reorder not yet fixed.
arpi
parents: 6745
diff changeset
375 raSetPwd(sh->context,"Ardubancel Quazanga"); // set password... lol.
f0886fe4be89 support for 'sipr' codec - descrambling/reorder not yet fixed.
arpi
parents: 6745
diff changeset
376 }
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 27341
diff changeset
377
17149
9a0a376a54b1 Move audio packets reordering from codec interface to demuxers for real
rtognimp
parents: 17012
diff changeset
378 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
379 short flavor;
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 27341
diff changeset
380
17149
9a0a376a54b1 Move audio packets reordering from codec interface to demuxers for real
rtognimp
parents: 17012
diff changeset
381 if (sh->wf->nAvgBytesPerSec > 1531)
9a0a376a54b1 Move audio packets reordering from codec interface to demuxers for real
rtognimp
parents: 17012
diff changeset
382 flavor = 3;
9a0a376a54b1 Move audio packets reordering from codec interface to demuxers for real
rtognimp
parents: 17012
diff changeset
383 else if (sh->wf->nAvgBytesPerSec > 937)
9a0a376a54b1 Move audio packets reordering from codec interface to demuxers for real
rtognimp
parents: 17012
diff changeset
384 flavor = 1;
9a0a376a54b1 Move audio packets reordering from codec interface to demuxers for real
rtognimp
parents: 17012
diff changeset
385 else if (sh->wf->nAvgBytesPerSec > 719)
9a0a376a54b1 Move audio packets reordering from codec interface to demuxers for real
rtognimp
parents: 17012
diff changeset
386 flavor = 0;
9a0a376a54b1 Move audio packets reordering from codec interface to demuxers for real
rtognimp
parents: 17012
diff changeset
387 else
9a0a376a54b1 Move audio packets reordering from codec interface to demuxers for real
rtognimp
parents: 17012
diff changeset
388 flavor = 2;
9a0a376a54b1 Move audio packets reordering from codec interface to demuxers for real
rtognimp
parents: 17012
diff changeset
389 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
390
27341
e7c989f7a7c9 Start unifying names of internal preprocessor directives.
diego
parents: 23631
diff changeset
391 #ifdef CONFIG_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
392 if (dll_type == 1)
17149
9a0a376a54b1 Move audio packets reordering from codec interface to demuxers for real
rtognimp
parents: 17012
diff changeset
393 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
394 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
395 #endif
17149
9a0a376a54b1 Move audio packets reordering from codec interface to demuxers for real
rtognimp
parents: 17012
diff changeset
396 result=raSetFlavor(sh->context,flavor);
6367
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
397 if(result){
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
398 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
399 return 0;
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
400 }
17149
9a0a376a54b1 Move audio packets reordering from codec interface to demuxers for real
rtognimp
parents: 17012
diff changeset
401 } // sipr flavor
6380
947d6a639c5a fixed copyright
arpi
parents: 6377
diff changeset
402
17149
9a0a376a54b1 Move audio packets reordering from codec interface to demuxers for real
rtognimp
parents: 17012
diff changeset
403 sh->i_bps=sh->wf->nAvgBytesPerSec;
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 27341
diff changeset
404
6380
947d6a639c5a fixed copyright
arpi
parents: 6377
diff changeset
405 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
406 sh->audio_in_minsize = sh->wf->nBlockAlign;
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 27341
diff changeset
407
6367
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
408 return 1; // return values: 1=OK 0=ERROR
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
409 }
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
410
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
411 static int init(sh_audio_t *sh_audio){
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
412 // initialize the decoder, set tables etc...
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
413
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
414 // you can store HANDLE or private struct pointer at sh->context
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
415 // you can access WAVEFORMATEX header at sh->wf
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 27341
diff changeset
416
6367
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
417 // set sample format/rate parameters if you didn't do it in preinit() yet.
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
418
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
419 return 1; // return values: 1=OK 0=ERROR
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
420 }
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
421
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
422 static void uninit(sh_audio_t *sh){
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
423 // uninit the decoder etc...
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
424 // again: you don't have to free() a_in_buffer here! it's done by the core.
27341
e7c989f7a7c9 Start unifying names of internal preprocessor directives.
diego
parents: 23631
diff changeset
425 #ifdef CONFIG_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
426 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
427 {
2d651a218031 windows support and eleminating some 10ls. Win32 ATRC has audio artifacts, Win32 SIPR is just silent, but at least Win32 COOK works nice -- at least by me, on linux
alex
parents: 8094
diff changeset
428 if (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
429 if (wraCloseCodec) wraCloseCodec(sh->context);
9551
d447d6403faf - removed unused global 'handle'
arpi
parents: 9395
diff changeset
430 }
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
431 #endif
9551
d447d6403faf - removed unused global 'handle'
arpi
parents: 9395
diff changeset
432
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
433 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
434 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
435
12628
985e1813e298 support for realvideo codecs under macosx, original patch by Donnie Smith
alex
parents: 12356
diff changeset
436
27341
e7c989f7a7c9 Start unifying names of internal preprocessor directives.
diego
parents: 23631
diff changeset
437 #ifdef CONFIG_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
438 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
439 {
2d651a218031 windows support and eleminating some 10ls. Win32 ATRC has audio 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 (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
441 } 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
442 #endif
9551
d447d6403faf - removed unused global 'handle'
arpi
parents: 9395
diff changeset
443 // this dlclose() causes some memory corruption, and crashes soon (in caller):
d447d6403faf - removed unused global 'handle'
arpi
parents: 9395
diff changeset
444 // 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
445 rv_handle = NULL;
6367
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
446 }
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
447
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
448 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
449 int result;
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
450 int len=-1;
7104
6d784b2812b9 'sipr' descrambling implemented, at least for 16*6 matrix
arpi
parents: 7097
diff changeset
451
6373
8d5d339f2944 get matrix w*h from the demuxer
arpi
parents: 6370
diff changeset
452 if(sh->a_in_buffer_len<=0){
8d5d339f2944 get matrix w*h from the demuxer
arpi
parents: 6370
diff changeset
453 // fill the buffer!
19135
776e4be859e9 Quit on eof, was broken by r17150
rtogni
parents: 18771
diff changeset
454 if (sh->ds->eof)
776e4be859e9 Quit on eof, was broken by r17150
rtogni
parents: 18771
diff changeset
455 return 0;
6373
8d5d339f2944 get matrix w*h from the demuxer
arpi
parents: 6370
diff changeset
456 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
457 sh->a_in_buffer_size=
8d5d339f2944 get matrix w*h from the demuxer
arpi
parents: 6370
diff changeset
458 sh->a_in_buffer_len=sh->wf->nBlockAlign;
8d5d339f2944 get matrix w*h from the demuxer
arpi
parents: 6370
diff changeset
459 }
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 27341
diff changeset
460
27341
e7c989f7a7c9 Start unifying names of internal preprocessor directives.
diego
parents: 23631
diff changeset
461 #ifdef CONFIG_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
462 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
463 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
464 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
465 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
466 #endif
6373
8d5d339f2944 get matrix w*h from the demuxer
arpi
parents: 6370
diff changeset
467 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
468 buf, &len, -1);
6368
9511fffdb8c6 yeah, it worx! but needs a big cleanup and removal of hardcoded stuff
arpi
parents: 6367
diff changeset
469 sh->a_in_buffer_len-=sh->wf->nBlockAlign;
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 27341
diff changeset
470
6376
e3c74c01a3a2 use path & dllname from config
arpi
parents: 6373
diff changeset
471 // printf("radecode: %d bytes, res=0x%X \n",len,result);
6367
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
472
6368
9511fffdb8c6 yeah, it worx! but needs a big cleanup and removal of hardcoded stuff
arpi
parents: 6367
diff changeset
473 return len; // return value: number of _bytes_ written to output buffer,
6367
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
474 // or -1 for EOF (or uncorrectable error)
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
475 }
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
476
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
477 static int control(sh_audio_t *sh,int cmd,void* arg, ...){
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
478 // various optional functions you MAY implement:
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
479 switch(cmd){
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
480 case ADCTRL_RESYNC_STREAM:
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
481 // it is called once after seeking, to resync.
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
482 // Note: sh_audio->a_in_buffer_len=0; is done _before_ this call!
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
483 return CONTROL_TRUE;
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
484 case ADCTRL_SKIP_FRAME:
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
485 // 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
486 // of audio data - used to sync audio to video after seeking
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
487 // if you don't return CONTROL_TRUE, it will defaults to:
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
488 // ds_fill_buffer(sh_audio->ds); // skip 1 demux packet
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
489 return CONTROL_TRUE;
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
490 }
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
491 return CONTROL_UNKNOWN;
489c4bcbda13 readaudio decoder - not yet working
arpi
parents:
diff changeset
492 }