annotate libmpcodecs/vd_realvid.c @ 9346:eb760cafaf75

minor fixes for font autoscaling
author henry
date Sat, 08 Feb 2003 18:45:32 +0000
parents 8d0bfe72e709
children 8537d9a5fed5
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
6341
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
1 #include <stdio.h>
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
2 #include <stdlib.h>
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
3
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
4 #include "config.h"
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
5 #ifdef USE_REALCODECS
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
6
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
7 #include <dlfcn.h>
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
8
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
9 #include "mp_msg.h"
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
10 #include "help_mp.h"
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
11
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
12 #include "vd_internal.h"
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
13
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
14 static vd_info_t info = {
6404
83b3315c679b Implement Nilmoni's and Bernd Ernesti's patches for:
atmos4
parents: 6361
diff changeset
15 "RealVideo decoder",
7174
7672615cc811 sync driver names with codec-cfg
arpi
parents: 7172
diff changeset
16 "realvid",
8525
8d0bfe72e709 win32 dlls support
alex
parents: 8522
diff changeset
17 "Florian Schneider & A'rpi", // win32 dlls support by alex
6341
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
18 "using original closed source codecs for Linux",
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
19 "binary real video codecs"
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
20 };
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
21
7174
7672615cc811 sync driver names with codec-cfg
arpi
parents: 7172
diff changeset
22 LIBVD_EXTERN(realvid)
6341
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
23
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
24
8522
4b29a7646dac alpha support by Alan Young <ayoung@teleport.com>
alex
parents: 7728
diff changeset
25 /*
4b29a7646dac alpha support by Alan Young <ayoung@teleport.com>
alex
parents: 7728
diff changeset
26 * Structures for data packets. These used to be tables of unsigned ints, but
4b29a7646dac alpha support by Alan Young <ayoung@teleport.com>
alex
parents: 7728
diff changeset
27 * that does not work on 64 bit platforms (e.g. Alpha). The entries that are
4b29a7646dac alpha support by Alan Young <ayoung@teleport.com>
alex
parents: 7728
diff changeset
28 * pointers get truncated. Pointers on 64 bit platforms are 8 byte longs.
4b29a7646dac alpha support by Alan Young <ayoung@teleport.com>
alex
parents: 7728
diff changeset
29 * So we have to use structures so the compiler will assign the proper space
4b29a7646dac alpha support by Alan Young <ayoung@teleport.com>
alex
parents: 7728
diff changeset
30 * for the pointer.
4b29a7646dac alpha support by Alan Young <ayoung@teleport.com>
alex
parents: 7728
diff changeset
31 */
4b29a7646dac alpha support by Alan Young <ayoung@teleport.com>
alex
parents: 7728
diff changeset
32 typedef struct cmsg_data_s {
4b29a7646dac alpha support by Alan Young <ayoung@teleport.com>
alex
parents: 7728
diff changeset
33 uint32_t data1;
4b29a7646dac alpha support by Alan Young <ayoung@teleport.com>
alex
parents: 7728
diff changeset
34 uint32_t data2;
4b29a7646dac alpha support by Alan Young <ayoung@teleport.com>
alex
parents: 7728
diff changeset
35 uint32_t* dimensions;
4b29a7646dac alpha support by Alan Young <ayoung@teleport.com>
alex
parents: 7728
diff changeset
36 } cmsg_data_t;
4b29a7646dac alpha support by Alan Young <ayoung@teleport.com>
alex
parents: 7728
diff changeset
37
4b29a7646dac alpha support by Alan Young <ayoung@teleport.com>
alex
parents: 7728
diff changeset
38 typedef struct transform_in_s {
4b29a7646dac alpha support by Alan Young <ayoung@teleport.com>
alex
parents: 7728
diff changeset
39 uint32_t len;
4b29a7646dac alpha support by Alan Young <ayoung@teleport.com>
alex
parents: 7728
diff changeset
40 uint32_t unknown1;
4b29a7646dac alpha support by Alan Young <ayoung@teleport.com>
alex
parents: 7728
diff changeset
41 uint32_t chunks;
4b29a7646dac alpha support by Alan Young <ayoung@teleport.com>
alex
parents: 7728
diff changeset
42 uint32_t* extra;
4b29a7646dac alpha support by Alan Young <ayoung@teleport.com>
alex
parents: 7728
diff changeset
43 uint32_t unknown2;
4b29a7646dac alpha support by Alan Young <ayoung@teleport.com>
alex
parents: 7728
diff changeset
44 uint32_t timestamp;
4b29a7646dac alpha support by Alan Young <ayoung@teleport.com>
alex
parents: 7728
diff changeset
45 } transform_in_t;
4b29a7646dac alpha support by Alan Young <ayoung@teleport.com>
alex
parents: 7728
diff changeset
46
4b29a7646dac alpha support by Alan Young <ayoung@teleport.com>
alex
parents: 7728
diff changeset
47 static unsigned long (*rvyuv_custom_message)(cmsg_data_t* ,void*);
7728
64b5604195c5 make local stuff 'static', complete uninit
arpi
parents: 7557
diff changeset
48 static unsigned long (*rvyuv_free)(void*);
64b5604195c5 make local stuff 'static', complete uninit
arpi
parents: 7557
diff changeset
49 static unsigned long (*rvyuv_hive_message)(unsigned long,unsigned long);
64b5604195c5 make local stuff 'static', complete uninit
arpi
parents: 7557
diff changeset
50 static unsigned long (*rvyuv_init)(void*, void*); // initdata,context
8522
4b29a7646dac alpha support by Alan Young <ayoung@teleport.com>
alex
parents: 7728
diff changeset
51 static unsigned long (*rvyuv_transform)(char*, char*,transform_in_t*,unsigned int*,void*);
8525
8d0bfe72e709 win32 dlls support
alex
parents: 8522
diff changeset
52 #ifdef USE_WIN32DLL
8d0bfe72e709 win32 dlls support
alex
parents: 8522
diff changeset
53 static unsigned long WINAPI (*wrvyuv_custom_message)(cmsg_data_t* ,void*);
8d0bfe72e709 win32 dlls support
alex
parents: 8522
diff changeset
54 static unsigned long WINAPI (*wrvyuv_free)(void*);
8d0bfe72e709 win32 dlls support
alex
parents: 8522
diff changeset
55 static unsigned long WINAPI (*wrvyuv_hive_message)(unsigned long,unsigned long);
8d0bfe72e709 win32 dlls support
alex
parents: 8522
diff changeset
56 static unsigned long WINAPI (*wrvyuv_init)(void*, void*); // initdata,context
8d0bfe72e709 win32 dlls support
alex
parents: 8522
diff changeset
57 static unsigned long WINAPI (*wrvyuv_transform)(char*, char*,transform_in_t*,unsigned int*,void*);
8d0bfe72e709 win32 dlls support
alex
parents: 8522
diff changeset
58 #endif
6341
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
59
7728
64b5604195c5 make local stuff 'static', complete uninit
arpi
parents: 7557
diff changeset
60 static void *rv_handle=NULL;
8525
8d0bfe72e709 win32 dlls support
alex
parents: 8522
diff changeset
61 #ifdef USE_WIN32DLL
8d0bfe72e709 win32 dlls support
alex
parents: 8522
diff changeset
62 static int dll_type = 0; /* 0 = unix dlopen, 1 = win32 dll */
8d0bfe72e709 win32 dlls support
alex
parents: 8522
diff changeset
63 #endif
6341
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
64
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
65 void *__builtin_vec_new(unsigned long size) {
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
66 return malloc(size);
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
67 }
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
68
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
69 void __builtin_vec_delete(void *mem) {
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
70 free(mem);
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
71 }
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
72
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
73 void __pure_virtual(void) {
6361
433bc1becbb6 freebsd support (hack) by Nexus
arpi
parents: 6360
diff changeset
74 printf("FATAL: __pure_virtual() called!\n");
433bc1becbb6 freebsd support (hack) by Nexus
arpi
parents: 6360
diff changeset
75 // exit(1);
6341
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
76 }
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
77
6404
83b3315c679b Implement Nilmoni's and Bernd Ernesti's patches for:
atmos4
parents: 6361
diff changeset
78 #if defined(__FreeBSD__) || defined(__NetBSD__)
6361
433bc1becbb6 freebsd support (hack) by Nexus
arpi
parents: 6360
diff changeset
79 void ___brk_addr(void) {exit(0);}
6404
83b3315c679b Implement Nilmoni's and Bernd Ernesti's patches for:
atmos4
parents: 6361
diff changeset
80 char **__environ={NULL};
6361
433bc1becbb6 freebsd support (hack) by Nexus
arpi
parents: 6360
diff changeset
81 #undef stderr
6404
83b3315c679b Implement Nilmoni's and Bernd Ernesti's patches for:
atmos4
parents: 6361
diff changeset
82 FILE *stderr=NULL;
6361
433bc1becbb6 freebsd support (hack) by Nexus
arpi
parents: 6360
diff changeset
83 #endif
6341
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
84
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
85 // to set/get/query special features/parameters
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
86 static int control(sh_video_t *sh,int cmd,void* arg,...){
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
87 // switch(cmd){
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
88 // case VDCTRL_QUERY_MAX_PP_LEVEL:
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
89 // return 9;
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
90 // case VDCTRL_SET_PP_LEVEL:
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
91 // vfw_set_postproc(sh,10*(*((int*)arg)));
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
92 // return CONTROL_OK;
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
93 // }
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
94 return CONTROL_UNKNOWN;
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
95 }
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
96
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
97 /* exits program when failure */
7728
64b5604195c5 make local stuff 'static', complete uninit
arpi
parents: 7557
diff changeset
98 static int load_syms_linux(char *path) {
6341
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
99 void *handle;
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
100
6361
433bc1becbb6 freebsd support (hack) by Nexus
arpi
parents: 6360
diff changeset
101 mp_msg(MSGT_DECVIDEO,MSGL_INFO, "opening shared obj '%s'\n", path);
8525
8d0bfe72e709 win32 dlls support
alex
parents: 8522
diff changeset
102 rv_handle = handle = dlopen (path, RTLD_LAZY);
6341
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
103 if (!handle) {
6361
433bc1becbb6 freebsd support (hack) by Nexus
arpi
parents: 6360
diff changeset
104 mp_msg(MSGT_DECVIDEO,MSGL_WARN,"Error: %s\n",dlerror());
6341
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
105 return 0;
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
106 }
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
107
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
108 rvyuv_custom_message = dlsym(handle, "RV20toYUV420CustomMessage");
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
109 rvyuv_free = dlsym(handle, "RV20toYUV420Free");
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
110 rvyuv_hive_message = dlsym(handle, "RV20toYUV420HiveMessage");
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
111 rvyuv_init = dlsym(handle, "RV20toYUV420Init");
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
112 rvyuv_transform = dlsym(handle, "RV20toYUV420Transform");
6361
433bc1becbb6 freebsd support (hack) by Nexus
arpi
parents: 6360
diff changeset
113
433bc1becbb6 freebsd support (hack) by Nexus
arpi
parents: 6360
diff changeset
114 if(rvyuv_custom_message &&
433bc1becbb6 freebsd support (hack) by Nexus
arpi
parents: 6360
diff changeset
115 rvyuv_free &&
433bc1becbb6 freebsd support (hack) by Nexus
arpi
parents: 6360
diff changeset
116 rvyuv_hive_message &&
433bc1becbb6 freebsd support (hack) by Nexus
arpi
parents: 6360
diff changeset
117 rvyuv_init &&
433bc1becbb6 freebsd support (hack) by Nexus
arpi
parents: 6360
diff changeset
118 rvyuv_transform) return 1;
433bc1becbb6 freebsd support (hack) by Nexus
arpi
parents: 6360
diff changeset
119
433bc1becbb6 freebsd support (hack) by Nexus
arpi
parents: 6360
diff changeset
120 mp_msg(MSGT_DECVIDEO,MSGL_WARN,"Error resolving symbols! (version incompatibility?)\n");
8525
8d0bfe72e709 win32 dlls support
alex
parents: 8522
diff changeset
121 dlclose(rv_handle);
8d0bfe72e709 win32 dlls support
alex
parents: 8522
diff changeset
122 rv_handle = NULL;
6361
433bc1becbb6 freebsd support (hack) by Nexus
arpi
parents: 6360
diff changeset
123 return 0;
6341
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
124 }
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
125
6543
70a9c9f695a2 first try to load linux dlls, if failed and we're supporting win32 dlls, then try to load the windows ones
alex
parents: 6404
diff changeset
126 #ifdef USE_WIN32DLL
7127
1e47c2e7aa8e mostly compiler warning fixes, some small bugfix
arpi
parents: 7083
diff changeset
127
1e47c2e7aa8e mostly compiler warning fixes, some small bugfix
arpi
parents: 7083
diff changeset
128 #include "../loader/ldt_keeper.h"
8525
8d0bfe72e709 win32 dlls support
alex
parents: 8522
diff changeset
129 void* WINAPI LoadLibraryA(char* name);
8d0bfe72e709 win32 dlls support
alex
parents: 8522
diff changeset
130 void* WINAPI GetProcAddress(void* handle,char* func);
8d0bfe72e709 win32 dlls support
alex
parents: 8522
diff changeset
131 int WINAPI FreeLibrary(void *handle);
7127
1e47c2e7aa8e mostly compiler warning fixes, some small bugfix
arpi
parents: 7083
diff changeset
132
7728
64b5604195c5 make local stuff 'static', complete uninit
arpi
parents: 7557
diff changeset
133 static int load_syms_windows(char *path) {
6360
1acda8182b14 win32 dll support (non-working)
arpi
parents: 6354
diff changeset
134 void *handle;
8525
8d0bfe72e709 win32 dlls support
alex
parents: 8522
diff changeset
135
8d0bfe72e709 win32 dlls support
alex
parents: 8522
diff changeset
136
8d0bfe72e709 win32 dlls support
alex
parents: 8522
diff changeset
137 mp_msg(MSGT_DECVIDEO,MSGL_INFO, "opening win32 dll '%s'\n", path);
6360
1acda8182b14 win32 dll support (non-working)
arpi
parents: 6354
diff changeset
138 Setup_LDT_Keeper();
1acda8182b14 win32 dll support (non-working)
arpi
parents: 6354
diff changeset
139 rv_handle = handle = LoadLibraryA(path);
6361
433bc1becbb6 freebsd support (hack) by Nexus
arpi
parents: 6360
diff changeset
140 mp_msg(MSGT_DECVIDEO,MSGL_V,"win32 real codec handle=%p \n",handle);
8525
8d0bfe72e709 win32 dlls support
alex
parents: 8522
diff changeset
141 if (!handle) {
8d0bfe72e709 win32 dlls support
alex
parents: 8522
diff changeset
142 mp_msg(MSGT_DECVIDEO,MSGL_WARN,"Error loading dll\n");
8d0bfe72e709 win32 dlls support
alex
parents: 8522
diff changeset
143 return 0;
8d0bfe72e709 win32 dlls support
alex
parents: 8522
diff changeset
144 }
6360
1acda8182b14 win32 dll support (non-working)
arpi
parents: 6354
diff changeset
145
8525
8d0bfe72e709 win32 dlls support
alex
parents: 8522
diff changeset
146 wrvyuv_custom_message = GetProcAddress(handle, "RV20toYUV420CustomMessage");
8d0bfe72e709 win32 dlls support
alex
parents: 8522
diff changeset
147 wrvyuv_free = GetProcAddress(handle, "RV20toYUV420Free");
8d0bfe72e709 win32 dlls support
alex
parents: 8522
diff changeset
148 wrvyuv_hive_message = GetProcAddress(handle, "RV20toYUV420HiveMessage");
8d0bfe72e709 win32 dlls support
alex
parents: 8522
diff changeset
149 wrvyuv_init = GetProcAddress(handle, "RV20toYUV420Init");
8d0bfe72e709 win32 dlls support
alex
parents: 8522
diff changeset
150 wrvyuv_transform = GetProcAddress(handle, "RV20toYUV420Transform");
8d0bfe72e709 win32 dlls support
alex
parents: 8522
diff changeset
151
8d0bfe72e709 win32 dlls support
alex
parents: 8522
diff changeset
152 dll_type = 1;
6360
1acda8182b14 win32 dll support (non-working)
arpi
parents: 6354
diff changeset
153
8525
8d0bfe72e709 win32 dlls support
alex
parents: 8522
diff changeset
154 if(wrvyuv_custom_message &&
8d0bfe72e709 win32 dlls support
alex
parents: 8522
diff changeset
155 wrvyuv_free &&
8d0bfe72e709 win32 dlls support
alex
parents: 8522
diff changeset
156 wrvyuv_hive_message &&
8d0bfe72e709 win32 dlls support
alex
parents: 8522
diff changeset
157 wrvyuv_init &&
8d0bfe72e709 win32 dlls support
alex
parents: 8522
diff changeset
158 wrvyuv_transform) return 1;
8d0bfe72e709 win32 dlls support
alex
parents: 8522
diff changeset
159
8d0bfe72e709 win32 dlls support
alex
parents: 8522
diff changeset
160 mp_msg(MSGT_DECVIDEO,MSGL_WARN,"Error resolving symbols! (version incompatibility?)\n");
8d0bfe72e709 win32 dlls support
alex
parents: 8522
diff changeset
161 FreeLibrary(rv_handle);
8d0bfe72e709 win32 dlls support
alex
parents: 8522
diff changeset
162 rv_handle = NULL;
6360
1acda8182b14 win32 dll support (non-working)
arpi
parents: 6354
diff changeset
163 return 0; // error
1acda8182b14 win32 dll support (non-working)
arpi
parents: 6354
diff changeset
164 }
1acda8182b14 win32 dll support (non-working)
arpi
parents: 6354
diff changeset
165 #endif
1acda8182b14 win32 dll support (non-working)
arpi
parents: 6354
diff changeset
166
6341
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
167 /* we need exact positions */
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
168 struct rv_init_t {
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
169 short unk1;
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
170 short w;
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
171 short h;
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
172 short unk3;
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
173 int unk2;
6345
2b6ff13acf5b - removed unused function pointers
arpi
parents: 6341
diff changeset
174 int subformat;
6341
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
175 int unk5;
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
176 int format;
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
177 } rv_init_t;
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
178
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
179 // init driver
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
180 static int init(sh_video_t *sh){
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
181 //unsigned int out_fmt;
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
182 char path[4096];
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
183 int result;
6345
2b6ff13acf5b - removed unused function pointers
arpi
parents: 6341
diff changeset
184 // we export codec id and sub-id from demuxer in bitmapinfohdr:
2b6ff13acf5b - removed unused function pointers
arpi
parents: 6341
diff changeset
185 unsigned int* extrahdr=(unsigned int*)(sh->bih+1);
6341
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
186 struct rv_init_t init_data={
6345
2b6ff13acf5b - removed unused function pointers
arpi
parents: 6341
diff changeset
187 11, sh->disp_w, sh->disp_h,0,0,extrahdr[0],
2b6ff13acf5b - removed unused function pointers
arpi
parents: 6341
diff changeset
188 1,extrahdr[1]}; // rv30
2b6ff13acf5b - removed unused function pointers
arpi
parents: 6341
diff changeset
189
2b6ff13acf5b - removed unused function pointers
arpi
parents: 6341
diff changeset
190 mp_msg(MSGT_DECVIDEO,MSGL_V,"realvideo codec id: 0x%08X sub-id: 0x%08X\n",extrahdr[1],extrahdr[0]);
6341
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
191
6404
83b3315c679b Implement Nilmoni's and Bernd Ernesti's patches for:
atmos4
parents: 6361
diff changeset
192 sprintf(path, REALCODEC_PATH "/%s", sh->codec->dll);
6543
70a9c9f695a2 first try to load linux dlls, if failed and we're supporting win32 dlls, then try to load the windows ones
alex
parents: 6404
diff changeset
193
70a9c9f695a2 first try to load linux dlls, if failed and we're supporting win32 dlls, then try to load the windows ones
alex
parents: 6404
diff changeset
194 /* first try to load linux dlls, if failed and we're supporting win32 dlls,
70a9c9f695a2 first try to load linux dlls, if failed and we're supporting win32 dlls, then try to load the windows ones
alex
parents: 6404
diff changeset
195 then try to load the windows ones */
70a9c9f695a2 first try to load linux dlls, if failed and we're supporting win32 dlls, then try to load the windows ones
alex
parents: 6404
diff changeset
196 if(!load_syms_linux(path))
6544
222f6da66fa3 first try to load linux dlls, if failed and we're supporting win32 dlls, then try to load the windows ones
alex
parents: 6543
diff changeset
197 #ifdef USE_WIN32DLL
6543
70a9c9f695a2 first try to load linux dlls, if failed and we're supporting win32 dlls, then try to load the windows ones
alex
parents: 6404
diff changeset
198 if (!load_syms_windows(path))
70a9c9f695a2 first try to load linux dlls, if failed and we're supporting win32 dlls, then try to load the windows ones
alex
parents: 6404
diff changeset
199 #endif
70a9c9f695a2 first try to load linux dlls, if failed and we're supporting win32 dlls, then try to load the windows ones
alex
parents: 6404
diff changeset
200 {
6341
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
201 mp_msg(MSGT_DECVIDEO,MSGL_ERR,MSGTR_MissingDLLcodec,sh->codec->dll);
6404
83b3315c679b Implement Nilmoni's and Bernd Ernesti's patches for:
atmos4
parents: 6361
diff changeset
202 mp_msg(MSGT_DECVIDEO,MSGL_HINT,"You need to copy the contents from the RealPlayer codecs directory\n");
83b3315c679b Implement Nilmoni's and Bernd Ernesti's patches for:
atmos4
parents: 6361
diff changeset
203 mp_msg(MSGT_DECVIDEO,MSGL_HINT,"into " REALCODEC_PATH "/ !\n");
6341
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
204 return 0;
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
205 }
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
206 // only I420 supported
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
207 if(!mpcodecs_config_vo(sh,sh->disp_w,sh->disp_h,IMGFMT_I420)) return 0;
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
208 // init codec:
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
209 sh->context=NULL;
8525
8d0bfe72e709 win32 dlls support
alex
parents: 8522
diff changeset
210 #ifdef USE_WIN32DLL
8d0bfe72e709 win32 dlls support
alex
parents: 8522
diff changeset
211 if (dll_type == 1)
8d0bfe72e709 win32 dlls support
alex
parents: 8522
diff changeset
212 result=(*wrvyuv_init)(&init_data, &sh->context);
8d0bfe72e709 win32 dlls support
alex
parents: 8522
diff changeset
213 else
8d0bfe72e709 win32 dlls support
alex
parents: 8522
diff changeset
214 #endif
6341
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
215 result=(*rvyuv_init)(&init_data, &sh->context);
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
216 if (result){
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
217 mp_msg(MSGT_DECVIDEO,MSGL_ERR,"Couldn't open RealVideo codec, error code: 0x%X \n",result);
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
218 return 0;
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
219 }
6345
2b6ff13acf5b - removed unused function pointers
arpi
parents: 6341
diff changeset
220 // setup rv30 codec (codec sub-type and image dimensions):
7083
6376abc95ae7 some newer rv20 variants also uses custommsg 0x24 to set codec subtype
arpi
parents: 7082
diff changeset
221 if(extrahdr[1]>=0x20200002){
8522
4b29a7646dac alpha support by Alan Young <ayoung@teleport.com>
alex
parents: 7728
diff changeset
222 uint32_t cmsg24[4]={sh->disp_w,sh->disp_h,sh->disp_w,sh->disp_h};
4b29a7646dac alpha support by Alan Young <ayoung@teleport.com>
alex
parents: 7728
diff changeset
223 cmsg_data_t cmsg_data={0x24,1+((extrahdr[0]>>16)&7), &cmsg24[0]};
8525
8d0bfe72e709 win32 dlls support
alex
parents: 8522
diff changeset
224
8d0bfe72e709 win32 dlls support
alex
parents: 8522
diff changeset
225 #ifdef USE_WIN32DLL
8d0bfe72e709 win32 dlls support
alex
parents: 8522
diff changeset
226 if (dll_type == 1)
8d0bfe72e709 win32 dlls support
alex
parents: 8522
diff changeset
227 (*wrvyuv_custom_message)(&cmsg_data,sh->context);
8d0bfe72e709 win32 dlls support
alex
parents: 8522
diff changeset
228 else
8d0bfe72e709 win32 dlls support
alex
parents: 8522
diff changeset
229 #endif
8522
4b29a7646dac alpha support by Alan Young <ayoung@teleport.com>
alex
parents: 7728
diff changeset
230 (*rvyuv_custom_message)(&cmsg_data,sh->context);
6345
2b6ff13acf5b - removed unused function pointers
arpi
parents: 6341
diff changeset
231 }
6341
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
232 mp_msg(MSGT_DECVIDEO,MSGL_V,"INFO: RealVideo codec init OK!\n");
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
233 return 1;
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
234 }
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
235
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
236 // uninit driver
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
237 static void uninit(sh_video_t *sh){
8525
8d0bfe72e709 win32 dlls support
alex
parents: 8522
diff changeset
238 #ifdef USE_WIN32DLL
8d0bfe72e709 win32 dlls support
alex
parents: 8522
diff changeset
239 if (dll_type == 1)
8d0bfe72e709 win32 dlls support
alex
parents: 8522
diff changeset
240 {
8d0bfe72e709 win32 dlls support
alex
parents: 8522
diff changeset
241 if (wrvyuv_free) wrvyuv_free(sh->context);
8d0bfe72e709 win32 dlls support
alex
parents: 8522
diff changeset
242 } else
8d0bfe72e709 win32 dlls support
alex
parents: 8522
diff changeset
243 #endif
7728
64b5604195c5 make local stuff 'static', complete uninit
arpi
parents: 7557
diff changeset
244 if(rvyuv_free) rvyuv_free(sh->context);
8525
8d0bfe72e709 win32 dlls support
alex
parents: 8522
diff changeset
245
8d0bfe72e709 win32 dlls support
alex
parents: 8522
diff changeset
246 #ifdef USE_WIN32DLL
8d0bfe72e709 win32 dlls support
alex
parents: 8522
diff changeset
247 if (dll_type == 1)
8d0bfe72e709 win32 dlls support
alex
parents: 8522
diff changeset
248 {
8d0bfe72e709 win32 dlls support
alex
parents: 8522
diff changeset
249 if (rv_handle) FreeLibrary(rv_handle);
8d0bfe72e709 win32 dlls support
alex
parents: 8522
diff changeset
250 } else
8d0bfe72e709 win32 dlls support
alex
parents: 8522
diff changeset
251 #endif
6345
2b6ff13acf5b - removed unused function pointers
arpi
parents: 6341
diff changeset
252 if(rv_handle) dlclose(rv_handle);
2b6ff13acf5b - removed unused function pointers
arpi
parents: 6341
diff changeset
253 rv_handle=NULL;
6341
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
254 }
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
255
7082
678e77165b8e uses new dp_hdr_t packet structure
arpi
parents: 6745
diff changeset
256 // copypaste from demux_real.c - it should match to get it working!
678e77165b8e uses new dp_hdr_t packet structure
arpi
parents: 6745
diff changeset
257 typedef struct dp_hdr_s {
678e77165b8e uses new dp_hdr_t packet structure
arpi
parents: 6745
diff changeset
258 uint32_t chunks; // number of chunks
678e77165b8e uses new dp_hdr_t packet structure
arpi
parents: 6745
diff changeset
259 uint32_t timestamp; // timestamp from packet header
678e77165b8e uses new dp_hdr_t packet structure
arpi
parents: 6745
diff changeset
260 uint32_t len; // length of actual data
678e77165b8e uses new dp_hdr_t packet structure
arpi
parents: 6745
diff changeset
261 uint32_t chunktab; // offset to chunk offset array
678e77165b8e uses new dp_hdr_t packet structure
arpi
parents: 6745
diff changeset
262 } dp_hdr_t;
678e77165b8e uses new dp_hdr_t packet structure
arpi
parents: 6745
diff changeset
263
6341
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
264 // decode a frame
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
265 static mp_image_t* decode(sh_video_t *sh,void* data,int len,int flags){
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
266 mp_image_t* mpi;
6745
9734bfbb200a Avoid ulong typedef clash and replace if by unsigned long, patch by Joey Parrish.
atmos4
parents: 6544
diff changeset
267 unsigned long result;
7082
678e77165b8e uses new dp_hdr_t packet structure
arpi
parents: 6745
diff changeset
268 dp_hdr_t* dp_hdr=(dp_hdr_t*)data;
678e77165b8e uses new dp_hdr_t packet structure
arpi
parents: 6745
diff changeset
269 unsigned char* dp_data=((unsigned char*)data)+sizeof(dp_hdr_t);
678e77165b8e uses new dp_hdr_t packet structure
arpi
parents: 6745
diff changeset
270 uint32_t* extra=(uint32_t*)(((char*)data)+dp_hdr->chunktab);
678e77165b8e uses new dp_hdr_t packet structure
arpi
parents: 6745
diff changeset
271
8522
4b29a7646dac alpha support by Alan Young <ayoung@teleport.com>
alex
parents: 7728
diff changeset
272 unsigned int transform_out[5];
4b29a7646dac alpha support by Alan Young <ayoung@teleport.com>
alex
parents: 7728
diff changeset
273 transform_in_t transform_in={
7082
678e77165b8e uses new dp_hdr_t packet structure
arpi
parents: 6745
diff changeset
274 dp_hdr->len, // length of the packet (sub-packets appended)
6341
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
275 0, // unknown, seems to be unused
7082
678e77165b8e uses new dp_hdr_t packet structure
arpi
parents: 6745
diff changeset
276 dp_hdr->chunks, // number of sub-packets - 1
8522
4b29a7646dac alpha support by Alan Young <ayoung@teleport.com>
alex
parents: 7728
diff changeset
277 extra, // table of sub-packet offsets
6341
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
278 0, // unknown, seems to be unused
7082
678e77165b8e uses new dp_hdr_t packet structure
arpi
parents: 6745
diff changeset
279 dp_hdr->timestamp,// timestamp (the integer value from the stream)
6341
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
280 };
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
281
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
282 if(len<=0 || flags&2) return NULL; // skipped frame || hardframedrop
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
283
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
284 mpi=mpcodecs_get_image(sh, MP_IMGTYPE_TEMP, 0 /*MP_IMGFLAG_ACCEPT_STRIDE*/,
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
285 sh->disp_w, sh->disp_h);
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
286 if(!mpi) return NULL;
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
287
8525
8d0bfe72e709 win32 dlls support
alex
parents: 8522
diff changeset
288 #ifdef USE_WIN32DLL
8d0bfe72e709 win32 dlls support
alex
parents: 8522
diff changeset
289 if (dll_type == 1)
8d0bfe72e709 win32 dlls support
alex
parents: 8522
diff changeset
290 result=(*wrvyuv_transform)(dp_data, mpi->planes[0], &transform_in,
8d0bfe72e709 win32 dlls support
alex
parents: 8522
diff changeset
291 transform_out, sh->context);
8d0bfe72e709 win32 dlls support
alex
parents: 8522
diff changeset
292 else
8d0bfe72e709 win32 dlls support
alex
parents: 8522
diff changeset
293 #endif
8522
4b29a7646dac alpha support by Alan Young <ayoung@teleport.com>
alex
parents: 7728
diff changeset
294 result=(*rvyuv_transform)(dp_data, mpi->planes[0], &transform_in,
6341
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
295 transform_out, sh->context);
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
296
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
297 return (result?NULL:mpi);
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
298 }
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
299
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
300 #endif