comparison libvo/vo_dxr3.c @ 3630:f24527fc1b79

Removed conversion for yuy2, libmp1e supports this format, no need to cnovert it...
author mswitch
date Thu, 20 Dec 2001 08:02:38 +0000
parents a9d1ee93d1c9
children 64ee21b3bd09
comparison
equal deleted inserted replaced
3629:a9d1ee93d1c9 3630:f24527fc1b79
70 }; 70 };
71 71
72 #ifdef USE_MP1E 72 #ifdef USE_MP1E
73 void write_dxr3( rte_context* context, void* data, size_t size, void* user_data ) 73 void write_dxr3( rte_context* context, void* data, size_t size, void* user_data )
74 { 74 {
75 if(ioctl(fd_video,EM8300_IOCTL_VIDEO_SETPTS,&vo_pts) < 0)
76 printf( "VO: [dxr3] Unable to set pts\n" );
75 write( fd_video, data, size ); 77 write( fd_video, data, size );
76 } 78 }
77 #endif 79 #endif
78 80
79 static uint32_t init(uint32_t scr_width, uint32_t scr_height, uint32_t width, uint32_t height, uint32_t fullscreen, char *title, uint32_t format) 81 static uint32_t init(uint32_t scr_width, uint32_t scr_height, uint32_t width, uint32_t height, uint32_t fullscreen, char *title, uint32_t format)
122 if( format == IMGFMT_YV12 || format == IMGFMT_YUY2 || format == IMGFMT_BGR24 ) 124 if( format == IMGFMT_YV12 || format == IMGFMT_YUY2 || format == IMGFMT_BGR24 )
123 { 125 {
124 #ifdef USE_MP1E 126 #ifdef USE_MP1E
125 int size; 127 int size;
126 enum rte_frame_rate frame_rate; 128 enum rte_frame_rate frame_rate;
129 enum rte_pixformat pixel_format;
127 130
128 if( !rte_init() ) 131 if( !rte_init() )
129 { 132 {
130 printf( "VO: [dxr3] Unable to initialize MP1E!\n" ); 133 printf( "VO: [dxr3] Unable to initialize MP1E!\n" );
131 return -1; 134 return -1;
162 else if( vo_fps < 59.97 ) frame_rate = RTE_RATE_6; 165 else if( vo_fps < 59.97 ) frame_rate = RTE_RATE_6;
163 else if( vo_fps < 60.0 ) frame_rate = RTE_RATE_7; 166 else if( vo_fps < 60.0 ) frame_rate = RTE_RATE_7;
164 else if( vo_fps > 60.0 ) frame_rate = RTE_RATE_8; 167 else if( vo_fps > 60.0 ) frame_rate = RTE_RATE_8;
165 else frame_rate = RTE_RATE_NORATE; 168 else frame_rate = RTE_RATE_NORATE;
166 169
167 if( !rte_set_video_parameters( mp1e_context, RTE_YUV420, mp1e_context->width, 170 if( format == IMGFMT_YUY2 )
171 pixel_format = RTE_YUYV;
172 else
173 pixel_format = RTE_YUV420;
174 if( !rte_set_video_parameters( mp1e_context, pixel_format, mp1e_context->width,
168 mp1e_context->height, frame_rate, 175 mp1e_context->height, frame_rate,
169 3e6, "I" ) ) 176 3e6, "I" ) )
170 { 177 {
171 printf( "VO: [dxr3] Unable to set mp1e context!\n" ); 178 printf( "VO: [dxr3] Unable to set mp1e context!\n" );
172 rte_context_destroy( mp1e_context ); 179 rte_context_destroy( mp1e_context );
266 return 0; 273 return 0;
267 } 274 }
268 #ifdef USE_MP1E 275 #ifdef USE_MP1E
269 else if( img_format == IMGFMT_YUY2 ) 276 else if( img_format == IMGFMT_YUY2 )
270 { 277 {
271 int w=v_width,h=v_height; 278 mp1e_buffer.data = src[0];
272 unsigned char *s,*dY,*dU,*dV;
273
274 if(d_pos_x+w>picture_linesize[0]) w=picture_linesize[0]-d_pos_x;
275 if(d_pos_y+h>s_height) h=s_height-d_pos_y;
276
277 s = src[0]+s_pos_x+s_pos_y*(w*2);
278 dY = picture_data[0]+d_pos_x+d_pos_y*picture_linesize[0];
279 dU = picture_data[1]+(d_pos_x/2)+(d_pos_y/2)*picture_linesize[1];
280 dV = picture_data[2]+(d_pos_x/2)+(d_pos_y/2)*picture_linesize[2];
281
282 yuy2toyv12( s, dY, dU, dV, w, h, picture_linesize[0], picture_linesize[1], w*2 );
283
284 mp1e_buffer.data = picture_data[0];
285 mp1e_buffer.time = vo_pts/90000.0; 279 mp1e_buffer.time = vo_pts/90000.0;
286 mp1e_buffer.user_data = NULL; 280 mp1e_buffer.user_data = NULL;
287 rte_push_video_buffer( mp1e_context, &mp1e_buffer ); 281 rte_push_video_buffer( mp1e_context, &mp1e_buffer );
288 return 0; 282 return 0;
289 } 283 }