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),
60 ,i_width((unsigned)-1)
61 ,i_height((unsigned)-1)
70 ,p_btnFullscreen(NULL)
75 memset(&npwindow, 0, sizeof(NPWindow));
77 memset(&npvideo, 0, sizeof(Window));
78 memset(&npcontrol, 0, sizeof(Window));
82 static bool boolValue(const char *value) {
83 return ( !strcmp(value, "1") ||
84 !strcasecmp(value, "true") ||
85 !strcasecmp(value, "yes") );
88 NPError VlcPlugin::init(int argc, char* const argn[], char* const argv[])
90 /* prepare VLC command line */
91 const char *ppsz_argv[32];
95 ppsz_argv[ppsz_argc++] = "--no-plugins-cache";
98 /* locate VLC module path */
100 ppsz_argv[ppsz_argc++] = "--plugin-path=/Library/Internet\\ Plug-Ins/VLC\\ Plugin.plugin/Contents/MacOS/modules";
101 ppsz_argv[ppsz_argc++] = "--vout=macosx";
102 #elif defined(XP_WIN)
104 DWORD i_type, i_data = MAX_PATH + 1;
105 char p_data[MAX_PATH + 1];
106 if( RegOpenKeyEx( HKEY_LOCAL_MACHINE, "Software\\VideoLAN\\VLC",
107 0, KEY_READ, &h_key ) == ERROR_SUCCESS )
109 if( RegQueryValueEx( h_key, "InstallDir", 0, &i_type,
110 (LPBYTE)p_data, &i_data ) == ERROR_SUCCESS )
112 if( i_type == REG_SZ )
114 strcat( p_data, "\\plugins" );
115 ppsz_argv[ppsz_argc++] = "--plugin-path";
116 ppsz_argv[ppsz_argc++] = p_data;
119 RegCloseKey( h_key );
121 ppsz_argv[ppsz_argc++] = "--no-one-instance";
123 #endif /* XP_MACOSX */
125 /* common settings */
126 ppsz_argv[ppsz_argc++] = "-vv";
127 ppsz_argv[ppsz_argc++] = "--no-stats";
128 ppsz_argv[ppsz_argc++] = "--no-media-library";
129 ppsz_argv[ppsz_argc++] = "--ignore-config";
130 ppsz_argv[ppsz_argc++] = "--intf=dummy";
131 ppsz_argv[ppsz_argc++] = "--no-video-title-show";
133 const char *progid = NULL;
135 /* parse plugin arguments */
136 for( int i = 0; i < argc ; i++ )
138 /* fprintf(stderr, "argn=%s, argv=%s\n", argn[i], argv[i]); */
140 if( !strcmp( argn[i], "target" )
141 || !strcmp( argn[i], "mrl")
142 || !strcmp( argn[i], "filename")
143 || !strcmp( argn[i], "src") )
145 psz_target = argv[i];
147 else if( !strcmp( argn[i], "autoplay")
148 || !strcmp( argn[i], "autostart") )
150 b_autoplay = boolValue(argv[i]);
152 else if( !strcmp( argn[i], "fullscreen" ) )
154 if( boolValue(argv[i]) )
156 ppsz_argv[ppsz_argc++] = "--fullscreen";
160 ppsz_argv[ppsz_argc++] = "--no-fullscreen";
163 else if( !strcmp( argn[i], "mute" ) )
165 if( boolValue(argv[i]) )
167 ppsz_argv[ppsz_argc++] = "--volume=0";
170 else if( !strcmp( argn[i], "loop")
171 || !strcmp( argn[i], "autoloop") )
173 if( boolValue(argv[i]) )
175 ppsz_argv[ppsz_argc++] = "--loop";
179 ppsz_argv[ppsz_argc++] = "--no-loop";
182 else if( !strcmp( argn[i], "version")
183 || !strcmp( argn[i], "progid") )
187 else if( !strcmp( argn[i], "toolbar" ) )
189 /* FIXME: Remove this when toolbar functionality has been implemented on
190 * MacOS X and Win32 for Firefox/Mozilla/Safari. */
192 b_toolbar = boolValue(argv[i]);
197 libvlc_exception_t ex;
198 libvlc_exception_init(&ex);
200 libvlc_instance = libvlc_new(ppsz_argc, ppsz_argv, &ex);
201 if( libvlc_exception_raised(&ex) )
203 libvlc_exception_clear(&ex);
204 return NPERR_GENERIC_ERROR;
207 libvlc_media_list = libvlc_media_list_new(libvlc_instance,&ex);
208 if( libvlc_exception_raised(&ex) )
210 libvlc_exception_clear(&ex);
211 return NPERR_GENERIC_ERROR;
215 ** fetch plugin base URL, which is the URL of the page containing the plugin
216 ** this URL is used for making absolute URL from relative URL that may be
217 ** passed as an MRL argument
221 if( NPERR_NO_ERROR == NPN_GetValue(p_browser, NPNVWindowNPObject, &plugin) )
224 ** is there a better way to get that info ?
226 static const char docLocHref[] = "document.location.href";
230 script.utf8characters = docLocHref;
231 script.utf8length = sizeof(docLocHref)-1;
233 if( NPN_Evaluate(p_browser, plugin, &script, &result) )
235 if( NPVARIANT_IS_STRING(result) )
237 NPString &location = NPVARIANT_TO_STRING(result);
239 psz_baseURL = static_cast<char*>(malloc(location.utf8length+1));
242 strncpy(psz_baseURL, location.utf8characters, location.utf8length);
243 psz_baseURL[location.utf8length] = '\0';
246 NPN_ReleaseVariantValue(&result);
248 NPN_ReleaseObject(plugin);
253 // get absolute URL from src
254 char *psz_absurl = getAbsoluteURL(psz_target);
255 psz_target = psz_absurl ? psz_absurl : strdup(psz_target);
258 /* assign plugin script root class */
260 p_scriptClass = RuntimeNPClass<LibvlcRootNPObject>::getClass();
262 return NPERR_NO_ERROR;
265 VlcPlugin::~VlcPlugin()
269 if( libvlc_media_player )
270 libvlc_media_player_release( libvlc_media_player );
271 if( libvlc_media_list )
272 libvlc_media_list_release( libvlc_media_list );
273 if( libvlc_instance )
274 libvlc_release(libvlc_instance);
277 /*****************************************************************************
278 * VlcPlugin playlist replacement methods
279 *****************************************************************************/
280 void VlcPlugin::set_player_window( libvlc_exception_t *ex )
283 libvlc_media_player_set_xwindow(libvlc_media_player,
284 (libvlc_drawable_t)getVideoWindow(),
288 // XXX FIXME insert appropriate call here
291 libvlc_media_player_set_hwnd(libvlc_media_player,
297 int VlcPlugin::playlist_add( const char *mrl, libvlc_exception_t *ex )
300 libvlc_media_t *p_m = libvlc_media_new(libvlc_instance,mrl,ex);
301 if( libvlc_exception_raised(ex) )
304 libvlc_media_list_lock(libvlc_media_list);
305 libvlc_media_list_add_media(libvlc_media_list,p_m,ex);
306 if( !libvlc_exception_raised(ex) )
307 item = libvlc_media_list_count(libvlc_media_list,ex)-1;
308 libvlc_media_list_unlock(libvlc_media_list);
310 libvlc_media_release(p_m);
315 int VlcPlugin::playlist_add_extended_untrusted( const char *mrl, const char *name,
316 int optc, const char **optv, libvlc_exception_t *ex )
318 libvlc_media_t *p_m = libvlc_media_new(libvlc_instance, mrl,ex);
320 if( libvlc_exception_raised(ex) )
323 for( int i = 0; i < optc; ++i )
325 libvlc_media_add_option_untrusted(p_m, optv[i],ex);
326 if( libvlc_exception_raised(ex) )
328 libvlc_media_release(p_m);
333 libvlc_media_list_lock(libvlc_media_list);
334 libvlc_media_list_add_media(libvlc_media_list,p_m,ex);
335 if( !libvlc_exception_raised(ex) )
336 item = libvlc_media_list_count(libvlc_media_list,ex)-1;
337 libvlc_media_list_unlock(libvlc_media_list);
338 libvlc_media_release(p_m);
343 bool VlcPlugin::playlist_select( int idx, libvlc_exception_t *ex )
345 libvlc_media_t *p_m = NULL;
347 libvlc_media_list_lock(libvlc_media_list);
349 int count = libvlc_media_list_count(libvlc_media_list,ex);
350 if( libvlc_exception_raised(ex) )
353 if( idx<0||idx>=count )
356 playlist_index = idx;
358 p_m = libvlc_media_list_item_at_index(libvlc_media_list,playlist_index,ex);
359 libvlc_media_list_unlock(libvlc_media_list);
361 if( libvlc_exception_raised(ex) )
364 if( libvlc_media_player )
366 libvlc_media_player_release( libvlc_media_player );
367 libvlc_media_player = NULL;
370 libvlc_media_player = libvlc_media_player_new_from_media(p_m,ex);
371 if( libvlc_media_player )
372 set_player_window(ex);
374 libvlc_media_release( p_m );
375 return !libvlc_exception_raised(ex);
378 libvlc_media_list_unlock(libvlc_media_list);
382 void VlcPlugin::playlist_delete_item( int idx, libvlc_exception_t *ex )
384 libvlc_media_list_lock(libvlc_media_list);
385 libvlc_media_list_remove_index(libvlc_media_list,idx,ex);
386 libvlc_media_list_unlock(libvlc_media_list);
389 void VlcPlugin::playlist_clear( libvlc_exception_t *ex )
391 if( libvlc_media_list )
392 libvlc_media_list_release(libvlc_media_list);
393 libvlc_media_list = libvlc_media_list_new(getVLC(),ex);
396 int VlcPlugin::playlist_count( libvlc_exception_t *ex )
399 libvlc_media_list_lock(libvlc_media_list);
400 items_count = libvlc_media_list_count(libvlc_media_list,ex);
401 libvlc_media_list_unlock(libvlc_media_list);
405 void VlcPlugin::toggle_fullscreen( libvlc_exception_t *ex )
407 if( playlist_isplaying(ex) )
408 libvlc_toggle_fullscreen(libvlc_media_player,ex);
410 void VlcPlugin::set_fullscreen( int yes, libvlc_exception_t *ex )
412 if( playlist_isplaying(ex) )
413 libvlc_set_fullscreen(libvlc_media_player,yes,ex);
415 int VlcPlugin::get_fullscreen( libvlc_exception_t *ex )
418 if( playlist_isplaying(ex) )
419 r = libvlc_get_fullscreen(libvlc_media_player,ex);
423 int VlcPlugin::player_has_vout( libvlc_exception_t *ex )
426 if( playlist_isplaying(ex) )
427 r = libvlc_media_player_has_vout(libvlc_media_player, ex);
431 /*****************************************************************************
433 *****************************************************************************/
435 char *VlcPlugin::getAbsoluteURL(const char *url)
439 // check whether URL is already absolute
440 const char *end=strchr(url, ':');
441 if( (NULL != end) && (end != url) )
443 // validate protocol header
444 const char *start = url;
449 while( start != end )
456 || ('/' == c)) ) /* VLC uses / to allow user to specify a demuxer */
457 // not valid protocol header, assume relative URL
461 /* we have a protocol header, therefore URL is absolute */
464 // not a valid protocol header, assume relative URL
471 size_t baseLen = strlen(psz_baseURL);
472 char *href = static_cast<char*>(malloc(baseLen+strlen(url)+1));
475 /* prepend base URL */
476 memcpy(href, psz_baseURL, baseLen+1);
479 ** relative url could be empty,
480 ** in which case return base URL
486 ** locate pathname part of base URL
489 /* skip over protocol part */
490 char *pathstart = strchr(href, ':');
491 char *pathend = href+baseLen;
494 if( '/' == *(++pathstart) )
496 if( '/' == *(++pathstart) )
501 /* skip over host part */
502 pathstart = strchr(pathstart, '/');
505 // no path, add a / past end of url (over '\0')
512 /* baseURL is just a UNIX path */
515 /* baseURL is not an absolute path */
522 /* relative URL made of an absolute path ? */
525 /* replace path completely */
526 strcpy(pathstart, url);
530 /* find last path component and replace it */
531 while( '/' != *pathend)
535 ** if relative url path starts with one or more '../',
536 ** factor them out of href so that we return a
539 while( pathend != pathstart )
547 /* relative url is just '.' */
553 /* relative url starts with './' */
562 /* relative url is '..' */
568 /* relative url starts with '../' */
576 while( '/' != *pathend );
578 /* skip over '/' separator */
580 /* concatenate remaining base URL and relative URL */
581 strcpy(pathend, url);
590 int VlcPlugin::setSize(unsigned width, unsigned height)
592 int diff = (width != i_width) || (height != i_height);
601 #define BTN_SPACE ((unsigned int)4)
602 void VlcPlugin::showToolbar()
604 const NPWindow& window = getWindow();
605 Window control = getControlWindow();
606 Window video = getVideoWindow();
607 Display *p_display = ((NPSetWindowCallbackStruct *)window.ws_info)->display;
608 unsigned int i_height = 0, i_width = BTN_SPACE;
612 XpmReadFileToImage( p_display, DATA_PATH "/mozilla/play.xpm",
613 &p_btnPlay, NULL, NULL);
616 i_height = __MAX( i_height, p_btnPlay->height );
619 XpmReadFileToImage( p_display, DATA_PATH "/mozilla/pause.xpm",
620 &p_btnPause, NULL, NULL);
623 i_height = __MAX( i_height, p_btnPause->height );
625 i_width += __MAX( p_btnPause->width, p_btnPlay->width );
628 XpmReadFileToImage( p_display, DATA_PATH "/mozilla/stop.xpm",
629 &p_btnStop, NULL, NULL );
632 i_height = __MAX( i_height, p_btnStop->height );
633 i_width += BTN_SPACE + p_btnStop->width;
636 XpmReadFileToImage( p_display, DATA_PATH "/mozilla/time_line.xpm",
637 &p_timeline, NULL, NULL);
640 i_height = __MAX( i_height, p_timeline->height );
641 i_width += BTN_SPACE + p_timeline->width;
644 XpmReadFileToImage( p_display, DATA_PATH "/mozilla/time_icon.xpm",
645 &p_btnTime, NULL, NULL);
648 i_height = __MAX( i_height, p_btnTime->height );
649 i_width += BTN_SPACE + p_btnTime->width;
651 if( !p_btnFullscreen )
652 XpmReadFileToImage( p_display, DATA_PATH "/mozilla/fullscreen.xpm",
653 &p_btnFullscreen, NULL, NULL);
654 if( p_btnFullscreen )
656 i_height = __MAX( i_height, p_btnFullscreen->height );
657 i_width += BTN_SPACE + p_btnFullscreen->width;
660 XpmReadFileToImage( p_display, DATA_PATH "/mozilla/volume_max.xpm",
661 &p_btnMute, NULL, NULL);
664 i_height = __MAX( i_height, p_btnMute->height );
667 XpmReadFileToImage( p_display, DATA_PATH "/mozilla/volume_mute.xpm",
668 &p_btnUnmute, NULL, NULL);
671 i_height = __MAX( i_height, p_btnUnmute->height );
673 i_width += BTN_SPACE + __MAX( p_btnUnmute->width, p_btnMute->width );
675 setToolbarSize( i_width, i_height );
677 if( !p_btnPlay || !p_btnPause || !p_btnStop || !p_timeline ||
678 !p_btnTime || !p_btnFullscreen || !p_btnMute || !p_btnUnmute )
679 fprintf(stderr, "Error: some button images not found in %s\n", DATA_PATH );
681 /* reset panels position and size */
682 /* XXX use i_width */
683 XResizeWindow( p_display, video, window.width, window.height - i_height);
684 XMoveWindow( p_display, control, 0, window.height - i_height );
685 XResizeWindow( p_display, control, window.width, i_height -1);
687 b_toolbar = 1; /* says toolbar is now shown */
691 void VlcPlugin::hideToolbar()
693 const NPWindow& window = getWindow();
694 Display *p_display = ((NPSetWindowCallbackStruct *)window.ws_info)->display;
695 Window control = getControlWindow();
696 Window video = getVideoWindow();
698 i_tb_width = i_tb_height = 0;
700 if( p_btnPlay ) XDestroyImage( p_btnPlay );
701 if( p_btnPause ) XDestroyImage( p_btnPause );
702 if( p_btnStop ) XDestroyImage( p_btnStop );
703 if( p_timeline ) XDestroyImage( p_timeline );
704 if( p_btnTime ) XDestroyImage( p_btnTime );
705 if( p_btnFullscreen ) XDestroyImage( p_btnFullscreen );
706 if( p_btnMute ) XDestroyImage( p_btnMute );
707 if( p_btnUnmute ) XDestroyImage( p_btnUnmute );
714 p_btnFullscreen = NULL;
718 /* reset panels position and size */
719 /* XXX use i_width */
720 XResizeWindow( p_display, video, window.width, window.height );
721 XMoveWindow( p_display, control, 0, window.height-1 );
722 XResizeWindow( p_display, control, window.width, 1 );
724 b_toolbar = 0; /* says toolbar is now hidden */
728 void VlcPlugin::redrawToolbar()
730 libvlc_exception_t ex;
733 unsigned int dst_x, dst_y;
736 unsigned int i_tb_width, i_tb_height;
738 /* This method does nothing if toolbar is hidden. */
742 const NPWindow& window = getWindow();
743 Window control = getControlWindow();
744 Display *p_display = ((NPSetWindowCallbackStruct *)window.ws_info)->display;
746 getToolbarSize( &i_tb_width, &i_tb_height );
748 libvlc_exception_init( &ex );
751 b_mute = libvlc_audio_get_mute( getVLC(), &ex );
752 libvlc_exception_clear( &ex );
754 gcv.foreground = BlackPixel( p_display, 0 );
755 gc = XCreateGC( p_display, control, GCForeground, &gcv );
757 XFillRectangle( p_display, control, gc,
758 0, 0, window.width, i_tb_height );
759 gcv.foreground = WhitePixel( p_display, 0 );
760 XChangeGC( p_display, gc, GCForeground, &gcv );
764 dst_y = i_tb_height >> 1; /* baseline = vertical middle */
766 if( p_btnPause && (is_playing == 1) )
768 XPutImage( p_display, control, gc, p_btnPause, 0, 0, dst_x,
769 dst_y - (p_btnPause->height >> 1),
770 p_btnPause->width, p_btnPause->height );
771 dst_x += BTN_SPACE + p_btnPause->width;
775 XPutImage( p_display, control, gc, p_btnPlay, 0, 0, dst_x,
776 dst_y - (p_btnPlay->height >> 1),
777 p_btnPlay->width, p_btnPlay->height );
778 dst_x += BTN_SPACE + p_btnPlay->width;
782 XPutImage( p_display, control, gc, p_btnStop, 0, 0, dst_x,
783 dst_y - (p_btnStop->height >> 1),
784 p_btnStop->width, p_btnStop->height );
786 dst_x += BTN_SPACE + ( p_btnStop ? p_btnStop->width : 0 );
788 if( p_btnFullscreen )
789 XPutImage( p_display, control, gc, p_btnFullscreen, 0, 0, dst_x,
790 dst_y - (p_btnFullscreen->height >> 1),
791 p_btnFullscreen->width, p_btnFullscreen->height );
793 dst_x += BTN_SPACE + ( p_btnFullscreen ? p_btnFullscreen->width : 0 );
795 if( p_btnUnmute && b_mute )
797 XPutImage( p_display, control, gc, p_btnUnmute, 0, 0, dst_x,
798 dst_y - (p_btnUnmute->height >> 1),
799 p_btnUnmute->width, p_btnUnmute->height );
801 dst_x += BTN_SPACE + ( p_btnUnmute ? p_btnUnmute->width : 0 );
805 XPutImage( p_display, control, gc, p_btnMute, 0, 0, dst_x,
806 dst_y - (p_btnMute->height >> 1),
807 p_btnMute->width, p_btnMute->height );
809 dst_x += BTN_SPACE + ( p_btnMute ? p_btnMute->width : 0 );
813 XPutImage( p_display, control, gc, p_timeline, 0, 0, dst_x,
814 dst_y - (p_timeline->height >> 1),
815 (window.width-(dst_x+BTN_SPACE)), p_timeline->height );
817 /* get movie position in % */
818 if( playlist_isplaying(&ex) )
820 i_last_position = (int)((window.width-(dst_x+BTN_SPACE))*
821 libvlc_media_player_get_position(libvlc_media_player,&ex));
823 libvlc_exception_clear( &ex );
826 XPutImage( p_display, control, gc, p_btnTime,
827 0, 0, (dst_x+i_last_position),
828 dst_y - (p_btnTime->height >> 1),
829 p_btnTime->width, p_btnTime->height );
831 XFreeGC( p_display, gc );
834 vlc_toolbar_clicked_t VlcPlugin::getToolbarButtonClicked( int i_xpos, int i_ypos )
836 unsigned int i_dest = BTN_SPACE;
839 libvlc_exception_t ex;
842 fprintf( stderr, "ToolbarButtonClicked:: "
843 "trying to match (%d,%d) (%d,%d)\n",
844 i_xpos, i_ypos, i_tb_height, i_tb_width );
846 if( i_ypos >= i_tb_width )
847 return clicked_Unknown;
849 /* Note: the order of testing is dependend on the original
850 * drawing positions of the icon buttons. Buttons are tested
855 libvlc_exception_init( &ex );
856 is_playing = playlist_isplaying( &ex );
857 libvlc_exception_clear( &ex );
860 b_mute = libvlc_audio_get_mute( getVLC(), &ex );
861 libvlc_exception_clear( &ex );
863 /* is Pause of Play button clicked */
864 if( (is_playing != 1) &&
865 (i_xpos >= (BTN_SPACE>>1)) &&
866 (i_xpos <= i_dest + p_btnPlay->width + (BTN_SPACE>>1)) )
868 else if( (i_xpos >= (BTN_SPACE>>1)) &&
869 (i_xpos <= i_dest + p_btnPause->width) )
870 return clicked_Pause;
872 /* is Stop button clicked */
873 if( is_playing != 1 )
874 i_dest += (p_btnPlay->width + (BTN_SPACE>>1));
876 i_dest += (p_btnPause->width + (BTN_SPACE>>1));
878 if( (i_xpos >= i_dest) &&
879 (i_xpos <= i_dest + p_btnStop->width + (BTN_SPACE>>1)) )
882 /* is Fullscreen button clicked */
883 i_dest += (p_btnStop->width + (BTN_SPACE>>1));
884 if( (i_xpos >= i_dest) &&
885 (i_xpos <= i_dest + p_btnFullscreen->width + (BTN_SPACE>>1)) )
886 return clicked_Fullscreen;
888 /* is Mute or Unmute button clicked */
889 i_dest += (p_btnFullscreen->width + (BTN_SPACE>>1));
890 if( !b_mute && (i_xpos >= i_dest) &&
891 (i_xpos <= i_dest + p_btnMute->width + (BTN_SPACE>>1)) )
893 else if( (i_xpos >= i_dest) &&
894 (i_xpos <= i_dest + p_btnUnmute->width + (BTN_SPACE>>1)) )
895 return clicked_Unmute;
897 /* is timeline clicked */
899 i_dest += (p_btnMute->width + (BTN_SPACE>>1));
901 i_dest += (p_btnUnmute->width + (BTN_SPACE>>1));
902 if( (i_xpos >= i_dest) &&
903 (i_xpos <= i_dest + p_timeline->width + (BTN_SPACE>>1)) )
904 return clicked_timeline;
906 /* is time button clicked */
907 i_dest += (p_timeline->width + (BTN_SPACE>>1));
908 if( (i_xpos >= i_dest) &&
909 (i_xpos <= i_dest + p_btnTime->width + (BTN_SPACE>>1)) )
912 return clicked_Unknown;