1 /*****************************************************************************
2 * vlcplugin.cpp: a VLC plugin for Mozilla
3 *****************************************************************************
4 * Copyright (C) 2002-2009 the VideoLAN team
7 * Authors: Samuel Hocevar <sam@zoy.org>
8 * Damien Fouilleul <damienf.fouilleul@laposte.net>
9 * Jean-Paul Saman <jpsaman@videolan.org>
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
24 *****************************************************************************/
26 /*****************************************************************************
28 *****************************************************************************/
31 #ifdef HAVE_MOZILLA_CONFIG_H
32 # include <mozilla-config.h>
35 #include "vlcplugin.h"
36 #include "control/npolibvlc.h"
40 /*****************************************************************************
41 * VlcPlugin constructor and destructor
42 *****************************************************************************/
43 VlcPlugin::VlcPlugin( NPP instance, uint16 mode ) :
50 libvlc_instance(NULL),
51 libvlc_media_list(NULL),
52 libvlc_media_player(NULL),
61 ,i_width((unsigned)-1)
62 ,i_height((unsigned)-1)
71 ,p_btnFullscreen(NULL)
76 memset(&npwindow, 0, sizeof(NPWindow));
78 memset(&npvideo, 0, sizeof(Window));
79 memset(&npcontrol, 0, sizeof(Window));
83 static bool boolValue(const char *value) {
84 return ( !strcmp(value, "1") ||
85 !strcasecmp(value, "true") ||
86 !strcasecmp(value, "yes") );
89 NPError VlcPlugin::init(int argc, char* const argn[], char* const argv[])
91 /* prepare VLC command line */
92 const char *ppsz_argv[32];
96 ppsz_argv[ppsz_argc++] = "--no-plugins-cache";
99 /* locate VLC module path */
101 ppsz_argv[ppsz_argc++] = "--plugin-path=/Library/Internet\\ Plug-Ins/VLC\\ Plugin.plugin/Contents/MacOS/modules";
102 ppsz_argv[ppsz_argc++] = "--vout=macosx";
103 #elif defined(XP_WIN)
105 DWORD i_type, i_data = MAX_PATH + 1;
106 char p_data[MAX_PATH + 1];
107 if( RegOpenKeyEx( HKEY_LOCAL_MACHINE, "Software\\VideoLAN\\VLC",
108 0, KEY_READ, &h_key ) == ERROR_SUCCESS )
110 if( RegQueryValueEx( h_key, "InstallDir", 0, &i_type,
111 (LPBYTE)p_data, &i_data ) == ERROR_SUCCESS )
113 if( i_type == REG_SZ )
115 strcat( p_data, "\\plugins" );
116 ppsz_argv[ppsz_argc++] = "--plugin-path";
117 ppsz_argv[ppsz_argc++] = p_data;
120 RegCloseKey( h_key );
122 ppsz_argv[ppsz_argc++] = "--no-one-instance";
124 #endif /* XP_MACOSX */
126 /* common settings */
127 ppsz_argv[ppsz_argc++] = "-vv";
128 ppsz_argv[ppsz_argc++] = "--no-stats";
129 ppsz_argv[ppsz_argc++] = "--no-media-library";
130 ppsz_argv[ppsz_argc++] = "--ignore-config";
131 ppsz_argv[ppsz_argc++] = "--intf=dummy";
132 ppsz_argv[ppsz_argc++] = "--no-video-title-show";
134 const char *progid = NULL;
136 /* parse plugin arguments */
137 for( int i = 0; i < argc ; i++ )
139 /* fprintf(stderr, "argn=%s, argv=%s\n", argn[i], argv[i]); */
141 if( !strcmp( argn[i], "target" )
142 || !strcmp( argn[i], "mrl")
143 || !strcmp( argn[i], "filename")
144 || !strcmp( argn[i], "src") )
146 psz_target = argv[i];
148 else if( !strcmp( argn[i], "autoplay")
149 || !strcmp( argn[i], "autostart") )
151 b_autoplay = boolValue(argv[i]);
153 else if( !strcmp( argn[i], "fullscreen" ) )
155 if( boolValue(argv[i]) )
157 ppsz_argv[ppsz_argc++] = "--fullscreen";
161 ppsz_argv[ppsz_argc++] = "--no-fullscreen";
164 else if( !strcmp( argn[i], "mute" ) )
166 if( boolValue(argv[i]) )
168 ppsz_argv[ppsz_argc++] = "--volume=0";
171 else if( !strcmp( argn[i], "loop")
172 || !strcmp( argn[i], "autoloop") )
174 if( boolValue(argv[i]) )
176 ppsz_argv[ppsz_argc++] = "--loop";
180 ppsz_argv[ppsz_argc++] = "--no-loop";
183 else if( !strcmp( argn[i], "version")
184 || !strcmp( argn[i], "progid") )
188 else if( !strcmp( argn[i], "toolbar" ) )
190 /* FIXME: Remove this when toolbar functionality has been implemented on
191 * MacOS X and Win32 for Firefox/Mozilla/Safari. */
193 b_toolbar = boolValue(argv[i]);
198 libvlc_exception_t ex;
199 libvlc_exception_init(&ex);
201 libvlc_instance = libvlc_new(ppsz_argc, ppsz_argv, &ex);
202 if( libvlc_exception_raised(&ex) )
204 libvlc_exception_clear(&ex);
205 return NPERR_GENERIC_ERROR;
208 libvlc_media_list = libvlc_media_list_new(libvlc_instance,&ex);
209 if( libvlc_exception_raised(&ex) )
211 libvlc_exception_clear(&ex);
212 return NPERR_GENERIC_ERROR;
216 ** fetch plugin base URL, which is the URL of the page containing the plugin
217 ** this URL is used for making absolute URL from relative URL that may be
218 ** passed as an MRL argument
222 if( NPERR_NO_ERROR == NPN_GetValue(p_browser, NPNVWindowNPObject, &plugin) )
225 ** is there a better way to get that info ?
227 static const char docLocHref[] = "document.location.href";
231 script.utf8characters = docLocHref;
232 script.utf8length = sizeof(docLocHref)-1;
234 if( NPN_Evaluate(p_browser, plugin, &script, &result) )
236 if( NPVARIANT_IS_STRING(result) )
238 NPString &location = NPVARIANT_TO_STRING(result);
240 psz_baseURL = static_cast<char*>(malloc(location.utf8length+1));
243 strncpy(psz_baseURL, location.utf8characters, location.utf8length);
244 psz_baseURL[location.utf8length] = '\0';
247 NPN_ReleaseVariantValue(&result);
249 NPN_ReleaseObject(plugin);
254 // get absolute URL from src
255 char *psz_absurl = getAbsoluteURL(psz_target);
256 psz_target = psz_absurl ? psz_absurl : strdup(psz_target);
259 /* assign plugin script root class */
261 p_scriptClass = RuntimeNPClass<LibvlcRootNPObject>::getClass();
263 return NPERR_NO_ERROR;
266 VlcPlugin::~VlcPlugin()
271 libvlc_log_close(libvlc_log, NULL);
272 if( libvlc_media_player )
273 libvlc_media_player_release( libvlc_media_player );
274 if( libvlc_media_list )
275 libvlc_media_list_release( libvlc_media_list );
276 if( libvlc_instance )
277 libvlc_release(libvlc_instance);
280 /*****************************************************************************
281 * VlcPlugin playlist replacement methods
282 *****************************************************************************/
283 void VlcPlugin::set_player_window( libvlc_exception_t *ex )
286 libvlc_media_player_set_xwindow(libvlc_media_player,
287 (libvlc_drawable_t)getVideoWindow(),
291 // XXX FIXME insert appropriate call here
294 libvlc_media_player_set_hwnd(libvlc_media_player,
300 int VlcPlugin::playlist_add( const char *mrl, libvlc_exception_t *ex )
303 libvlc_media_t *p_m = libvlc_media_new(libvlc_instance,mrl,ex);
304 if( libvlc_exception_raised(ex) )
307 libvlc_media_list_lock(libvlc_media_list);
308 libvlc_media_list_add_media(libvlc_media_list,p_m,ex);
309 if( !libvlc_exception_raised(ex) )
310 item = libvlc_media_list_count(libvlc_media_list,ex)-1;
311 libvlc_media_list_unlock(libvlc_media_list);
313 libvlc_media_release(p_m);
318 int VlcPlugin::playlist_add_extended_untrusted( const char *mrl, const char *name,
319 int optc, const char **optv, libvlc_exception_t *ex )
321 libvlc_media_t *p_m = libvlc_media_new(libvlc_instance, mrl,ex);
323 if( libvlc_exception_raised(ex) )
326 for( int i = 0; i < optc; ++i )
328 libvlc_media_add_option_untrusted(p_m, optv[i],ex);
329 if( libvlc_exception_raised(ex) )
331 libvlc_media_release(p_m);
336 libvlc_media_list_lock(libvlc_media_list);
337 libvlc_media_list_add_media(libvlc_media_list,p_m,ex);
338 if( !libvlc_exception_raised(ex) )
339 item = libvlc_media_list_count(libvlc_media_list,ex)-1;
340 libvlc_media_list_unlock(libvlc_media_list);
341 libvlc_media_release(p_m);
346 bool VlcPlugin::playlist_select( int idx, libvlc_exception_t *ex )
348 libvlc_media_t *p_m = NULL;
350 libvlc_media_list_lock(libvlc_media_list);
352 int count = libvlc_media_list_count(libvlc_media_list,ex);
353 if( libvlc_exception_raised(ex) )
356 if( idx<0||idx>=count )
359 playlist_index = idx;
361 p_m = libvlc_media_list_item_at_index(libvlc_media_list,playlist_index,ex);
362 libvlc_media_list_unlock(libvlc_media_list);
364 if( libvlc_exception_raised(ex) )
367 if( libvlc_media_player )
369 libvlc_media_player_release( libvlc_media_player );
370 libvlc_media_player = NULL;
373 libvlc_media_player = libvlc_media_player_new_from_media(p_m,ex);
374 if( libvlc_media_player )
375 set_player_window(ex);
377 libvlc_media_release( p_m );
378 return !libvlc_exception_raised(ex);
381 libvlc_media_list_unlock(libvlc_media_list);
385 void VlcPlugin::playlist_delete_item( int idx, libvlc_exception_t *ex )
387 libvlc_media_list_lock(libvlc_media_list);
388 libvlc_media_list_remove_index(libvlc_media_list,idx,ex);
389 libvlc_media_list_unlock(libvlc_media_list);
392 void VlcPlugin::playlist_clear( libvlc_exception_t *ex )
394 if( libvlc_media_list )
395 libvlc_media_list_release(libvlc_media_list);
396 libvlc_media_list = libvlc_media_list_new(getVLC(),ex);
399 int VlcPlugin::playlist_count( libvlc_exception_t *ex )
402 libvlc_media_list_lock(libvlc_media_list);
403 items_count = libvlc_media_list_count(libvlc_media_list,ex);
404 libvlc_media_list_unlock(libvlc_media_list);
408 void VlcPlugin::toggle_fullscreen( libvlc_exception_t *ex )
410 if( playlist_isplaying(ex) )
411 libvlc_toggle_fullscreen(libvlc_media_player,ex);
413 void VlcPlugin::set_fullscreen( int yes, libvlc_exception_t *ex )
415 if( playlist_isplaying(ex) )
416 libvlc_set_fullscreen(libvlc_media_player,yes,ex);
418 int VlcPlugin::get_fullscreen( libvlc_exception_t *ex )
421 if( playlist_isplaying(ex) )
422 r = libvlc_get_fullscreen(libvlc_media_player,ex);
426 int VlcPlugin::player_has_vout( libvlc_exception_t *ex )
429 if( playlist_isplaying(ex) )
430 r = libvlc_media_player_has_vout(libvlc_media_player, ex);
434 /*****************************************************************************
436 *****************************************************************************/
438 char *VlcPlugin::getAbsoluteURL(const char *url)
442 // check whether URL is already absolute
443 const char *end=strchr(url, ':');
444 if( (NULL != end) && (end != url) )
446 // validate protocol header
447 const char *start = url;
452 while( start != end )
459 || ('/' == c)) ) /* VLC uses / to allow user to specify a demuxer */
460 // not valid protocol header, assume relative URL
464 /* we have a protocol header, therefore URL is absolute */
467 // not a valid protocol header, assume relative URL
474 size_t baseLen = strlen(psz_baseURL);
475 char *href = static_cast<char*>(malloc(baseLen+strlen(url)+1));
478 /* prepend base URL */
479 strcpy(href, psz_baseURL);
482 ** relative url could be empty,
483 ** in which case return base URL
489 ** locate pathname part of base URL
492 /* skip over protocol part */
493 char *pathstart = strchr(href, ':');
497 if( '/' == *(++pathstart) )
499 if( '/' == *(++pathstart) )
504 /* skip over host part */
505 pathstart = strchr(pathstart, '/');
506 pathend = href+baseLen;
509 // no path, add a / past end of url (over '\0')
516 /* baseURL is just a UNIX path */
519 /* baseURL is not an absolute path */
524 pathend = href+baseLen;
527 /* relative URL made of an absolute path ? */
530 /* replace path completely */
531 strcpy(pathstart, url);
535 /* find last path component and replace it */
536 while( '/' != *pathend)
540 ** if relative url path starts with one or more '../',
541 ** factor them out of href so that we return a
544 while( pathend != pathstart )
552 /* relative url is just '.' */
558 /* relative url starts with './' */
567 /* relative url is '..' */
573 /* relative url starts with '../' */
581 while( '/' != *pathend );
583 /* skip over '/' separator */
585 /* concatenate remaining base URL and relative URL */
586 strcpy(pathend, url);
595 int VlcPlugin::setSize(unsigned width, unsigned height)
597 int diff = (width != i_width) || (height != i_height);
606 #define BTN_SPACE ((unsigned int)4)
607 void VlcPlugin::showToolbar()
609 const NPWindow& window = getWindow();
610 Window control = getControlWindow();
611 Window video = getVideoWindow();
612 Display *p_display = ((NPSetWindowCallbackStruct *)window.ws_info)->display;
613 unsigned int i_height = 0, i_width = BTN_SPACE;
617 XpmReadFileToImage( p_display, DATA_PATH "/mozilla/play.xpm",
618 &p_btnPlay, NULL, NULL);
621 i_height = __MAX( i_height, p_btnPlay->height );
624 XpmReadFileToImage( p_display, DATA_PATH "/mozilla/pause.xpm",
625 &p_btnPause, NULL, NULL);
628 i_height = __MAX( i_height, p_btnPause->height );
630 i_width += __MAX( p_btnPause->width, p_btnPlay->width );
633 XpmReadFileToImage( p_display, DATA_PATH "/mozilla/stop.xpm",
634 &p_btnStop, NULL, NULL );
637 i_height = __MAX( i_height, p_btnStop->height );
638 i_width += BTN_SPACE + p_btnStop->width;
641 XpmReadFileToImage( p_display, DATA_PATH "/mozilla/time_line.xpm",
642 &p_timeline, NULL, NULL);
645 i_height = __MAX( i_height, p_timeline->height );
646 i_width += BTN_SPACE + p_timeline->width;
649 XpmReadFileToImage( p_display, DATA_PATH "/mozilla/time_icon.xpm",
650 &p_btnTime, NULL, NULL);
653 i_height = __MAX( i_height, p_btnTime->height );
654 i_width += BTN_SPACE + p_btnTime->width;
656 if( !p_btnFullscreen )
657 XpmReadFileToImage( p_display, DATA_PATH "/mozilla/fullscreen.xpm",
658 &p_btnFullscreen, NULL, NULL);
659 if( p_btnFullscreen )
661 i_height = __MAX( i_height, p_btnFullscreen->height );
662 i_width += BTN_SPACE + p_btnFullscreen->width;
665 XpmReadFileToImage( p_display, DATA_PATH "/mozilla/volume_max.xpm",
666 &p_btnMute, NULL, NULL);
669 i_height = __MAX( i_height, p_btnMute->height );
672 XpmReadFileToImage( p_display, DATA_PATH "/mozilla/volume_mute.xpm",
673 &p_btnUnmute, NULL, NULL);
676 i_height = __MAX( i_height, p_btnUnmute->height );
678 i_width += BTN_SPACE + __MAX( p_btnUnmute->width, p_btnMute->width );
680 setToolbarSize( i_width, i_height );
682 if( !p_btnPlay || !p_btnPause || !p_btnStop || !p_timeline ||
683 !p_btnTime || !p_btnFullscreen || !p_btnMute || !p_btnUnmute )
684 fprintf(stderr, "Error: some button images not found in %s\n", DATA_PATH );
686 /* reset panels position and size */
687 /* XXX use i_width */
688 XResizeWindow( p_display, video, window.width, window.height - i_height);
689 XMoveWindow( p_display, control, 0, window.height - i_height );
690 XResizeWindow( p_display, control, window.width, i_height -1);
692 b_toolbar = 1; /* says toolbar is now shown */
696 void VlcPlugin::hideToolbar()
698 const NPWindow& window = getWindow();
699 Display *p_display = ((NPSetWindowCallbackStruct *)window.ws_info)->display;
700 Window control = getControlWindow();
701 Window video = getVideoWindow();
703 i_tb_width = i_tb_height = 0;
705 if( p_btnPlay ) XDestroyImage( p_btnPlay );
706 if( p_btnPause ) XDestroyImage( p_btnPause );
707 if( p_btnStop ) XDestroyImage( p_btnStop );
708 if( p_timeline ) XDestroyImage( p_timeline );
709 if( p_btnTime ) XDestroyImage( p_btnTime );
710 if( p_btnFullscreen ) XDestroyImage( p_btnFullscreen );
711 if( p_btnMute ) XDestroyImage( p_btnMute );
712 if( p_btnUnmute ) XDestroyImage( p_btnUnmute );
719 p_btnFullscreen = NULL;
723 /* reset panels position and size */
724 /* XXX use i_width */
725 XResizeWindow( p_display, video, window.width, window.height );
726 XMoveWindow( p_display, control, 0, window.height-1 );
727 XResizeWindow( p_display, control, window.width, 1 );
729 b_toolbar = 0; /* says toolbar is now hidden */
733 void VlcPlugin::redrawToolbar()
735 libvlc_exception_t ex;
738 unsigned int dst_x, dst_y;
741 unsigned int i_tb_width, i_tb_height;
743 /* This method does nothing if toolbar is hidden. */
747 const NPWindow& window = getWindow();
748 Window control = getControlWindow();
749 Display *p_display = ((NPSetWindowCallbackStruct *)window.ws_info)->display;
751 getToolbarSize( &i_tb_width, &i_tb_height );
753 libvlc_exception_init( &ex );
756 b_mute = libvlc_audio_get_mute( getVLC(), &ex );
757 libvlc_exception_clear( &ex );
759 gcv.foreground = BlackPixel( p_display, 0 );
760 gc = XCreateGC( p_display, control, GCForeground, &gcv );
762 XFillRectangle( p_display, control, gc,
763 0, 0, window.width, i_tb_height );
764 gcv.foreground = WhitePixel( p_display, 0 );
765 XChangeGC( p_display, gc, GCForeground, &gcv );
769 dst_y = i_tb_height >> 1; /* baseline = vertical middle */
771 if( p_btnPause && (is_playing == 1) )
773 XPutImage( p_display, control, gc, p_btnPause, 0, 0, dst_x,
774 dst_y - (p_btnPause->height >> 1),
775 p_btnPause->width, p_btnPause->height );
776 dst_x += BTN_SPACE + p_btnPause->width;
780 XPutImage( p_display, control, gc, p_btnPlay, 0, 0, dst_x,
781 dst_y - (p_btnPlay->height >> 1),
782 p_btnPlay->width, p_btnPlay->height );
783 dst_x += BTN_SPACE + p_btnPlay->width;
787 XPutImage( p_display, control, gc, p_btnStop, 0, 0, dst_x,
788 dst_y - (p_btnStop->height >> 1),
789 p_btnStop->width, p_btnStop->height );
791 dst_x += BTN_SPACE + ( p_btnStop ? p_btnStop->width : 0 );
793 if( p_btnFullscreen )
794 XPutImage( p_display, control, gc, p_btnFullscreen, 0, 0, dst_x,
795 dst_y - (p_btnFullscreen->height >> 1),
796 p_btnFullscreen->width, p_btnFullscreen->height );
798 dst_x += BTN_SPACE + ( p_btnFullscreen ? p_btnFullscreen->width : 0 );
800 if( p_btnUnmute && b_mute )
802 XPutImage( p_display, control, gc, p_btnUnmute, 0, 0, dst_x,
803 dst_y - (p_btnUnmute->height >> 1),
804 p_btnUnmute->width, p_btnUnmute->height );
806 dst_x += BTN_SPACE + ( p_btnUnmute ? p_btnUnmute->width : 0 );
810 XPutImage( p_display, control, gc, p_btnMute, 0, 0, dst_x,
811 dst_y - (p_btnMute->height >> 1),
812 p_btnMute->width, p_btnMute->height );
814 dst_x += BTN_SPACE + ( p_btnMute ? p_btnMute->width : 0 );
818 XPutImage( p_display, control, gc, p_timeline, 0, 0, dst_x,
819 dst_y - (p_timeline->height >> 1),
820 (window.width-(dst_x+BTN_SPACE)), p_timeline->height );
822 /* get movie position in % */
823 if( playlist_isplaying(&ex) )
825 i_last_position = (int)((window.width-(dst_x+BTN_SPACE))*
826 libvlc_media_player_get_position(libvlc_media_player,&ex));
828 libvlc_exception_clear( &ex );
831 XPutImage( p_display, control, gc, p_btnTime,
832 0, 0, (dst_x+i_last_position),
833 dst_y - (p_btnTime->height >> 1),
834 p_btnTime->width, p_btnTime->height );
836 XFreeGC( p_display, gc );
839 vlc_toolbar_clicked_t VlcPlugin::getToolbarButtonClicked( int i_xpos, int i_ypos )
841 unsigned int i_dest = BTN_SPACE;
844 libvlc_exception_t ex;
847 fprintf( stderr, "ToolbarButtonClicked:: "
848 "trying to match (%d,%d) (%d,%d)\n",
849 i_xpos, i_ypos, i_tb_height, i_tb_width );
851 if( i_ypos >= i_tb_width )
852 return clicked_Unknown;
854 /* Note: the order of testing is dependend on the original
855 * drawing positions of the icon buttons. Buttons are tested
860 libvlc_exception_init( &ex );
861 is_playing = playlist_isplaying( &ex );
862 libvlc_exception_clear( &ex );
865 b_mute = libvlc_audio_get_mute( getVLC(), &ex );
866 libvlc_exception_clear( &ex );
868 /* is Pause of Play button clicked */
869 if( (is_playing != 1) &&
870 (i_xpos >= (BTN_SPACE>>1)) &&
871 (i_xpos <= i_dest + p_btnPlay->width + (BTN_SPACE>>1)) )
873 else if( (i_xpos >= (BTN_SPACE>>1)) &&
874 (i_xpos <= i_dest + p_btnPause->width) )
875 return clicked_Pause;
877 /* is Stop button clicked */
878 if( is_playing != 1 )
879 i_dest += (p_btnPlay->width + (BTN_SPACE>>1));
881 i_dest += (p_btnPause->width + (BTN_SPACE>>1));
883 if( (i_xpos >= i_dest) &&
884 (i_xpos <= i_dest + p_btnStop->width + (BTN_SPACE>>1)) )
887 /* is Fullscreen button clicked */
888 i_dest += (p_btnStop->width + (BTN_SPACE>>1));
889 if( (i_xpos >= i_dest) &&
890 (i_xpos <= i_dest + p_btnFullscreen->width + (BTN_SPACE>>1)) )
891 return clicked_Fullscreen;
893 /* is Mute or Unmute button clicked */
894 i_dest += (p_btnFullscreen->width + (BTN_SPACE>>1));
895 if( !b_mute && (i_xpos >= i_dest) &&
896 (i_xpos <= i_dest + p_btnMute->width + (BTN_SPACE>>1)) )
898 else if( (i_xpos >= i_dest) &&
899 (i_xpos <= i_dest + p_btnUnmute->width + (BTN_SPACE>>1)) )
900 return clicked_Unmute;
902 /* is timeline clicked */
904 i_dest += (p_btnMute->width + (BTN_SPACE>>1));
906 i_dest += (p_btnUnmute->width + (BTN_SPACE>>1));
907 if( (i_xpos >= i_dest) &&
908 (i_xpos <= i_dest + p_timeline->width + (BTN_SPACE>>1)) )
909 return clicked_timeline;
911 /* is time button clicked */
912 i_dest += (p_timeline->width + (BTN_SPACE>>1));
913 if( (i_xpos >= i_dest) &&
914 (i_xpos <= i_dest + p_btnTime->width + (BTN_SPACE>>1)) )
917 return clicked_Unknown;