Mercurial > mplayer.hg
comparison libvo/mga_common.c @ 7681:62be493f77c3
draw_image() implementation (new libvo API)
author | arpi |
---|---|
date | Wed, 09 Oct 2002 14:38:38 +0000 |
parents | d60cfb1f8b37 |
children | b64f14fdadfb |
comparison
equal
deleted
inserted
replaced
7680:d60cfb1f8b37 | 7681:62be493f77c3 |
---|---|
118 vid_data=frames[mga_next_frame]; | 118 vid_data=frames[mga_next_frame]; |
119 #endif | 119 #endif |
120 | 120 |
121 } | 121 } |
122 | 122 |
123 | |
124 static void | |
125 write_frame_yuy2(uint8_t *y) | |
126 { | |
127 int len=2*mga_vid_config.src_width; | |
128 uint32_t bespitch = (mga_vid_config.src_width + 31) & ~31; | |
129 | |
130 mem2agpcpy_pic(vid_data, y, len, mga_vid_config.src_height, 2*bespitch, len); | |
131 } | |
132 | |
133 static uint32_t | 123 static uint32_t |
134 draw_frame(uint8_t *src[]) | 124 draw_frame(uint8_t *src[]) |
135 { | 125 { |
136 switch(mga_vid_config.format){ | 126 printf("!!! mga::draw_frame() called !!!\n"); |
137 case MGA_VID_FORMAT_YUY2: | |
138 case MGA_VID_FORMAT_UYVY: | |
139 write_frame_yuy2(src[0]);break; | |
140 } | |
141 return 0; | 127 return 0; |
142 } | 128 } |
143 | 129 |
144 static uint32_t | 130 static uint32_t get_image(mp_image_t *mpi){ |
145 get_image(mp_image_t *mpi){ | |
146 uint32_t bespitch = (mga_vid_config.src_width + 31) & ~31; | 131 uint32_t bespitch = (mga_vid_config.src_width + 31) & ~31; |
147 uint32_t bespitch2 = bespitch/2; | 132 uint32_t bespitch2 = bespitch/2; |
148 // printf("mga: get_image() called\n"); | 133 // printf("mga: get_image() called\n"); |
149 if(mpi->type==MP_IMGTYPE_STATIC && mga_vid_config.num_frames>1) return VO_FALSE; // it is not static | 134 if(mpi->type==MP_IMGTYPE_STATIC && mga_vid_config.num_frames>1) return VO_FALSE; // it is not static |
150 if(mpi->flags&MP_IMGFLAG_READABLE) return VO_FALSE; // slow video ram | 135 if(mpi->flags&MP_IMGFLAG_READABLE) return VO_FALSE; // slow video ram |
175 } | 160 } |
176 return VO_FALSE; | 161 return VO_FALSE; |
177 } | 162 } |
178 | 163 |
179 static uint32_t | 164 static uint32_t |
165 draw_image(mp_image_t *mpi){ | |
166 uint32_t bespitch = (mga_vid_config.src_width + 31) & ~31; | |
167 | |
168 // if -dr or -slices then do nothing: | |
169 if(mpi->flags&(MP_IMGFLAG_DIRECT|MP_IMGFLAG_DRAW_CALLBACK)) return VO_TRUE; | |
170 | |
171 if(mpi->flags&MP_IMGFLAG_PLANAR){ | |
172 // copy planar: | |
173 draw_slice(mpi->planes,mpi->stride,mpi->w,mpi->h,mpi->x,mpi->y); | |
174 } else { | |
175 // copy packed: | |
176 mem2agpcpy_pic(vid_data, mpi->planes[0], // dst,src | |
177 mpi->w*(mpi->bpp/8), mpi->h, // w,h | |
178 bespitch*2, mpi->stride[0]); // dstride,sstride | |
179 } | |
180 return VO_TRUE; | |
181 } | |
182 | |
183 static uint32_t | |
180 query_format(uint32_t format) | 184 query_format(uint32_t format) |
181 { | 185 { |
182 switch(format){ | 186 switch(format){ |
183 case IMGFMT_YV12: | 187 case IMGFMT_YV12: |
184 case IMGFMT_I420: | 188 case IMGFMT_I420: |
185 case IMGFMT_IYUV: | 189 case IMGFMT_IYUV: |
186 case IMGFMT_YUY2: | 190 case IMGFMT_YUY2: |
187 case IMGFMT_UYVY: | 191 case IMGFMT_UYVY: |
188 // case IMGFMT_RGB|24: | |
189 // case IMGFMT_BGR|24: | |
190 return 3 | VFCAP_OSD|VFCAP_HWSCALE_UP|VFCAP_HWSCALE_DOWN; | 192 return 3 | VFCAP_OSD|VFCAP_HWSCALE_UP|VFCAP_HWSCALE_DOWN; |
191 } | 193 } |
192 return 0; | 194 return 0; |
193 } | 195 } |
194 | 196 |
217 switch (request) { | 219 switch (request) { |
218 case VOCTRL_QUERY_FORMAT: | 220 case VOCTRL_QUERY_FORMAT: |
219 return query_format(*((uint32_t*)data)); | 221 return query_format(*((uint32_t*)data)); |
220 case VOCTRL_GET_IMAGE: | 222 case VOCTRL_GET_IMAGE: |
221 return get_image(data); | 223 return get_image(data); |
224 case VOCTRL_DRAW_IMAGE: | |
225 return draw_image(data); | |
222 case VOCTRL_SET_EQUALIZER: | 226 case VOCTRL_SET_EQUALIZER: |
223 { | 227 { |
224 va_list ap; | 228 va_list ap; |
225 short value; | 229 short value; |
226 uint32_t luma,prev; | 230 uint32_t luma,prev; |
377 memset(frames[0],0x80,mga_vid_config.frame_size*mga_vid_config.num_frames); | 381 memset(frames[0],0x80,mga_vid_config.frame_size*mga_vid_config.num_frames); |
378 | 382 |
379 ioctl(f,MGA_VID_ON,0); | 383 ioctl(f,MGA_VID_ON,0); |
380 | 384 |
381 return 0; | 385 return 0; |
382 | |
383 } | 386 } |
384 | 387 |
385 static int mga_uninit(){ | 388 static int mga_uninit(){ |
386 if(f>=0){ | 389 if(f>=0){ |
387 ioctl( f,MGA_VID_OFF,0 ); | 390 ioctl( f,MGA_VID_OFF,0 ); |