Changeset 965:6aad7bf5ca29 in mediastreamer2
- Timestamp:
- May 12, 2010 8:08:14 PM (3 years ago)
- Branch:
- default
- Files:
-
- 4 edited
-
include/mediastreamer2/msinterfaces.h (modified) (1 diff)
-
include/mediastreamer2/msvideo.h (modified) (1 diff)
-
src/drawdib-display.c (modified) (9 diffs)
-
src/msvideo.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
include/mediastreamer2/msinterfaces.h
r963 r965 27 27 /** whether the video window should be resized to the stream's resolution*/ 28 28 #define MS_VIDEO_DISPLAY_ENABLE_AUTOFIT \ 29 MS_FILTER_METHOD(MSFilterVideoDisplayInterface,0, bool_t)29 MS_FILTER_METHOD(MSFilterVideoDisplayInterface,0,int) 30 30 31 31 /**position of the local view */ -
include/mediastreamer2/msvideo.h
r903 r965 150 150 uint8_t *dst_planes[], const int dst_strides[3], MSVideoSize roi); 151 151 void ms_yuv_buf_mirror(YuvBuf *buf); 152 void rgb24_mirror(uint8_t *buf, int w, int h, int linesize); 152 153 void rgb24_revert(uint8_t *buf, int w, int h, int linesize); 153 154 void rgb24_copy_revert(uint8_t *dstbuf, int dstlsz, -
src/drawdib-display.c
r964 r965 77 77 78 78 79 static void yuv2rgb_process(Yuv2RgbCtx *ctx, MSPicture *src, MSVideoSize dstsize ){79 static void yuv2rgb_process(Yuv2RgbCtx *ctx, MSPicture *src, MSVideoSize dstsize, bool_t mirroring){ 80 80 MSVideoSize srcsize; 81 81 … … 94 94 ms_error("Error in 420->rgb ms_sws_scale()."); 95 95 } 96 if (mirroring) rgb24_mirror(ctx->rgb,dstsize.width,dstsize.height,dstsize.width*3); 96 97 } 97 98 } … … 108 109 bi.biCompression=BI_RGB; 109 110 bi.biSizeImage=ctx->rgblen; 110 DrawDibDraw(ddh,hdc,dstx,dsty, ctx->dsize.width,ctx->dsize.height,&bi,ctx->rgb,111 DrawDibDraw(ddh,hdc,dstx,dsty,-1,-1,&bi,ctx->rgb, 111 112 0,0,ctx->dsize.width,ctx->dsize.height,0); 112 113 } … … 121 122 Yuv2RgbCtx locview; 122 123 bool_t need_repaint; 124 bool_t autofit; 125 bool_t mirroring; 123 126 }DDDisplay; 124 127 … … 209 212 yuv2rgb_init(&obj->locview); 210 213 obj->need_repaint=FALSE; 214 obj->autofit=TRUE; 215 obj->mirroring=FALSE; 211 216 f->data=obj; 212 217 } … … 353 358 if (f->inputs[0]!=NULL && (main_im=ms_queue_peek_last(f->inputs[0]))!=NULL) { 354 359 if (yuv_buf_init_from_mblk(&mainpic,main_im)==0){ 360 if (obj->autofit && (obj->vsize.width!=mainpic.w || obj->vsize.height!=mainpic.h) 361 && (mainpic.w>wsize.width || mainpic.h>wsize.height)){ 362 RECT cur; 363 ms_message("Detected video resolution changed, resizing window"); 364 GetWindowRect(obj->window,&cur); 365 wsize.width=mainpic.w; 366 wsize.height=mainpic.h; 367 MoveWindow(obj->window,cur.left, cur.top, wsize.width, wsize.height,TRUE); 368 } 355 369 obj->vsize.width=mainpic.w; 356 370 obj->vsize.height=mainpic.h; … … 364 378 365 379 if (local_im!=NULL) 366 yuv2rgb_process(&obj->locview,&localpic,lsize );367 380 yuv2rgb_process(&obj->locview,&localpic,lsize,!mblk_get_precious_flag(local_im)); 381 368 382 if (main_im!=NULL) 369 yuv2rgb_process(&obj->mainview,&mainpic,vsize );383 yuv2rgb_process(&obj->mainview,&mainpic,vsize,obj->mirroring && !mblk_get_precious_flag(main_im)); 370 384 371 385 hdc=GetDC(obj->window); … … 385 399 386 400 if (local_im!=NULL || main_im!=NULL){ 387 draw_local_view_frame(hdc,wsize,localrect); 388 yuv2rgb_draw(&obj->locview,obj->ddh,hdc,localrect.x,localrect.y); 401 if (obj->locview.rgb!=NULL){ 402 draw_local_view_frame(hdc,wsize,localrect); 403 yuv2rgb_draw(&obj->locview,obj->ddh,hdc,localrect.x,localrect.y); 404 } 389 405 } 390 406 … … 402 418 } 403 419 420 static int enable_autofit(MSFilter *f, void *data){ 421 DDDisplay *obj=(DDDisplay*)f->data; 422 obj->autofit=*(int*)data; 423 return 0; 424 } 425 426 static int enable_mirroring(MSFilter *f, void *data){ 427 DDDisplay *obj=(DDDisplay*)f->data; 428 obj->mirroring=*(int*)data; 429 return 0; 430 } 431 404 432 static MSFilterMethod methods[]={ 405 433 { MS_VIDEO_DISPLAY_GET_NATIVE_WINDOW_ID, get_native_window_id }, 434 { MS_VIDEO_DISPLAY_ENABLE_AUTOFIT , enable_autofit }, 435 { MS_VIDEO_DISPLAY_ENABLE_MIRRORING , enable_mirroring}, 406 436 { 0 ,NULL} 407 437 }; -
src/msvideo.c
r964 r965 198 198 } 199 199 200 void rgb24_mirror(uint8_t *buf, int w, int h, int linesize){ 201 int i,j; 202 int r,g,b; 203 int end=w*3; 204 for(i=0;i<h;++i){ 205 for(j=0;j<end/2;j+=3){ 206 r=buf[j]; 207 g=buf[j+1]; 208 b=buf[j+2]; 209 buf[j]=buf[end-j-3]; 210 buf[j+1]=buf[end-j-2]; 211 buf[j+2]=buf[end-j-1]; 212 buf[end-j-3]=r; 213 buf[end-j-2]=g; 214 buf[end-j-1]=b; 215 } 216 buf+=linesize; 217 } 218 } 219 200 220 void rgb24_revert(uint8_t *buf, int w, int h, int linesize){ 201 221 uint8_t *p,*pe;
Note: See TracChangeset
for help on using the changeset viewer.
