Mercurial > mplayer.hg
comparison libvo/vo_x11.c @ 4627:3db7ee2ac7b0
bgr15 / bgr16 input support (with -zoom)
stride % 8 == 0
author | michael |
---|---|
date | Sun, 10 Feb 2002 01:07:58 +0000 |
parents | c35d7ce151b3 |
children | b7f340349470 |
comparison
equal
deleted
inserted
replaced
4626:6d6595dfc5a8 | 4627:3db7ee2ac7b0 |
---|---|
276 | 276 |
277 if ( depth != 15 && depth != 16 && depth != 24 && depth != 32 ) depth=24; | 277 if ( depth != 15 && depth != 16 && depth != 24 && depth != 32 ) depth=24; |
278 XMatchVisualInfo( mDisplay,mScreen,depth,TrueColor,&vinfo ); | 278 XMatchVisualInfo( mDisplay,mScreen,depth,TrueColor,&vinfo ); |
279 | 279 |
280 if( flags&0x04 && ( format==IMGFMT_YV12 || format==IMGFMT_I420 || format==IMGFMT_IYUV | 280 if( flags&0x04 && ( format==IMGFMT_YV12 || format==IMGFMT_I420 || format==IMGFMT_IYUV |
281 || format==IMGFMT_YUY2 || format==IMGFMT_BGR24 || format==IMGFMT_BGR32)) { | 281 || format==IMGFMT_YUY2 |
282 || format==IMGFMT_BGR15|| format==IMGFMT_BGR16 || format==IMGFMT_BGR24 || format==IMGFMT_BGR32)) { | |
282 // software scale | 283 // software scale |
283 if(fullscreen){ | 284 if(fullscreen){ |
284 image_width=vo_screenwidth; | 285 image_width=vo_screenwidth; |
285 image_height=vo_screenheight; | 286 image_height=vo_screenheight; |
286 } else { | 287 } else { |
436 { return &vo_info; } | 437 { return &vo_info; } |
437 | 438 |
438 static void Display_Image( XImage *myximage,uint8_t *ImageData ) | 439 static void Display_Image( XImage *myximage,uint8_t *ImageData ) |
439 { | 440 { |
440 #ifdef DISP | 441 #ifdef DISP |
442 // myximage->width is the stride and not the width if the sw scaler is used | |
443 int dstW= (swsContext) ? swsContext->dstW : myximage->width; | |
441 #ifdef HAVE_SHM | 444 #ifdef HAVE_SHM |
442 if ( Shmem_Flag ) | 445 if ( Shmem_Flag ) |
443 { | 446 { |
444 XShmPutImage( mDisplay,mywindow,mygc,myximage, | 447 XShmPutImage( mDisplay,mywindow,mygc,myximage, |
445 0,0, | 448 0,0, |
446 ( vo_dwidth - myximage->width ) / 2,( vo_dheight - myximage->height ) / 2, | 449 ( vo_dwidth - dstW ) / 2,( vo_dheight - myximage->height ) / 2, |
447 myximage->width,myximage->height,True ); | 450 dstW,myximage->height,True ); |
448 } | 451 } |
449 else | 452 else |
450 #endif | 453 #endif |
451 { | 454 { |
452 XPutImage( mDisplay,mywindow,mygc,myximage, | 455 XPutImage( mDisplay,mywindow,mygc,myximage, |
453 0,0, | 456 0,0, |
454 ( vo_dwidth - myximage->width ) / 2,( vo_dheight - myximage->height ) / 2, | 457 ( vo_dwidth - dstW ) / 2,( vo_dheight - myximage->height ) / 2, |
455 myximage->width,myximage->height ); | 458 dstW,myximage->height ); |
456 } | 459 } |
457 #endif | 460 #endif |
458 } | 461 } |
459 | 462 |
460 static void draw_osd(void) | 463 static void draw_osd(void) |
473 int newW= vo_dwidth&(~1); // the swscaler should be able to handle odd sizes but something else doesnt seem to like it | 476 int newW= vo_dwidth&(~1); // the swscaler should be able to handle odd sizes but something else doesnt seem to like it |
474 int newH= vo_dheight&(~1); | 477 int newH= vo_dheight&(~1); |
475 | 478 |
476 if(sws_flags==0) newW&= (~31); // not needed but, if the user wants the FAST_BILINEAR SCALER, then its needed | 479 if(sws_flags==0) newW&= (~31); // not needed but, if the user wants the FAST_BILINEAR SCALER, then its needed |
477 | 480 |
478 if(image_width!=newW || image_height!=newH) | 481 if(swsContext->dstW!=newW || image_height!=newH) |
479 { | 482 { |
480 SwsContext *oldContext= swsContext; | 483 SwsContext *oldContext= swsContext; |
481 | 484 |
482 swsContext= getSwsContextFromCmdLine(oldContext->srcW, oldContext->srcH, oldContext->srcFormat, | 485 swsContext= getSwsContextFromCmdLine(oldContext->srcW, oldContext->srcH, oldContext->srcFormat, |
483 newW, newH, out_format); | 486 newW, newH, out_format); |
484 if(swsContext) | 487 if(swsContext) |
485 { | 488 { |
486 image_width= newW; | 489 image_width= (newW+7)&(~7); |
487 image_height= newH; | 490 image_height= newH; |
491 | |
488 freeMyXImage(); | 492 freeMyXImage(); |
489 getMyXImage(); | 493 getMyXImage(); |
490 freeSwsContext(oldContext); | 494 freeSwsContext(oldContext); |
491 } | 495 } |
492 else | 496 else |
521 | 525 |
522 if(swsContext) | 526 if(swsContext) |
523 { | 527 { |
524 int stride[3]= {0,0,0}; | 528 int stride[3]= {0,0,0}; |
525 if (swsContext->srcFormat==IMGFMT_YUY2) stride[0]=swsContext->srcW*2; | 529 if (swsContext->srcFormat==IMGFMT_YUY2) stride[0]=swsContext->srcW*2; |
530 else if(swsContext->srcFormat==IMGFMT_BGR15) stride[0]=swsContext->srcW*2; | |
531 else if(swsContext->srcFormat==IMGFMT_BGR16) stride[0]=swsContext->srcW*2; | |
526 else if(swsContext->srcFormat==IMGFMT_BGR24) stride[0]=swsContext->srcW*3; | 532 else if(swsContext->srcFormat==IMGFMT_BGR24) stride[0]=swsContext->srcW*3; |
527 else if(swsContext->srcFormat==IMGFMT_BGR32) stride[0]=swsContext->srcW*4; | 533 else if(swsContext->srcFormat==IMGFMT_BGR32) stride[0]=swsContext->srcW*4; |
528 | 534 |
529 return draw_slice(src, stride, swsContext->srcW, swsContext->srcH, 0, 0); | 535 return draw_slice(src, stride, swsContext->srcW, swsContext->srcH, 0, 0); |
530 } | 536 } |
591 if( bpp==24 && vo_depthonscreen==32) return 1; // built-in conversion | 597 if( bpp==24 && vo_depthonscreen==32) return 1; // built-in conversion |
592 } | 598 } |
593 | 599 |
594 switch( format ) | 600 switch( format ) |
595 { | 601 { |
602 case IMGFMT_BGR15: | |
603 case IMGFMT_BGR16: | |
596 case IMGFMT_BGR24: | 604 case IMGFMT_BGR24: |
597 case IMGFMT_BGR32: | 605 case IMGFMT_BGR32: |
598 case IMGFMT_YUY2: | 606 case IMGFMT_YUY2: |
599 if(softzoom) return 1; | 607 if(softzoom) return 1; |
600 else return 0; | 608 else return 0; |