annotate libmpcodecs/vd_xvid.c @ 7046:e6cab2610139

sync by anders@gnulinux.dk
author jaf
date Mon, 19 Aug 2002 11:17:24 +0000
parents 5ca9fc4d2994
children 28677d779205
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
6701
522713337297 Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff changeset
1 #include <stdio.h>
522713337297 Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff changeset
2 #include <stdlib.h>
522713337297 Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff changeset
3
522713337297 Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff changeset
4 #include "config.h"
522713337297 Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff changeset
5 #include "mp_msg.h"
522713337297 Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff changeset
6
522713337297 Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff changeset
7 #ifdef HAVE_XVID
522713337297 Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff changeset
8
522713337297 Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff changeset
9 #include "vd_internal.h"
6756
6af6d7b40638 Add direct rendering method 2
albeu
parents: 6701
diff changeset
10 #include "cfgparser.h"
6701
522713337297 Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff changeset
11
522713337297 Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff changeset
12 #include <divx4.h>
522713337297 Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff changeset
13 #include <xvid.h>
522713337297 Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff changeset
14
522713337297 Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff changeset
15 static vd_info_t info =
522713337297 Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff changeset
16 {
522713337297 Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff changeset
17 "xvid decoder",
522713337297 Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff changeset
18 "xvid",
522713337297 Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff changeset
19 VFM_XVID,
522713337297 Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff changeset
20 "Albeu",
522713337297 Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff changeset
21 "Albeu",
522713337297 Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff changeset
22 ""
522713337297 Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff changeset
23 };
522713337297 Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff changeset
24
522713337297 Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff changeset
25 LIBVD_EXTERN(xvid)
522713337297 Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff changeset
26
522713337297 Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff changeset
27 typedef struct {
522713337297 Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff changeset
28 int cs;
6756
6af6d7b40638 Add direct rendering method 2
albeu
parents: 6701
diff changeset
29 unsigned char img_type;
6701
522713337297 Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff changeset
30 void* hdl;
522713337297 Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff changeset
31 mp_image_t* mpi;
522713337297 Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff changeset
32 } priv_t;
522713337297 Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff changeset
33
6756
6af6d7b40638 Add direct rendering method 2
albeu
parents: 6701
diff changeset
34 static int do_dr2 = 0;
6af6d7b40638 Add direct rendering method 2
albeu
parents: 6701
diff changeset
35
6af6d7b40638 Add direct rendering method 2
albeu
parents: 6701
diff changeset
36 struct config xvid_dec_opts[] = {
6af6d7b40638 Add direct rendering method 2
albeu
parents: 6701
diff changeset
37 { "dr2", &do_dr2, CONF_TYPE_FLAG, 0, 0, 1, NULL},
6af6d7b40638 Add direct rendering method 2
albeu
parents: 6701
diff changeset
38 { "nodr2", &do_dr2, CONF_TYPE_FLAG, 0, 1, 0, NULL},
6af6d7b40638 Add direct rendering method 2
albeu
parents: 6701
diff changeset
39 {NULL, NULL, 0, 0, 0, 0, NULL}
6af6d7b40638 Add direct rendering method 2
albeu
parents: 6701
diff changeset
40 };
6af6d7b40638 Add direct rendering method 2
albeu
parents: 6701
diff changeset
41
6701
522713337297 Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff changeset
42 // to set/get/query special features/parameters
522713337297 Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff changeset
43 static int control(sh_video_t *sh,int cmd,void* arg,...){
522713337297 Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff changeset
44 return CONTROL_UNKNOWN;
522713337297 Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff changeset
45 }
522713337297 Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff changeset
46
522713337297 Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff changeset
47 // init driver
522713337297 Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff changeset
48 static int init(sh_video_t *sh){
522713337297 Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff changeset
49 XVID_INIT_PARAM ini;
522713337297 Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff changeset
50 XVID_DEC_PARAM dec_p;
522713337297 Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff changeset
51 priv_t* p;
522713337297 Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff changeset
52 int cs;
522713337297 Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff changeset
53
522713337297 Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff changeset
54 memset(&ini,0,sizeof(XVID_INIT_PARAM));
522713337297 Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff changeset
55 memset(&dec_p,0,sizeof(XVID_DEC_PARAM));
522713337297 Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff changeset
56
522713337297 Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff changeset
57 if(!mpcodecs_config_vo(sh,sh->disp_w,sh->disp_h,IMGFMT_YV12))
522713337297 Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff changeset
58 return 0;
522713337297 Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff changeset
59
522713337297 Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff changeset
60 switch(sh->codec->outfmt[sh->outfmtidx]){
522713337297 Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff changeset
61 case IMGFMT_YV12:
6767
a6240ba29795 support for older xvid versions and IMGFMT_IYUV
alex
parents: 6756
diff changeset
62 #ifdef XVID_CSP_EXTERN
6756
6af6d7b40638 Add direct rendering method 2
albeu
parents: 6701
diff changeset
63 cs= do_dr2 ? XVID_CSP_EXTERN : XVID_CSP_USER;
6767
a6240ba29795 support for older xvid versions and IMGFMT_IYUV
alex
parents: 6756
diff changeset
64 #else
a6240ba29795 support for older xvid versions and IMGFMT_IYUV
alex
parents: 6756
diff changeset
65 cs= XVID_CSP_USER;
a6240ba29795 support for older xvid versions and IMGFMT_IYUV
alex
parents: 6756
diff changeset
66 #endif
6701
522713337297 Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff changeset
67 break;
522713337297 Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff changeset
68 case IMGFMT_YUY2:
522713337297 Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff changeset
69 cs=XVID_CSP_YUY2;
522713337297 Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff changeset
70 break;
522713337297 Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff changeset
71 case IMGFMT_UYVY:
522713337297 Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff changeset
72 cs=XVID_CSP_UYVY;
522713337297 Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff changeset
73 break;
522713337297 Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff changeset
74 case IMGFMT_I420:
6767
a6240ba29795 support for older xvid versions and IMGFMT_IYUV
alex
parents: 6756
diff changeset
75 case IMGFMT_IYUV:
6701
522713337297 Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff changeset
76 cs=XVID_CSP_I420;
522713337297 Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff changeset
77 break;
522713337297 Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff changeset
78 case IMGFMT_BGR15:
522713337297 Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff changeset
79 cs=XVID_CSP_RGB555;
522713337297 Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff changeset
80 break;
522713337297 Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff changeset
81 case IMGFMT_BGR16:
522713337297 Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff changeset
82 cs=XVID_CSP_RGB565;
522713337297 Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff changeset
83 break;
522713337297 Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff changeset
84 case IMGFMT_BGR24:
522713337297 Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff changeset
85 cs=XVID_CSP_RGB24;
522713337297 Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff changeset
86 break;
522713337297 Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff changeset
87 case IMGFMT_BGR32:
522713337297 Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff changeset
88 cs=XVID_CSP_RGB32;
522713337297 Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff changeset
89 break;
522713337297 Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff changeset
90 case IMGFMT_YVYU:
522713337297 Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff changeset
91 cs=XVID_CSP_YVYU;
522713337297 Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff changeset
92 break;
522713337297 Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff changeset
93 default:
522713337297 Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff changeset
94 mp_msg(MSGT_DECVIDEO,MSGL_ERR,"Unsupported out_fmt: 0x%X\n",sh->codec->outfmt[sh->outfmtidx]);
522713337297 Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff changeset
95 return 0;
522713337297 Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff changeset
96 }
522713337297 Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff changeset
97
522713337297 Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff changeset
98 if(xvid_init(NULL, 0, &ini, NULL))
522713337297 Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff changeset
99 return 0;
522713337297 Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff changeset
100
522713337297 Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff changeset
101 if(ini.api_version != API_VERSION) {
522713337297 Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff changeset
102 if(ini.api_version < API_VERSION) {
522713337297 Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff changeset
103 mp_msg(MSGT_DECVIDEO,MSGL_ERR,"Too old version of xivd (min. %d)\n",API_VERSION);
522713337297 Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff changeset
104 return 0;
522713337297 Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff changeset
105 }
522713337297 Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff changeset
106 mp_msg(MSGT_DECVIDEO,MSGL_WARN,"Bad xvid version %d was compiled with %d\n",
522713337297 Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff changeset
107 ini.api_version,API_VERSION);
522713337297 Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff changeset
108 }
522713337297 Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff changeset
109
522713337297 Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff changeset
110 dec_p.width = sh->disp_w;
522713337297 Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff changeset
111 dec_p.height = sh->disp_h;
522713337297 Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff changeset
112
522713337297 Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff changeset
113 if(xvid_decore(NULL, XVID_DEC_CREATE, &dec_p, NULL)) {
522713337297 Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff changeset
114 mp_msg(MSGT_DECVIDEO,MSGL_ERR,"xvid init failed\n");
522713337297 Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff changeset
115 return 0;
522713337297 Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff changeset
116 }
522713337297 Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff changeset
117
522713337297 Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff changeset
118 p = (priv_t*)malloc(sizeof(priv_t));
522713337297 Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff changeset
119 p->cs = cs;
522713337297 Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff changeset
120 p->hdl = dec_p.handle;
522713337297 Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff changeset
121 sh->context = p;
522713337297 Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff changeset
122
6756
6af6d7b40638 Add direct rendering method 2
albeu
parents: 6701
diff changeset
123 switch(cs) {
6767
a6240ba29795 support for older xvid versions and IMGFMT_IYUV
alex
parents: 6756
diff changeset
124 #ifdef XVID_CSP_EXTERN
6756
6af6d7b40638 Add direct rendering method 2
albeu
parents: 6701
diff changeset
125 case XVID_CSP_EXTERN:
6af6d7b40638 Add direct rendering method 2
albeu
parents: 6701
diff changeset
126 p->img_type = MP_IMGTYPE_STATIC;
6af6d7b40638 Add direct rendering method 2
albeu
parents: 6701
diff changeset
127 break;
6767
a6240ba29795 support for older xvid versions and IMGFMT_IYUV
alex
parents: 6756
diff changeset
128 #endif
6756
6af6d7b40638 Add direct rendering method 2
albeu
parents: 6701
diff changeset
129 case XVID_CSP_USER:
6af6d7b40638 Add direct rendering method 2
albeu
parents: 6701
diff changeset
130 p->img_type = MP_IMGTYPE_EXPORT;
6af6d7b40638 Add direct rendering method 2
albeu
parents: 6701
diff changeset
131 break;
6af6d7b40638 Add direct rendering method 2
albeu
parents: 6701
diff changeset
132 default:
6af6d7b40638 Add direct rendering method 2
albeu
parents: 6701
diff changeset
133 p->img_type = MP_IMGTYPE_TEMP;
6af6d7b40638 Add direct rendering method 2
albeu
parents: 6701
diff changeset
134 break;
6af6d7b40638 Add direct rendering method 2
albeu
parents: 6701
diff changeset
135 }
6af6d7b40638 Add direct rendering method 2
albeu
parents: 6701
diff changeset
136
6701
522713337297 Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff changeset
137 return 1;
522713337297 Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff changeset
138 }
522713337297 Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff changeset
139
522713337297 Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff changeset
140 // uninit driver
522713337297 Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff changeset
141 static void uninit(sh_video_t *sh){
522713337297 Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff changeset
142 priv_t* p = sh->context;
522713337297 Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff changeset
143 if(!p)
522713337297 Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff changeset
144 return;
522713337297 Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff changeset
145 xvid_decore(p->hdl,XVID_DEC_DESTROY, NULL, NULL);
522713337297 Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff changeset
146 free(p);
522713337297 Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff changeset
147 }
522713337297 Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff changeset
148
522713337297 Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff changeset
149 // decode a frame
522713337297 Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff changeset
150 static mp_image_t* decode(sh_video_t *sh,void* data,int len,int flags){
522713337297 Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff changeset
151 XVID_DEC_FRAME dec;
522713337297 Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff changeset
152 DEC_PICTURE d4_pic;
6915
5ca9fc4d2994 compilation bug found by Julien Portalier <julien@portalier.com>
arpi
parents: 6767
diff changeset
153 #ifdef XVID_CSP_EXTERN
6756
6af6d7b40638 Add direct rendering method 2
albeu
parents: 6701
diff changeset
154 XVID_DEC_PICTURE pic;
6915
5ca9fc4d2994 compilation bug found by Julien Portalier <julien@portalier.com>
arpi
parents: 6767
diff changeset
155 #endif
6701
522713337297 Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff changeset
156 priv_t* p = sh->context;
522713337297 Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff changeset
157
6756
6af6d7b40638 Add direct rendering method 2
albeu
parents: 6701
diff changeset
158 mp_image_t* mpi = mpcodecs_get_image(sh, p->img_type,
6701
522713337297 Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff changeset
159 MP_IMGFLAG_ACCEPT_STRIDE,
522713337297 Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff changeset
160 sh->disp_w,sh->disp_h);
522713337297 Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff changeset
161
522713337297 Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff changeset
162 if(!data || !mpi || len <= 0)
522713337297 Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff changeset
163 return NULL;
522713337297 Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff changeset
164
522713337297 Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff changeset
165 memset(&dec,0,sizeof(XVID_DEC_FRAME));
522713337297 Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff changeset
166
522713337297 Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff changeset
167 dec.bitstream = data;
522713337297 Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff changeset
168 dec.length = len;
522713337297 Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff changeset
169 switch(p->cs) {
522713337297 Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff changeset
170 case XVID_CSP_USER:
522713337297 Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff changeset
171 dec.image = &d4_pic;
522713337297 Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff changeset
172 break;
6767
a6240ba29795 support for older xvid versions and IMGFMT_IYUV
alex
parents: 6756
diff changeset
173 #ifdef XVID_CSP_EXTERN
6756
6af6d7b40638 Add direct rendering method 2
albeu
parents: 6701
diff changeset
174 case XVID_CSP_EXTERN:
6af6d7b40638 Add direct rendering method 2
albeu
parents: 6701
diff changeset
175 pic.y = mpi->planes[0];
6af6d7b40638 Add direct rendering method 2
albeu
parents: 6701
diff changeset
176 pic.u = mpi->planes[1];
6af6d7b40638 Add direct rendering method 2
albeu
parents: 6701
diff changeset
177 pic.v = mpi->planes[2];
6af6d7b40638 Add direct rendering method 2
albeu
parents: 6701
diff changeset
178 pic.stride_y = mpi->stride[0];
6af6d7b40638 Add direct rendering method 2
albeu
parents: 6701
diff changeset
179 pic.stride_u = mpi->stride[1];
6af6d7b40638 Add direct rendering method 2
albeu
parents: 6701
diff changeset
180 pic.stride_v = mpi->stride[2];
6af6d7b40638 Add direct rendering method 2
albeu
parents: 6701
diff changeset
181 dec.image = &pic;
6af6d7b40638 Add direct rendering method 2
albeu
parents: 6701
diff changeset
182 break;
6767
a6240ba29795 support for older xvid versions and IMGFMT_IYUV
alex
parents: 6756
diff changeset
183 #endif
6701
522713337297 Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff changeset
184 default:
522713337297 Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff changeset
185 dec.image = mpi->planes[0];
522713337297 Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff changeset
186 if(IMGFMT_IS_BGR(mpi->imgfmt) || IMGFMT_IS_RGB(mpi->imgfmt))
522713337297 Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff changeset
187 dec.stride = mpi->width;
522713337297 Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff changeset
188 else
522713337297 Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff changeset
189 dec.stride = mpi->stride[0];
522713337297 Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff changeset
190 }
522713337297 Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff changeset
191 dec.colorspace = p->cs;
522713337297 Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff changeset
192
522713337297 Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff changeset
193 if(xvid_decore(p->hdl,XVID_DEC_DECODE,&dec,NULL)) {
522713337297 Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff changeset
194 mp_msg(MSGT_DECVIDEO,MSGL_ERR,"decoding error\n");
522713337297 Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff changeset
195 return NULL;
522713337297 Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff changeset
196 }
522713337297 Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff changeset
197
522713337297 Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff changeset
198 if(p->cs == XVID_CSP_USER) {
522713337297 Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff changeset
199 mpi->planes[0] = d4_pic.y;
522713337297 Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff changeset
200 mpi->planes[1] = d4_pic.u;
522713337297 Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff changeset
201 mpi->planes[2] = d4_pic.v;
522713337297 Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff changeset
202 mpi->stride[0] = d4_pic.stride_y;
522713337297 Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff changeset
203 mpi->stride[1] = mpi->stride[2] = d4_pic.stride_uv;
522713337297 Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff changeset
204 }
522713337297 Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff changeset
205
522713337297 Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff changeset
206 return mpi;
522713337297 Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff changeset
207 }
522713337297 Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff changeset
208
522713337297 Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff changeset
209 #endif