annotate libmpcodecs/vd_realvid.c @ 7825:52818222a8be

endianness fixes for mach64 vidix driver patch by (Colin Leroy <colin at colino dot net>)
author michael
date Mon, 21 Oct 2002 16:57:02 +0000
parents 64b5604195c5
children 4b29a7646dac
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",
7082
678e77165b8e uses new dp_hdr_t packet structure
arpi
parents: 6745
diff changeset
17 "Florian Schneider & A'rpi",
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
7728
64b5604195c5 make local stuff 'static', complete uninit
arpi
parents: 7557
diff changeset
25 static unsigned long (*rvyuv_custom_message)(unsigned long*,void*);
64b5604195c5 make local stuff 'static', complete uninit
arpi
parents: 7557
diff changeset
26 static unsigned long (*rvyuv_free)(void*);
64b5604195c5 make local stuff 'static', complete uninit
arpi
parents: 7557
diff changeset
27 static unsigned long (*rvyuv_hive_message)(unsigned long,unsigned long);
64b5604195c5 make local stuff 'static', complete uninit
arpi
parents: 7557
diff changeset
28 static unsigned long (*rvyuv_init)(void*, void*); // initdata,context
64b5604195c5 make local stuff 'static', complete uninit
arpi
parents: 7557
diff changeset
29 static unsigned long (*rvyuv_transform)(char*, char*,unsigned long*,unsigned long*,void*);
6341
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
30
7728
64b5604195c5 make local stuff 'static', complete uninit
arpi
parents: 7557
diff changeset
31 static void *rv_handle=NULL;
6341
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
32
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
33 void *__builtin_vec_new(unsigned long size) {
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
34 return malloc(size);
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
35 }
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
36
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
37 void __builtin_vec_delete(void *mem) {
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
38 free(mem);
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
39 }
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
40
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
41 void __pure_virtual(void) {
6361
433bc1becbb6 freebsd support (hack) by Nexus
arpi
parents: 6360
diff changeset
42 printf("FATAL: __pure_virtual() called!\n");
433bc1becbb6 freebsd support (hack) by Nexus
arpi
parents: 6360
diff changeset
43 // exit(1);
6341
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
44 }
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
45
6404
83b3315c679b Implement Nilmoni's and Bernd Ernesti's patches for:
atmos4
parents: 6361
diff changeset
46 #if defined(__FreeBSD__) || defined(__NetBSD__)
6361
433bc1becbb6 freebsd support (hack) by Nexus
arpi
parents: 6360
diff changeset
47 void ___brk_addr(void) {exit(0);}
6404
83b3315c679b Implement Nilmoni's and Bernd Ernesti's patches for:
atmos4
parents: 6361
diff changeset
48 char **__environ={NULL};
6361
433bc1becbb6 freebsd support (hack) by Nexus
arpi
parents: 6360
diff changeset
49 #undef stderr
6404
83b3315c679b Implement Nilmoni's and Bernd Ernesti's patches for:
atmos4
parents: 6361
diff changeset
50 FILE *stderr=NULL;
6361
433bc1becbb6 freebsd support (hack) by Nexus
arpi
parents: 6360
diff changeset
51 #endif
6341
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
52
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
53 // to set/get/query special features/parameters
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
54 static int control(sh_video_t *sh,int cmd,void* arg,...){
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
55 // switch(cmd){
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
56 // case VDCTRL_QUERY_MAX_PP_LEVEL:
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
57 // return 9;
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
58 // case VDCTRL_SET_PP_LEVEL:
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
59 // vfw_set_postproc(sh,10*(*((int*)arg)));
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
60 // return CONTROL_OK;
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
61 // }
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
62 return CONTROL_UNKNOWN;
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
63 }
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 /* exits program when failure */
7728
64b5604195c5 make local stuff 'static', complete uninit
arpi
parents: 7557
diff changeset
66 static int load_syms_linux(char *path) {
6341
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
67 void *handle;
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
68
6361
433bc1becbb6 freebsd support (hack) by Nexus
arpi
parents: 6360
diff changeset
69 mp_msg(MSGT_DECVIDEO,MSGL_INFO, "opening shared obj '%s'\n", path);
6341
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
70 rv_handle = dlopen (path, RTLD_LAZY);
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
71 handle=rv_handle;
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
72 if (!handle) {
6361
433bc1becbb6 freebsd support (hack) by Nexus
arpi
parents: 6360
diff changeset
73 mp_msg(MSGT_DECVIDEO,MSGL_WARN,"Error: %s\n",dlerror());
6341
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
74 return 0;
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
75 }
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 rvyuv_custom_message = dlsym(handle, "RV20toYUV420CustomMessage");
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
78 rvyuv_free = dlsym(handle, "RV20toYUV420Free");
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
79 rvyuv_hive_message = dlsym(handle, "RV20toYUV420HiveMessage");
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
80 rvyuv_init = dlsym(handle, "RV20toYUV420Init");
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
81 rvyuv_transform = dlsym(handle, "RV20toYUV420Transform");
6361
433bc1becbb6 freebsd support (hack) by Nexus
arpi
parents: 6360
diff changeset
82
433bc1becbb6 freebsd support (hack) by Nexus
arpi
parents: 6360
diff changeset
83 if(rvyuv_custom_message &&
433bc1becbb6 freebsd support (hack) by Nexus
arpi
parents: 6360
diff changeset
84 rvyuv_free &&
433bc1becbb6 freebsd support (hack) by Nexus
arpi
parents: 6360
diff changeset
85 rvyuv_hive_message &&
433bc1becbb6 freebsd support (hack) by Nexus
arpi
parents: 6360
diff changeset
86 rvyuv_init &&
433bc1becbb6 freebsd support (hack) by Nexus
arpi
parents: 6360
diff changeset
87 rvyuv_transform) return 1;
433bc1becbb6 freebsd support (hack) by Nexus
arpi
parents: 6360
diff changeset
88
433bc1becbb6 freebsd support (hack) by Nexus
arpi
parents: 6360
diff changeset
89 mp_msg(MSGT_DECVIDEO,MSGL_WARN,"Error resolving symbols! (version incompatibility?)\n");
433bc1becbb6 freebsd support (hack) by Nexus
arpi
parents: 6360
diff changeset
90 return 0;
6341
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
91 }
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
92
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
93 #ifdef USE_WIN32DLL
7127
1e47c2e7aa8e mostly compiler warning fixes, some small bugfix
arpi
parents: 7083
diff changeset
94
1e47c2e7aa8e mostly compiler warning fixes, some small bugfix
arpi
parents: 7083
diff changeset
95 #include "../loader/ldt_keeper.h"
1e47c2e7aa8e mostly compiler warning fixes, some small bugfix
arpi
parents: 7083
diff changeset
96 void* LoadLibraryA(char* name);
1e47c2e7aa8e mostly compiler warning fixes, some small bugfix
arpi
parents: 7083
diff changeset
97 void* GetProcAddress(void* handle,char* func);
1e47c2e7aa8e mostly compiler warning fixes, some small bugfix
arpi
parents: 7083
diff changeset
98
7728
64b5604195c5 make local stuff 'static', complete uninit
arpi
parents: 7557
diff changeset
99 static int load_syms_windows(char *path) {
6360
1acda8182b14 win32 dll support (non-working)
arpi
parents: 6354
diff changeset
100 void *handle;
1acda8182b14 win32 dll support (non-working)
arpi
parents: 6354
diff changeset
101 Setup_LDT_Keeper();
1acda8182b14 win32 dll support (non-working)
arpi
parents: 6354
diff changeset
102 rv_handle = handle = LoadLibraryA(path);
6361
433bc1becbb6 freebsd support (hack) by Nexus
arpi
parents: 6360
diff changeset
103 mp_msg(MSGT_DECVIDEO,MSGL_V,"win32 real codec handle=%p \n",handle);
6360
1acda8182b14 win32 dll support (non-working)
arpi
parents: 6354
diff changeset
104
1acda8182b14 win32 dll support (non-working)
arpi
parents: 6354
diff changeset
105 rvyuv_custom_message = GetProcAddress(handle, "RV20toYUV420CustomMessage");
1acda8182b14 win32 dll support (non-working)
arpi
parents: 6354
diff changeset
106 rvyuv_free = GetProcAddress(handle, "RV20toYUV420Free");
1acda8182b14 win32 dll support (non-working)
arpi
parents: 6354
diff changeset
107 rvyuv_hive_message = GetProcAddress(handle, "RV20toYUV420HiveMessage");
1acda8182b14 win32 dll support (non-working)
arpi
parents: 6354
diff changeset
108 rvyuv_init = GetProcAddress(handle, "RV20toYUV420Init");
1acda8182b14 win32 dll support (non-working)
arpi
parents: 6354
diff changeset
109 rvyuv_transform = GetProcAddress(handle, "RV20toYUV420Transform");
1acda8182b14 win32 dll support (non-working)
arpi
parents: 6354
diff changeset
110
1acda8182b14 win32 dll support (non-working)
arpi
parents: 6354
diff changeset
111 if(rvyuv_custom_message &&
1acda8182b14 win32 dll support (non-working)
arpi
parents: 6354
diff changeset
112 rvyuv_free &&
1acda8182b14 win32 dll support (non-working)
arpi
parents: 6354
diff changeset
113 rvyuv_hive_message &&
1acda8182b14 win32 dll support (non-working)
arpi
parents: 6354
diff changeset
114 rvyuv_init &&
1acda8182b14 win32 dll support (non-working)
arpi
parents: 6354
diff changeset
115 rvyuv_transform) return 1;
1acda8182b14 win32 dll support (non-working)
arpi
parents: 6354
diff changeset
116 return 0; // error
1acda8182b14 win32 dll support (non-working)
arpi
parents: 6354
diff changeset
117 }
1acda8182b14 win32 dll support (non-working)
arpi
parents: 6354
diff changeset
118 #endif
1acda8182b14 win32 dll support (non-working)
arpi
parents: 6354
diff changeset
119
6341
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
120 /* we need exact positions */
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
121 struct rv_init_t {
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
122 short unk1;
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
123 short w;
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
124 short h;
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
125 short unk3;
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
126 int unk2;
6345
2b6ff13acf5b - removed unused function pointers
arpi
parents: 6341
diff changeset
127 int subformat;
6341
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
128 int unk5;
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
129 int format;
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
130 } rv_init_t;
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
131
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
132 // init driver
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
133 static int init(sh_video_t *sh){
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
134 //unsigned int out_fmt;
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
135 char path[4096];
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
136 int result;
6345
2b6ff13acf5b - removed unused function pointers
arpi
parents: 6341
diff changeset
137 // we export codec id and sub-id from demuxer in bitmapinfohdr:
2b6ff13acf5b - removed unused function pointers
arpi
parents: 6341
diff changeset
138 unsigned int* extrahdr=(unsigned int*)(sh->bih+1);
6341
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
139 struct rv_init_t init_data={
6345
2b6ff13acf5b - removed unused function pointers
arpi
parents: 6341
diff changeset
140 11, sh->disp_w, sh->disp_h,0,0,extrahdr[0],
2b6ff13acf5b - removed unused function pointers
arpi
parents: 6341
diff changeset
141 1,extrahdr[1]}; // rv30
2b6ff13acf5b - removed unused function pointers
arpi
parents: 6341
diff changeset
142
2b6ff13acf5b - removed unused function pointers
arpi
parents: 6341
diff changeset
143 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
144
6404
83b3315c679b Implement Nilmoni's and Bernd Ernesti's patches for:
atmos4
parents: 6361
diff changeset
145 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
146
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
147 /* 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
148 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
149 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
150 #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
151 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
152 #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
153 {
6341
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
154 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
155 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
156 mp_msg(MSGT_DECVIDEO,MSGL_HINT,"into " REALCODEC_PATH "/ !\n");
6341
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
157 return 0;
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
158 }
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
159 // only I420 supported
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
160 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
161 // init codec:
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
162 sh->context=NULL;
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
163 result=(*rvyuv_init)(&init_data, &sh->context);
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
164 if (result){
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
165 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
166 return 0;
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
167 }
6345
2b6ff13acf5b - removed unused function pointers
arpi
parents: 6341
diff changeset
168 // 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
169 if(extrahdr[1]>=0x20200002){
6745
9734bfbb200a Avoid ulong typedef clash and replace if by unsigned long, patch by Joey Parrish.
atmos4
parents: 6544
diff changeset
170 unsigned long cmsg24[4]={sh->disp_w,sh->disp_h,sh->disp_w,sh->disp_h};
7557
f296ff05bcd0 warning fixes
arpi
parents: 7472
diff changeset
171 unsigned long cmsg_data[3]={0x24,1+((extrahdr[0]>>16)&7),(unsigned long) &cmsg24};
6345
2b6ff13acf5b - removed unused function pointers
arpi
parents: 6341
diff changeset
172 (*rvyuv_custom_message)(cmsg_data,sh->context);
2b6ff13acf5b - removed unused function pointers
arpi
parents: 6341
diff changeset
173 }
6341
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
174 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
175 return 1;
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
176 }
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
177
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
178 // uninit driver
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
179 static void uninit(sh_video_t *sh){
7728
64b5604195c5 make local stuff 'static', complete uninit
arpi
parents: 7557
diff changeset
180 if(rvyuv_free) rvyuv_free(sh->context);
6345
2b6ff13acf5b - removed unused function pointers
arpi
parents: 6341
diff changeset
181 if(rv_handle) dlclose(rv_handle);
2b6ff13acf5b - removed unused function pointers
arpi
parents: 6341
diff changeset
182 rv_handle=NULL;
6341
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
183 }
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
184
7082
678e77165b8e uses new dp_hdr_t packet structure
arpi
parents: 6745
diff changeset
185 // 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
186 typedef struct dp_hdr_s {
678e77165b8e uses new dp_hdr_t packet structure
arpi
parents: 6745
diff changeset
187 uint32_t chunks; // number of chunks
678e77165b8e uses new dp_hdr_t packet structure
arpi
parents: 6745
diff changeset
188 uint32_t timestamp; // timestamp from packet header
678e77165b8e uses new dp_hdr_t packet structure
arpi
parents: 6745
diff changeset
189 uint32_t len; // length of actual data
678e77165b8e uses new dp_hdr_t packet structure
arpi
parents: 6745
diff changeset
190 uint32_t chunktab; // offset to chunk offset array
678e77165b8e uses new dp_hdr_t packet structure
arpi
parents: 6745
diff changeset
191 } dp_hdr_t;
678e77165b8e uses new dp_hdr_t packet structure
arpi
parents: 6745
diff changeset
192
6341
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
193 // decode a frame
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
194 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
195 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
196 unsigned long result;
7082
678e77165b8e uses new dp_hdr_t packet structure
arpi
parents: 6745
diff changeset
197 dp_hdr_t* dp_hdr=(dp_hdr_t*)data;
678e77165b8e uses new dp_hdr_t packet structure
arpi
parents: 6745
diff changeset
198 unsigned char* dp_data=((unsigned char*)data)+sizeof(dp_hdr_t);
678e77165b8e uses new dp_hdr_t packet structure
arpi
parents: 6745
diff changeset
199 uint32_t* extra=(uint32_t*)(((char*)data)+dp_hdr->chunktab);
678e77165b8e uses new dp_hdr_t packet structure
arpi
parents: 6745
diff changeset
200
6745
9734bfbb200a Avoid ulong typedef clash and replace if by unsigned long, patch by Joey Parrish.
atmos4
parents: 6544
diff changeset
201 unsigned long transform_out[5];
9734bfbb200a Avoid ulong typedef clash and replace if by unsigned long, patch by Joey Parrish.
atmos4
parents: 6544
diff changeset
202 unsigned long transform_in[6]={
7082
678e77165b8e uses new dp_hdr_t packet structure
arpi
parents: 6745
diff changeset
203 dp_hdr->len, // length of the packet (sub-packets appended)
6341
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
204 0, // unknown, seems to be unused
7082
678e77165b8e uses new dp_hdr_t packet structure
arpi
parents: 6745
diff changeset
205 dp_hdr->chunks, // number of sub-packets - 1
7557
f296ff05bcd0 warning fixes
arpi
parents: 7472
diff changeset
206 (unsigned long) extra, // table of sub-packet offsets
6341
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
207 0, // unknown, seems to be unused
7082
678e77165b8e uses new dp_hdr_t packet structure
arpi
parents: 6745
diff changeset
208 dp_hdr->timestamp,// timestamp (the integer value from the stream)
6341
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
209 };
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
210
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
211 if(len<=0 || flags&2) return NULL; // skipped frame || hardframedrop
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
212
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
213 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
214 sh->disp_w, sh->disp_h);
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
215 if(!mpi) return NULL;
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
216
7082
678e77165b8e uses new dp_hdr_t packet structure
arpi
parents: 6745
diff changeset
217 result=(*rvyuv_transform)(dp_data, mpi->planes[0], transform_in,
6341
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
218 transform_out, sh->context);
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
219
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
220 return (result?NULL:mpi);
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
221 }
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
222
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
223 #endif