annotate libmpcodecs/vd_real.c @ 6690:e8f7dbe19df0

Sync by Jiri Svoboda <jiri.svoboda at seznam.cz>
author atmos4
date Wed, 10 Jul 2002 03:19:28 +0000
parents 222f6da66fa3
children 9734bfbb200a
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",
6341
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
16 "real",
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
17 VFM_REAL,
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
18 "Florian Schneider",
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
19 "using original closed source codecs for Linux",
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
20 "binary real video codecs"
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
21 };
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
22
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
23 LIBVD_EXTERN(real)
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
24
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
25
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
26 typedef unsigned long ulong;
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
27
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
28 ulong (*rvyuv_custom_message)(ulong,ulong);
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
29 ulong (*rvyuv_free)(ulong);
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
30 ulong (*rvyuv_hive_message)(ulong,ulong);
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
31 ulong (*rvyuv_init)(ulong,ulong);
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
32 ulong (*rvyuv_transform)(ulong,ulong,ulong,ulong,ulong);
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
33
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
34 void *rv_handle=NULL;
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 void *__builtin_vec_new(unsigned long size) {
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
37 return malloc(size);
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
38 }
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 void __builtin_vec_delete(void *mem) {
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
41 free(mem);
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
42 }
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
43
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
44 void __pure_virtual(void) {
6361
433bc1becbb6 freebsd support (hack) by Nexus
arpi
parents: 6360
diff changeset
45 printf("FATAL: __pure_virtual() called!\n");
433bc1becbb6 freebsd support (hack) by Nexus
arpi
parents: 6360
diff changeset
46 // exit(1);
6341
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
47 }
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
48
6404
83b3315c679b Implement Nilmoni's and Bernd Ernesti's patches for:
atmos4
parents: 6361
diff changeset
49 #if defined(__FreeBSD__) || defined(__NetBSD__)
6361
433bc1becbb6 freebsd support (hack) by Nexus
arpi
parents: 6360
diff changeset
50 void ___brk_addr(void) {exit(0);}
6404
83b3315c679b Implement Nilmoni's and Bernd Ernesti's patches for:
atmos4
parents: 6361
diff changeset
51 char **__environ={NULL};
6361
433bc1becbb6 freebsd support (hack) by Nexus
arpi
parents: 6360
diff changeset
52 #undef stderr
6404
83b3315c679b Implement Nilmoni's and Bernd Ernesti's patches for:
atmos4
parents: 6361
diff changeset
53 FILE *stderr=NULL;
6361
433bc1becbb6 freebsd support (hack) by Nexus
arpi
parents: 6360
diff changeset
54 #endif
6341
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
55
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
56 // to set/get/query special features/parameters
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
57 static int control(sh_video_t *sh,int cmd,void* arg,...){
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
58 // switch(cmd){
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
59 // case VDCTRL_QUERY_MAX_PP_LEVEL:
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
60 // return 9;
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
61 // case VDCTRL_SET_PP_LEVEL:
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
62 // vfw_set_postproc(sh,10*(*((int*)arg)));
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
63 // return CONTROL_OK;
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 return CONTROL_UNKNOWN;
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
66 }
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 /* exits program when failure */
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
69 int load_syms_linux(char *path) {
6341
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
70 void *handle;
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
71 char *error;
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
72
6361
433bc1becbb6 freebsd support (hack) by Nexus
arpi
parents: 6360
diff changeset
73 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
74 rv_handle = dlopen (path, RTLD_LAZY);
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
75 handle=rv_handle;
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
76 if (!handle) {
6361
433bc1becbb6 freebsd support (hack) by Nexus
arpi
parents: 6360
diff changeset
77 mp_msg(MSGT_DECVIDEO,MSGL_WARN,"Error: %s\n",dlerror());
6341
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
78 return 0;
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
79 }
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
80
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
81 rvyuv_custom_message = dlsym(handle, "RV20toYUV420CustomMessage");
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
82 rvyuv_free = dlsym(handle, "RV20toYUV420Free");
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
83 rvyuv_hive_message = dlsym(handle, "RV20toYUV420HiveMessage");
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
84 rvyuv_init = dlsym(handle, "RV20toYUV420Init");
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
85 rvyuv_transform = dlsym(handle, "RV20toYUV420Transform");
6361
433bc1becbb6 freebsd support (hack) by Nexus
arpi
parents: 6360
diff changeset
86
433bc1becbb6 freebsd support (hack) by Nexus
arpi
parents: 6360
diff changeset
87 if(rvyuv_custom_message &&
433bc1becbb6 freebsd support (hack) by Nexus
arpi
parents: 6360
diff changeset
88 rvyuv_free &&
433bc1becbb6 freebsd support (hack) by Nexus
arpi
parents: 6360
diff changeset
89 rvyuv_hive_message &&
433bc1becbb6 freebsd support (hack) by Nexus
arpi
parents: 6360
diff changeset
90 rvyuv_init &&
433bc1becbb6 freebsd support (hack) by Nexus
arpi
parents: 6360
diff changeset
91 rvyuv_transform) return 1;
433bc1becbb6 freebsd support (hack) by Nexus
arpi
parents: 6360
diff changeset
92
433bc1becbb6 freebsd support (hack) by Nexus
arpi
parents: 6360
diff changeset
93 mp_msg(MSGT_DECVIDEO,MSGL_WARN,"Error resolving symbols! (version incompatibility?)\n");
433bc1becbb6 freebsd support (hack) by Nexus
arpi
parents: 6360
diff changeset
94 return 0;
6341
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
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
97 #ifdef USE_WIN32DLL
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
98 int load_syms_windows(char *path) {
6360
1acda8182b14 win32 dll support (non-working)
arpi
parents: 6354
diff changeset
99 void *handle;
1acda8182b14 win32 dll support (non-working)
arpi
parents: 6354
diff changeset
100 Setup_LDT_Keeper();
1acda8182b14 win32 dll support (non-working)
arpi
parents: 6354
diff changeset
101 rv_handle = handle = LoadLibraryA(path);
6361
433bc1becbb6 freebsd support (hack) by Nexus
arpi
parents: 6360
diff changeset
102 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
103
1acda8182b14 win32 dll support (non-working)
arpi
parents: 6354
diff changeset
104 rvyuv_custom_message = GetProcAddress(handle, "RV20toYUV420CustomMessage");
1acda8182b14 win32 dll support (non-working)
arpi
parents: 6354
diff changeset
105 rvyuv_free = GetProcAddress(handle, "RV20toYUV420Free");
1acda8182b14 win32 dll support (non-working)
arpi
parents: 6354
diff changeset
106 rvyuv_hive_message = GetProcAddress(handle, "RV20toYUV420HiveMessage");
1acda8182b14 win32 dll support (non-working)
arpi
parents: 6354
diff changeset
107 rvyuv_init = GetProcAddress(handle, "RV20toYUV420Init");
1acda8182b14 win32 dll support (non-working)
arpi
parents: 6354
diff changeset
108 rvyuv_transform = GetProcAddress(handle, "RV20toYUV420Transform");
1acda8182b14 win32 dll support (non-working)
arpi
parents: 6354
diff changeset
109
1acda8182b14 win32 dll support (non-working)
arpi
parents: 6354
diff changeset
110 if(rvyuv_custom_message &&
1acda8182b14 win32 dll support (non-working)
arpi
parents: 6354
diff changeset
111 rvyuv_free &&
1acda8182b14 win32 dll support (non-working)
arpi
parents: 6354
diff changeset
112 rvyuv_hive_message &&
1acda8182b14 win32 dll support (non-working)
arpi
parents: 6354
diff changeset
113 rvyuv_init &&
1acda8182b14 win32 dll support (non-working)
arpi
parents: 6354
diff changeset
114 rvyuv_transform) return 1;
1acda8182b14 win32 dll support (non-working)
arpi
parents: 6354
diff changeset
115 return 0; // error
1acda8182b14 win32 dll support (non-working)
arpi
parents: 6354
diff changeset
116 }
1acda8182b14 win32 dll support (non-working)
arpi
parents: 6354
diff changeset
117 #endif
1acda8182b14 win32 dll support (non-working)
arpi
parents: 6354
diff changeset
118
6341
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
119 /* we need exact positions */
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
120 struct rv_init_t {
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
121 short unk1;
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
122 short w;
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
123 short h;
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
124 short unk3;
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
125 int unk2;
6345
2b6ff13acf5b - removed unused function pointers
arpi
parents: 6341
diff changeset
126 int subformat;
6341
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
127 int unk5;
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
128 int format;
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
129 } rv_init_t;
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
130
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
131 // init driver
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
132 static int init(sh_video_t *sh){
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
133 //unsigned int out_fmt;
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
134 char path[4096];
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
135 int result;
6345
2b6ff13acf5b - removed unused function pointers
arpi
parents: 6341
diff changeset
136 // we export codec id and sub-id from demuxer in bitmapinfohdr:
2b6ff13acf5b - removed unused function pointers
arpi
parents: 6341
diff changeset
137 unsigned int* extrahdr=(unsigned int*)(sh->bih+1);
6341
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
138 struct rv_init_t init_data={
6345
2b6ff13acf5b - removed unused function pointers
arpi
parents: 6341
diff changeset
139 11, sh->disp_w, sh->disp_h,0,0,extrahdr[0],
2b6ff13acf5b - removed unused function pointers
arpi
parents: 6341
diff changeset
140 1,extrahdr[1]}; // rv30
2b6ff13acf5b - removed unused function pointers
arpi
parents: 6341
diff changeset
141
2b6ff13acf5b - removed unused function pointers
arpi
parents: 6341
diff changeset
142 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
143
6404
83b3315c679b Implement Nilmoni's and Bernd Ernesti's patches for:
atmos4
parents: 6361
diff changeset
144 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
145
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 /* 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
147 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
148 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
149 #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
150 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
151 #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
152 {
6341
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
153 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
154 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
155 mp_msg(MSGT_DECVIDEO,MSGL_HINT,"into " REALCODEC_PATH "/ !\n");
6341
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
156 return 0;
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
157 }
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
158 // only I420 supported
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
159 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
160 // init codec:
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
161 sh->context=NULL;
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
162 result=(*rvyuv_init)(&init_data, &sh->context);
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
163 if (result){
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
164 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
165 return 0;
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
166 }
6345
2b6ff13acf5b - removed unused function pointers
arpi
parents: 6341
diff changeset
167 // setup rv30 codec (codec sub-type and image dimensions):
2b6ff13acf5b - removed unused function pointers
arpi
parents: 6341
diff changeset
168 if(extrahdr[1]>=0x30000000){
2b6ff13acf5b - removed unused function pointers
arpi
parents: 6341
diff changeset
169 ulong cmsg24[4]={sh->disp_w,sh->disp_h,sh->disp_w,sh->disp_h};
6354
66dd95953ec2 very high bitrate (RealOne) support fixed
arpi
parents: 6345
diff changeset
170 ulong cmsg_data[3]={0x24,1+((extrahdr[0]>>16)&7),&cmsg24};
6345
2b6ff13acf5b - removed unused function pointers
arpi
parents: 6341
diff changeset
171 (*rvyuv_custom_message)(cmsg_data,sh->context);
2b6ff13acf5b - removed unused function pointers
arpi
parents: 6341
diff changeset
172 }
6341
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
173 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
174 return 1;
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
175 }
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 // uninit driver
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
178 static void uninit(sh_video_t *sh){
6345
2b6ff13acf5b - removed unused function pointers
arpi
parents: 6341
diff changeset
179 if(rv_handle) dlclose(rv_handle);
2b6ff13acf5b - removed unused function pointers
arpi
parents: 6341
diff changeset
180 rv_handle=NULL;
6341
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
181 }
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
182
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
183 // decode a frame
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
184 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
185 mp_image_t* mpi;
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
186 ulong result;
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
187 int *buff=(unsigned int *)((char*)data+len);
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
188 ulong transform_out[5];
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
189 ulong transform_in[6]={
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
190 len, // length of the packet (sub-packets appended)
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
191 0, // unknown, seems to be unused
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
192 buff[0], // number of sub-packets - 1
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
193 &buff[2], // table of sub-packet offsets
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
194 0, // unknown, seems to be unused
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
195 buff[1], // timestamp (the integer value from the stream)
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
196 };
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
197
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
198 if(len<=0 || flags&2) return NULL; // skipped frame || hardframedrop
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
199
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
200 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
201 sh->disp_w, sh->disp_h);
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
202 if(!mpi) return NULL;
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
203
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
204 result=(*rvyuv_transform)(data, mpi->planes[0], transform_in,
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
205 transform_out, sh->context);
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
206
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
207 return (result?NULL:mpi);
d79c52610702 RealVideo rv30 decoder, using binary driver from realplayer8
arpi
parents:
diff changeset
208 }
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 #endif