Changeset 65de9dd76f0ec5cfff4a84d3fbd818942321114d
- Timestamp:
- 01/19/08 15:54:38 (7 months ago)
- git-parent:
- Files:
-
- THANKS (modified) (2 diffs)
- configure.ac (modified) (2 diffs)
- mozilla/vlcplugin.h (modified) (4 diffs)
- mozilla/vlcshell.cpp (modified) (14 diffs)
- share/mozilla/fullscreen.xpm (added)
- share/mozilla/pause.xpm (added)
- share/mozilla/play.xpm (added)
- share/mozilla/skip_next.xpm (added)
- share/mozilla/skip_previous.xpm (added)
- share/mozilla/stop.xpm (added)
- share/mozilla/time_icon.xpm (added)
- share/mozilla/time_line.xpm (added)
- share/mozilla/volume_knob.xpm (added)
- share/mozilla/volume_max.xpm (added)
- share/mozilla/volume_mute.xpm (added)
- share/mozilla/volume_slider_bar.xpm (added)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
THANKS
r8f3d5d0 r65de9dd 85 85 François Seingier <francois.seingier at club-internet.fr> - TTL setting in the wx stream output dialog 86 86 Frank Chao <frank0624 at gmail.com> - Chinese Traditional translation 87 Frans van Veen <f.m.j.c.vanveen at student.hhs.nl> - Mozilla plugin toolbar 87 88 Fumio Nakayama <endymion at ca2.so-net.ne.jp> - Japanese translation 88 89 Gabor Kelemen <kelemeng at gnome dot hu> - Hungarian translation … … 104 105 Jan Gerber <j at v2v dot org> - patch theora decoding aspect ratio 105 106 Jan Van Boghout <vlc at macrabbit.com> - iTunes like slider for OSX intf 106 Ja vier Varela <tonxabar at hotmail.com> - Spanish translation107 J ean-Alexis Montignies <ja at sente.ch> - coreaudio multiple streams fix107 Jasper Alias <j.alias at student.hhs.nl>- Mozilla plugin toolbar 108 Javier Varela <tonxabar at hotmail.com> - Spanish translation Jean-Alexis Montignies <ja at sente.ch> - coreaudio multiple streams fix 108 109 Jean-Baptiste Le Stang <jp.lestand at lestang.org> - Equalizer-GUI-fixes (OSX), Universal Binary Script 109 110 Jean-Philippe Grimaldi <jeanphi at via.ecp.fr> - bug fixes configure.ac
rbc77ed1 r65de9dd 5806 5806 fi 5807 5807 if grep '^#define MOZ_X11 1' ${MOZILLA_CONFIG_H} 2>&1 > /dev/null ; then 5808 VLC_ADD_LIBS([mozilla], [${X_LIBS} ${X_PRE_LIBS} -lX11 -lXt ])5808 VLC_ADD_LIBS([mozilla], [${X_LIBS} ${X_PRE_LIBS} -lX11 -lXt -lXpm]) 5809 5809 fi 5810 5810 VLC_ADD_CPPFLAGS([mozilla],[${CPPFLAGS}]) … … 5843 5843 [ 5844 5844 VLC_ADD_CPPFLAGS([mozilla],[${X_CFLAGS}]) 5845 VLC_ADD_LIBS([mozilla],[${X_LIBS} ${X_PRE_LIBS} -lXt -lX11 -lSM -lICE ])5845 VLC_ADD_LIBS([mozilla],[${X_LIBS} ${X_PRE_LIBS} -lXt -lX11 -lSM -lICE -lXpm]) 5846 5846 ], 5847 5847 [], 5848 [[${X_LIBS} ${X_PRE_LIBS} -lX11 -lSM -lICE ]5848 [[${X_LIBS} ${X_PRE_LIBS} -lX11 -lSM -lICE -lXpm] 5849 5849 ]) 5850 5850 LDFLAGS="${LDFLAGS_save}" mozilla/vlcplugin.h
r7db3162 r65de9dd 53 53 # include <X11/Intrinsic.h> 54 54 # include <X11/StringDefs.h> 55 # include <X11/X.h> 55 56 #endif 56 57 … … 88 89 #if XP_UNIX 89 90 int setSize(unsigned width, unsigned height); 91 Window getVideoWindow() 92 { return npvideo; }; 93 void setVideoWindow(Window window) 94 { npvideo = window; }; 95 Window getControlWindow() 96 { return npcontrol; }; 97 void setControlWindow(Window window) 98 { npcontrol = window; }; 90 99 #endif 91 100 … … 114 123 #if XP_UNIX 115 124 unsigned int i_width, i_height; 125 Window npvideo, npcontrol; 116 126 #endif 117 127 }; … … 152 162 "application/x-mplayer2::Windows Media;" \ 153 163 "video/x-ms-wmv:wmv:Windows Media;" \ 164 "video/x-ms-wvx:wvx:Windows Media Video;" \ 154 165 /* Google VLC */ \ 155 166 "application/x-google-vlc-plugin::Google VLC plugin;" \ mozilla/vlcshell.cpp
r6ee1e19 r65de9dd 30 30 #include <string.h> 31 31 #include <stdlib.h> 32 #include <X11/xpm.h> 32 33 33 34 /* Mozilla stuff */ … … 46 47 #undef X11_RESIZE_DEBUG 47 48 48 #define WINDOW_TEXT "(no video)" 49 #define WINDOW_TEXT "Video is loading..." 50 #define CONTROL_HEIGHT 45 49 51 50 52 /***************************************************************************** … … 54 56 55 57 static void Redraw( Widget w, XtPointer closure, XEvent *event ); 58 static void ControlHandler( Widget w, XtPointer closure, XEvent *event ); 56 59 static void Resize( Widget w, XtPointer closure, XEvent *event ); 57 60 … … 185 188 if( libvlc_playlist_isplaying(p_vlc, NULL) ) 186 189 { 187 libvlc_media_instance_t *p_md = libvlc_playlist_get_media_instance(p_vlc, NULL); 190 libvlc_media_instance_t *p_md = 191 libvlc_playlist_get_media_instance(p_vlc, NULL); 188 192 if( p_md ) 189 193 { … … 215 219 if( libvlc_playlist_isplaying(p_vlc, NULL) ) 216 220 { 217 libvlc_media_instance_t *p_md = libvlc_playlist_get_media_instance(p_vlc, NULL); 221 libvlc_media_instance_t *p_md = 222 libvlc_playlist_get_media_instance(p_vlc, NULL); 218 223 if( p_md ) 219 224 { … … 241 246 242 247 /* seems that firefox forgets to set the following on occasion (reload) */ 243 SetOrigin(((NP_Port *)npwindow.window)->portx, ((NP_Port *)npwindow.window)->porty); 248 SetOrigin(((NP_Port *)npwindow.window)->portx, 249 ((NP_Port *)npwindow.window)->porty); 244 250 245 251 Rect rect; … … 439 445 } 440 446 /* attach our plugin object */ 441 SetWindowLongPtr((HWND)drawable, GWLP_USERDATA, reinterpret_cast<LONG_PTR>(p_plugin)); 447 SetWindowLongPtr((HWND)drawable, GWLP_USERDATA, 448 reinterpret_cast<LONG_PTR>(p_plugin)); 442 449 443 450 /* install our WNDPROC */ 444 451 p_plugin->setWindowProc( (WNDPROC)SetWindowLong( drawable, 445 GWL_WNDPROC, (LONG)Manage ) );452 GWL_WNDPROC, (LONG)Manage ) ); 446 453 447 454 /* change window style to our liking */ … … 476 483 if( window && window->window ) 477 484 { 478 Window drawable= (Window) window->window;479 if( !curwin.window || drawable != (Window)curwin.window)485 Window parent = (Window) window->window; 486 if( !curwin.window || (parent != (Window)curwin.window) ) 480 487 { 481 488 Display *p_display = ((NPSetWindowCallbackStruct *)window->ws_info)->display; 482 489 483 XResizeWindow( p_display, drawable, window->width, window->height ); 484 Widget w = XtWindowToWidget( p_display, drawable ); 485 486 XtAddEventHandler( w, ExposureMask, FALSE, (XtEventHandler)Redraw, p_plugin ); 487 XtAddEventHandler( w, StructureNotifyMask, FALSE, (XtEventHandler)Resize, p_plugin ); 490 XResizeWindow( p_display, parent, window->width, window->height ); 491 492 int i_blackColor = BlackPixel(p_display, DefaultScreen(p_display)); 493 494 Window video = XCreateSimpleWindow( p_display, parent, 0, 0, 495 window->width, window->height - CONTROL_HEIGHT, 0, 496 i_blackColor, i_blackColor ); 497 Window controls = XCreateSimpleWindow( p_display, parent, 0, 498 window->height - CONTROL_HEIGHT-1, window->width, 499 CONTROL_HEIGHT-1, 0, i_blackColor, i_blackColor ); 500 501 XMapWindow( p_display, parent ); 502 XMapWindow( p_display, video ); 503 XMapWindow( p_display, controls ); 504 505 XFlush(p_display); 506 507 Widget w = XtWindowToWidget( p_display, parent ); 508 509 XtAddEventHandler( w, ExposureMask, FALSE, 510 (XtEventHandler)Redraw, p_plugin ); 511 XtAddEventHandler( w, StructureNotifyMask, FALSE, 512 (XtEventHandler)Resize, p_plugin ); 513 XtAddEventHandler( w, ButtonReleaseMask, FALSE, 514 (XtEventHandler)ControlHandler, p_plugin ); 515 516 /* callback */ 517 /* 518 libvlc_media_instance_t *p_md; 519 520 libvlc_exception_t ex; 521 libvlc_exception_init(& ex ); 522 p_md = libvlc_playlist_get_media_instance( p_plugin->getVLC(), &ex ); 523 libvlc_exception_init( &ex ); 524 libvlc_event_attach( libvlc_media_instance_event_manager( p_md, &ex ), 525 libvlc_MediaInstancePositionChanged, Redraw, NULL, &ex ); 526 */ 488 527 489 528 /* set/change parent window */ 490 libvlc_video_set_parent( p_vlc, (libvlc_drawable_t)drawable, NULL);529 libvlc_video_set_parent( p_vlc, (libvlc_drawable_t) video, NULL ); 491 530 492 531 /* remember window */ 493 p_plugin->setWindow(*window); 532 p_plugin->setWindow( *window ); 533 p_plugin->setVideoWindow( video ); 534 p_plugin->setControlWindow( controls ); 494 535 495 536 Redraw( w, (XtPointer)p_plugin, NULL ); … … 508 549 if( p_plugin->psz_target ) 509 550 { 510 if( libvlc_playlist_add( p_vlc, p_plugin->psz_target, NULL, NULL ) != -1 ) 551 if( libvlc_playlist_add( p_vlc, p_plugin->psz_target, 552 NULL, NULL ) != -1 ) 511 553 { 512 554 if( p_plugin->b_autoplay ) … … 703 745 SetTextColor(hdc, RGB(255, 255, 255)); 704 746 SetBkColor(hdc, RGB(0, 0, 0)); 705 DrawText( hdc, WINDOW_TEXT, strlen(WINDOW_TEXT), &rect, DT_CENTER|DT_VCENTER|DT_SINGLELINE); 747 DrawText( hdc, WINDOW_TEXT, strlen(WINDOW_TEXT), &rect, 748 DT_CENTER|DT_VCENTER|DT_SINGLELINE); 706 749 707 750 EndPaint( p_hwnd, &paintstruct ); … … 726 769 XGCValues gcv; 727 770 728 Window drawable = (Window) window.window; 771 /* Toolbar */ 772 XImage *p_playIcon = NULL; 773 XImage *p_pauseIcon = NULL; 774 XImage *p_stopIcon = NULL; 775 XImage *p_timeline = NULL; 776 XImage *p_timeKnob = NULL; 777 XImage *p_fscreen = NULL; 778 XImage *p_muteIcon = NULL; 779 XImage *p_unmuteIcon = NULL; 780 781 libvlc_media_instance_t *p_md = NULL; 782 float f_position = 0; 783 int i_playing = 0; 784 bool b_mute = false; 785 786 Window video = p_plugin->getVideoWindow(); 787 Window control = p_plugin->getControlWindow(); 729 788 Display *p_display = ((NPSetWindowCallbackStruct *)window.ws_info)->display; 730 789 731 790 gcv.foreground = BlackPixel( p_display, 0 ); 732 gc = XCreateGC( p_display, drawable, GCForeground, &gcv );733 734 XFillRectangle( p_display, drawable, gc,735 0, 0, window.width, window.height );791 gc = XCreateGC( p_display, video, GCForeground, &gcv ); 792 793 XFillRectangle( p_display, video, gc, 794 0, 0, window.width, window.height - CONTROL_HEIGHT ); 736 795 737 796 gcv.foreground = WhitePixel( p_display, 0 ); 738 797 XChangeGC( p_display, gc, GCForeground, &gcv ); 739 798 740 XDrawString( p_display, drawable, gc,741 window.width / 2 - 40, window.height/ 2,799 XDrawString( p_display, video, gc, 800 window.width / 2 - 40, (window.height - CONTROL_HEIGHT) / 2, 742 801 WINDOW_TEXT, strlen(WINDOW_TEXT) ); 743 802 803 /* RedrawToolbar */ 804 gcv.foreground = BlackPixel( p_display, 0 ); 805 gc = XCreateGC( p_display, control, GCForeground, &gcv ); 806 807 XFillRectangle( p_display, control, gc, 808 0, 0, window.width, CONTROL_HEIGHT ); 809 810 811 gcv.foreground = WhitePixel( p_display, 0 ); 812 XChangeGC( p_display, gc, GCForeground, &gcv ); 813 814 /* get media instance */ 815 libvlc_exception_t ex; 816 libvlc_exception_init( &ex ); 817 p_md = libvlc_playlist_get_media_instance( p_plugin->getVLC(), &ex ); 818 libvlc_exception_clear( &ex ); 819 820 /* get isplaying */ 821 libvlc_exception_init( &ex ); 822 i_playing = libvlc_playlist_isplaying( p_plugin->getVLC(), &ex ); 823 libvlc_exception_clear( &ex ); 824 825 /* get mute info */ 826 libvlc_exception_init(&ex); 827 b_mute = libvlc_audio_get_mute( p_plugin->getVLC(), &ex ); 828 libvlc_exception_clear( &ex ); 829 830 /* get movie position in % */ 831 if( i_playing == 1 ) 832 { 833 libvlc_exception_init( &ex ); 834 f_position = libvlc_media_instance_get_position(p_md, &ex)*100; 835 libvlc_exception_clear( &ex ); 836 } 837 libvlc_media_instance_release(p_md); 838 839 /* load icons */ 840 XpmReadFileToImage( p_display, "/usr/share/vlc/mozilla/play.xpm", 841 &p_playIcon, NULL, NULL); 842 XpmReadFileToImage( p_display, "/usr/share/vlc/mozilla/pause.xpm", 843 &p_pauseIcon, NULL, NULL); 844 XpmReadFileToImage( p_display, "/usr/share/vlc/mozilla/stop.xpm", 845 &p_stopIcon, NULL, NULL ); 846 XpmReadFileToImage( p_display, "/usr/share/vlc/mozilla/time_line.xpm", 847 &p_timeline, NULL, NULL); 848 XpmReadFileToImage( p_display, "/usr/share/vlc/mozilla/time_icon.xpm", 849 &p_timeKnob, NULL, NULL); 850 XpmReadFileToImage( p_display, "/usr/share/vlc/mozilla/fullscreen.xpm", 851 &p_fscreen, NULL, NULL); 852 XpmReadFileToImage( p_display, "/usr/share/vlc/mozilla/volume_max.xpm", 853 &p_muteIcon, NULL, NULL); 854 XpmReadFileToImage( p_display, "/usr/share/vlc/mozilla/volume_mute.xpm", 855 &p_unmuteIcon, NULL, NULL); 856 857 #if 1 /* DEBUG */ 858 if( !p_playIcon ) 859 { 860 fprintf(stderr, "Error: playImage not found\n"); 861 } 862 if( !p_pauseIcon ) 863 { 864 fprintf(stderr, "Error: pauseImage not found\n"); 865 } 866 if( !p_stopIcon ) 867 { 868 fprintf(stderr, "Error: stopImage not found\n"); 869 } 870 if( !p_timeline ) 871 { 872 fprintf(stderr, "Error: TimeLineImage not found\n"); 873 } 874 if( !p_timeKnob ) 875 { 876 fprintf(stderr, "Error: TimeIcon not found\n"); 877 } 878 if( !p_fscreen ) 879 { 880 fprintf(stderr, "Error: FullscreenImage not found\n"); 881 } 882 if( !p_muteIcon ) 883 { 884 fprintf(stderr, "Error: MuteImage not found\n"); 885 } 886 if( !p_unmuteIcon ) 887 { 888 fprintf(stderr, "Error: UnMuteImage not found\n"); 889 } 890 #endif 891 892 /* position icons */ 893 if( p_pauseIcon && (i_playing == 1) ) 894 { 895 XPutImage( p_display, control, gc, p_pauseIcon, 0, 0, 4, 14, 896 p_pauseIcon->width, p_pauseIcon->height ); 897 } 898 else if( p_playIcon ) 899 { 900 XPutImage( p_display, control, gc, p_playIcon, 0, 0, 4, 14, 901 p_playIcon->width, p_playIcon->height ); 902 } 903 904 if( p_stopIcon ) 905 XPutImage( p_display, control, gc, p_stopIcon, 0, 0, 39, 14, 906 p_stopIcon->width, p_stopIcon->height ); 907 if( p_fscreen ) 908 XPutImage( p_display, control, gc, p_fscreen, 0, 0, 67, 21, 909 p_fscreen->width, p_fscreen->height ); 910 911 if( p_unmuteIcon && b_mute ) 912 { 913 XPutImage( p_display, control, gc, p_unmuteIcon, 0, 0, 94, 30, 914 p_unmuteIcon->width, p_unmuteIcon->height ); 915 } 916 else if( p_muteIcon ) 917 { 918 XPutImage( p_display, control, gc, p_muteIcon, 0, 0, 94, 30, 919 p_muteIcon->width, p_muteIcon->height ); 920 } 921 922 if( p_timeline ) 923 XPutImage( p_display, control, gc, p_timeline, 0, 0, 4, 4, 924 (window.width-8), p_timeline->height ); 925 if( p_timeKnob && (f_position > 0) ) 926 { 927 f_position = (((float)window.width-8)/100)*f_position; 928 XPutImage( p_display, control, gc, p_timeKnob, 0, 0, (4+f_position), 2, 929 p_timeKnob->width, p_timeKnob->height ); 930 } 931 932 /* Cleanup */ 933 if( p_playIcon ) XDestroyImage( p_playIcon ); 934 if( p_pauseIcon ) XDestroyImage( p_pauseIcon ); 935 if( p_stopIcon ) XDestroyImage( p_stopIcon ); 936 if( p_timeline ) XDestroyImage( p_timeline ); 937 if( p_timeKnob ) XDestroyImage( p_timeKnob ); 938 if( p_fscreen ) XDestroyImage( p_fscreen ); 939 if( p_muteIcon ) XDestroyImage( p_muteIcon ); 940 if( p_unmuteIcon ) XDestroyImage( p_unmuteIcon ); 941 744 942 XFreeGC( p_display, gc ); 745 943 } 746 944 747 static void Resize( Widget w, XtPointer closure, XEvent *event )945 static void ControlHandler( Widget w, XtPointer closure, XEvent *event ) 748 946 { 749 947 VlcPlugin* p_plugin = reinterpret_cast<VlcPlugin*>(closure); 750 948 const NPWindow& window = p_plugin->getWindow(); 751 Window drawable = (Window) window.window; 949 950 int i_height = window.height; 951 int i_width = window.width; 952 int i_xPos = event->xbutton.x; 953 int i_yPos = event->xbutton.y; 954 955 libvlc_exception_t ex; 956 libvlc_exception_init( &ex ); 957 libvlc_media_instance_t *p_md = 958 libvlc_playlist_get_media_instance(p_plugin->getVLC(), &ex); 959 libvlc_exception_clear( &ex ); 960 961 /* jump in the movie */ 962 if( i_yPos <= (i_height-30) ) 963 { 964 vlc_int64_t f_length; 965 libvlc_exception_init( &ex ); 966 f_length = libvlc_media_instance_get_length( p_md, &ex ) / 100; 967 libvlc_exception_clear( &ex ); 968 969 f_length = (float)f_length * 970 ( ((float)i_xPos-4 ) / ( ((float)i_width-8)/100) ); 971 972 libvlc_exception_init( &ex ); 973 libvlc_media_instance_set_time( p_md, f_length, &ex ); 974 libvlc_exception_clear( &ex ); 975 } 976 977 /* play/pause toggle */ 978 if( (i_yPos > (i_height-30)) && (i_xPos > 4) && (i_xPos <= 39) ) 979 { 980 int i_playing; 981 libvlc_exception_init( &ex ); 982 i_playing = libvlc_playlist_isplaying( p_plugin->getVLC(), &ex ); 983 libvlc_exception_clear( &ex ); 984 985 libvlc_exception_init( &ex ); 986 if( i_playing == 1 ) 987 libvlc_playlist_pause( p_plugin->getVLC(), &ex ); 988 else 989 libvlc_playlist_play( p_plugin->getVLC(), -1, 0, NULL, &ex ); 990 libvlc_exception_clear( &ex ); 991 } 992 993 /* stop */ 994 if( (i_yPos > (i_height-30)) && (i_xPos > 39) && (i_xPos < 67) ) 995 { 996 libvlc_exception_init( &ex ); 997 libvlc_playlist_stop( p_plugin->getVLC(), &ex ); 998 libvlc_exception_clear( &ex ); 999 } 1000 1001 /* fullscreen */ 1002 if( (i_yPos > (i_height-30)) && (i_xPos >= 67) && (i_xPos < 94) ) 1003 { 1004 libvlc_exception_init( &ex ); 1005 libvlc_set_fullscreen( p_md, 1, &ex ); 1006 libvlc_exception_clear( &ex ); 1007 } 1008 1009 /* mute toggle */ 1010 if( (i_yPos > (i_height-30)) && (i_xPos >= 94) && (i_xPos < 109)) 1011 { 1012 libvlc_exception_init( &ex ); 1013 libvlc_audio_toggle_mute( p_plugin->getVLC(), &ex ); 1014 libvlc_exception_clear( &ex ); 1015 } 1016 libvlc_media_instance_release( p_md ); 1017 1018 Redraw( w, closure, event ); 1019 } 1020 1021 static void Resize ( Widget w, XtPointer closure, XEvent *event ) 1022 { 1023 VlcPlugin* p_plugin = reinterpret_cast<VlcPlugin*>(closure); 1024 const NPWindow& window = p_plugin->getWindow(); 1025 Window drawable = p_plugin->getVideoWindow(); 752 1026 Display *p_display = ((NPSetWindowCallbackStruct *)window.ws_info)->display; 753 1027 … … 769 1043 #endif /* X11_RESIZE_DEBUG */ 770 1044 771 if( ! p_plugin->setSize(window.width, window.height) )1045 if( ! p_plugin->setSize(window.width, (window.height - CONTROL_HEIGHT)) ) 772 1046 { 773 1047 /* size already set */ … … 776 1050 777 1051 778 i_ret = XResizeWindow( p_display, drawable, window.width, window.height);1052 i_ret = XResizeWindow( p_display, drawable, window.width, (window.height - CONTROL_HEIGHT) ); 779 1053 780 1054 #ifdef X11_RESIZE_DEBUG … … 808 1082 809 1083 i_ret = XResizeWindow( p_display, base_window, 810 window.width, window.height);1084 window.width, ( window.height - CONTROL_HEIGHT ) ); 811 1085 812 1086 #ifdef X11_RESIZE_DEBUG
