Mercurial > mplayer.hg
annotate libmpcodecs/vd_xvid.c @ 9293:96bcc9def790
Sync by Dmitry Baryshkov <lumag@qnc.ru>.
author | diego |
---|---|
date | Thu, 06 Feb 2003 01:05:34 +0000 |
parents | 3725cbbc9366 |
children | 32be26de0d7c |
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 | 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 |
8491
ce25d80dd6c3
Use the XVID_API_UNSTABLE macro instead of a home-made one.
rguyom
parents:
8462
diff
changeset
|
15 |
ce25d80dd6c3
Use the XVID_API_UNSTABLE macro instead of a home-made one.
rguyom
parents:
8462
diff
changeset
|
16 #ifdef XVID_API_UNSTABLE |
ce25d80dd6c3
Use the XVID_API_UNSTABLE macro instead of a home-made one.
rguyom
parents:
8462
diff
changeset
|
17 #warning ******************************************************************* |
ce25d80dd6c3
Use the XVID_API_UNSTABLE macro instead of a home-made one.
rguyom
parents:
8462
diff
changeset
|
18 #warning ** ** |
ce25d80dd6c3
Use the XVID_API_UNSTABLE macro instead of a home-made one.
rguyom
parents:
8462
diff
changeset
|
19 #warning ** Y O U '' R E U S I N G U N S T A B L E S O F T W A R E ** |
ce25d80dd6c3
Use the XVID_API_UNSTABLE macro instead of a home-made one.
rguyom
parents:
8462
diff
changeset
|
20 #warning ** ** |
ce25d80dd6c3
Use the XVID_API_UNSTABLE macro instead of a home-made one.
rguyom
parents:
8462
diff
changeset
|
21 #warning ** There are bugs, this code could crash, could blow up your PC ** |
ce25d80dd6c3
Use the XVID_API_UNSTABLE macro instead of a home-made one.
rguyom
parents:
8462
diff
changeset
|
22 #warning ** or the whole building and do many other nasty things ! ** |
ce25d80dd6c3
Use the XVID_API_UNSTABLE macro instead of a home-made one.
rguyom
parents:
8462
diff
changeset
|
23 #warning ** ** |
ce25d80dd6c3
Use the XVID_API_UNSTABLE macro instead of a home-made one.
rguyom
parents:
8462
diff
changeset
|
24 #warning ** If you want stable code use stable XViD releases (0.9.x). ** |
ce25d80dd6c3
Use the XVID_API_UNSTABLE macro instead of a home-made one.
rguyom
parents:
8462
diff
changeset
|
25 #warning ** ** |
ce25d80dd6c3
Use the XVID_API_UNSTABLE macro instead of a home-made one.
rguyom
parents:
8462
diff
changeset
|
26 #warning ******************************************************************* |
8462
800d77666843
Support the latest development code from XViD dev-api-3 CVS
rguyom
parents:
7180
diff
changeset
|
27 #endif |
800d77666843
Support the latest development code from XViD dev-api-3 CVS
rguyom
parents:
7180
diff
changeset
|
28 |
6701
522713337297
Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff
changeset
|
29 static vd_info_t info = |
522713337297
Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff
changeset
|
30 { |
522713337297
Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff
changeset
|
31 "xvid decoder", |
522713337297
Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff
changeset
|
32 "xvid", |
522713337297
Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff
changeset
|
33 "Albeu", |
522713337297
Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff
changeset
|
34 "Albeu", |
522713337297
Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff
changeset
|
35 "" |
522713337297
Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff
changeset
|
36 }; |
522713337297
Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff
changeset
|
37 |
522713337297
Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff
changeset
|
38 LIBVD_EXTERN(xvid) |
522713337297
Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff
changeset
|
39 |
522713337297
Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff
changeset
|
40 typedef struct { |
522713337297
Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff
changeset
|
41 int cs; |
6756 | 42 unsigned char img_type; |
6701
522713337297
Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff
changeset
|
43 void* hdl; |
522713337297
Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff
changeset
|
44 mp_image_t* mpi; |
522713337297
Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff
changeset
|
45 } priv_t; |
522713337297
Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff
changeset
|
46 |
6756 | 47 static int do_dr2 = 0; |
48 | |
49 struct config xvid_dec_opts[] = { | |
50 { "dr2", &do_dr2, CONF_TYPE_FLAG, 0, 0, 1, NULL}, | |
51 { "nodr2", &do_dr2, CONF_TYPE_FLAG, 0, 1, 0, NULL}, | |
52 {NULL, NULL, 0, 0, 0, 0, NULL} | |
53 }; | |
54 | |
6701
522713337297
Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff
changeset
|
55 // to set/get/query special features/parameters |
522713337297
Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff
changeset
|
56 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
|
57 return CONTROL_UNKNOWN; |
522713337297
Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff
changeset
|
58 } |
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 // init driver |
522713337297
Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff
changeset
|
61 static int init(sh_video_t *sh){ |
522713337297
Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff
changeset
|
62 XVID_INIT_PARAM ini; |
522713337297
Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff
changeset
|
63 XVID_DEC_PARAM dec_p; |
522713337297
Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff
changeset
|
64 priv_t* p; |
522713337297
Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff
changeset
|
65 int cs; |
522713337297
Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff
changeset
|
66 |
8491
ce25d80dd6c3
Use the XVID_API_UNSTABLE macro instead of a home-made one.
rguyom
parents:
8462
diff
changeset
|
67 #ifdef XVID_API_UNSTABLE |
ce25d80dd6c3
Use the XVID_API_UNSTABLE macro instead of a home-made one.
rguyom
parents:
8462
diff
changeset
|
68 mp_msg (MSGT_DECVIDEO, MSGL_WARN, |
ce25d80dd6c3
Use the XVID_API_UNSTABLE macro instead of a home-made one.
rguyom
parents:
8462
diff
changeset
|
69 "\n" |
ce25d80dd6c3
Use the XVID_API_UNSTABLE macro instead of a home-made one.
rguyom
parents:
8462
diff
changeset
|
70 "*******************************************************************\n" |
ce25d80dd6c3
Use the XVID_API_UNSTABLE macro instead of a home-made one.
rguyom
parents:
8462
diff
changeset
|
71 "** **\n" |
ce25d80dd6c3
Use the XVID_API_UNSTABLE macro instead of a home-made one.
rguyom
parents:
8462
diff
changeset
|
72 "** Y O U ' R E U S I N G U N S T A B L E S O F T W A R E **\n" |
ce25d80dd6c3
Use the XVID_API_UNSTABLE macro instead of a home-made one.
rguyom
parents:
8462
diff
changeset
|
73 "** **\n" |
ce25d80dd6c3
Use the XVID_API_UNSTABLE macro instead of a home-made one.
rguyom
parents:
8462
diff
changeset
|
74 "** There are bugs, this code could crash, could blow up your PC **\n" |
ce25d80dd6c3
Use the XVID_API_UNSTABLE macro instead of a home-made one.
rguyom
parents:
8462
diff
changeset
|
75 "** or the whole building and do many other nasty things ! **\n" |
ce25d80dd6c3
Use the XVID_API_UNSTABLE macro instead of a home-made one.
rguyom
parents:
8462
diff
changeset
|
76 "** **\n" |
ce25d80dd6c3
Use the XVID_API_UNSTABLE macro instead of a home-made one.
rguyom
parents:
8462
diff
changeset
|
77 "** If you want stable code use stable XViD releases (0.9.x). **\n" |
ce25d80dd6c3
Use the XVID_API_UNSTABLE macro instead of a home-made one.
rguyom
parents:
8462
diff
changeset
|
78 "** **\n" |
ce25d80dd6c3
Use the XVID_API_UNSTABLE macro instead of a home-made one.
rguyom
parents:
8462
diff
changeset
|
79 "*******************************************************************\n" |
ce25d80dd6c3
Use the XVID_API_UNSTABLE macro instead of a home-made one.
rguyom
parents:
8462
diff
changeset
|
80 "\n"); |
ce25d80dd6c3
Use the XVID_API_UNSTABLE macro instead of a home-made one.
rguyom
parents:
8462
diff
changeset
|
81 #endif |
ce25d80dd6c3
Use the XVID_API_UNSTABLE macro instead of a home-made one.
rguyom
parents:
8462
diff
changeset
|
82 |
6701
522713337297
Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff
changeset
|
83 memset(&ini,0,sizeof(XVID_INIT_PARAM)); |
522713337297
Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff
changeset
|
84 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
|
85 |
522713337297
Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff
changeset
|
86 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
|
87 return 0; |
522713337297
Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff
changeset
|
88 |
522713337297
Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff
changeset
|
89 switch(sh->codec->outfmt[sh->outfmtidx]){ |
522713337297
Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff
changeset
|
90 case IMGFMT_YV12: |
6767 | 91 #ifdef XVID_CSP_EXTERN |
6756 | 92 cs= do_dr2 ? XVID_CSP_EXTERN : XVID_CSP_USER; |
6767 | 93 #else |
94 cs= XVID_CSP_USER; | |
95 #endif | |
6701
522713337297
Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff
changeset
|
96 break; |
522713337297
Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff
changeset
|
97 case IMGFMT_YUY2: |
522713337297
Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff
changeset
|
98 cs=XVID_CSP_YUY2; |
522713337297
Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff
changeset
|
99 break; |
522713337297
Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff
changeset
|
100 case IMGFMT_UYVY: |
522713337297
Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff
changeset
|
101 cs=XVID_CSP_UYVY; |
522713337297
Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff
changeset
|
102 break; |
522713337297
Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff
changeset
|
103 case IMGFMT_I420: |
6767 | 104 case IMGFMT_IYUV: |
6701
522713337297
Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff
changeset
|
105 cs=XVID_CSP_I420; |
522713337297
Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff
changeset
|
106 break; |
522713337297
Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff
changeset
|
107 case IMGFMT_BGR15: |
522713337297
Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff
changeset
|
108 cs=XVID_CSP_RGB555; |
522713337297
Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff
changeset
|
109 break; |
522713337297
Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff
changeset
|
110 case IMGFMT_BGR16: |
522713337297
Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff
changeset
|
111 cs=XVID_CSP_RGB565; |
522713337297
Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff
changeset
|
112 break; |
522713337297
Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff
changeset
|
113 case IMGFMT_BGR24: |
522713337297
Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff
changeset
|
114 cs=XVID_CSP_RGB24; |
522713337297
Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff
changeset
|
115 break; |
522713337297
Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff
changeset
|
116 case IMGFMT_BGR32: |
522713337297
Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff
changeset
|
117 cs=XVID_CSP_RGB32; |
522713337297
Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff
changeset
|
118 break; |
522713337297
Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff
changeset
|
119 case IMGFMT_YVYU: |
522713337297
Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff
changeset
|
120 cs=XVID_CSP_YVYU; |
522713337297
Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff
changeset
|
121 break; |
522713337297
Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff
changeset
|
122 default: |
522713337297
Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff
changeset
|
123 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
|
124 return 0; |
522713337297
Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff
changeset
|
125 } |
522713337297
Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff
changeset
|
126 |
522713337297
Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff
changeset
|
127 if(xvid_init(NULL, 0, &ini, NULL)) |
522713337297
Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff
changeset
|
128 return 0; |
522713337297
Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff
changeset
|
129 |
522713337297
Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff
changeset
|
130 if(ini.api_version != API_VERSION) { |
522713337297
Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff
changeset
|
131 if(ini.api_version < API_VERSION) { |
9196 | 132 mp_msg(MSGT_DECVIDEO,MSGL_ERR,"Too old version of xvid (min. %d)\n",API_VERSION); |
6701
522713337297
Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff
changeset
|
133 return 0; |
522713337297
Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff
changeset
|
134 } |
522713337297
Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff
changeset
|
135 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
|
136 ini.api_version,API_VERSION); |
522713337297
Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff
changeset
|
137 } |
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 dec_p.width = sh->disp_w; |
522713337297
Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff
changeset
|
140 dec_p.height = sh->disp_h; |
522713337297
Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff
changeset
|
141 |
522713337297
Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff
changeset
|
142 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
|
143 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
|
144 return 0; |
522713337297
Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff
changeset
|
145 } |
522713337297
Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff
changeset
|
146 |
522713337297
Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff
changeset
|
147 p = (priv_t*)malloc(sizeof(priv_t)); |
522713337297
Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff
changeset
|
148 p->cs = cs; |
522713337297
Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff
changeset
|
149 p->hdl = dec_p.handle; |
522713337297
Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff
changeset
|
150 sh->context = p; |
522713337297
Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff
changeset
|
151 |
6756 | 152 switch(cs) { |
6767 | 153 #ifdef XVID_CSP_EXTERN |
6756 | 154 case XVID_CSP_EXTERN: |
155 p->img_type = MP_IMGTYPE_STATIC; | |
156 break; | |
6767 | 157 #endif |
6756 | 158 case XVID_CSP_USER: |
159 p->img_type = MP_IMGTYPE_EXPORT; | |
160 break; | |
161 default: | |
162 p->img_type = MP_IMGTYPE_TEMP; | |
163 break; | |
164 } | |
165 | |
6701
522713337297
Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff
changeset
|
166 return 1; |
522713337297
Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff
changeset
|
167 } |
522713337297
Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff
changeset
|
168 |
522713337297
Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff
changeset
|
169 // uninit driver |
522713337297
Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff
changeset
|
170 static void uninit(sh_video_t *sh){ |
522713337297
Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff
changeset
|
171 priv_t* p = sh->context; |
522713337297
Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff
changeset
|
172 if(!p) |
522713337297
Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff
changeset
|
173 return; |
522713337297
Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff
changeset
|
174 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
|
175 free(p); |
522713337297
Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff
changeset
|
176 } |
522713337297
Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff
changeset
|
177 |
522713337297
Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff
changeset
|
178 // decode a frame |
522713337297
Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff
changeset
|
179 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
|
180 XVID_DEC_FRAME dec; |
522713337297
Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff
changeset
|
181 DEC_PICTURE d4_pic; |
6915
5ca9fc4d2994
compilation bug found by Julien Portalier <julien@portalier.com>
arpi
parents:
6767
diff
changeset
|
182 #ifdef XVID_CSP_EXTERN |
6756 | 183 XVID_DEC_PICTURE pic; |
6915
5ca9fc4d2994
compilation bug found by Julien Portalier <julien@portalier.com>
arpi
parents:
6767
diff
changeset
|
184 #endif |
6701
522713337297
Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff
changeset
|
185 priv_t* p = sh->context; |
522713337297
Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff
changeset
|
186 |
6756 | 187 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
|
188 MP_IMGFLAG_ACCEPT_STRIDE, |
522713337297
Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff
changeset
|
189 sh->disp_w,sh->disp_h); |
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 if(!data || !mpi || len <= 0) |
522713337297
Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff
changeset
|
192 return NULL; |
522713337297
Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff
changeset
|
193 |
522713337297
Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff
changeset
|
194 memset(&dec,0,sizeof(XVID_DEC_FRAME)); |
522713337297
Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff
changeset
|
195 |
522713337297
Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff
changeset
|
196 dec.bitstream = data; |
522713337297
Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff
changeset
|
197 dec.length = len; |
8491
ce25d80dd6c3
Use the XVID_API_UNSTABLE macro instead of a home-made one.
rguyom
parents:
8462
diff
changeset
|
198 #ifdef XVID_API_UNSTABLE |
8462
800d77666843
Support the latest development code from XViD dev-api-3 CVS
rguyom
parents:
7180
diff
changeset
|
199 dec.general |= XVID_DEC_LOWDELAY; |
800d77666843
Support the latest development code from XViD dev-api-3 CVS
rguyom
parents:
7180
diff
changeset
|
200 #endif |
6701
522713337297
Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff
changeset
|
201 switch(p->cs) { |
522713337297
Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff
changeset
|
202 case XVID_CSP_USER: |
522713337297
Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff
changeset
|
203 dec.image = &d4_pic; |
522713337297
Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff
changeset
|
204 break; |
6767 | 205 #ifdef XVID_CSP_EXTERN |
6756 | 206 case XVID_CSP_EXTERN: |
207 pic.y = mpi->planes[0]; | |
208 pic.u = mpi->planes[1]; | |
209 pic.v = mpi->planes[2]; | |
210 pic.stride_y = mpi->stride[0]; | |
211 pic.stride_u = mpi->stride[1]; | |
212 pic.stride_v = mpi->stride[2]; | |
213 dec.image = &pic; | |
214 break; | |
6767 | 215 #endif |
6701
522713337297
Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff
changeset
|
216 default: |
522713337297
Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff
changeset
|
217 dec.image = mpi->planes[0]; |
522713337297
Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff
changeset
|
218 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
|
219 dec.stride = mpi->width; |
522713337297
Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff
changeset
|
220 else |
522713337297
Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff
changeset
|
221 dec.stride = mpi->stride[0]; |
522713337297
Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff
changeset
|
222 } |
522713337297
Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff
changeset
|
223 dec.colorspace = p->cs; |
522713337297
Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff
changeset
|
224 |
522713337297
Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff
changeset
|
225 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
|
226 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
|
227 return NULL; |
522713337297
Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff
changeset
|
228 } |
522713337297
Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff
changeset
|
229 |
522713337297
Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff
changeset
|
230 if(p->cs == XVID_CSP_USER) { |
522713337297
Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff
changeset
|
231 mpi->planes[0] = d4_pic.y; |
522713337297
Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff
changeset
|
232 mpi->planes[1] = d4_pic.u; |
522713337297
Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff
changeset
|
233 mpi->planes[2] = d4_pic.v; |
522713337297
Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff
changeset
|
234 mpi->stride[0] = d4_pic.stride_y; |
522713337297
Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff
changeset
|
235 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
|
236 } |
522713337297
Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff
changeset
|
237 |
522713337297
Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff
changeset
|
238 return mpi; |
522713337297
Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff
changeset
|
239 } |
522713337297
Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff
changeset
|
240 |
522713337297
Support for Xvid using their new api. If divx4 compatiblity is disabeled
albeu
parents:
diff
changeset
|
241 #endif |