Mercurial > mplayer.hg
annotate libmpcodecs/vd_xanim.c @ 36835:6bc38224c74a
Fix bug with Win32 GUI preferences.
The combobox entry must not be used as the priority option's name.
Translate between the text presented to the user and the internal
name to be used.
author | ib |
---|---|
date | Mon, 24 Feb 2014 15:20:34 +0000 |
parents | 25667edae85c |
children |
rev | line source |
---|---|
7285 | 1 /* |
30421
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
2 * XAnim Video Codec DLL support |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
3 * |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
4 * It partly emulates the Xanim codebase. |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
5 * You need the -rdynamic flag to use this with gcc. |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
6 * |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
7 * Copyright (C) 2001-2002 Alex Beregszaszi |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
8 * Arpad Gereoffy <arpi@thot.banki.hu> |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
9 * |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
10 * This file is part of MPlayer. |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
11 * |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
12 * MPlayer is free software; you can redistribute it and/or modify |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
13 * it under the terms of the GNU General Public License as published by |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
14 * the Free Software Foundation; either version 2 of the License, or |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
15 * (at your option) any later version. |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
16 * |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
17 * MPlayer is distributed in the hope that it will be useful, |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
20 * GNU General Public License for more details. |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
21 * |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
22 * You should have received a copy of the GNU General Public License along |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
23 * with MPlayer; if not, write to the Free Software Foundation, Inc., |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
24 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
25 */ |
7298
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
26 |
4969 | 27 #include <stdio.h> |
28 #include <stdlib.h> | |
7285 | 29 #include <string.h> /* strerror */ |
4969 | 30 |
31 #include "config.h" | |
30901 | 32 #include "path.h" |
4969 | 33 #include "mp_msg.h" |
34 | |
35 #include "vd_internal.h" | |
36 | |
30504
cc27da5d7286
Mark all ad_info_t/vd_info_t structure declarations as const.
diego
parents:
30421
diff
changeset
|
37 static const vd_info_t info = { |
4969 | 38 "XAnim codecs", |
39 "xanim", | |
40 "A'rpi & Alex", | |
5272 | 41 "Xanim (http://xanim.va.pubnix.com/)", |
4969 | 42 "binary codec plugins" |
43 }; | |
44 | |
45 LIBVD_EXTERN(xanim) | |
46 | |
7285 | 47 #ifdef __FreeBSD__ |
48 #include <unistd.h> | |
49 #endif | |
50 | |
51 #include <dlfcn.h> /* dlsym, dlopen, dlclose */ | |
52 #include <stdarg.h> /* va_alist, va_start, va_end */ | |
53 #include <errno.h> /* strerror, errno */ | |
54 | |
55 #include "mp_msg.h" | |
26542
3a2e8ae7c548
Consistently #include mpbswap.h instead of bswap.h everywhere.
diego
parents:
23375
diff
changeset
|
56 #include "mpbswap.h" |
7285 | 57 |
9380 | 58 #include "osdep/timer.h" |
7285 | 59 |
7298
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
60 #if 0 |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
61 /* this should be removed */ |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
62 #ifndef RTLD_NOW |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
63 #define RLTD_NOW 2 |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
64 #endif |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
65 #ifndef RTLD_LAZY |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
66 #define RLTD_LAZY 1 |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
67 #endif |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
68 #ifndef RTLD_GLOBAL |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
69 #define RLTD_GLOBAL 256 |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
70 #endif |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
71 #endif |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
72 |
31545 | 73 struct XA_CODEC_HDR; |
74 struct XA_DEC_INFO; | |
75 | |
76 typedef long init_function(struct XA_CODEC_HDR *); | |
77 typedef unsigned int decode_function(unsigned char *, unsigned char *, | |
78 unsigned int, struct XA_DEC_INFO *); | |
79 | |
7285 | 80 typedef struct |
81 { | |
82 unsigned int what; | |
83 unsigned int id; | |
31545 | 84 init_function *iq_func; /* init/query function */ |
85 decode_function *dec_func; /* opt decode function */ | |
7285 | 86 } XAVID_FUNC_HDR; |
87 | |
88 #define XAVID_WHAT_NO_MORE 0x0000 | |
89 #define XAVID_AVI_QUERY 0x0001 | |
90 #define XAVID_QT_QUERY 0x0002 | |
91 #define XAVID_DEC_FUNC 0x0100 | |
92 | |
93 #define XAVID_API_REV 0x0003 | |
94 | |
95 typedef struct | |
96 { | |
97 unsigned int api_rev; | |
98 char *desc; | |
99 char *rev; | |
100 char *copyright; | |
101 char *mod_author; | |
102 char *authors; | |
103 unsigned int num_funcs; | |
104 XAVID_FUNC_HDR *funcs; | |
105 } XAVID_MOD_HDR; | |
106 | |
107 /* XA CODEC .. */ | |
31545 | 108 typedef struct XA_CODEC_HDR |
7285 | 109 { |
110 void *anim_hdr; | |
111 unsigned int compression; | |
112 unsigned int x, y; | |
113 unsigned int depth; | |
114 void *extra; | |
115 unsigned int xapi_rev; | |
31545 | 116 decode_function *decoder; |
7285 | 117 char *description; |
118 unsigned int avi_ctab_flag; | |
31545 | 119 unsigned int (*avi_read_ext)(void); |
7285 | 120 } XA_CODEC_HDR; |
121 | |
122 #define CODEC_SUPPORTED 1 | |
123 #define CODEC_UNKNOWN 0 | |
124 #define CODEC_UNSUPPORTED -1 | |
125 | |
126 /* fuckin colormap structures for xanim */ | |
127 typedef struct | |
128 { | |
129 unsigned short red; | |
130 unsigned short green; | |
131 unsigned short blue; | |
132 unsigned short gray; | |
133 } ColorReg; | |
134 | |
135 typedef struct XA_ACTION_STRUCT | |
136 { | |
137 int type; | |
138 int cmap_rev; | |
139 unsigned char *data; | |
140 struct XA_ACTION_STRUCT *next; | |
141 struct XA_CHDR_STRUCT *chdr; | |
142 ColorReg *h_cmap; | |
143 unsigned int *map; | |
144 struct XA_ACTION_STRUCT *next_same_chdr; | |
145 } XA_ACTION; | |
146 | |
147 typedef struct XA_CHDR_STRUCT | |
148 { | |
149 unsigned int rev; | |
150 ColorReg *cmap; | |
151 unsigned int csize, coff; | |
152 unsigned int *map; | |
153 unsigned int msize, moff; | |
154 struct XA_CHDR_STRUCT *next; | |
155 XA_ACTION *acts; | |
156 struct XA_CHDR_STRUCT *new_chdr; | |
157 } XA_CHDR; | |
158 | |
31545 | 159 typedef struct XA_DEC_INFO |
7285 | 160 { |
161 unsigned int cmd; | |
162 unsigned int skip_flag; | |
163 unsigned int imagex, imagey; /* image buffer size */ | |
164 unsigned int imaged; /* image depth */ | |
165 XA_CHDR *chdr; /* color map header */ | |
166 unsigned int map_flag; | |
167 unsigned int *map; | |
168 unsigned int xs, ys; | |
169 unsigned int xe, ye; | |
170 unsigned int special; | |
171 void *extra; | |
172 } XA_DEC_INFO; | |
173 | |
174 typedef struct | |
175 { | |
176 unsigned int file_num; | |
177 unsigned int anim_type; | |
178 unsigned int imagex; | |
179 unsigned int imagey; | |
180 unsigned int imagec; | |
181 unsigned int imaged; | |
182 } XA_ANIM_HDR; | |
183 | |
184 typedef struct { | |
7298
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
185 XA_DEC_INFO *decinfo; |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
186 void *file_handler; |
31545 | 187 init_function *iq_func; |
188 decode_function *dec_func; | |
7355 | 189 mp_image_t *mpi; |
7298
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
190 } vd_xanim_ctx; |
7285 | 191 |
192 #if 0 | |
193 typedef char xaBYTE; | |
194 typedef short xaSHORT; | |
195 typedef int xaLONG; | |
196 | |
197 typedef unsigned char xaUBYTE; | |
198 typedef unsigned short xaUSHORT; | |
199 typedef unsigned int xaULONG; | |
200 #endif | |
201 | |
202 #define xaFALSE 0 | |
203 #define xaTRUE 1 | |
204 | |
7298
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
205 #define ACT_DLTA_NORM 0x00000000 |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
206 #define ACT_DLTA_BODY 0x00000001 |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
207 #define ACT_DLTA_XOR 0x00000002 |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
208 #define ACT_DLTA_NOP 0x00000004 |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
209 #define ACT_DLTA_MAPD 0x00000008 |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
210 #define ACT_DLTA_DROP 0x00000010 |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
211 #define ACT_DLTA_BAD 0x80000000 |
7285 | 212 |
213 #define XA_CLOSE_FUNCS 5 | |
7298
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
214 int xa_close_funcs = 0; |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
215 void *xa_close_func[XA_CLOSE_FUNCS]; |
7285 | 216 |
7298
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
217 /* load, init and query */ |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
218 static int xacodec_load(sh_video_t *sh, char *filename) |
7285 | 219 { |
7298
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
220 vd_xanim_ctx *priv = sh->context; |
31545 | 221 void *(*what_the)(void); |
7298
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
222 char *error; |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
223 XAVID_MOD_HDR *mod_hdr; |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
224 XAVID_FUNC_HDR *func; |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
225 int i; |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
226 |
7383 | 227 // priv->file_handler = dlopen(filename, RTLD_NOW|RTLD_GLOBAL); |
228 priv->file_handler = dlopen(filename, RTLD_LAZY); | |
7298
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
229 if (!priv->file_handler) |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
230 { |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
231 error = dlerror(); |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
232 if (error) |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
233 mp_msg(MSGT_DECVIDEO, MSGL_FATAL, "xacodec: failed to dlopen %s while %s\n", filename, error); |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
234 else |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
235 mp_msg(MSGT_DECVIDEO, MSGL_FATAL, "xacodec: failed to dlopen %s\n", filename); |
26754
63630c09e237
cosmetics: Remove pointless parentheses from return calls.
diego
parents:
26542
diff
changeset
|
236 return 0; |
7298
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
237 } |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
238 |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
239 what_the = dlsym(priv->file_handler, "What_The"); |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
240 if ((error = dlerror()) != NULL) |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
241 { |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
242 mp_msg(MSGT_DECVIDEO, MSGL_FATAL, "xacodec: failed to init %s while %s\n", filename, error); |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
243 dlclose(priv->file_handler); |
26754
63630c09e237
cosmetics: Remove pointless parentheses from return calls.
diego
parents:
26542
diff
changeset
|
244 return 0; |
7298
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
245 } |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
26754
diff
changeset
|
246 |
7298
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
247 mod_hdr = what_the(); |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
248 if (!mod_hdr) |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
249 { |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
250 mp_msg(MSGT_DECVIDEO, MSGL_FATAL, "xacodec: initializer function failed in %s\n", filename); |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
251 dlclose(priv->file_handler); |
26754
63630c09e237
cosmetics: Remove pointless parentheses from return calls.
diego
parents:
26542
diff
changeset
|
252 return 0; |
7298
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
253 } |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
26754
diff
changeset
|
254 |
7298
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
255 mp_msg(MSGT_DECVIDEO, MSGL_V, "=== XAnim Codec ===\n"); |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
256 mp_msg(MSGT_DECVIDEO, MSGL_V, " Filename: %s (API revision: %x)\n", filename, mod_hdr->api_rev); |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
257 mp_msg(MSGT_DECVIDEO, MSGL_V, " Codec: %s. Rev: %s\n", mod_hdr->desc, mod_hdr->rev); |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
258 if (mod_hdr->copyright) |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
259 mp_msg(MSGT_DECVIDEO, MSGL_V, " %s\n", mod_hdr->copyright); |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
260 if (mod_hdr->mod_author) |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
261 mp_msg(MSGT_DECVIDEO, MSGL_V, " Module Author(s): %s\n", mod_hdr->mod_author); |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
262 if (mod_hdr->authors) |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
263 mp_msg(MSGT_DECVIDEO, MSGL_V, " Codec Author(s): %s\n", mod_hdr->authors); |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
264 |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
265 if (mod_hdr->api_rev > XAVID_API_REV) |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
266 { |
33841
25667edae85c
cleanup: adjust printf format strings to match parameter types
diego
parents:
32537
diff
changeset
|
267 mp_msg(MSGT_DECVIDEO, MSGL_FATAL, |
25667edae85c
cleanup: adjust printf format strings to match parameter types
diego
parents:
32537
diff
changeset
|
268 "xacodec: not supported api revision (%u) in %s\n", |
7298
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
269 mod_hdr->api_rev, filename); |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
270 dlclose(priv->file_handler); |
26754
63630c09e237
cosmetics: Remove pointless parentheses from return calls.
diego
parents:
26542
diff
changeset
|
271 return 0; |
7298
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
272 } |
7285 | 273 |
7298
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
274 func = mod_hdr->funcs; |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
275 if (!func) |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
276 { |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
277 mp_msg(MSGT_DECVIDEO, MSGL_FATAL, "xacodec: function table error in %s\n", filename); |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
278 dlclose(priv->file_handler); |
26754
63630c09e237
cosmetics: Remove pointless parentheses from return calls.
diego
parents:
26542
diff
changeset
|
279 return 0; |
7298
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
280 } |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
26754
diff
changeset
|
281 |
33841
25667edae85c
cleanup: adjust printf format strings to match parameter types
diego
parents:
32537
diff
changeset
|
282 mp_msg(MSGT_DECVIDEO, MSGL_DBG2, |
25667edae85c
cleanup: adjust printf format strings to match parameter types
diego
parents:
32537
diff
changeset
|
283 "Exported functions by codec: [functable: %p entries: %u]\n", |
7298
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
284 mod_hdr->funcs, mod_hdr->num_funcs); |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
285 for (i = 0; i < (int)mod_hdr->num_funcs; i++) |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
286 { |
33841
25667edae85c
cleanup: adjust printf format strings to match parameter types
diego
parents:
32537
diff
changeset
|
287 mp_msg(MSGT_DECVIDEO, MSGL_DBG2, " %d: %u %u [iq:%p d:%p]\n", |
7298
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
288 i, func[i].what, func[i].id, func[i].iq_func, func[i].dec_func); |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
289 if (func[i].what & XAVID_AVI_QUERY) |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
290 { |
33841
25667edae85c
cleanup: adjust printf format strings to match parameter types
diego
parents:
32537
diff
changeset
|
291 mp_msg(MSGT_DECVIDEO, MSGL_DBG2, " %p: avi init/query func (id: %u)\n", |
7298
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
292 func[i].iq_func, func[i].id); |
31545 | 293 priv->iq_func = func[i].iq_func; |
7298
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
294 } |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
295 if (func[i].what & XAVID_QT_QUERY) |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
296 { |
33841
25667edae85c
cleanup: adjust printf format strings to match parameter types
diego
parents:
32537
diff
changeset
|
297 mp_msg(MSGT_DECVIDEO, MSGL_DBG2, " %p: qt init/query func (id: %u)\n", |
7298
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
298 func[i].iq_func, func[i].id); |
31545 | 299 priv->iq_func = func[i].iq_func; |
7298
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
300 } |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
301 if (func[i].what & XAVID_DEC_FUNC) |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
302 { |
33841
25667edae85c
cleanup: adjust printf format strings to match parameter types
diego
parents:
32537
diff
changeset
|
303 mp_msg(MSGT_DECVIDEO, MSGL_DBG2, " %p: decoder func (init/query: %p) (id: %u)\n", |
7298
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
304 func[i].dec_func, func[i].iq_func, func[i].id); |
31545 | 305 priv->dec_func = func[i].dec_func; |
7298
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
306 } |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
307 } |
26754
63630c09e237
cosmetics: Remove pointless parentheses from return calls.
diego
parents:
26542
diff
changeset
|
308 return 1; |
7298
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
309 } |
7285 | 310 |
7298
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
311 static int xacodec_query(sh_video_t *sh, XA_CODEC_HDR *codec_hdr) |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
312 { |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
313 vd_xanim_ctx *priv = sh->context; |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
314 long ret; |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
315 |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
316 #if 0 |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
317 /* the brute one */ |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
318 if (priv->dec_func) |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
319 { |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
320 codec_hdr->decoder = priv->dec_func; |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
321 mp_msg(MSGT_DECVIDEO, MSGL_DBG2, "We got decoder's address at init! %p\n", codec_hdr->decoder); |
26754
63630c09e237
cosmetics: Remove pointless parentheses from return calls.
diego
parents:
26542
diff
changeset
|
322 return 1; |
7298
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
323 } |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
324 #endif |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
325 |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
326 ret = priv->iq_func(codec_hdr); |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
327 switch(ret) |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
328 { |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
329 case CODEC_SUPPORTED: |
31545 | 330 priv->dec_func = codec_hdr->decoder; |
17366 | 331 mp_msg(MSGT_DECVIDEO, MSGL_DBG2, "Codec is supported: found decoder for %s at %p\n", |
7298
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
332 codec_hdr->description, codec_hdr->decoder); |
26754
63630c09e237
cosmetics: Remove pointless parentheses from return calls.
diego
parents:
26542
diff
changeset
|
333 return 1; |
7298
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
334 case CODEC_UNSUPPORTED: |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
335 mp_msg(MSGT_DECVIDEO, MSGL_FATAL, "Codec (%s) is unsupported by dll\n", |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
336 codec_hdr->description); |
26754
63630c09e237
cosmetics: Remove pointless parentheses from return calls.
diego
parents:
26542
diff
changeset
|
337 return 0; |
7298
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
338 case CODEC_UNKNOWN: |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
339 default: |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
340 mp_msg(MSGT_DECVIDEO, MSGL_FATAL, "Codec (%s) is unknown by dll\n", |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
341 codec_hdr->description); |
26754
63630c09e237
cosmetics: Remove pointless parentheses from return calls.
diego
parents:
26542
diff
changeset
|
342 return 0; |
7298
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
343 } |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
344 } |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
345 |
30565
6e85fdf79584
Revert marking seemingly unused XAnim-binary-related functions as static.
diego
parents:
30555
diff
changeset
|
346 /* These functions are required for loading XAnim binary libs. |
6e85fdf79584
Revert marking seemingly unused XAnim-binary-related functions as static.
diego
parents:
30555
diff
changeset
|
347 * Add forward declarations to avoid warnings with -Wmissing-prototypes. */ |
6e85fdf79584
Revert marking seemingly unused XAnim-binary-related functions as static.
diego
parents:
30555
diff
changeset
|
348 void XA_Print(char *fmt, ...); |
6e85fdf79584
Revert marking seemingly unused XAnim-binary-related functions as static.
diego
parents:
30555
diff
changeset
|
349 void TheEnd1(char *err_mess); |
31545 | 350 void XA_Add_Func_To_Free_Chain(XA_ANIM_HDR *anim_hdr, void (*function)(void)); |
30565
6e85fdf79584
Revert marking seemingly unused XAnim-binary-related functions as static.
diego
parents:
30555
diff
changeset
|
351 unsigned long XA_Time_Read(void); |
6e85fdf79584
Revert marking seemingly unused XAnim-binary-related functions as static.
diego
parents:
30555
diff
changeset
|
352 void XA_Gen_YUV_Tabs(XA_ANIM_HDR *anim_hdr); |
6e85fdf79584
Revert marking seemingly unused XAnim-binary-related functions as static.
diego
parents:
30555
diff
changeset
|
353 void JPG_Setup_Samp_Limit_Table(XA_ANIM_HDR *anim_hdr); |
6e85fdf79584
Revert marking seemingly unused XAnim-binary-related functions as static.
diego
parents:
30555
diff
changeset
|
354 void JPG_Alloc_MCU_Bufs(XA_ANIM_HDR *anim_hdr, unsigned int width, |
6e85fdf79584
Revert marking seemingly unused XAnim-binary-related functions as static.
diego
parents:
30555
diff
changeset
|
355 unsigned int height, unsigned int full_flag); |
6e85fdf79584
Revert marking seemingly unused XAnim-binary-related functions as static.
diego
parents:
30555
diff
changeset
|
356 void *YUV2x2_Blk_Func(unsigned int image_type, int blks, |
6e85fdf79584
Revert marking seemingly unused XAnim-binary-related functions as static.
diego
parents:
30555
diff
changeset
|
357 unsigned int dith_flag); |
6e85fdf79584
Revert marking seemingly unused XAnim-binary-related functions as static.
diego
parents:
30555
diff
changeset
|
358 void *YUV2x2_Map_Func(unsigned int image_type, unsigned int dith_type); |
6e85fdf79584
Revert marking seemingly unused XAnim-binary-related functions as static.
diego
parents:
30555
diff
changeset
|
359 void *XA_YUV1611_Func(unsigned int image_type); |
6e85fdf79584
Revert marking seemingly unused XAnim-binary-related functions as static.
diego
parents:
30555
diff
changeset
|
360 void *XA_YUV221111_Func(unsigned int image_type); |
6e85fdf79584
Revert marking seemingly unused XAnim-binary-related functions as static.
diego
parents:
30555
diff
changeset
|
361 |
6e85fdf79584
Revert marking seemingly unused XAnim-binary-related functions as static.
diego
parents:
30555
diff
changeset
|
362 void XA_Print(char *fmt, ...) |
7285 | 363 { |
364 va_list vallist; | |
365 char buf[1024]; | |
366 | |
367 va_start(vallist, fmt); | |
368 vsnprintf(buf, 1024, fmt, vallist); | |
369 mp_msg(MSGT_XACODEC, MSGL_DBG2, "[xacodec] %s\n", buf); | |
370 va_end(vallist); | |
371 | |
372 return; | |
373 } | |
374 | |
375 /* 0 is no debug (needed by 3ivX) */ | |
376 long xa_debug = 0; | |
377 | |
30565
6e85fdf79584
Revert marking seemingly unused XAnim-binary-related functions as static.
diego
parents:
30555
diff
changeset
|
378 void TheEnd1(char *err_mess) |
7285 | 379 { |
380 XA_Print("error: %s - exiting\n", err_mess); | |
7298
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
381 /* we should exit here... */ |
7285 | 382 |
383 return; | |
384 } | |
385 | |
31545 | 386 void XA_Add_Func_To_Free_Chain(XA_ANIM_HDR *anim_hdr, void (*function)(void)) |
7285 | 387 { |
388 // XA_Print("XA_Add_Func_To_Free_Chain('anim_hdr: %08x', 'function: %08x')", | |
389 // anim_hdr, function); | |
7298
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
390 xa_close_func[xa_close_funcs] = function; |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
391 if (xa_close_funcs+1 < XA_CLOSE_FUNCS) |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
392 xa_close_funcs++; |
7285 | 393 |
394 return; | |
395 } | |
396 | |
30565
6e85fdf79584
Revert marking seemingly unused XAnim-binary-related functions as static.
diego
parents:
30555
diff
changeset
|
397 unsigned long XA_Time_Read(void) |
7285 | 398 { |
399 return GetTimer(); //(GetRelativeTime()); | |
400 } | |
401 | |
30555
ad6740b58b0d
libmpcodecs: Mark functions not used outside of their files as static.
diego
parents:
30504
diff
changeset
|
402 static void XA_dummy(void) |
7285 | 403 { |
404 XA_Print("dummy() called"); | |
405 } | |
406 | |
30565
6e85fdf79584
Revert marking seemingly unused XAnim-binary-related functions as static.
diego
parents:
30555
diff
changeset
|
407 void XA_Gen_YUV_Tabs(XA_ANIM_HDR *anim_hdr) |
7285 | 408 { |
409 XA_Print("XA_Gen_YUV_Tabs('anim_hdr: %08x')", anim_hdr); | |
410 return; | |
411 } | |
412 | |
30565
6e85fdf79584
Revert marking seemingly unused XAnim-binary-related functions as static.
diego
parents:
30555
diff
changeset
|
413 void JPG_Setup_Samp_Limit_Table(XA_ANIM_HDR *anim_hdr) |
7285 | 414 { |
415 XA_Print("JPG_Setup_Samp_Limit_Table('anim_hdr: %08x')", anim_hdr); | |
416 return; | |
417 } | |
418 | |
30565
6e85fdf79584
Revert marking seemingly unused XAnim-binary-related functions as static.
diego
parents:
30555
diff
changeset
|
419 void JPG_Alloc_MCU_Bufs(XA_ANIM_HDR *anim_hdr, unsigned int width, |
6e85fdf79584
Revert marking seemingly unused XAnim-binary-related functions as static.
diego
parents:
30555
diff
changeset
|
420 unsigned int height, unsigned int full_flag) |
7285 | 421 { |
422 XA_Print("JPG_Alloc_MCU_Bufs('anim_hdr: %08x', 'width: %d', 'height: %d', 'full_flag: %d')", | |
423 anim_hdr, width, height, full_flag); | |
424 return; | |
425 } | |
426 | |
427 /* --------------- 4x4 pixel YUV block fillers [CVID] ----------------- */ | |
428 | |
429 typedef struct | |
430 { | |
431 unsigned char r0, g0, b0; | |
432 unsigned char r1, g1, b1; | |
433 unsigned char r2, g2, b2; | |
434 unsigned char r3, g3, b3; | |
435 unsigned int clr0_0, clr0_1, clr0_2, clr0_3; | |
436 unsigned int clr1_0, clr1_1, clr1_2, clr1_3; | |
437 unsigned int clr2_0, clr2_1, clr2_2, clr2_3; | |
438 unsigned int clr3_0, clr3_1, clr3_2, clr3_3; | |
439 } XA_2x2_Color; | |
440 | |
441 #define SET_4_YUV_PIXELS(image,x,y,cmap2x2) \ | |
442 image->planes[0][((x)+0)+((y)+0)*image->stride[0]]=cmap2x2->clr0_0;\ | |
443 image->planes[0][((x)+1)+((y)+0)*image->stride[0]]=cmap2x2->clr0_1;\ | |
444 image->planes[0][((x)+0)+((y)+1)*image->stride[0]]=cmap2x2->clr0_2;\ | |
445 image->planes[0][((x)+1)+((y)+1)*image->stride[0]]=cmap2x2->clr0_3;\ | |
446 image->planes[1][((x)>>1)+((y)>>1)*image->stride[1]]=cmap2x2->clr1_0;\ | |
447 image->planes[2][((x)>>1)+((y)>>1)*image->stride[2]]=cmap2x2->clr1_1; | |
448 | |
30555
ad6740b58b0d
libmpcodecs: Mark functions not used outside of their files as static.
diego
parents:
30504
diff
changeset
|
449 static void XA_2x2_OUT_1BLK_Convert(unsigned char *image_p, unsigned int x, unsigned int y, |
7285 | 450 unsigned int imagex, XA_2x2_Color *cmap2x2) |
451 { | |
7298
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
452 mp_image_t *mpi = (mp_image_t *)image_p; |
7285 | 453 |
454 #if 0 | |
7298
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
455 SET_4_YUV_PIXELS(mpi,x,y,cmap2x2) |
7285 | 456 #else |
7298
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
457 SET_4_YUV_PIXELS(mpi,x,y,cmap2x2) |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
458 SET_4_YUV_PIXELS(mpi,x+2,y,cmap2x2) |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
459 SET_4_YUV_PIXELS(mpi,x,y+2,cmap2x2) |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
460 SET_4_YUV_PIXELS(mpi,x+2,y+2,cmap2x2) |
7285 | 461 #endif |
7298
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
462 |
7285 | 463 return; |
464 } | |
465 | |
30555
ad6740b58b0d
libmpcodecs: Mark functions not used outside of their files as static.
diego
parents:
30504
diff
changeset
|
466 static void XA_2x2_OUT_4BLKS_Convert(unsigned char *image_p, unsigned int x, unsigned int y, |
7285 | 467 unsigned int imagex, XA_2x2_Color *cm0, XA_2x2_Color *cm1, XA_2x2_Color *cm2, |
468 XA_2x2_Color *cm3) | |
469 { | |
7298
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
470 mp_image_t *mpi = (mp_image_t *)image_p; |
7285 | 471 |
7298
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
472 SET_4_YUV_PIXELS(mpi,x,y,cm0) |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
473 SET_4_YUV_PIXELS(mpi,x+2,y,cm1) |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
474 SET_4_YUV_PIXELS(mpi,x,y+2,cm2) |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
475 SET_4_YUV_PIXELS(mpi,x+2,y+2,cm3) |
7285 | 476 return; |
477 } | |
478 | |
30565
6e85fdf79584
Revert marking seemingly unused XAnim-binary-related functions as static.
diego
parents:
30555
diff
changeset
|
479 void *YUV2x2_Blk_Func(unsigned int image_type, int blks, unsigned int dith_flag) |
7285 | 480 { |
33841
25667edae85c
cleanup: adjust printf format strings to match parameter types
diego
parents:
32537
diff
changeset
|
481 mp_dbg(MSGT_DECVIDEO,MSGL_DBG2, |
25667edae85c
cleanup: adjust printf format strings to match parameter types
diego
parents:
32537
diff
changeset
|
482 "YUV2x2_Blk_Func(image_type=%u, blks=%d, dith_flag=%u)\n", |
7285 | 483 image_type, blks, dith_flag); |
484 switch(blks){ | |
485 case 1: | |
486 return (void*) XA_2x2_OUT_1BLK_Convert; | |
487 case 4: | |
488 return (void*) XA_2x2_OUT_4BLKS_Convert; | |
489 } | |
490 | |
33841
25667edae85c
cleanup: adjust printf format strings to match parameter types
diego
parents:
32537
diff
changeset
|
491 mp_msg(MSGT_DECVIDEO, MSGL_WARN, |
25667edae85c
cleanup: adjust printf format strings to match parameter types
diego
parents:
32537
diff
changeset
|
492 "Unimplemented: YUV2x2_Blk_Func(image_type=%u blks=%d dith=%u)\n", |
25667edae85c
cleanup: adjust printf format strings to match parameter types
diego
parents:
32537
diff
changeset
|
493 image_type, blks, dith_flag); |
7285 | 494 return (void*) XA_dummy; |
495 } | |
496 | |
497 // Take Four Y's and UV and put them into a 2x2 Color structure. | |
498 | |
30555
ad6740b58b0d
libmpcodecs: Mark functions not used outside of their files as static.
diego
parents:
30504
diff
changeset
|
499 static void XA_YUV_2x2_clr(XA_2x2_Color *cmap2x2, unsigned int Y0, unsigned int Y1, |
7285 | 500 unsigned int Y2, unsigned int Y3, unsigned int U, unsigned int V, |
501 unsigned int map_flag, unsigned int *map, XA_CHDR *chdr) | |
502 { | |
503 | |
33841
25667edae85c
cleanup: adjust printf format strings to match parameter types
diego
parents:
32537
diff
changeset
|
504 mp_dbg(MSGT_DECVIDEO, MSGL_DBG3, |
25667edae85c
cleanup: adjust printf format strings to match parameter types
diego
parents:
32537
diff
changeset
|
505 "XA_YUV_2x2_clr(%p [%u,%u,%u,%u][%u][%u] %u %p %p)\n", |
25667edae85c
cleanup: adjust printf format strings to match parameter types
diego
parents:
32537
diff
changeset
|
506 cmap2x2, Y0, Y1, Y2, Y3, U, V, map_flag, map, chdr); |
7285 | 507 |
508 cmap2x2->clr0_0=Y0; | |
509 cmap2x2->clr0_1=Y1; | |
510 cmap2x2->clr0_2=Y2; | |
511 cmap2x2->clr0_3=Y3; | |
512 cmap2x2->clr1_0=U; | |
513 cmap2x2->clr1_1=V; | |
514 return; | |
515 } | |
516 | |
30565
6e85fdf79584
Revert marking seemingly unused XAnim-binary-related functions as static.
diego
parents:
30555
diff
changeset
|
517 void *YUV2x2_Map_Func(unsigned int image_type, unsigned int dith_type) |
7285 | 518 { |
33841
25667edae85c
cleanup: adjust printf format strings to match parameter types
diego
parents:
32537
diff
changeset
|
519 mp_dbg(MSGT_DECVIDEO, MSGL_DBG2, |
25667edae85c
cleanup: adjust printf format strings to match parameter types
diego
parents:
32537
diff
changeset
|
520 "YUV2x2_Map_Func('image_type: %u', 'dith_type: %u')", |
25667edae85c
cleanup: adjust printf format strings to match parameter types
diego
parents:
32537
diff
changeset
|
521 image_type, dith_type); |
26754
63630c09e237
cosmetics: Remove pointless parentheses from return calls.
diego
parents:
26542
diff
changeset
|
522 return (void*)XA_YUV_2x2_clr; |
7285 | 523 } |
524 | |
525 /* -------------------- whole YUV frame converters ------------------------- */ | |
526 | |
527 typedef struct | |
528 { | |
529 unsigned char *Ybuf; | |
530 unsigned char *Ubuf; | |
531 unsigned char *Vbuf; | |
532 unsigned char *the_buf; | |
533 unsigned int the_buf_size; | |
534 unsigned short y_w, y_h; | |
535 unsigned short uv_w, uv_h; | |
536 } YUVBufs; | |
537 | |
538 typedef struct | |
539 { | |
540 unsigned long Uskip_mask; | |
541 long *YUV_Y_tab; | |
542 long *YUV_UB_tab; | |
543 long *YUV_VR_tab; | |
544 long *YUV_UG_tab; | |
545 long *YUV_VG_tab; | |
546 } YUVTabs; | |
547 | |
548 YUVBufs jpg_YUVBufs; | |
549 YUVTabs def_yuv_tabs; | |
550 | |
551 /* -------------- YUV 4x4 1x1 1x1 (4:1:0 aka YVU9) [Indeo 3,4,5] ------------------ */ | |
552 | |
30555
ad6740b58b0d
libmpcodecs: Mark functions not used outside of their files as static.
diego
parents:
30504
diff
changeset
|
553 static void XA_YUV1611_Convert(unsigned char *image_p, unsigned int imagex, unsigned int imagey, |
7285 | 554 unsigned int i_x, unsigned int i_y, YUVBufs *yuv, YUVTabs *yuv_tabs, |
555 unsigned int map_flag, unsigned int *map, XA_CHDR *chdr) | |
556 { | |
7355 | 557 sh_video_t *sh = (sh_video_t*)image_p; |
558 vd_xanim_ctx *priv = sh->context; | |
559 mp_image_t *mpi; | |
7285 | 560 int y; |
7355 | 561 int ystride=(yuv->y_w)?yuv->y_w:imagex; |
562 int uvstride=(yuv->uv_w)?yuv->uv_w:(imagex/4); | |
7285 | 563 |
33841
25667edae85c
cleanup: adjust printf format strings to match parameter types
diego
parents:
32537
diff
changeset
|
564 mp_dbg(MSGT_DECVIDEO, MSGL_DBG3, "YUVTabs: %lu %p %p %p %p %p\n", |
25667edae85c
cleanup: adjust printf format strings to match parameter types
diego
parents:
32537
diff
changeset
|
565 yuv_tabs->Uskip_mask, |
7285 | 566 yuv_tabs->YUV_Y_tab, |
567 yuv_tabs->YUV_UB_tab, | |
568 yuv_tabs->YUV_VR_tab, | |
569 yuv_tabs->YUV_UG_tab, | |
570 yuv_tabs->YUV_VG_tab ); | |
571 | |
33841
25667edae85c
cleanup: adjust printf format strings to match parameter types
diego
parents:
32537
diff
changeset
|
572 mp_dbg(MSGT_DECVIDEO, MSGL_DBG3, |
25667edae85c
cleanup: adjust printf format strings to match parameter types
diego
parents:
32537
diff
changeset
|
573 "XA_YUV1611_Convert('image: %p', 'imagex: %u', 'imagey: %u', 'i_x: %u', 'i_y: %u', 'yuv_bufs: %p', 'yuv_tabs: %p', 'map_flag: %u', 'map: %p', 'chdr: %p')", |
7298
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
574 image_p, imagex, imagey, i_x, i_y, yuv, yuv_tabs, map_flag, map, chdr); |
7285 | 575 |
33841
25667edae85c
cleanup: adjust printf format strings to match parameter types
diego
parents:
32537
diff
changeset
|
576 mp_dbg(MSGT_DECVIDEO,MSGL_DBG3, "YUV: %p %p %p %p (%u) %hux%hu %hux%hu\n", |
7285 | 577 yuv->Ybuf,yuv->Ubuf,yuv->Vbuf,yuv->the_buf,yuv->the_buf_size, |
578 yuv->y_w,yuv->y_h,yuv->uv_w,yuv->uv_h); | |
579 | |
7355 | 580 if(!yuv_tabs->YUV_Y_tab){ |
581 // standard YVU9 - simply export it! | |
582 mpi = mpcodecs_get_image(sh, MP_IMGTYPE_EXPORT, 0, | |
583 sh->disp_w, sh->disp_h); | |
584 priv->mpi=mpi; if(!mpi) return; // ERROR! | |
585 mpi->planes[0]=yuv->Ybuf; | |
586 mpi->planes[1]=yuv->Ubuf; | |
587 mpi->planes[2]=yuv->Vbuf; | |
588 mpi->width=imagex; | |
589 mpi->stride[0]=ystride; //i_x; // yuv->y_w | |
590 mpi->stride[1]=mpi->stride[2]=uvstride; //i_x/4; // yuv->uv_w | |
7285 | 591 return; |
592 } | |
593 | |
7355 | 594 // allocate TEMP buffer and convert the image: |
595 mpi = mpcodecs_get_image(sh, MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE, | |
596 sh->disp_w, sh->disp_h); | |
597 priv->mpi=mpi; if(!mpi) return; // ERROR! | |
7285 | 598 |
7355 | 599 // convert the Y plane: |
600 for(y=0;y<(int)imagey;y++){ | |
601 unsigned int x; | |
602 unsigned char* s=yuv->Ybuf+ystride*y; | |
603 unsigned char* d=mpi->planes[0]+mpi->stride[0]*y; | |
604 for(x=0;x<imagex;x++) d[x]=s[x]<<1; | |
605 } | |
606 | |
7285 | 607 imagex>>=2; |
608 imagey>>=2; | |
609 | |
7355 | 610 // convert the U plane: |
7298
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
611 for(y=0;y<(int)imagey;y++){ |
7355 | 612 unsigned int x; |
613 unsigned char* s=yuv->Ubuf+uvstride*y; | |
614 unsigned char* d=mpi->planes[1]+mpi->stride[1]*y; | |
615 for(x=0;x<imagex;x++) d[x]=s[x]<<1; | |
7285 | 616 } |
7298
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
617 |
7355 | 618 // convert the V plane: |
619 for(y=0;y<(int)imagey;y++){ | |
620 unsigned int x; | |
621 unsigned char* s=yuv->Vbuf+uvstride*y; | |
622 unsigned char* d=mpi->planes[2]+mpi->stride[2]*y; | |
623 for(x=0;x<imagex;x++) d[x]=s[x]<<1; | |
624 } | |
7285 | 625 } |
626 | |
30565
6e85fdf79584
Revert marking seemingly unused XAnim-binary-related functions as static.
diego
parents:
30555
diff
changeset
|
627 void *XA_YUV1611_Func(unsigned int image_type) |
7285 | 628 { |
33841
25667edae85c
cleanup: adjust printf format strings to match parameter types
diego
parents:
32537
diff
changeset
|
629 mp_dbg(MSGT_DECVIDEO, MSGL_DBG2, "XA_YUV1611_Func('image_type: %u')", image_type); |
26754
63630c09e237
cosmetics: Remove pointless parentheses from return calls.
diego
parents:
26542
diff
changeset
|
630 return (void *)XA_YUV1611_Convert; |
7285 | 631 } |
632 | |
633 /* --------------- YUV 2x2 1x1 1x1 (4:2:0 aka YV12) [3ivX,H263] ------------ */ | |
634 | |
30555
ad6740b58b0d
libmpcodecs: Mark functions not used outside of their files as static.
diego
parents:
30504
diff
changeset
|
635 static void XA_YUV221111_Convert(unsigned char *image_p, unsigned int imagex, unsigned int imagey, |
7285 | 636 unsigned int i_x, unsigned int i_y, YUVBufs *yuv, YUVTabs *yuv_tabs, unsigned int map_flag, |
637 unsigned int *map, XA_CHDR *chdr) | |
638 { | |
7355 | 639 sh_video_t *sh = (sh_video_t*)image_p; |
640 vd_xanim_ctx *priv = sh->context; | |
641 mp_image_t *mpi; | |
642 // note: 3ivX codec doesn't set y_w, uv_w, they are random junk :( | |
643 int ystride=imagex; //(yuv->y_w)?yuv->y_w:imagex; | |
644 int uvstride=imagex/2; //(yuv->uv_w)?yuv->uv_w:(imagex/2); | |
7285 | 645 |
33841
25667edae85c
cleanup: adjust printf format strings to match parameter types
diego
parents:
32537
diff
changeset
|
646 mp_dbg(MSGT_DECVIDEO, MSGL_DBG3, |
25667edae85c
cleanup: adjust printf format strings to match parameter types
diego
parents:
32537
diff
changeset
|
647 "XA_YUV221111_Convert(%p %ux%u %u;%u [%dx%d] %p %p %u %p %p)\n", |
7383 | 648 image_p,imagex,imagey,i_x,i_y, sh->disp_w, sh->disp_h, |
7285 | 649 yuv,yuv_tabs,map_flag,map,chdr); |
650 | |
33841
25667edae85c
cleanup: adjust printf format strings to match parameter types
diego
parents:
32537
diff
changeset
|
651 mp_dbg(MSGT_DECVIDEO,MSGL_DBG3, "YUV: %p %p %p %p (%X) %hXx%hX %hXx%hX\n", |
7285 | 652 yuv->Ybuf,yuv->Ubuf,yuv->Vbuf,yuv->the_buf,yuv->the_buf_size, |
653 yuv->y_w,yuv->y_h,yuv->uv_w,yuv->uv_h); | |
654 | |
7355 | 655 // standard YV12 - simply export it! |
656 mpi = mpcodecs_get_image(sh, MP_IMGTYPE_EXPORT, 0, sh->disp_w, sh->disp_h); | |
657 priv->mpi=mpi; if(!mpi) return; // ERROR! | |
7298
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
658 mpi->planes[0]=yuv->Ybuf; |
7355 | 659 mpi->planes[1]=yuv->Ubuf; |
660 mpi->planes[2]=yuv->Vbuf; | |
661 mpi->width=imagex; | |
662 mpi->stride[0]=ystride; //i_x; // yuv->y_w | |
663 mpi->stride[1]=mpi->stride[2]=uvstride; //=i_x/4; // yuv->uv_w | |
7285 | 664 } |
665 | |
30565
6e85fdf79584
Revert marking seemingly unused XAnim-binary-related functions as static.
diego
parents:
30555
diff
changeset
|
666 void *XA_YUV221111_Func(unsigned int image_type) |
7285 | 667 { |
33841
25667edae85c
cleanup: adjust printf format strings to match parameter types
diego
parents:
32537
diff
changeset
|
668 mp_dbg(MSGT_DECVIDEO,MSGL_DBG2, "XA_YUV221111_Func('image_type: %u')\n",image_type); |
26754
63630c09e237
cosmetics: Remove pointless parentheses from return calls.
diego
parents:
26542
diff
changeset
|
669 return (void *)XA_YUV221111_Convert; |
7285 | 670 } |
671 | |
672 /* *** EOF XANIM *** */ | |
4969 | 673 |
674 // to set/get/query special features/parameters | |
675 static int control(sh_video_t *sh,int cmd,void* arg,...){ | |
676 return CONTROL_UNKNOWN; | |
677 } | |
678 | |
679 // init driver | |
7298
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
680 static int init(sh_video_t *sh) |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
681 { |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
682 vd_xanim_ctx *priv; |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
683 char dll[1024]; |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
684 XA_CODEC_HDR codec_hdr; |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
685 int i; |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
26754
diff
changeset
|
686 |
7298
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
687 priv = malloc(sizeof(vd_xanim_ctx)); |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
688 if (!priv) |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
689 return 0; |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
690 sh->context = priv; |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
691 memset(priv, 0, sizeof(vd_xanim_ctx)); |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
692 |
6525 | 693 if(!mpcodecs_config_vo(sh,sh->disp_w,sh->disp_h,IMGFMT_YV12)) return 0; |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
26754
diff
changeset
|
694 |
7298
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
695 priv->iq_func = NULL; |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
696 priv->dec_func = NULL; |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
697 |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
698 for (i=0; i < XA_CLOSE_FUNCS; i++) |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
699 xa_close_func[i] = NULL; |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
700 |
30907
b32527b30d17
Get rid of pointless def_path variable; use codec_path directly instead.
diego
parents:
30901
diff
changeset
|
701 snprintf(dll, 1024, "%s/%s", codec_path, sh->codec->dll); |
7298
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
702 if (xacodec_load(sh, dll) == 0) |
26754
63630c09e237
cosmetics: Remove pointless parentheses from return calls.
diego
parents:
26542
diff
changeset
|
703 return 0; |
7298
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
704 |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
705 codec_hdr.xapi_rev = XAVID_API_REV; |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
706 codec_hdr.anim_hdr = malloc(4096); |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
707 codec_hdr.description = sh->codec->info; |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
708 codec_hdr.compression = bswap_32(sh->bih->biCompression); |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
709 codec_hdr.decoder = NULL; |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
710 codec_hdr.x = sh->bih->biWidth; /* ->disp_w */ |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
711 codec_hdr.y = sh->bih->biHeight; /* ->disp_h */ |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
712 /* extra fields to store palette */ |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
713 codec_hdr.avi_ctab_flag = 0; |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
714 codec_hdr.avi_read_ext = NULL; |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
715 codec_hdr.extra = NULL; |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
716 |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
717 switch(sh->codec->outfmt[sh->outfmtidx]) |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
718 { |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
719 case IMGFMT_BGR32: |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
720 codec_hdr.depth = 32; |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
721 break; |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
722 case IMGFMT_BGR24: |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
723 codec_hdr.depth = 24; |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
724 break; |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
725 case IMGFMT_IYUV: |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
726 case IMGFMT_I420: |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
727 case IMGFMT_YV12: |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
728 codec_hdr.depth = 12; |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
729 break; |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
730 case IMGFMT_YVU9: |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
731 codec_hdr.depth = 9; |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
732 break; |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
733 default: |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
734 mp_msg(MSGT_DECVIDEO, MSGL_FATAL, "xacodec: not supported image out format (%s)\n", |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
735 vo_format_name(sh->codec->outfmt[sh->outfmtidx])); |
26754
63630c09e237
cosmetics: Remove pointless parentheses from return calls.
diego
parents:
26542
diff
changeset
|
736 return 0; |
7298
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
737 } |
33841
25667edae85c
cleanup: adjust printf format strings to match parameter types
diego
parents:
32537
diff
changeset
|
738 mp_msg(MSGT_DECVIDEO, MSGL_INFO, |
25667edae85c
cleanup: adjust printf format strings to match parameter types
diego
parents:
32537
diff
changeset
|
739 "xacodec: querying for input %ux%u %ubit [fourcc: %4x] (%s)...\n", |
7298
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
740 codec_hdr.x, codec_hdr.y, codec_hdr.depth, codec_hdr.compression, codec_hdr.description); |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
741 |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
742 if (xacodec_query(sh, &codec_hdr) == 0) |
26754
63630c09e237
cosmetics: Remove pointless parentheses from return calls.
diego
parents:
26542
diff
changeset
|
743 return 0; |
7298
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
744 |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
745 // free(codec_hdr.anim_hdr); |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
746 |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
747 priv->decinfo = malloc(sizeof(XA_DEC_INFO)); |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
748 if (priv->decinfo == NULL) |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
749 { |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
750 mp_msg(MSGT_DECVIDEO, MSGL_FATAL, "xacodec: memory allocation error: %s\n", |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
751 strerror(errno)); |
26754
63630c09e237
cosmetics: Remove pointless parentheses from return calls.
diego
parents:
26542
diff
changeset
|
752 return 0; |
7298
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
753 } |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
754 priv->decinfo->cmd = 0; |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
755 priv->decinfo->skip_flag = 0; |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
756 priv->decinfo->imagex = priv->decinfo->xe = codec_hdr.x; |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
757 priv->decinfo->imagey = priv->decinfo->ye = codec_hdr.y; |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
758 priv->decinfo->imaged = codec_hdr.depth; |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
759 priv->decinfo->chdr = NULL; |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
760 priv->decinfo->map_flag = 0; /* xaFALSE */ |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
761 priv->decinfo->map = NULL; |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
762 priv->decinfo->xs = priv->decinfo->ys = 0; |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
763 priv->decinfo->special = 0; |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
764 priv->decinfo->extra = codec_hdr.extra; |
17366 | 765 mp_msg(MSGT_DECVIDEO, MSGL_DBG2, "decinfo->extra, filled by codec: %p [%s]\n", |
766 &priv->decinfo->extra, (char *)priv->decinfo->extra); | |
7298
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
767 |
26754
63630c09e237
cosmetics: Remove pointless parentheses from return calls.
diego
parents:
26542
diff
changeset
|
768 return 1; |
4969 | 769 } |
770 | |
771 // uninit driver | |
7298
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
772 static void uninit(sh_video_t *sh) |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
773 { |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
774 vd_xanim_ctx *priv = sh->context; |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
775 int i; |
31545 | 776 void (*close_func)(void); |
7298
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
777 |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
778 for (i=0; i < XA_CLOSE_FUNCS; i++) |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
779 if (xa_close_func[i]) |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
780 { |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
781 close_func = xa_close_func[i]; |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
782 close_func(); |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
783 } |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
784 dlclose(priv->file_handler); |
32537
8fa2f43cb760
Remove most of the NULL pointer check before free all over the code
cboesch
parents:
31545
diff
changeset
|
785 free(priv->decinfo); |
7298
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
786 free(priv); |
4969 | 787 } |
788 | |
7298
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
789 // unsigned int (*dec_func)(unsigned char *image, unsigned char *delta, |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
790 // unsigned int dsize, XA_DEC_INFO *dec_info); |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
791 |
4969 | 792 // decode a frame |
7298
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
793 static mp_image_t* decode(sh_video_t *sh, void *data, int len, int flags) |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
794 { |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
795 vd_xanim_ctx *priv = sh->context; |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
796 unsigned int ret; |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
26754
diff
changeset
|
797 |
7298
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
798 if (len <= 0) |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
799 return NULL; // skipped frame |
4969 | 800 |
7298
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
801 priv->decinfo->skip_flag = (flags&3)?1:0; |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
802 |
7355 | 803 if(sh->codec->outflags[sh->outfmtidx] & CODECS_FLAG_STATIC){ |
804 // allocate static buffer for cvid-like codecs: | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
26754
diff
changeset
|
805 priv->mpi = mpcodecs_get_image(sh, MP_IMGTYPE_STATIC, |
7355 | 806 MP_IMGFLAG_ACCEPT_STRIDE|MP_IMGFLAG_PREFER_ALIGNED_STRIDE, |
807 (sh->disp_w+3)&(~3), (sh->disp_h+3)&(~3)); | |
808 if (!priv->mpi) return NULL; | |
809 ret = priv->dec_func((uint8_t*)priv->mpi, data, len, priv->decinfo); | |
810 } else { | |
811 // left the buffer allocation to the codecs, pass sh_video && priv | |
812 priv->mpi=NULL; | |
813 ret = priv->dec_func((uint8_t*)sh, data, len, priv->decinfo); | |
814 } | |
7298
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
815 |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
816 if (ret == ACT_DLTA_NORM) |
7355 | 817 return priv->mpi; |
4969 | 818 |
7298
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
819 if (ret & ACT_DLTA_MAPD) |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
820 mp_msg(MSGT_DECVIDEO, MSGL_DBG2, "mapd\n"); |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
821 /* |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
822 if (!(ret & ACT_DLT_MAPD)) |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
823 xacodec_driver->decinfo->map_flag = 0; |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
824 else |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
825 { |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
826 xacodec_driver->decinfo->map_flag = 1; |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
827 xacodec_driver->decinfo->map = ... |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
828 } |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
829 */ |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
830 |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
831 if (ret & ACT_DLTA_XOR) |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
832 { |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
833 mp_msg(MSGT_DECVIDEO, MSGL_DBG2, "xor\n"); |
7355 | 834 return priv->mpi; |
7298
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
835 } |
4969 | 836 |
7298
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
837 /* nothing changed */ |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
838 if (ret & ACT_DLTA_NOP) |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
839 { |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
840 mp_msg(MSGT_DECVIDEO, MSGL_DBG2, "nop\n"); |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
841 return NULL; |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
842 } |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
843 |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
844 /* frame dropped (also display latest frame) */ |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
845 if (ret & ACT_DLTA_DROP) |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
846 { |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
847 mp_msg(MSGT_DECVIDEO, MSGL_DBG2, "drop\n"); |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
848 return NULL; |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
849 } |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
850 |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
851 if (ret & ACT_DLTA_BAD) |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
852 { |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
853 mp_msg(MSGT_DECVIDEO, MSGL_DBG2, "bad\n"); |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
854 return NULL; |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
855 } |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
856 |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
857 /* used for double buffer */ |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
858 if (ret & ACT_DLTA_BODY) |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
859 { |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
860 mp_msg(MSGT_DECVIDEO, MSGL_DBG2, "body\n"); |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
861 return NULL; |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
862 } |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
26754
diff
changeset
|
863 |
7355 | 864 return priv->mpi; |
4969 | 865 } |