Changeset 4994baa7237b561a0f9259c606332baea2383ea1
- Timestamp:
- 22/07/04 00:38:49 (4 years ago)
- git-parent:
- Files:
-
- include/vlc_common.h (modified) (1 diff)
- include/vlc_objects.h (modified) (1 diff)
- include/vlc_opengl.h (added)
- modules/video_output/x11/glx.c (modified) (33 diffs)
- modules/visualization/galaktos/Modules.am (modified) (1 diff)
- modules/visualization/galaktos/glx.c (deleted)
- modules/visualization/galaktos/glx.h (deleted)
- modules/visualization/galaktos/main.c (modified) (2 diffs)
- modules/visualization/galaktos/plugin.c (modified) (8 diffs)
- modules/visualization/galaktos/plugin.h (modified) (1 diff)
- src/misc/objects.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
include/vlc_common.h
re414aa3 r4994baa 340 340 typedef struct httpd_redirect_t httpd_redirect_t; 341 341 typedef struct httpd_stream_t httpd_stream_t; 342 343 /* opengl */ 344 typedef struct opengl_t opengl_t; 345 typedef struct opengl_sys_t opengl_sys_t; 342 346 343 347 /* divers */ include/vlc_objects.h
r53b4094 r4994baa 53 53 #define VLC_OBJECT_ACCESS (-19) 54 54 #define VLC_OBJECT_STREAM (-20) 55 #define VLC_OBJECT_OPENGL (-21) 55 56 56 57 #define VLC_OBJECT_GENERIC (-666) modules/video_output/x11/glx.c
r5d041dd r4994baa 33 33 #include <vlc/vout.h> 34 34 35 /* For the opengl provider interface */ 36 #include "vlc_opengl.h" 37 35 38 #include <X11/Xlib.h> 36 39 #include <X11/Xutil.h> 37 40 #include <GL/glx.h> 38 41 42 43 /* Data common to vout and opengl provider structures */ 44 typedef struct glx_t 45 { 46 Display *p_display; 47 int b_glx13; 48 int i_width; 49 int i_height; 50 int b_fullscreen; 51 GLXContext gwctx; 52 Window wnd; 53 GLXWindow gwnd; 54 Atom wm_delete; 55 } glx_t; 56 57 58 /***************************************************************************** 59 * Vout interface 60 *****************************************************************************/ 61 static int CreateVout ( vlc_object_t * ); 62 static void DestroyVout ( vlc_object_t * ); 63 static int Init ( vout_thread_t * ); 64 static void End ( vout_thread_t * ); 65 static int Manage ( vout_thread_t * ); 66 static void Render ( vout_thread_t *p_vout, picture_t *p_pic ); 67 static void DisplayVideo ( vout_thread_t *, picture_t * ); 68 69 /***************************************************************************** 70 * OpenGL providerinterface 71 *****************************************************************************/ 72 static int CreateOpenGL ( vlc_object_t * ); 73 static void DestroyOpenGL( vlc_object_t * ); 74 static int InitOpenGL ( opengl_t *, int, int ); 75 static void SwapBuffers ( opengl_t * ); 76 static int HandleEvents ( opengl_t * ); 77 39 78 /***************************************************************************** 40 79 * Local prototypes 41 80 *****************************************************************************/ 42 static int Create ( vlc_object_t * ); 43 static void Destroy ( vlc_object_t * ); 44 45 static int Init ( vout_thread_t * ); 46 static void End ( vout_thread_t * ); 47 static int Manage ( vout_thread_t * ); 48 static void Render ( vout_thread_t *p_vout, picture_t *p_pic ); 49 static void DisplayVideo( vout_thread_t *, picture_t * ); 50 51 static int OpenDisplay ( vout_thread_t * ); 52 static void CloseDisplay( vout_thread_t * ); 53 static int InitGLX12 ( vout_thread_t *p_vout ); 54 static int InitGLX13 ( vout_thread_t *p_vout ); 55 static void CreateWindow( vout_thread_t *p_vout, XVisualInfo *p_vi ); 56 static void SwitchContext( vout_thread_t *p_vout ); 81 static int OpenDisplay ( vlc_object_t *, glx_t * ); 82 static void CloseDisplay( glx_t * ); 83 static int InitGLX12 ( vlc_object_t *, glx_t * ); 84 static int InitGLX13 ( vlc_object_t *, glx_t * ); 85 static void CreateWindow( vlc_object_t *, glx_t *, XVisualInfo *); 86 static int HandleX11Events( vlc_object_t *, glx_t * ); 87 static void SwitchContext( glx_t * ); 57 88 58 89 static inline int GetAlignedSize( int i_size ); … … 65 96 set_capability( "video output", 20 ); 66 97 add_shortcut( "glx" ); 67 set_callbacks( Create, Destroy ); 98 set_callbacks( CreateVout, DestroyVout ); 99 100 add_submodule(); 101 set_description( _("X11 OpenGL provider") ); 102 set_capability( "opengl provider", 50 ); 103 set_callbacks( CreateOpenGL, DestroyOpenGL ); 68 104 vlc_module_end(); 105 69 106 70 107 /***************************************************************************** … … 78 115 uint8_t *p_buffer; 79 116 int i_index; 80 81 117 int i_tex_width; 82 118 int i_tex_height; 83 84 int i_width;85 int i_height;86 int b_fullscreen;87 88 Display *p_display;89 int b_glx13;90 GLXContext gwctx;91 Window wnd;92 GLXWindow gwnd;93 Atom wm_delete;94 95 119 GLuint texture; 96 97 120 int i_effect; //XXX 121 122 glx_t glx; 98 123 }; 124 125 struct opengl_sys_t 126 { 127 glx_t glx; 128 }; 129 99 130 100 131 #define MWM_HINTS_DECORATIONS (1L << 1) … … 111 142 112 143 /***************************************************************************** 113 * Create : allocates GLX video thread output method144 * CreateVout: allocates GLX video thread output method 114 145 ***************************************************************************** 115 146 * This function allocates and initializes a GLX vout method. 116 147 *****************************************************************************/ 117 static int Create ( vlc_object_t *p_this )148 static int CreateVout( vlc_object_t *p_this ) 118 149 { 119 150 vout_thread_t *p_vout = (vout_thread_t *)p_this; … … 130 161 p_vout->p_sys->i_effect = 1; 131 162 132 /* p_vout->p_sys-> i_width = p_vout->i_window_width;133 p_vout->p_sys-> i_height = p_vout->i_window_height; */134 p_vout->p_sys-> i_width = 700;135 p_vout->p_sys-> i_height = 700;136 p_vout->p_sys-> b_fullscreen = 0;163 /* p_vout->p_sys->glx.i_width = p_vout->i_window_width; 164 p_vout->p_sys->glx.i_height = p_vout->i_window_height; */ 165 p_vout->p_sys->glx.i_width = 700; 166 p_vout->p_sys->glx.i_height = 700; 167 p_vout->p_sys->glx.b_fullscreen = 0; 137 168 138 169 /* A texture must have a size aligned on a power of 2 */ … … 144 175 145 176 /* Open and initialize device */ 146 if( OpenDisplay( p_ vout) )177 if( OpenDisplay( p_this, &p_vout->p_sys->glx ) ) 147 178 { 148 179 msg_Err( p_vout, "cannot open display" ); … … 201 232 p_pic->i_planes = 1; 202 233 234 p_vout->p_sys->p_buffer = 235 malloc( p_vout->p_sys->i_tex_width * p_vout->p_sys->i_tex_height * 4 ); 236 if( !p_vout->p_sys->p_buffer ) 237 { 238 msg_Err( p_vout, "Out of memory" ); 239 return -1; 240 } 203 241 204 242 p_pic->p->p_pixels = p_vout->p_sys->p_buffer … … 218 256 I_OUTPUTPICTURES = 1; 219 257 220 SwitchContext( p_vout);258 SwitchContext( &p_vout->p_sys->glx ); 221 259 222 260 /* Set the texture parameters */ … … 227 265 { 228 266 glEnable( GL_CULL_FACE); 229 /*glDisable( GL_DEPTH_TEST );267 /* glDisable( GL_DEPTH_TEST ); 230 268 glEnable( GL_BLEND ); 231 269 glBlendFunc( GL_SRC_ALPHA, GL_ONE );*/ … … 254 292 * Destroy: destroy GLX video thread output method 255 293 ***************************************************************************** 256 * Terminate an output method created by Create 257 *****************************************************************************/ 258 static void Destroy ( vlc_object_t *p_this )294 * Terminate an output method created by CreateVout 295 *****************************************************************************/ 296 static void DestroyVout( vlc_object_t *p_this ) 259 297 { 260 298 vout_thread_t *p_vout = (vout_thread_t *)p_this; 261 299 262 CloseDisplay( p_vout);300 CloseDisplay( &p_vout->p_sys->glx ); 263 301 264 302 /* Free the texture buffer*/ … … 270 308 free( p_vout->p_sys ); 271 309 } 310 311 312 /***************************************************************************** 313 * CreateOpenGL: initialize an OpenGL provider 314 *****************************************************************************/ 315 static int CreateOpenGL( vlc_object_t *p_this ) 316 { 317 opengl_t *p_opengl = (opengl_t*)p_this; 318 319 /* Allocate the structure */ 320 p_opengl->p_sys = malloc(sizeof(opengl_sys_t)); 321 322 /* Set the function pointers */ 323 p_opengl->pf_init = InitOpenGL; 324 p_opengl->pf_swap = SwapBuffers; 325 p_opengl->pf_handle_events = HandleEvents; 326 327 p_opengl->p_sys->glx.wnd = None; 328 329 return VLC_SUCCESS; 330 } 331 332 333 /***************************************************************************** 334 * DestroyOpenGL: destroys an OpenGL provider 335 *****************************************************************************/ 336 static void DestroyOpenGL( vlc_object_t *p_this ) 337 { 338 opengl_t *p_opengl = (opengl_t*)p_this; 339 340 /* Free the structure */ 341 free(p_opengl->p_sys); 342 } 343 344 /***************************************************************************** 345 * InitOpenGL: creates the OpenGL window 346 *****************************************************************************/ 347 static int InitOpenGL( opengl_t *p_opengl, int i_width, int i_height ) 348 { 349 p_opengl->p_sys->glx.i_width = i_width; 350 p_opengl->p_sys->glx.i_height = i_height; 351 p_opengl->p_sys->glx.b_fullscreen = 0; 352 353 if( OpenDisplay( (vlc_object_t*)p_opengl, &p_opengl->p_sys->glx ) ) 354 { 355 msg_Err( p_opengl, "Cannot create OpenGL window" ); 356 return VLC_EGENERIC; 357 } 358 359 /* Set the OpenGL context _for the current thread_ */ 360 SwitchContext( &p_opengl->p_sys->glx ); 361 362 return VLC_SUCCESS; 363 } 364 365 366 /***************************************************************************** 367 * SwapBuffers: swap front/back buffers 368 *****************************************************************************/ 369 static void SwapBuffers( opengl_t *p_opengl ) 370 { 371 if( p_opengl->p_sys->glx.b_glx13 ) 372 { 373 glXSwapBuffers( p_opengl->p_sys->glx.p_display, 374 p_opengl->p_sys->glx.gwnd ); 375 } 376 else 377 { 378 glXSwapBuffers( p_opengl->p_sys->glx.p_display, 379 p_opengl->p_sys->glx.wnd ); 380 } 381 } 382 383 384 /***************************************************************************** 385 * HandleEvents: handle window events 386 *****************************************************************************/ 387 static int HandleEvents( opengl_t *p_opengl ) 388 { 389 int i_ret = 390 HandleX11Events( (vlc_object_t*)p_opengl, &p_opengl->p_sys->glx ); 391 if( i_ret ) 392 { 393 /* close the window */ 394 CloseDisplay( &p_opengl->p_sys->glx ); 395 } 396 return i_ret; 397 } 398 272 399 273 400 /***************************************************************************** … … 279 406 static int Manage( vout_thread_t *p_vout ) 280 407 { 408 if( HandleX11Events( (vlc_object_t*)p_vout, &p_vout->p_sys->glx ) ) 409 { 410 /* the user wants to close the window */ 411 playlist_t * p_playlist = 412 (playlist_t *)vlc_object_find( p_vout, VLC_OBJECT_PLAYLIST, 413 FIND_ANYWHERE ); 414 if( p_playlist != NULL ) 415 { 416 playlist_Stop( p_playlist ); 417 vlc_object_release( p_playlist ); 418 } 419 } 420 return 0; 421 } 422 423 424 static int HandleX11Events( vlc_object_t *p_thread, glx_t *p_glx ) 425 { 281 426 Display *p_display; 282 427 283 p_display = p_ vout->p_sys->p_display;428 p_display = p_glx->p_display; 284 429 285 430 /* loop on X11 events */ … … 294 439 /* Delete notification */ 295 440 if( (evt.xclient.format == 32) && 296 ((Atom)evt.xclient.data.l[0] == p_vout->p_sys->wm_delete) ) 441 ((Atom)evt.xclient.data.l[0] == 442 p_glx->wm_delete) ) 297 443 { 298 /* the user wants to close the window */ 299 playlist_t * p_playlist = 300 (playlist_t *)vlc_object_find( p_vout, VLC_OBJECT_PLAYLIST, 301 FIND_ANYWHERE ); 302 if( p_playlist != NULL ) 303 { 304 playlist_Stop( p_playlist ); 305 vlc_object_release( p_playlist ); 306 } 444 return -1; 307 445 } 308 446 break; … … 312 450 return 0; 313 451 } 452 314 453 315 454 /***************************************************************************** … … 422 561 } 423 562 glDisable( GL_TEXTURE_2D); 424 425 426 } 563 } 564 427 565 428 566 /***************************************************************************** … … 431 569 static void DisplayVideo( vout_thread_t *p_vout, picture_t *p_pic ) 432 570 { 433 if( p_vout->p_sys->b_glx13 ) 434 { 435 glXSwapBuffers( p_vout->p_sys->p_display, p_vout->p_sys->gwnd ); 571 if( p_vout->p_sys->glx.b_glx13 ) 572 { 573 glXSwapBuffers( p_vout->p_sys->glx.p_display, 574 p_vout->p_sys->glx.gwnd ); 436 575 } 437 576 else 438 577 { 439 glXSwapBuffers( p_vout->p_sys->p_display, p_vout->p_sys->wnd ); 440 } 441 442 } 443 444 /* following functions are local */ 578 glXSwapBuffers( p_vout->p_sys->glx.p_display, 579 p_vout->p_sys->glx.wnd ); 580 } 581 } 582 445 583 446 584 /***************************************************************************** 447 585 * OpenDisplay: open and initialize OpenGL device 448 586 *****************************************************************************/ 449 450 static int OpenDisplay( vout_thread_t *p_vout ) 587 static int OpenDisplay( vlc_object_t *p_thread, glx_t *p_glx ) 451 588 { 452 589 Display *p_display; … … 455 592 456 593 /* Open the display */ 457 p_ vout->p_sys->p_display = p_display = XOpenDisplay( NULL );594 p_glx->p_display = p_display = XOpenDisplay( NULL ); 458 595 if( !p_display ) 459 596 { 460 msg_Err( p_ vout, "Cannot open display" );597 msg_Err( p_thread, "Cannot open display" ); 461 598 return -1; 462 599 } … … 465 602 if( !XQueryExtension( p_display, "GLX", &i_opcode, &i_evt, &i_err ) ) 466 603 { 467 msg_Err( p_ vout, "GLX extension not supported" );604 msg_Err( p_thread, "GLX extension not supported" ); 468 605 return -1; 469 606 } 470 607 if( !glXQueryExtension( p_display, &i_err, &i_evt ) ) 471 608 { 472 msg_Err( p_ vout, "glXQueryExtension failed" );609 msg_Err( p_thread, "glXQueryExtension failed" ); 473 610 return -1; 474 611 } … … 477 614 if (!glXQueryVersion( p_display, &i_maj, &i_min ) ) 478 615 { 479 msg_Err( p_ vout, "glXQueryVersion failed" );616 msg_Err( p_thread, "glXQueryVersion failed" ); 480 617 return -1; 481 618 } 482 619 if( i_maj <= 0 || ((i_maj == 1) && (i_min < 3)) ) 483 620 { 484 p_ vout->p_sys->b_glx13 = 0;485 msg_Dbg( p_ vout, "Using GLX 1.2 API" );486 if( InitGLX12( p_ vout) == -1 )621 p_glx->b_glx13 = 0; 622 msg_Dbg( p_thread, "Using GLX 1.2 API" ); 623 if( InitGLX12( p_thread, p_glx ) == -1 ) 487 624 { 488 625 return -1; … … 491 628 else 492 629 { 493 p_ vout->p_sys->b_glx13 = 1;494 msg_Dbg( p_ vout, "Using GLX 1.3 API" );495 if( InitGLX13( p_ vout) == -1 )630 p_glx->b_glx13 = 1; 631 msg_Dbg( p_thread, "Using GLX 1.3 API" ); 632 if( InitGLX13( p_thread, p_glx ) == -1 ) 496 633 { 497 634 return -1; … … 499 636 } 500 637 501 XMapWindow( p_display, p_ vout->p_sys->wnd );502 if( p_ vout->p_sys->b_fullscreen )638 XMapWindow( p_display, p_glx->wnd ); 639 if( p_glx->b_fullscreen ) 503 640 { 504 641 //XXX 505 XMoveWindow( p_display, p_ vout->p_sys->wnd, 0, 0 );642 XMoveWindow( p_display, p_glx->wnd, 0, 0 ); 506 643 } 507 644 XFlush( p_display ); 508 509 /* Allocate the texture buffer */510 p_vout->p_sys->p_buffer =511 malloc( p_vout->p_sys->i_tex_width * p_vout->p_sys->i_tex_height * 4 );512 if( !p_vout->p_sys->p_buffer )513 {514 msg_Err( p_vout, "Out of memory" );515 return -1;516 }517 645 return 0; 518 646 } … … 524 652 * state of the device. 525 653 *****************************************************************************/ 526 static void CloseDisplay( vout_thread_t *p_vout)654 static void CloseDisplay( glx_t *p_glx ) 527 655 { 528 656 Display *p_display; 529 657 658 if (p_glx->wnd == None ) 659 { 660 // Already closed or not opened... 661 return; 662 } 663 530 664 glFlush(); 531 532 p_display = p_vout->p_sys->p_display; 533 glXDestroyContext( p_display, p_vout->p_sys->gwctx ); 534 if( p_vout->p_sys->b_glx13 ) 535 { 536 glXDestroyWindow( p_display, p_vout->p_sys->gwnd ); 537 } 538 XDestroyWindow( p_display, p_vout->p_sys->wnd ); 539 XCloseDisplay( p_display ); 540 541 } 542 543 544 int InitGLX12( vout_thread_t *p_vout ) 665 p_display = p_glx->p_display; 666 glXDestroyContext( p_display, p_glx->gwctx ); 667 if( p_glx->b_glx13 ) 668 { 669 glXDestroyWindow( p_display, p_glx->gwnd ); 670 } 671 XDestroyWindow( p_display, p_glx->wnd ); 672 p_glx->wnd = None; 673 } 674 675 676 int InitGLX12( vlc_object_t *p_thread, glx_t *p_glx ) 545 677 { 546 678 Display *p_display; … … 551 683 0 }; 552 684 553 p_display = p_ vout->p_sys->p_display;685 p_display = p_glx->p_display; 554 686 555 687 p_vi = glXChooseVisual( p_display, DefaultScreen( p_display), p_attr ); 556 688 if(! p_vi ) 557 689 { 558 msg_Err( p_ vout, "Cannot get GLX 1.2 visual" );690 msg_Err( p_thread, "Cannot get GLX 1.2 visual" ); 559 691 return -1; 560 692 } 561 693 562 694 /* Create the window */ 563 CreateWindow( p_ vout, p_vi );695 CreateWindow( p_thread, p_glx, p_vi ); 564 696 565 697 /* Create an OpenGL context */ 566 p_ vout->p_sys->gwctx = gwctx = glXCreateContext( p_display, p_vi, 0, True );698 p_glx->gwctx = gwctx = glXCreateContext( p_display, p_vi, 0, True ); 567 699 if( !gwctx ) 568 700 { 569 msg_Err( p_ vout, "Cannot create OpenGL context");701 msg_Err( p_thread, "Cannot create OpenGL context"); 570 702 XFree( p_vi ); 571 703 return -1; … … 577 709 578 710 579 int InitGLX13( v out_thread_t *p_vout)711 int InitGLX13( vlc_object_t *p_thread, glx_t *p_glx ) 580 712 { 581 713 Display *p_display; … … 588 720 GLX_DRAWABLE_TYPE, GLX_WINDOW_BIT, 0 }; 589 721 590 p_display = p_ vout->p_sys->p_display;722 p_display = p_glx->p_display; 591 723 592 724 /* Get the FB configuration */ … … 594 726 if( (i_nbelem <= 0) || !p_fbconfs ) 595 727 { 596 msg_Err( p_ vout, "Cannot get FB configurations");728 msg_Err( p_thread, "Cannot get FB configurations"); 597 729 if( p_fbconfs ) 598 730 { … … 607 739 if( !p_vi ) 608 740 { 609 msg_Err( p_ vout, "Cannot get X11 visual" );741 msg_Err( p_thread, "Cannot get X11 visual" ); 610 742 XFree( p_fbconfs ); 611 743 return -1; … … 613 745 614 746 /* Create the window */ 615 CreateWindow( p_ vout, p_vi );747 CreateWindow( p_thread, p_glx, p_vi ); 616 748 617 749 XFree( p_vi ); 618 750 619 751 /* Create the GLX window */ 620 p_ vout->p_sys->gwnd = glXCreateWindow( p_display, fbconf, p_vout->p_sys->wnd, NULL );621 if( p_ vout->p_sys->gwnd == None )622 { 623 msg_Err( p_ vout, "Cannot create GLX window" );752 p_glx->gwnd = glXCreateWindow( p_display, fbconf, p_glx->wnd, NULL ); 753 if( p_glx->gwnd == None ) 754 { 755 msg_Err( p_thread, "Cannot create GLX window" ); 624 756 return -1; 625 757 } 626 758 627 759 /* Create an OpenGL context */ 628 p_ vout->p_sys->gwctx = gwctx = glXCreateNewContext( p_display, fbconf,760 p_glx->gwctx = gwctx = glXCreateNewContext( p_display, fbconf, 629 761 GLX_RGBA_TYPE, NULL, True ); 630 762 if( !gwctx ) 631 763 { 632 msg_Err( p_ vout, "Cannot create OpenGL context");764 msg_Err( p_thread, "Cannot create OpenGL context"); 633 765 XFree( p_fbconfs ); 634 766 return -1; … … 640 772 641 773 642 643 void CreateWindow( vout_thread_t *p_vout, XVisualInfo *p_vi ) 774 void CreateWindow( vlc_object_t *p_thread, glx_t *p_glx, XVisualInfo *p_vi ) 644 775 { 645 776 Display *p_display; … … 651 782 mwmhints_t mwmhints; 652 783 653 p_display = p_ vout->p_sys->p_display;784 p_display = p_glx->p_display; 654 785 655 786 /* Create a colormap */ … … 661 792 xattr.border_pixel = 0; 662 793 xattr.colormap = cm; 663 p_ vout->p_sys->wnd = wnd = XCreateWindow( p_display, DefaultRootWindow(p_display),664 0, 0, p_ vout->p_sys->i_width, p_vout->p_sys->i_height, 0, p_vi->depth,794 p_glx->wnd = wnd = XCreateWindow( p_display, DefaultRootWindow(p_display), 795 0, 0, p_glx->i_width, p_glx->i_height, 0, p_vi->depth, 665 796 InputOutput, p_vi->visual, 666 797 CWBackPixel | CWBorderPixel | CWColormap, &xattr); 667 798 668 799 /* Allow the window to be deleted by the window manager */ 669 p_ vout->p_sys->wm_delete = XInternAtom( p_display, "WM_DELETE_WINDOW", False );670 XSetWMProtocols( p_display, wnd, &p_ vout->p_sys->wm_delete, 1 );671 672 if( p_ vout->p_sys->b_fullscreen )800 p_glx->wm_delete = XInternAtom( p_display, "WM_DELETE_WINDOW", False ); 801 XSetWMProtocols( p_display, wnd, &p_glx->wm_delete, 1 ); 802 803 if( p_glx->b_fullscreen ) 673 804 { 674 805 mwmhints.flags = MWM_HINTS_DECORATIONS; … … 684 815 p_size_hints = XAllocSizeHints(); 685 816 p_size_hints->flags = PMinSize | PMaxSize; 686 p_size_hints->min_width = p_ vout->p_sys->i_width;687 p_size_hints->min_height = p_ vout->p_sys->i_height;688 p_size_hints->max_width = p_ vout->p_sys->i_width;689 p_size_hints->max_height = p_ vout->p_sys->i_height;817 p_size_hints->min_width = p_glx->i_width; 818 p_size_hints->min_height = p_glx->i_height; 819 p_size_hints->max_width = p_glx->i_width; 820 p_size_hints->max_height = p_glx->i_height; 690 821 XSetWMNormalHints( p_display, wnd, p_size_hints ); 691 822 XFree( p_size_hints ); … … 695 826 696 827 697 void SwitchContext( vout_thread_t *p_vout)828 void SwitchContext( glx_t *p_glx ) 698 829 { 699 830 /* Change the current OpenGL context */ 700 if( p_ vout->p_sys->b_glx13 )701 { 702 glXMakeContextCurrent( p_ vout->p_sys->p_display, p_vout->p_sys->gwnd,703 p_ vout->p_sys->gwnd, p_vout->p_sys->gwctx );831 if( p_glx->b_glx13 ) 832 { 833 glXMakeContextCurrent( p_glx->p_display, p_glx->gwnd, 834 p_glx->gwnd, p_glx->gwctx ); 704 835 } 705 836 else 706 837 { 707 glXMakeCurrent( p_ vout->p_sys->p_display, p_vout->p_sys->wnd,708 p_ vout->p_sys->gwctx );838 glXMakeCurrent( p_glx->p_display, p_glx->wnd, 839 p_glx->gwctx ); 709 840 } 710 841 } modules/visualization/galaktos/Modules.am
rb45ccdd r4994baa 1 1 SOURCES_galaktos = plugin.c \ 2 2 plugin.h \ 3 glx.c \4 glx.h \5 3 main.c \ 6 4 main.h \ modules/visualization/galaktos/main.c
rc0a1dbe r4994baa 23 23 *****************************************************************************/ 24 24 25 #include "glx.h" 25 #include "plugin.h" 26 #include "vlc_opengl.h" 26 27 #include <GL/gl.h> 27 28 #include <GL/glu.h> … … 270 271 glFlush(); 271 272 // printf("Flush %d\n",(SDL_GetTicks()-timestart)); 272 galaktos_glx_swap( p_thread);273 274 /* Process X11events */275 if( galaktos_glx_handle_events( p_thread ) == 1)273 (p_thread->p_opengl->pf_swap)( p_thread->p_opengl ); 274 275 /* Process events */ 276 if( (p_thread->p_opengl->pf_handle_events)( p_thread->p_opengl ) ) 276 277 { 277 278 return 1; modules/visualization/galaktos/plugin.c
r1e4bfd0 r4994baa 30 30 31 31 #include "plugin.h" 32 #include "glx.h"33 32 #include "main.h" 34 33 #include "PCM.h" … … 39 38 #include <vlc/vout.h> 40 39 #include "aout_internal.h" 40 #include "vlc_opengl.h" 41 41 42 42 /***************************************************************************** … … 79 79 aout_filter_t *p_filter = (aout_filter_t *)p_this; 80 80 aout_filter_sys_t *p_sys; 81 galaktos_thread_t *p_thread;81 galaktos_thread_t *p_thread; 82 82 vlc_value_t width, height; 83 83 … … 104 104 vlc_object_create( p_filter, sizeof( galaktos_thread_t ) ); 105 105 vlc_object_attach( p_thread, p_this ); 106 107 /* Get on OpenGL provider */ 108 p_thread->p_opengl = 109 (opengl_t *)vlc_object_create( p_this, VLC_OBJECT_OPENGL ); 110 if( p_thread->p_opengl == NULL ) 111 { 112 msg_Err( p_filter, "out of memory" ); 113 return VLC_ENOMEM; 114 } 115 116 p_thread->p_module = 117 module_Need( p_thread->p_opengl, "opengl provider", NULL, 0 ); 118 if( p_thread->p_module == NULL ) 119 { 120 msg_Err( p_filter, "No OpenGL provider found" ); 121 vlc_object_destroy( p_thread->p_opengl ); 122 p_thread->p_opengl = NULL; 123 return VLC_ENOOBJ; 124 } 106 125 107 126 /* … … 117 136 p_thread->i_height = 600; 118 137 p_thread->b_fullscreen = 0; 119 galaktos_glx_init( p_thread );120 138 galaktos_init( p_thread ); 121 139 … … 204 222 int mspf=0; 205 223 206 galaktos_glx_activate_window( p_thread ); 224 /* Initialize the opengl provider */ 225 (p_thread->p_opengl->pf_init)(p_thread->p_opengl, p_thread->i_width, 226 p_thread->i_height); 227 207 228 setup_opengl( p_thread->i_width, p_thread->i_height ); 208 229 CreateRenderTarget(512, &RenderTargetTextureID, NULL); … … 236 257 timestart=mdate()/1000; 237 258 } 238 239 galaktos_glx_done( p_thread );240 259 } 241 260 … … 254 273 255 274 vlc_thread_join( p_sys->p_thread ); 275 276 /* Free the openGL provider */ 277 module_Unneed( p_sys->p_thread->p_opengl, p_sys->p_thread->p_module ); 278 vlc_object_destroy( p_sys->p_thread->p_opengl ); 256 279 257 280 /* Free data */ modules/visualization/galaktos/plugin.h
r1e4bfd0 r4994baa 36 36 char *psz_title; 37 37 38 /* OpenGL provider */ 39 opengl_t *p_opengl; 40 module_t *p_module; 41 38 42 /* Window properties */ 39 43 int i_width; src/misc/objects.c
r2455945 r4994baa 49 49 #include "vlc_codec.h" 50 50 51 #include "vlc_opengl.h" 52 51 53 #include "vlc_httpd.h" 52 54 #include "vlc_vlm.h" … … 170 172 psz_type = "vlm dameon"; 171 173 break; 174 case VLC_OBJECT_OPENGL: 175 i_size = sizeof( opengl_t ); 176 psz_type = "opengl provider"; 177 break; 172 178 case VLC_OBJECT_ANNOUNCE: 173 179 i_size = sizeof( announce_handler_t );
