From 5c9abf7f9f02a3b675072b2725c2814d1c1ee239 Mon Sep 17 00:00:00 2001 From: diego Date: Mon, 23 Apr 2007 07:42:42 +0000 Subject: Gui --> gui git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@23095 b3059339-0415-0410-9bf9-f77b7e298cf2 --- gui/Makefile | 53 + gui/app.c | 225 ++++ gui/app.h | 190 ++++ gui/bitmap.c | 241 ++++ gui/bitmap.h | 18 + gui/cfg.c | 349 ++++++ gui/cfg.h | 76 ++ gui/interface.c | 1338 +++++++++++++++++++++++ gui/interface.h | 229 ++++ gui/mplayer/common.c | 289 +++++ gui/mplayer/common.h | 20 + gui/mplayer/gmplayer.h | 35 + gui/mplayer/gtk/about.c | 329 ++++++ gui/mplayer/gtk/about.h | 12 + gui/mplayer/gtk/common.c | 180 +++ gui/mplayer/gtk/common.h | 24 + gui/mplayer/gtk/eq.c | 670 ++++++++++++ gui/mplayer/gtk/eq.h | 12 + gui/mplayer/gtk/fs.c | 684 ++++++++++++ gui/mplayer/gtk/fs.h | 21 + gui/mplayer/gtk/mb.c | 97 ++ gui/mplayer/gtk/mb.h | 13 + gui/mplayer/gtk/menu.c | 629 +++++++++++ gui/mplayer/gtk/menu.h | 13 + gui/mplayer/gtk/opts.c | 1814 +++++++++++++++++++++++++++++++ gui/mplayer/gtk/opts.h | 16 + gui/mplayer/gtk/pl.c | 529 +++++++++ gui/mplayer/gtk/pl.h | 14 + gui/mplayer/gtk/sb.c | 195 ++++ gui/mplayer/gtk/sb.h | 18 + gui/mplayer/gtk/url.c | 153 +++ gui/mplayer/gtk/url.h | 11 + gui/mplayer/menu.c | 159 +++ gui/mplayer/mw.c | 624 +++++++++++ gui/mplayer/pb.c | 247 +++++ gui/mplayer/pixmaps/MPlayer_mini.xpm | 638 +++++++++++ gui/mplayer/pixmaps/a11.xpm | 22 + gui/mplayer/pixmaps/a169.xpm | 22 + gui/mplayer/pixmaps/a235.xpm | 22 + gui/mplayer/pixmaps/a43.xpm | 22 + gui/mplayer/pixmaps/ab.xpm | 34 + gui/mplayer/pixmaps/about.xpm | 427 ++++++++ gui/mplayer/pixmaps/aspect.xpm | 22 + gui/mplayer/pixmaps/cancel.xpm | 139 +++ gui/mplayer/pixmaps/chapter.xpm | 23 + gui/mplayer/pixmaps/delsub.xpm | 22 + gui/mplayer/pixmaps/dir.xpm | 148 +++ gui/mplayer/pixmaps/dolby.xpm | 23 + gui/mplayer/pixmaps/double.xpm | 151 +++ gui/mplayer/pixmaps/dvd.xpm | 129 +++ gui/mplayer/pixmaps/empty.xpm | 20 + gui/mplayer/pixmaps/empty1px.xpm | 5 + gui/mplayer/pixmaps/eq.xpm | 35 + gui/mplayer/pixmaps/error.xpm | 544 +++++++++ gui/mplayer/pixmaps/exit.xpm | 82 ++ gui/mplayer/pixmaps/file.xpm | 26 + gui/mplayer/pixmaps/file2.xpm | 27 + gui/mplayer/pixmaps/fs.xpm | 109 ++ gui/mplayer/pixmaps/half.xpm | 144 +++ gui/mplayer/pixmaps/icon.xpm | 323 ++++++ gui/mplayer/pixmaps/loadeaf.xpm | 151 +++ gui/mplayer/pixmaps/logo.xpm | 1227 +++++++++++++++++++++ gui/mplayer/pixmaps/mplayer-desktop.xpm | 149 +++ gui/mplayer/pixmaps/next.xpm | 79 ++ gui/mplayer/pixmaps/normal.xpm | 130 +++ gui/mplayer/pixmaps/ok.xpm | 24 + gui/mplayer/pixmaps/open.xpm | 83 ++ gui/mplayer/pixmaps/pause.xpm | 48 + gui/mplayer/pixmaps/pl.xpm | 26 + gui/mplayer/pixmaps/play.xpm | 56 + gui/mplayer/pixmaps/playdvd.xpm | 137 +++ gui/mplayer/pixmaps/playvcd.xpm | 201 ++++ gui/mplayer/pixmaps/prefs.xpm | 69 ++ gui/mplayer/pixmaps/prev.xpm | 77 ++ gui/mplayer/pixmaps/question.xpm | 335 ++++++ gui/mplayer/pixmaps/skin.xpm | 181 +++ gui/mplayer/pixmaps/sound.xpm | 140 +++ gui/mplayer/pixmaps/stop.xpm | 254 +++++ gui/mplayer/pixmaps/stop2.xpm | 48 + gui/mplayer/pixmaps/sub.xpm | 21 + gui/mplayer/pixmaps/title.xpm | 23 + gui/mplayer/pixmaps/tongue.xpm | 169 +++ gui/mplayer/pixmaps/tonguebla.xpm | 156 +++ gui/mplayer/pixmaps/up.xpm | 112 ++ gui/mplayer/pixmaps/url.xpm | 21 + gui/mplayer/pixmaps/vcd.xpm | 179 +++ gui/mplayer/pixmaps/warning.xpm | 314 ++++++ gui/mplayer/play.c | 372 +++++++ gui/mplayer/play.h | 34 + gui/mplayer/sw.c | 92 ++ gui/mplayer/widgets.c | 238 ++++ gui/mplayer/widgets.h | 61 ++ gui/skin/cut.c | 36 + gui/skin/cut.h | 10 + gui/skin/font.c | 251 +++++ gui/skin/font.h | 38 + gui/skin/skin.c | 727 +++++++++++++ gui/skin/skin.h | 18 + gui/win32/Changelog | 317 ++++++ gui/win32/README | 20 + gui/win32/dialogs.c | 1133 +++++++++++++++++++ gui/win32/dialogs.h | 132 +++ gui/win32/gui.c | 1551 ++++++++++++++++++++++++++ gui/win32/gui.h | 116 ++ gui/win32/interface.c | 952 ++++++++++++++++ gui/win32/playlist.c | 154 +++ gui/win32/playlist.h | 57 + gui/win32/preferences.c | 722 ++++++++++++ gui/win32/skinload.c | 809 ++++++++++++++ gui/win32/skinload.h | 213 ++++ gui/win32/widgetrender.c | 351 ++++++ gui/win32/wincfg.c | 143 +++ gui/win32/wincfg.h | 38 + gui/wm/ws.c | 1272 ++++++++++++++++++++++ gui/wm/ws.h | 262 +++++ gui/wm/wskeys.h | 165 +++ gui/wm/wsmkeys.h | 64 ++ gui/wm/wsxdnd.c | 242 +++++ gui/wm/wsxdnd.h | 53 + 119 files changed, 27739 insertions(+) create mode 100644 gui/Makefile create mode 100644 gui/app.c create mode 100644 gui/app.h create mode 100644 gui/bitmap.c create mode 100644 gui/bitmap.h create mode 100644 gui/cfg.c create mode 100644 gui/cfg.h create mode 100644 gui/interface.c create mode 100644 gui/interface.h create mode 100644 gui/mplayer/common.c create mode 100644 gui/mplayer/common.h create mode 100644 gui/mplayer/gmplayer.h create mode 100644 gui/mplayer/gtk/about.c create mode 100644 gui/mplayer/gtk/about.h create mode 100644 gui/mplayer/gtk/common.c create mode 100644 gui/mplayer/gtk/common.h create mode 100644 gui/mplayer/gtk/eq.c create mode 100644 gui/mplayer/gtk/eq.h create mode 100644 gui/mplayer/gtk/fs.c create mode 100644 gui/mplayer/gtk/fs.h create mode 100644 gui/mplayer/gtk/mb.c create mode 100644 gui/mplayer/gtk/mb.h create mode 100644 gui/mplayer/gtk/menu.c create mode 100644 gui/mplayer/gtk/menu.h create mode 100644 gui/mplayer/gtk/opts.c create mode 100644 gui/mplayer/gtk/opts.h create mode 100644 gui/mplayer/gtk/pl.c create mode 100644 gui/mplayer/gtk/pl.h create mode 100644 gui/mplayer/gtk/sb.c create mode 100644 gui/mplayer/gtk/sb.h create mode 100644 gui/mplayer/gtk/url.c create mode 100644 gui/mplayer/gtk/url.h create mode 100644 gui/mplayer/menu.c create mode 100644 gui/mplayer/mw.c create mode 100644 gui/mplayer/pb.c create mode 100644 gui/mplayer/pixmaps/MPlayer_mini.xpm create mode 100644 gui/mplayer/pixmaps/a11.xpm create mode 100644 gui/mplayer/pixmaps/a169.xpm create mode 100644 gui/mplayer/pixmaps/a235.xpm create mode 100644 gui/mplayer/pixmaps/a43.xpm create mode 100644 gui/mplayer/pixmaps/ab.xpm create mode 100644 gui/mplayer/pixmaps/about.xpm create mode 100644 gui/mplayer/pixmaps/aspect.xpm create mode 100644 gui/mplayer/pixmaps/cancel.xpm create mode 100644 gui/mplayer/pixmaps/chapter.xpm create mode 100644 gui/mplayer/pixmaps/delsub.xpm create mode 100644 gui/mplayer/pixmaps/dir.xpm create mode 100644 gui/mplayer/pixmaps/dolby.xpm create mode 100644 gui/mplayer/pixmaps/double.xpm create mode 100644 gui/mplayer/pixmaps/dvd.xpm create mode 100644 gui/mplayer/pixmaps/empty.xpm create mode 100644 gui/mplayer/pixmaps/empty1px.xpm create mode 100644 gui/mplayer/pixmaps/eq.xpm create mode 100644 gui/mplayer/pixmaps/error.xpm create mode 100644 gui/mplayer/pixmaps/exit.xpm create mode 100644 gui/mplayer/pixmaps/file.xpm create mode 100644 gui/mplayer/pixmaps/file2.xpm create mode 100644 gui/mplayer/pixmaps/fs.xpm create mode 100644 gui/mplayer/pixmaps/half.xpm create mode 100644 gui/mplayer/pixmaps/icon.xpm create mode 100644 gui/mplayer/pixmaps/loadeaf.xpm create mode 100644 gui/mplayer/pixmaps/logo.xpm create mode 100644 gui/mplayer/pixmaps/mplayer-desktop.xpm create mode 100644 gui/mplayer/pixmaps/next.xpm create mode 100644 gui/mplayer/pixmaps/normal.xpm create mode 100644 gui/mplayer/pixmaps/ok.xpm create mode 100644 gui/mplayer/pixmaps/open.xpm create mode 100644 gui/mplayer/pixmaps/pause.xpm create mode 100644 gui/mplayer/pixmaps/pl.xpm create mode 100644 gui/mplayer/pixmaps/play.xpm create mode 100644 gui/mplayer/pixmaps/playdvd.xpm create mode 100644 gui/mplayer/pixmaps/playvcd.xpm create mode 100644 gui/mplayer/pixmaps/prefs.xpm create mode 100644 gui/mplayer/pixmaps/prev.xpm create mode 100644 gui/mplayer/pixmaps/question.xpm create mode 100644 gui/mplayer/pixmaps/skin.xpm create mode 100644 gui/mplayer/pixmaps/sound.xpm create mode 100644 gui/mplayer/pixmaps/stop.xpm create mode 100644 gui/mplayer/pixmaps/stop2.xpm create mode 100644 gui/mplayer/pixmaps/sub.xpm create mode 100644 gui/mplayer/pixmaps/title.xpm create mode 100644 gui/mplayer/pixmaps/tongue.xpm create mode 100644 gui/mplayer/pixmaps/tonguebla.xpm create mode 100644 gui/mplayer/pixmaps/up.xpm create mode 100644 gui/mplayer/pixmaps/url.xpm create mode 100644 gui/mplayer/pixmaps/vcd.xpm create mode 100644 gui/mplayer/pixmaps/warning.xpm create mode 100644 gui/mplayer/play.c create mode 100644 gui/mplayer/play.h create mode 100644 gui/mplayer/sw.c create mode 100644 gui/mplayer/widgets.c create mode 100644 gui/mplayer/widgets.h create mode 100644 gui/skin/cut.c create mode 100644 gui/skin/cut.h create mode 100644 gui/skin/font.c create mode 100644 gui/skin/font.h create mode 100644 gui/skin/skin.c create mode 100644 gui/skin/skin.h create mode 100644 gui/win32/Changelog create mode 100644 gui/win32/README create mode 100644 gui/win32/dialogs.c create mode 100644 gui/win32/dialogs.h create mode 100644 gui/win32/gui.c create mode 100644 gui/win32/gui.h create mode 100644 gui/win32/interface.c create mode 100644 gui/win32/playlist.c create mode 100644 gui/win32/playlist.h create mode 100644 gui/win32/preferences.c create mode 100644 gui/win32/skinload.c create mode 100644 gui/win32/skinload.h create mode 100644 gui/win32/widgetrender.c create mode 100644 gui/win32/wincfg.c create mode 100644 gui/win32/wincfg.h create mode 100644 gui/wm/ws.c create mode 100644 gui/wm/ws.h create mode 100644 gui/wm/wskeys.h create mode 100644 gui/wm/wsmkeys.h create mode 100644 gui/wm/wsxdnd.c create mode 100644 gui/wm/wsxdnd.h (limited to 'gui') diff --git a/gui/Makefile b/gui/Makefile new file mode 100644 index 0000000000..8435035c58 --- /dev/null +++ b/gui/Makefile @@ -0,0 +1,53 @@ +include ../config.mak + +LIBNAME_MPLAYER = libgui.a + +#CFLAGS += -DDEBUG + +ifeq ($(TARGET_WIN32),yes) +SRCS_MPLAYER = win32/dialogs.c \ + win32/gui.c \ + win32/interface.c \ + win32/playlist.c \ + win32/preferences.c \ + win32/skinload.c \ + win32/widgetrender.c \ + win32/wincfg.c \ + +else +SRCS_MPLAYER = wm/ws.c \ + wm/wsxdnd.c \ + app.c \ + interface.c \ + cfg.c \ + bitmap.c \ + skin/skin.c \ + skin/font.c \ + skin/cut.c \ + mplayer/widgets.c \ + mplayer/play.c \ + mplayer/mw.c \ + mplayer/sw.c \ + mplayer/menu.c \ + mplayer/pb.c \ + mplayer/common.c \ + mplayer/gtk/menu.c \ + mplayer/gtk/mb.c \ + mplayer/gtk/about.c \ + mplayer/gtk/pl.c \ + mplayer/gtk/sb.c \ + mplayer/gtk/fs.c \ + mplayer/gtk/opts.c \ + mplayer/gtk/url.c \ + mplayer/gtk/eq.c \ + mplayer/gtk/common.c \ + +endif + +include ../mpcommon.mak + +clean:: + rm -f mplayer/*.o mplayer/*~ mplayer/gtk/*.o mplayer/gtk/*~ \ + skin/*.o skin/*~ \ + wm/*.o wm/*~ \ + win32/*.o win32/*~ \ diff --git a/gui/app.c b/gui/app.c new file mode 100644 index 0000000000..d375296dc4 --- /dev/null +++ b/gui/app.c @@ -0,0 +1,225 @@ + + +#include +#include +#include + +#include "config.h" +#include "mp_msg.h" +#include "help_mp.h" + +#include "app.h" +#include "wm/wskeys.h" +#include "skin/skin.h" +#include "mplayer/gmplayer.h" +#include "interface.h" + +evName evNames[] = + { + { evNone, "evNone" }, + { evPlay, "evPlay" }, + { evStop, "evStop" }, + { evPause, "evPause" }, + { evPrev, "evPrev" }, + { evNext, "evNext" }, + { evLoad, "evLoad" }, + { evEqualizer, "evEqualizer" }, + { evEqualizer, "evEqualeaser" }, + { evPlayList, "evPlaylist" }, + { evExit, "evExit" }, + { evIconify, "evIconify" }, + { evIncBalance, "evIncBalance" }, + { evDecBalance, "evDecBalance" }, + { evFullScreen, "evFullScreen" }, + { evFName, "evFName" }, + { evMovieTime, "evMovieTime" }, + { evAbout, "evAbout" }, + { evLoadPlay, "evLoadPlay" }, + { evPreferences, "evPreferences" }, + { evSkinBrowser, "evSkinBrowser" }, + { evBackward10sec, "evBackward10sec" }, + { evForward10sec, "evForward10sec" }, + { evBackward1min, "evBackward1min" }, + { evForward1min, "evForward1min" }, + { evBackward10min, "evBackward10min" }, + { evForward10min, "evForward10min" }, + { evIncVolume, "evIncVolume" }, + { evDecVolume, "evDecVolume" }, + { evMute, "evMute" }, + { evIncAudioBufDelay, "evIncAudioBufDelay" }, + { evDecAudioBufDelay, "evDecAudioBufDelay" }, + { evPlaySwitchToPause, "evPlaySwitchToPause" }, + { evPauseSwitchToPlay, "evPauseSwitchToPlay" }, + { evNormalSize, "evHalfSize" }, + { evNormalSize, "evNormalSize" }, + { evDoubleSize, "evDoubleSize" }, + { evSetMoviePosition, "evSetMoviePosition" }, + { evSetVolume, "evSetVolume" }, + { evSetBalance, "evSetBalance" }, + { evHelp, "evHelp" }, + { evLoadSubtitle, "evLoadSubtitle" }, + { evPlayDVD, "evPlayDVD" }, + { evPlayVCD, "evPlayVCD" }, + { evSetURL, "evSetURL" }, + { evLoadAudioFile, "evLoadAudioFile" }, + { evDropSubtitle, "evDropSubtitle" }, + { evSetAspect, "evSetAspect" } + }; + +int evBoxs = sizeof( evNames ) / sizeof( evName ); + +// --- + +extern char *get_path(const char *); + +listItems appMPlayer; + +/* FIXME: Eventually remove the obsolete directory names. */ +char * skinDirInHome=NULL; +char * skinDirInHome_obsolete=NULL; +char * skinMPlayerDir=NULL; +char * skinMPlayerDir_obsolete=NULL; +char * skinName = NULL; + +void appClearItem( wItem * item ) +{ + item->type=0; +// --- + item->x=0; item->y=0; item->width=0; item->height=0; +// --- + item->px=0; item->py=0; item->psx=0; item->psy=0; +// --- + item->msg=0; item->msg2=0; + item->pressed=btnReleased; + item->tmp=0; + item->key=0; item->key2=0; + item->Bitmap.Width=0; item->Bitmap.Height=0; item->Bitmap.BPP=0; item->Bitmap.ImageSize=0; + if ( item->Bitmap.Image ) free( item->Bitmap.Image ); + item->Bitmap.Image=NULL; +// --- + item->fontid=0; + if ( item->label ) free( item->label ); item->label=NULL; + item->event=0; +} + +void appCopy( listItems * dest,listItems * source ) +{ + dest->NumberOfItems=source->NumberOfItems; + memcpy( &dest->Items,&source->Items,128 * sizeof( wItem ) ); + + dest->NumberOfMenuItems=source->NumberOfMenuItems; + memcpy( &dest->MenuItems,&source->MenuItems,32 * sizeof( wItem ) ); + + memcpy( &dest->main,&source->main,sizeof( wItem ) ); + memcpy( &dest->sub,&source->sub,sizeof( wItem ) ); + memcpy( &dest->menuBase,&source->menuBase,sizeof( wItem ) ); + memcpy( &dest->menuSelected,&source->menuSelected,sizeof( wItem ) ); +} + +void appInitStruct( listItems * item ) +{ + int i; + for ( i=0;iNumberOfItems;i++ ) + appClearItem( &item->Items[i] ); + for ( i=0;iNumberOfMenuItems;i++ ) + appClearItem( &item->MenuItems[i] ); + for ( i=0;iNumberOfBarItems;i++ ) + appClearItem( &item->barItems[i] ); + + item->NumberOfItems=-1; + memset( item->Items,0,256 * sizeof( wItem ) ); + item->NumberOfMenuItems=-1; + memset( item->MenuItems,0,64 * sizeof( wItem ) ); + item->NumberOfBarItems=-1; + memset( item->barItems,0,256 * sizeof( wItem ) ); + + appClearItem( &item->main ); + item->mainDecoration=0; + appClearItem( &item->sub ); + item->sub.width=0; item->sub.height=0; + item->sub.x=-1; item->sub.y=-1; + appClearItem( &item->menuBase ); + appClearItem( &item->menuSelected ); + item->sub.R=item->sub.G=item->sub.B=0; + item->bar.R=item->bar.G=item->bar.B=0; + item->main.R=item->main.G=item->main.B=0; + item->barIsPresent=0; + item->menuIsPresent=0; +} + +int appFindKey( unsigned char * name ) +{ + int i; + for ( i=0;i 100.f ) state=100.0f; + appMPlayer.Items[j].value=state; + break; + } + } + + for ( j=0;j < appMPlayer.NumberOfBarItems + 1;j++ ) + if ( appMPlayer.barItems[j].msg == event ) + { + switch ( appMPlayer.barItems[j].type ) + { + case itButton: + appMPlayer.barItems[j].pressed=(int)state; + appMPlayer.barItems[j].tmp=(int)state; + break; + case itPotmeter: + case itVPotmeter: + case itHPotmeter: + if ( state < 0.0f ) state=0.0f; + if ( state > 100.f ) state=100.0f; + appMPlayer.barItems[j].value=state; + break; + } + } +} + +float btnGetValue( int event ) +{ + int j; + for ( j=0;j +#include +#include + +#include + +#include "mp_msg.h" +#include "help_mp.h" +#include "bitmap.h" + +int pngRead( unsigned char * fname,txSample * bf ) +{ + unsigned char header[8]; + png_structp png; + png_infop info; + png_infop endinfo; + png_bytep * row_p; + png_bytep palette = NULL; + int color; + png_uint_32 i; + + FILE *fp=fopen( fname,"rb" ); + if ( !fp ) + { + mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[png] file read error ( %s )\n",fname ); + return 1; + } + + fread( header,1,8,fp ); + if ( !png_check_sig( header,8 ) ) return 1; + + png=png_create_read_struct( PNG_LIBPNG_VER_STRING,NULL,NULL,NULL ); + info=png_create_info_struct( png ); + endinfo=png_create_info_struct( png ); + + png_init_io( png,fp ); + png_set_sig_bytes( png,8 ); + png_read_info( png,info ); + png_get_IHDR( png,info,&bf->Width,&bf->Height,&bf->BPP,&color,NULL,NULL,NULL ); + + row_p=malloc( sizeof( png_bytep ) * bf->Height ); + if ( !row_p ) + { + mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[png] not enough memory for row buffer\n" ); + return 2; + } + bf->Image=(png_bytep)malloc( png_get_rowbytes( png,info ) * bf->Height ); + if ( !bf->Image ) + { + mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[png] not enough memory for image buffer\n" ); + return 2; + } + for ( i=0; i < bf->Height; i++ ) row_p[i]=&bf->Image[png_get_rowbytes( png,info ) * i]; + + png_read_image( png,row_p ); + free( row_p ); + +#if 0 + if ( color == PNG_COLOR_TYPE_PALETTE ) + { + int cols; + png_get_PLTE( png,info,(png_colorp *)&palette,&cols ); + } +#endif + + if ( color&PNG_COLOR_MASK_ALPHA ) + { + if ( color&PNG_COLOR_MASK_PALETTE || color == PNG_COLOR_TYPE_GRAY_ALPHA ) bf->BPP*=2; + else bf->BPP*=4; + } + else + { + if ( color&PNG_COLOR_MASK_PALETTE || color == PNG_COLOR_TYPE_GRAY ) bf->BPP*=1; + else bf->BPP*=3; + } + + png_read_end( png,endinfo ); + png_destroy_read_struct( &png,&info,&endinfo ); + + if ( fclose( fp ) != 0 ) + { + free( bf->Image ); + free( palette ); + return 1; + } + bf->ImageSize=bf->Width * bf->Height * ( bf->BPP / 8 ); + + mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[png] filename: %s.\n",fname ); + mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[png] size: %dx%d bits: %d\n",bf->Width,bf->Height,bf->BPP ); + mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[png] imagesize: %lu\n",bf->ImageSize ); + return 0; +} + +int conv24to32( txSample * bf ) +{ + unsigned char * tmpImage; + int i,c; + + if ( bf->BPP == 24 ) + { + tmpImage=bf->Image; + bf->ImageSize=bf->Width * bf->Height * 4; + bf->BPP=32; + if ( ( bf->Image=malloc( bf->ImageSize ) ) == NULL ) + { + mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[bitmap] not enough memory for image\n" ); + return 1; + } + memset( bf->Image,0,bf->ImageSize ); + for ( c=0,i=0;i < (int)(bf->Width * bf->Height * 3); ) + { + bf->Image[c++]=tmpImage[i++]; //red + bf->Image[c++]=tmpImage[i++]; //green + bf->Image[c++]=tmpImage[i++]; c++; //blue + } + free( tmpImage ); + } + return 0; +} + +void bgr2rgb( txSample * bf ) +{ + unsigned char c; + int i; + + for ( i=0;i < (int)bf->ImageSize;i+=4 ) + { + c=bf->Image[i]; + bf->Image[i]=bf->Image[i+2]; + bf->Image[i+2]=c; + } +} + +void Normalize( txSample * bf ) +{ + int i; +#ifndef WORDS_BIGENDIAN + for ( i=0;i < (int)bf->ImageSize;i+=4 ) bf->Image[i+3]=0; +#else + for ( i=0;i < (int)bf->ImageSize;i+=4 ) bf->Image[i]=0; +#endif +} + +unsigned char tmp[512]; + +unsigned char * fExist( unsigned char * fname ) +{ + FILE * fl; + unsigned char ext[][6] = { ".png\0",".PNG\0" }; + int i; + + fl=fopen( fname,"rb" ); + if ( fl != NULL ) + { + fclose( fl ); + return fname; + } + for ( i=0;i<2;i++ ) + { + snprintf( tmp,511,"%s%s",fname,ext[i] ); + fl=fopen( tmp,"rb" ); + if ( fl != NULL ) + { + fclose( fl ); + return tmp; + } + } + return NULL; +} + +int bpRead( char * fname, txSample * bf ) +{ + fname=fExist( fname ); + if ( fname == NULL ) return -2; + if ( pngRead( fname,bf ) ) + { + mp_dbg( MSGT_GPLAYER,MSGL_FATAL,"[bitmap] unknown file type ( %s )\n",fname ); + return -5; + } + if ( bf->BPP < 24 ) + { + mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[bitmap] Sorry, only 24 and 32 bpp bitmaps are supported.\n" ); + return -1; + } + if ( conv24to32( bf ) ) return -8; +#ifdef WORDS_BIGENDIAN + swab(bf->Image, bf->Image, bf->ImageSize); +#endif + bgr2rgb( bf ); + Normalize( bf ); + return 0; +} + +void Convert32to1( txSample * in,txSample * out,int adaptivlimit ) +{ + out->Width=in->Width; + out->Height=in->Height; + out->BPP=1; + out->ImageSize=(out->Width * out->Height + 7) / 8; + mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[c32to1] imagesize: %d\n",out->ImageSize ); + out->Image=calloc( 1,out->ImageSize ); + if ( out->Image == NULL ) mp_msg( MSGT_GPLAYER,MSGL_WARN,MSGTR_NotEnoughMemoryC32To1 ); + { + int i,b,c=0; unsigned int * buf = NULL; unsigned char tmp = 0; int nothaveshape = 1; + buf=(unsigned int *)in->Image; + for ( b=0,i=0;i < (int)(out->Width * out->Height);i++ ) + { + if ( (int)buf[i] != adaptivlimit ) tmp=( tmp >> 1 )|128; + else { tmp=tmp >> 1; buf[i]=nothaveshape=0; } + if ( b++ == 7 ) { out->Image[c++]=tmp; tmp=b=0; } + } + if ( b ) out->Image[c]=tmp; + if ( nothaveshape ) { free( out->Image ); out->Image=NULL; } + } +} + +void Convert1to32( txSample * in,txSample * out ) +{ + if ( in->Image == NULL ) return; + out->Width=in->Width; + out->Height=in->Height; + out->BPP=32; + out->ImageSize=out->Width * out->Height * 4; + out->Image=calloc( 1,out->ImageSize ); + mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[c1to32] imagesize: %d\n",out->ImageSize ); + if ( out->Image == NULL ) mp_msg( MSGT_GPLAYER,MSGL_WARN,MSGTR_NotEnoughMemoryC1To32 ); + { + int i,b,c=0; unsigned int * buf = NULL; unsigned char tmp = 0; + buf=(unsigned int *)out->Image; + for ( c=0,i=0;i < (int)(in->Width * in->Height / 8);i++ ) + { + tmp=in->Image[i]; + for ( b=0;b<8;b++ ) + { + buf[c]=0; + if ( tmp&0x1 ) buf[c]=0xffffffff; + c++; tmp=tmp>>1; + } + } + } +} diff --git a/gui/bitmap.h b/gui/bitmap.h new file mode 100644 index 0000000000..5b4075a7e7 --- /dev/null +++ b/gui/bitmap.h @@ -0,0 +1,18 @@ +#ifndef __BITMAP_H +#define __BITMAP_H + +typedef struct _txSample +{ + unsigned long Width; + unsigned long Height; + unsigned int BPP; + unsigned long ImageSize; + char * Image; +} txSample; + +extern int bpRead( char * fname, txSample * bf ); +extern int conv24to32( txSample * bf ); +extern void Convert32to1( txSample * in,txSample * out,int adaptivlimit ); +extern void Convert1to32( txSample * in,txSample * out ); + +#endif /* __BITMAP_H */ diff --git a/gui/cfg.c b/gui/cfg.c new file mode 100644 index 0000000000..f12ce3a422 --- /dev/null +++ b/gui/cfg.c @@ -0,0 +1,349 @@ + +#include +#include +#include + +#include "config.h" +#include "mp_msg.h" +#include "help_mp.h" +#include "mixer.h" +#include "mplayer.h" +#include "m_config.h" +#include "m_option.h" + +#include "libvo/video_out.h" + +#include "cfg.h" +#include "app.h" +#include "interface.h" +#include "mplayer/play.h" + +// --- params + +int gtkEnableAudioEqualizer = 0; + +int gtkVfPP = 0; +#ifdef USE_LIBAVCODEC + int gtkVfLAVC = 0; +#endif + +int gtkAONorm = 0; +int gtkAOSurround = 0; +int gtkAOExtraStereo = 0; +float gtkAOExtraStereoMul = 1.0; +#ifdef USE_OSS_AUDIO +char * gtkAOOSSMixer; +char * gtkAOOSSMixerChannel; +char * gtkAOOSSDevice; +#endif +#if defined(HAVE_ALSA9) || defined (HAVE_ALSA1X) +char * gtkAOALSAMixer; +char * gtkAOALSAMixerChannel; +char * gtkAOALSADevice; +#endif +#ifdef HAVE_SDL +char * gtkAOSDLDriver; +#endif +#ifdef USE_ESD +char * gtkAOESDDevice; +#endif + +int gtkCacheOn = 0; +int gtkCacheSize = 2048; + +int gtkAutoSyncOn = 0; +int gtkAutoSync = 0; + +#ifdef HAVE_DXR3 + char * gtkDXR3Device; +#endif + +int gtkSubDumpMPSub = 0; +int gtkSubDumpSrt = 0; + +int gtkLoadFullscreen = 0; +int gtkShowVideoWindow = 1; +int gtkEnablePlayBar = 1; + +int gui_save_pos = 1; +int gui_main_pos_x = -2; +int gui_main_pos_y = -2; +int gui_sub_pos_x = -1; +int gui_sub_pos_y = -1; + +#ifdef USE_ASS +gtkASS_t gtkASS; +#endif +// --- + +extern char * get_path( const char * filename ); +extern int flip; +extern int frame_dropping; +extern int stop_xscreensaver; +extern int m_config_parse_config_file(m_config_t* config, char *conffile); + +static m_config_t * gui_conf; +static m_option_t gui_opts[] = +{ + { "enable_audio_equ",>kEnableAudioEqualizer,CONF_TYPE_FLAG,0,0,1,NULL }, + + { "vo_driver",&video_driver_list,CONF_TYPE_STRING_LIST,0,0,0,NULL }, + { "vo_panscan",&vo_panscan,CONF_TYPE_FLOAT,CONF_RANGE,0.0,1.0,NULL }, + { "vo_doublebuffering",&vo_doublebuffering,CONF_TYPE_FLAG,0,0,1,NULL }, + { "vo_direct_render",&vo_directrendering,CONF_TYPE_FLAG,0,0,1,NULL }, +#ifdef HAVE_DXR3 + { "vo_dxr3_device",>kDXR3Device,CONF_TYPE_STRING,0,0,0,NULL }, +#endif + + { "v_framedrop",&frame_dropping,CONF_TYPE_INT,CONF_RANGE,0,2,NULL }, + { "v_flip",&flip,CONF_TYPE_INT,CONF_RANGE,-1,1,NULL }, + { "v_ni",&force_ni,CONF_TYPE_FLAG,0,0,1,NULL }, + { "v_idx",&index_mode,CONF_TYPE_INT,CONF_RANGE,-1,2,NULL }, + { "v_vfm",&video_fm_list,CONF_TYPE_STRING_LIST,0,0,0,NULL }, + { "a_afm",&audio_fm_list,CONF_TYPE_STRING_LIST,0,0,0,NULL }, + + { "vf_pp",>kVfPP,CONF_TYPE_FLAG,0,0,1,NULL }, + { "vf_autoq",&auto_quality,CONF_TYPE_INT,CONF_RANGE,0,100,NULL }, +#ifdef USE_LIBAVCODEC + { "vf_lavc",>kVfLAVC,CONF_TYPE_FLAG,0,0,1,NULL }, +#endif + + { "ao_driver",&audio_driver_list,CONF_TYPE_STRING_LIST,0,0,0,NULL }, + { "ao_volnorm",>kAONorm,CONF_TYPE_FLAG,0,0,1,NULL }, + { "softvol",&soft_vol,CONF_TYPE_FLAG,0,0,1,NULL }, + { "ao_surround",>kAOSurround,CONF_TYPE_FLAG,0,0,1,NULL }, + { "ao_extra_stereo",>kAOExtraStereo,CONF_TYPE_FLAG,0,0,1,NULL }, + { "ao_extra_stereo_coefficient",>kAOExtraStereoMul,CONF_TYPE_FLOAT,CONF_RANGE,-10,10,NULL }, +#ifdef USE_OSS_AUDIO + { "ao_oss_mixer",>kAOOSSMixer,CONF_TYPE_STRING,0,0,0,NULL }, + { "ao_oss_mixer_channel",>kAOOSSMixerChannel,CONF_TYPE_STRING,0,0,0,NULL }, + { "ao_oss_device",>kAOOSSDevice,CONF_TYPE_STRING,0,0,0,NULL }, +#endif +#if defined(HAVE_ALSA9) || defined (HAVE_ALSA1X) + { "ao_alsa_mixer",>kAOALSAMixer,CONF_TYPE_STRING,0,0,0,NULL }, + { "ao_alsa_mixer_channel",>kAOALSAMixerChannel,CONF_TYPE_STRING,0,0,0,NULL }, + { "ao_alsa_device",>kAOALSADevice,CONF_TYPE_STRING,0,0,0,NULL }, +#endif +#ifdef HAVE_SDL + { "ao_sdl_subdriver",>kAOSDLDriver,CONF_TYPE_STRING,0,0,0,NULL }, +#endif +#ifdef USE_ESD + { "ao_esd_device",>kAOESDDevice,CONF_TYPE_STRING,0,0,0,NULL }, +#endif + + { "dvd_device",&dvd_device,CONF_TYPE_STRING,0,0,0,NULL }, + { "cdrom_device",&cdrom_device,CONF_TYPE_STRING,0,0,0,NULL }, + + { "osd_level",&osd_level,CONF_TYPE_INT,CONF_RANGE,0,3,NULL }, + { "sub_auto_load",&sub_auto,CONF_TYPE_FLAG,0,0,1,NULL }, + { "sub_unicode",&sub_unicode,CONF_TYPE_FLAG,0,0,1,NULL }, +#ifdef USE_ASS + { "ass_enabled",&ass_enabled,CONF_TYPE_FLAG,0,0,1,NULL }, + { "ass_use_margins",&ass_use_margins,CONF_TYPE_FLAG,0,0,1,NULL }, + { "ass_top_margin",&ass_top_margin,CONF_TYPE_INT,CONF_RANGE,0,512,NULL }, + { "ass_bottom_margin",&ass_bottom_margin,CONF_TYPE_INT,CONF_RANGE,0,512,NULL }, +#endif + { "sub_pos",&sub_pos,CONF_TYPE_INT,CONF_RANGE,0,200,NULL }, + { "sub_overlap",&suboverlap_enabled,CONF_TYPE_FLAG,0,0,0,NULL }, +#ifdef USE_ICONV + { "sub_cp",&sub_cp,CONF_TYPE_STRING,0,0,0,NULL }, +#endif + { "font_factor",&font_factor,CONF_TYPE_FLOAT,CONF_RANGE,0.0,10.0,NULL }, + { "font_name",&font_name,CONF_TYPE_STRING,0,0,0,NULL }, +#ifdef HAVE_FREETYPE + { "font_encoding",&subtitle_font_encoding,CONF_TYPE_STRING,0,0,0,NULL }, + { "font_text_scale",&text_font_scale_factor,CONF_TYPE_FLOAT,CONF_RANGE,0,100,NULL }, + { "font_osd_scale",&osd_font_scale_factor,CONF_TYPE_FLOAT,CONF_RANGE,0,100,NULL }, + { "font_blur",&subtitle_font_radius,CONF_TYPE_FLOAT,CONF_RANGE,0,8,NULL }, + { "font_outline",&subtitle_font_thickness,CONF_TYPE_FLOAT,CONF_RANGE,0,8,NULL }, + { "font_autoscale",&subtitle_autoscale,CONF_TYPE_INT,CONF_RANGE,0,3,NULL }, +#endif + + { "cache",>kCacheOn,CONF_TYPE_FLAG,0,0,1,NULL }, + { "cache_size",>kCacheSize,CONF_TYPE_INT,CONF_RANGE,-1,65535,NULL }, + + { "playbar",>kEnablePlayBar,CONF_TYPE_FLAG,0,0,1,NULL }, + { "load_fullscreen",>kLoadFullscreen,CONF_TYPE_FLAG,0,0,1,NULL }, + { "show_videowin", >kShowVideoWindow,CONF_TYPE_FLAG,0,0,1,NULL }, + { "stopxscreensaver",&stop_xscreensaver,CONF_TYPE_FLAG,0,0,1,NULL }, + + { "autosync",>kAutoSyncOn,CONF_TYPE_FLAG,0,0,1,NULL }, + { "autosync_size",>kAutoSync,CONF_TYPE_INT,CONF_RANGE,0,10000,NULL }, + + { "gui_skin",&skinName,CONF_TYPE_STRING,0,0,0,NULL }, + + { "gui_save_pos", &gui_save_pos, CONF_TYPE_FLAG,0,0,1,NULL}, + { "gui_main_pos_x", &gui_main_pos_x, CONF_TYPE_INT,0,0,0,NULL}, + { "gui_main_pos_y", &gui_main_pos_y, CONF_TYPE_INT,0,0,0,NULL}, + { "gui_video_out_pos_x", &gui_sub_pos_x, CONF_TYPE_INT,0,0,0,NULL}, + { "gui_video_out_pos_y", &gui_sub_pos_y, CONF_TYPE_INT,0,0,0,NULL}, + + { "equ_channel_1",>kEquChannel1,CONF_TYPE_STRING,0,0,0,NULL }, + { "equ_channel_2",>kEquChannel2,CONF_TYPE_STRING,0,0,0,NULL }, + { "equ_channel_3",>kEquChannel3,CONF_TYPE_STRING,0,0,0,NULL }, + { "equ_channel_4",>kEquChannel4,CONF_TYPE_STRING,0,0,0,NULL }, + { "equ_channel_5",>kEquChannel5,CONF_TYPE_STRING,0,0,0,NULL }, + { "equ_channel_6",>kEquChannel6,CONF_TYPE_STRING,0,0,0,NULL }, + +#if 1 +#define audio_equ_row( i,j ) { "equ_band_"#i#j,>kEquChannels[i][j],CONF_TYPE_FLOAT,CONF_RANGE,-15.0,15.0,NULL }, + audio_equ_row( 0,0 ) audio_equ_row( 0,1 ) audio_equ_row( 0,2 ) audio_equ_row( 0,3 ) audio_equ_row( 0,4 ) audio_equ_row( 0,5 ) audio_equ_row( 0,6 ) audio_equ_row( 0,7 ) audio_equ_row( 0,8 ) audio_equ_row( 0,9 ) + audio_equ_row( 1,0 ) audio_equ_row( 1,1 ) audio_equ_row( 1,2 ) audio_equ_row( 1,3 ) audio_equ_row( 1,4 ) audio_equ_row( 1,5 ) audio_equ_row( 1,6 ) audio_equ_row( 1,7 ) audio_equ_row( 1,8 ) audio_equ_row( 1,9 ) + audio_equ_row( 2,0 ) audio_equ_row( 2,1 ) audio_equ_row( 2,2 ) audio_equ_row( 2,3 ) audio_equ_row( 2,4 ) audio_equ_row( 2,5 ) audio_equ_row( 2,6 ) audio_equ_row( 2,7 ) audio_equ_row( 2,8 ) audio_equ_row( 2,9 ) + audio_equ_row( 3,0 ) audio_equ_row( 3,1 ) audio_equ_row( 3,2 ) audio_equ_row( 3,3 ) audio_equ_row( 3,4 ) audio_equ_row( 3,5 ) audio_equ_row( 3,6 ) audio_equ_row( 3,7 ) audio_equ_row( 3,8 ) audio_equ_row( 3,9 ) + audio_equ_row( 4,0 ) audio_equ_row( 4,1 ) audio_equ_row( 4,2 ) audio_equ_row( 4,3 ) audio_equ_row( 4,4 ) audio_equ_row( 4,5 ) audio_equ_row( 4,6 ) audio_equ_row( 4,7 ) audio_equ_row( 4,8 ) audio_equ_row( 4,9 ) + audio_equ_row( 5,0 ) audio_equ_row( 5,1 ) audio_equ_row( 5,2 ) audio_equ_row( 5,3 ) audio_equ_row( 5,4 ) audio_equ_row( 5,5 ) audio_equ_row( 5,6 ) audio_equ_row( 5,7 ) audio_equ_row( 5,8 ) audio_equ_row( 5,9 ) +#undef audio_equ_row +#endif + + { NULL, NULL, 0, 0, 0, 0, NULL } +}; + +char * gfgets( char * str, int size, FILE * f ) +{ + char * s = fgets( str,size,f ); + char c; + if ( s ) + { + c=s[ strlen( s ) - 1 ]; if ( c == '\n' || c == '\r' ) s[ strlen( s ) - 1 ]=0; + c=s[ strlen( s ) - 1 ]; if ( c == '\n' || c == '\r' ) s[ strlen( s ) - 1 ]=0; + } + return s; +} + +int cfg_read( void ) +{ + char * cfg = get_path( "gui.conf" ); + FILE * f; + +// -- read configuration + mp_msg( MSGT_GPLAYER,MSGL_V,"[cfg] reading config file: %s\n",cfg ); + gui_conf=m_config_new(); + m_config_register_options( gui_conf,gui_opts ); + if ( m_config_parse_config_file( gui_conf,cfg ) < 0 ) + { + mp_msg( MSGT_GPLAYER,MSGL_FATAL,MSGTR_ConfigFileError ); +// exit( 1 ); + } + free( cfg ); + +// -- read pl + cfg=get_path( "gui.pl" ); + if ( (f=fopen( cfg,"rt" )) ) + { + while ( !feof( f ) ) + { + char tmp[512]; plItem * item; + if ( gfgets( tmp,512,f ) == NULL ) continue; + item=calloc( 1,sizeof( plItem ) ); + item->path=strdup( tmp ); + gfgets( tmp,512,f ); + item->name=strdup( tmp ); + gtkSet( gtkAddPlItem,0,(void*)item ); + } + fclose( f ); + } + free( cfg ); + + //-- read previously visited urls + cfg=get_path( "gui.url" ); + if ( (f=fopen( cfg,"rt" )) ) + { + while ( !feof( f ) ) + { + char tmp[512]; URLItem * item; + if ( gfgets( tmp,512,f ) == NULL ) continue; + item=calloc( 1,sizeof( URLItem ) ); + item->url=strdup( tmp ); + gtkSet( gtkAddURLItem,0,(void*)item ); + } + fclose( f ); + } + free( cfg ); + +// -- reade file loader history + cfg=get_path( "gui.history" ); + if ( (f=fopen( cfg,"rt+" )) ) + { + int i = 0; + while ( !feof( f ) ) + { + char tmp[512]; + if ( gfgets( tmp,512,f ) == NULL ) continue; + fsHistory[i++]=gstrdup( tmp ); + } + fclose( f ); + } + free( cfg ); + + return 0; +} + +int cfg_write( void ) +{ + char * cfg = get_path( "gui.conf" ); + FILE * f; + int i; + +// -- save configuration + if ( (f=fopen( cfg,"wt+" )) ) + { + for ( i=0;gui_opts[i].name;i++ ) + { + char* v = m_option_print(&gui_opts[i],gui_opts[i].p); + if(v) { + fprintf( f,"%s = \"%s\"\n",gui_opts[i].name, v); + free(v); + } else if((int)v == -1) + mp_msg(MSGT_GPLAYER,MSGL_WARN,MSGTR_UnableToSaveOption, gui_opts[i].name); + } + fclose( f ); + } + free( cfg ); + +// -- save playlist + cfg=get_path( "gui.pl" ); + if ( (f=fopen( cfg,"wt+" )) ) + { + plCurrent=plList; + while ( plCurrent ) + { + if ( plCurrent->path && plCurrent->name ) + { + fprintf( f,"%s\n",plCurrent->path ); + fprintf( f,"%s\n",plCurrent->name ); + } + plCurrent=plCurrent->next; + } + fclose( f ); + } + free( cfg ); + +// -- save URL's + cfg=get_path( "gui.url" ); + if ( (f=fopen( cfg,"wt+" )) ) + { + while ( URLList ) + { + if ( URLList->url ) fprintf( f,"%s\n",URLList->url ); + URLList=URLList->next; + } + fclose( f ); + } + free( cfg ); + +// -- save file loader history + cfg=get_path( "gui.history" ); + if ( (f=fopen( cfg,"wt+" )) ) + { + int i = 0; +// while ( fsHistory[i] != NULL ) + for ( i=0;i < 5; i++) + if( fsHistory[i] ) fprintf( f,"%s\n",fsHistory[i] ); + fclose( f ); + } + free( cfg ); + + return 0; +} + diff --git a/gui/cfg.h b/gui/cfg.h new file mode 100644 index 0000000000..f78e983524 --- /dev/null +++ b/gui/cfg.h @@ -0,0 +1,76 @@ + +#ifndef __CFG_H +#define __CFG_H + +extern int gtkEnableAudioEqualizer; + +extern int gtkVfPP; +extern int gtkVfLAVC; + +extern int gtkAONorm; +extern int gtkAOFakeSurround; +extern int gtkAOExtraStereo; +extern float gtkAOExtraStereoMul; +#ifdef USE_OSS_AUDIO +extern char * gtkAOOSSMixer; +extern char * gtkAOOSSMixerChannel; +extern char * gtkAOOSSDevice; +#endif +#if defined(HAVE_ALSA9) || defined (HAVE_ALSA1X) +extern char * gtkAOALSAMixer; +extern char * gtkAOALSAMixerChannel; +extern char * gtkAOALSADevice; +#endif +#ifdef HAVE_SDL +extern char * gtkAOSDLDriver; +#endif +#ifdef USE_ESD +extern char * gtkAOESDDevice; +#endif +#ifdef HAVE_DXR3 +extern char * gtkDXR3Device; +#endif + +extern int gtkCacheOn; +extern int gtkCacheSize; + +extern int gtkAutoSyncOn; +extern int gtkAutoSync; + +extern int gtkSubDumpMPSub; +extern int gtkSubDumpSrt; + +extern char * gtkEquChannel1; +extern char * gtkEquChannel2; +extern char * gtkEquChannel3; +extern char * gtkEquChannel4; +extern char * gtkEquChannel5; +extern char * gtkEquChannel6; +extern int gtkLoadFullscreen; +extern int gtkShowVideoWindow; +extern int gtkEnablePlayBar; + +extern int gui_save_pos; +extern int gui_main_pos_x; +extern int gui_main_pos_y; +extern int gui_sub_pos_x; +extern int gui_sub_pos_y; + +#ifdef USE_ASS +typedef struct { + int enabled; + int use_margins; + int top_margin; + int bottom_margin; +} gtkASS_t; +extern gtkASS_t gtkASS; +extern int ass_enabled; +extern int ass_use_margins; +extern int ass_top_margin; +extern int ass_bottom_margin; +#endif + +extern int cfg_read( void ); +extern int cfg_write( void ); + +#endif diff --git a/gui/interface.c b/gui/interface.c new file mode 100644 index 0000000000..eb461bc7f7 --- /dev/null +++ b/gui/interface.c @@ -0,0 +1,1338 @@ + +#include +#include +#include +#include +#include + +#include "wm/ws.h" +#include "wm/wsxdnd.h" +#include "interface.h" +#include "skin/skin.h" + +#include "mplayer/gtk/eq.h" +#include "mplayer/widgets.h" +#include "mplayer/gmplayer.h" +#include "mplayer/play.h" + +#include "mplayer.h" +#include "access_mpcontext.h" +#include "app.h" +#include "cfg.h" +#include "help_mp.h" +#include "subreader.h" +#include "libvo/x11_common.h" +#include "libvo/video_out.h" +#include "libvo/font_load.h" +#include "libvo/sub.h" +#include "input/input.h" +#include "libao2/audio_out.h" +#include "mixer.h" +#include "libaf/af.h" +#include "libaf/equalizer.h" + +extern af_cfg_t af_cfg; + +#ifdef USE_ICONV +#include +#endif + +#include "stream/stream.h" +#include "libmpdemux/demuxer.h" +#include "libmpdemux/stheader.h" +#include "libmpcodecs/dec_video.h" + +#ifdef USE_DVDREAD +#include "stream/stream_dvd.h" +#endif + + +#include "m_config.h" +#include "m_option.h" + + +guiInterface_t guiIntfStruct; +int guiWinID=-1; + +char * gstrcat( char ** dest,const char * src ) +{ + char * tmp = NULL; + + if ( !src ) return NULL; + + if ( *dest ) + { + tmp=malloc( strlen( *dest ) + strlen( src ) + 1 ); + + if ( tmp ) /* TODO: advanced error handling */ + { + strcpy( tmp,*dest ); strcat( tmp,src ); free( *dest ); + } + } + else + { tmp=malloc( strlen( src ) + 1 ); strcpy( tmp,src ); } + *dest=tmp; + return tmp; +} + +int gstrcmp( const char * a,const char * b ) +{ + if ( !a && !b ) return 0; + if ( !a || !b ) return -1; + return strcmp( a,b ); +} + +int gstrncmp( const char * a,const char * b,int size ) +{ + if ( !a && !b ) return 0; + if ( !a || !b ) return -1; + return strncmp( a,b,size ); +} + +char * gstrdup( const char * str ) +{ + if ( !str ) return NULL; + return strdup( str ); +} + +char * gstrchr( char * str,int c ) +{ + if ( !str ) return NULL; + return strchr( str,c ); +} + +void gfree( void ** p ) +{ + if ( *p == NULL ) return; + free( *p ); *p=NULL; +} + +void gset( char ** str, const char * what ) +{ + if ( *str ) { if ( !strstr( *str,what ) ) { gstrcat( str,"," ); gstrcat( str,what ); }} + else gstrcat( str,what ); +} + +/** + * \brief this actually creates a new list containing only one element... + */ +void gaddlist( char *** list,const char * entry ) +{ + int i; + + if ( (*list) ) + { + for ( i=0;(*list)[i];i++ ) free( (*list)[i] ); + free( (*list) ); + } + + (*list)=malloc( 2 * sizeof(char **) ); + (*list)[0]=gstrdup( entry ); + (*list)[1]=NULL; +} + +/** + * \brief this replaces a string starting with search by replace. + * If not found, replace is appended. + */ +void greplace(char ***list, const char *search, const char *replace) +{ + int i = 0; + int len = (search) ? strlen(search) : 0; + + if (*list) { + for (i = 0; (*list)[i]; i++) { + if (search && (strncmp((*list)[i], search, len) == 0)) { + free((*list)[i]); + (*list)[i] = gstrdup(replace); + return; + } + } + *list = realloc(*list, (i + 2) * sizeof(char *)); + } + else + *list = malloc(2 * sizeof(char *)); + + (*list)[i] = gstrdup(replace); + (*list)[i + 1] = NULL; +} + +#ifdef USE_ICONV +char * gconvert_uri_to_filename( char * str ) +{ + iconv_t d; + char * out = strdup( str ); + char * tmp = NULL; + char * ize; + size_t inb,outb; + char * charset = "ISO8859-1"; + char * cs; + + if ( !strchr( str,'%' ) ) return str; + + { + char * t = calloc( 1,strlen( out ) ); + int i,c = 0; + for ( i=0;i < (int)strlen( out );i++ ) + if ( out[i] != '%' ) t[c++]=out[i]; + else + { + char tmp[5] = "0xXX"; +// if ( out[++i] == '%' ) { t[c++]='%'; continue; }; + tmp[2]=out[++i]; tmp[3]=out[++i]; + t[c++]=(char)strtol( tmp,(char **)NULL,0 ); + } + free( out ); + out=t; + } + + if ( (cs=getenv( "CHARSET" )) && *cs ) charset=cs; + + inb=outb=strlen( out ); + tmp=calloc( 1,outb + 1 ); + ize=tmp; + d=iconv_open( charset,"UTF-8" ); + if ( (iconv_t)(-1) == d ) return str; + iconv( d,&out,&inb,&tmp,&outb ); + iconv_close( d ); + free( out ); + return ize; +} +#endif + +void guiInit( void ) +{ + int i; + + memset( &guiIntfStruct,0,sizeof( guiIntfStruct ) ); + guiIntfStruct.Balance=50.0f; + guiIntfStruct.StreamType=-1; + + memset( >kEquChannels,0,sizeof( gtkEquChannels ) ); +#ifdef HAVE_DXR3 + if ( !gtkDXR3Device ) gtkDXR3Device=strdup( "/dev/em8300-0" ); +#endif + if ( stream_cache_size > 0 ) { gtkCacheOn=1; gtkCacheSize=stream_cache_size; } + else if ( stream_cache_size == 0 ) gtkCacheOn = 0; + if ( autosync && autosync != gtkAutoSync ) { gtkAutoSyncOn=1; gtkAutoSync=autosync; } + +#ifdef USE_ASS + gtkASS.enabled = ass_enabled; + gtkASS.use_margins = ass_use_margins; + gtkASS.top_margin = ass_top_margin; + gtkASS.bottom_margin = ass_bottom_margin; +#endif + + gtkInit(); +// --- initialize X + wsXInit( (void *)mDisplay ); +// --- load skin + skinDirInHome=get_path("skins"); + skinDirInHome_obsolete=get_path("Skin"); + skinMPlayerDir=MPLAYER_DATADIR "/skins"; + skinMPlayerDir_obsolete=MPLAYER_DATADIR "/Skin"; + mp_msg( MSGT_GPLAYER,MSGL_V,"SKIN dir 1: '%s'\n",skinDirInHome); + mp_msg( MSGT_GPLAYER,MSGL_V,"SKIN dir 1 (obsolete): '%s'\n",skinDirInHome_obsolete); + mp_msg( MSGT_GPLAYER,MSGL_V,"SKIN dir 2: '%s'\n",skinMPlayerDir); + mp_msg( MSGT_GPLAYER,MSGL_V,"SKIN dir 2 (obsolete): '%s'\n",skinMPlayerDir_obsolete); + if ( !skinName ) skinName=strdup( "default" ); + i = skinRead( skinName ); + if ((i == -1) && strcmp(skinName,"default")) + { + mp_msg( MSGT_GPLAYER,MSGL_WARN,MSGTR_SKIN_SKINCFG_SelectedSkinNotFound, skinName); + skinName=strdup( "default" ); + i = skinRead( skinName ); + } + switch (i) { + case -1: mp_msg( MSGT_GPLAYER,MSGL_ERR,MSGTR_SKIN_SKINCFG_SkinNotFound,skinName ); exit( 0 ); + case -2: mp_msg( MSGT_GPLAYER,MSGL_ERR,MSGTR_SKIN_SKINCFG_SkinCfgReadError,skinName ); exit( 0 ); + } +// --- initialize windows + if ( ( mplDrawBuffer = malloc( appMPlayer.main.Bitmap.ImageSize ) ) == NULL ) + { + fprintf( stderr,MSGTR_NEMDB ); + exit( 0 ); + } + + if ( gui_save_pos ) + { + appMPlayer.main.x = gui_main_pos_x; + appMPlayer.main.y = gui_main_pos_y; + appMPlayer.sub.x = gui_sub_pos_x; + appMPlayer.sub.y = gui_sub_pos_y; + } + + if (WinID>0) + { + appMPlayer.subWindow.Parent=WinID; + appMPlayer.sub.x=0; + appMPlayer.sub.y=0; + } + if (guiWinID>=0) appMPlayer.mainWindow.Parent=guiWinID; + + wsCreateWindow( &appMPlayer.subWindow, + appMPlayer.sub.x,appMPlayer.sub.y,appMPlayer.sub.width,appMPlayer.sub.height, + wsNoBorder,wsShowMouseCursor|wsHandleMouseButton|wsHandleMouseMove,wsShowFrame|wsHideWindow,"MPlayer - Video" ); + + wsDestroyImage( &appMPlayer.subWindow ); + wsCreateImage( &appMPlayer.subWindow,appMPlayer.sub.Bitmap.Width,appMPlayer.sub.Bitmap.Height ); + wsXDNDMakeAwareness(&appMPlayer.subWindow); + + mplMenuInit(); + mplPBInit(); + + vo_setwindow( appMPlayer.subWindow.WindowID, appMPlayer.subWindow.wGC ); + +// i=wsHideFrame|wsMaxSize|wsHideWindow; +// if ( appMPlayer.mainDecoration ) i=wsShowFrame|wsMaxSize|wsHideWindow; + i=wsShowFrame|wsMaxSize|wsHideWindow; + wsCreateWindow( &appMPlayer.mainWindow, + appMPlayer.main.x,appMPlayer.main.y,appMPlayer.main.width,appMPlayer.main.height, + wsNoBorder,wsShowMouseCursor|wsHandleMouseButton|wsHandleMouseMove,i,"MPlayer" ); + + wsSetShape( &appMPlayer.mainWindow,appMPlayer.main.Mask.Image ); + wsXDNDMakeAwareness(&appMPlayer.mainWindow); + +#ifdef DEBUG + mp_msg( MSGT_GPLAYER,MSGL_DBG2,"[main] depth on screen: %d\n",wsDepthOnScreen ); + mp_msg( MSGT_GPLAYER,MSGL_DBG2,"[main] parent: 0x%x\n",(int)appMPlayer.mainWindow.WindowID ); + mp_msg( MSGT_GPLAYER,MSGL_DBG2,"[main] sub: 0x%x\n",(int)appMPlayer.subWindow.WindowID ); +#endif + + appMPlayer.mainWindow.ReDraw=(void *)mplMainDraw; + appMPlayer.mainWindow.MouseHandler=mplMainMouseHandle; + appMPlayer.mainWindow.KeyHandler=mplMainKeyHandle; + appMPlayer.mainWindow.DandDHandler=mplDandDHandler; + + appMPlayer.subWindow.ReDraw=(void *)mplSubDraw; + appMPlayer.subWindow.MouseHandler=mplSubMouseHandle; + appMPlayer.subWindow.KeyHandler=mplMainKeyHandle; + appMPlayer.subWindow.DandDHandler=mplDandDHandler; + + wsSetBackgroundRGB( &appMPlayer.subWindow,appMPlayer.sub.R,appMPlayer.sub.G,appMPlayer.sub.B ); + wsClearWindow( appMPlayer.subWindow ); + if ( appMPlayer.sub.Bitmap.Image ) wsConvert( &appMPlayer.subWindow,appMPlayer.sub.Bitmap.Image,appMPlayer.sub.Bitmap.ImageSize ); + + btnModify( evSetVolume,guiIntfStruct.Volume ); + btnModify( evSetBalance,guiIntfStruct.Balance ); + btnModify( evSetMoviePosition,guiIntfStruct.Position ); + + wsSetIcon( wsDisplay,appMPlayer.mainWindow.WindowID,guiIcon,guiIconMask ); + wsSetIcon( wsDisplay,appMPlayer.subWindow.WindowID,guiIcon,guiIconMask ); + + guiIntfStruct.Playing=0; + + if ( !appMPlayer.mainDecoration ) wsWindowDecoration( &appMPlayer.mainWindow,0 ); + + wsVisibleWindow( &appMPlayer.mainWindow,wsShowWindow ); +#if 0 + wsVisibleWindow( &appMPlayer.subWindow,wsShowWindow ); + + { + XEvent xev; + do { XNextEvent( wsDisplay,&xev ); } while ( xev.type != MapNotify || xev.xmap.event != appMPlayer.subWindow.WindowID ); + appMPlayer.subWindow.Mapped=wsMapped; + } + + if ( !fullscreen ) fullscreen=gtkLoadFullscreen; + if ( fullscreen ) + { + mplFullScreen(); + btnModify( evFullScreen,btnPressed ); + } +#else + if ( !fullscreen ) fullscreen=gtkLoadFullscreen; + if ( gtkShowVideoWindow ) + { + wsVisibleWindow( &appMPlayer.subWindow,wsShowWindow ); + { + XEvent xev; + do { XNextEvent( wsDisplay,&xev ); } while ( xev.type != MapNotify || xev.xmap.event != appMPlayer.subWindow.WindowID ); + appMPlayer.subWindow.Mapped=wsMapped; + } + + if ( fullscreen ) + { + mplFullScreen(); + btnModify( evFullScreen,btnPressed ); + } + } + else + { + if ( fullscreen ) + { + wsVisibleWindow( &appMPlayer.subWindow,wsShowWindow ); + { + XEvent xev; + do { XNextEvent( wsDisplay,&xev ); } while ( xev.type != MapNotify || xev.xmap.event != appMPlayer.subWindow.WindowID ); + appMPlayer.subWindow.Mapped=wsMapped; + } + wsVisibleWindow( &appMPlayer.subWindow, wsShowWindow ); + + mplFullScreen(); + btnModify( evFullScreen,btnPressed ); + } + } +#endif + mplSubRender=1; +// --- + + if ( filename ) mplSetFileName( NULL,filename,STREAMTYPE_FILE ); + if ( plCurrent && !filename ) mplSetFileName( plCurrent->path,plCurrent->name,STREAMTYPE_FILE ); + if ( subdata ) guiSetFilename( guiIntfStruct.Subtitlename, subdata->filename ); + guiLoadFont(); +} + +void guiDone( void ) +{ + mplMainRender=0; + mp_msg( MSGT_GPLAYER,MSGL_V,"[GUI] done.\n" ); + + if ( gui_save_pos ) + { + gui_main_pos_x=appMPlayer.mainWindow.X; gui_main_pos_y=appMPlayer.mainWindow.Y; + gui_sub_pos_x=appMPlayer.subWindow.X; gui_sub_pos_y=appMPlayer.subWindow.Y; + } + +#ifdef USE_ASS + ass_enabled = gtkASS.enabled; + ass_use_margins = gtkASS.use_margins; + ass_top_margin = gtkASS.top_margin; + ass_bottom_margin = gtkASS.bottom_margin; +#endif + + cfg_write(); + wsXDone(); +} + +int guiCMDArray[] = + { + evLoadPlay, + evLoadSubtitle, + evAbout, + evPlay, + evStop, + evPlayList, + evPreferences, + evFullScreen, + evSkinBrowser + }; + +extern int frame_dropping; +extern int stream_dump_type; +extern int vcd_track; +extern m_obj_settings_t * vf_settings; + +void guiLoadFont( void ) +{ +#ifdef HAVE_FREETYPE + load_font_ft(vo_image_width, vo_image_height); +#else + if ( vo_font ) + { + int i; + if ( vo_font->name ) free( vo_font->name ); + if ( vo_font->fpath ) free( vo_font->fpath ); + for ( i=0;i<16;i++ ) + if ( vo_font->pic_a[i] ) + { + if ( vo_font->pic_a[i]->bmp ) free( vo_font->pic_a[i]->bmp ); + if ( vo_font->pic_a[i]->pal ) free( vo_font->pic_a[i]->pal ); + } + for ( i=0;i<16;i++ ) + if ( vo_font->pic_b[i] ) + { + if ( vo_font->pic_b[i]->bmp ) free( vo_font->pic_b[i]->bmp ); + if ( vo_font->pic_b[i]->pal ) free( vo_font->pic_b[i]->pal ); + } + free( vo_font ); vo_font=NULL; + } + if ( font_name ) + { + vo_font=read_font_desc( font_name,font_factor,0 ); + if ( !vo_font ) mp_msg( MSGT_CPLAYER,MSGL_ERR,MSGTR_CantLoadFont,font_name ); + } + else + { + font_name=gstrdup( get_path( "font/font.desc" ) ); + vo_font=read_font_desc( font_name,font_factor,0 ); + if ( !vo_font ) + { + gfree( (void **)&font_name ); font_name=gstrdup(MPLAYER_DATADIR "/font/font.desc" ); + vo_font=read_font_desc( font_name,font_factor,0 ); + } + } +#endif +} + +extern mp_osd_obj_t* vo_osd_list; + +extern char **sub_name; + +void guiLoadSubtitle( char * name ) +{ + if ( guiIntfStruct.Playing == 0 ) + { + guiIntfStruct.SubtitleChanged=1; //what is this for? (mw) + return; + } + if ( subdata ) + { + mp_msg( MSGT_GPLAYER,MSGL_INFO,MSGTR_DeletingSubtitles ); + sub_free( subdata ); + subdata=NULL; + vo_sub=NULL; + if ( vo_osd_list ) + { + int len; + mp_osd_obj_t * osd = vo_osd_list; + while ( osd ) + { + if ( osd->type == OSDTYPE_SUBTITLE ) break; + osd=osd->next; + } + if ( osd && osd->flags&OSDFLAG_VISIBLE ) + { + len=osd->stride * ( osd->bbox.y2 - osd->bbox.y1 ); + memset( osd->bitmap_buffer,0,len ); + memset( osd->alpha_buffer,0,len ); + } + } + } + if ( name ) + { + mp_msg( MSGT_GPLAYER,MSGL_INFO,MSGTR_LoadingSubtitles,name ); + subdata=sub_read_file( name, guiIntfStruct.FPS ); + if ( !subdata ) mp_msg( MSGT_GPLAYER,MSGL_ERR,MSGTR_CantLoadSub,name ); + sub_name = (malloc(2 * sizeof(char*))); //when mplayer will be restarted + sub_name[0] = strdup(name); //sub_name[0] will be read + sub_name[1] = NULL; + } + update_set_of_subtitles(); + +} + +static void add_vf( char * str ) +{ + mp_msg( MSGT_GPLAYER,MSGL_STATUS,MSGTR_AddingVideoFilter,str ); + if ( vf_settings ) + { + int i = 0; + while ( vf_settings[i].name ) if ( !gstrcmp( vf_settings[i++].name,str ) ) { i=-1; break; } + if ( i != -1 ) + { vf_settings=realloc( vf_settings,( i + 2 ) * sizeof( m_obj_settings_t ) ); vf_settings[i].name=strdup( str );vf_settings[i].attribs = NULL; vf_settings[i+1].name=NULL; } + } else { vf_settings=malloc( 2 * sizeof( m_obj_settings_t ) ); vf_settings[0].name=strdup( str );vf_settings[0].attribs = NULL; vf_settings[1].name=NULL; } +} + +static void remove_vf( char * str ) +{ + int n = 0; + + if ( !vf_settings ) return; + + mp_msg( MSGT_GPLAYER,MSGL_STATUS,MSGTR_RemovingVideoFilter,str ); + + while ( vf_settings[n++].name ); n--; + if ( n > -1 ) + { + int i = 0,m = -1; + while ( vf_settings[i].name ) if ( !gstrcmp( vf_settings[i++].name,str ) ) { m=i - 1; break; } + i--; + if ( m > -1 ) + { + if ( n == 1 ) { free( vf_settings[0].name );free( vf_settings[0].attribs ); free( vf_settings ); vf_settings=NULL; } + else { free( vf_settings[i].name );free( vf_settings[i].attribs ); memcpy( &vf_settings[i],&vf_settings[i + 1],( n - i ) * sizeof( m_obj_settings_t ) ); } + } + } +} + +int guiGetEvent( int type,char * arg ) +{ + ao_functions_t *audio_out = NULL; + vo_functions_t *video_out = NULL; + mixer_t *mixer = NULL; + + stream_t * stream = (stream_t *) arg; +#ifdef USE_DVDREAD + dvd_priv_t * dvdp = (dvd_priv_t *) arg; +#endif + + if (guiIntfStruct.mpcontext) { + audio_out = mpctx_get_audio_out(guiIntfStruct.mpcontext); + video_out = mpctx_get_video_out(guiIntfStruct.mpcontext); + mixer = mpctx_get_mixer(guiIntfStruct.mpcontext); + } + + switch ( type ) + { + case guiXEvent: + guiIntfStruct.event_struct=(void *)arg; + wsEvents( wsDisplay,(XEvent *)arg,NULL ); + gtkEventHandling(); + break; + case guiCEvent: + switch ( (int)arg ) + { + case guiSetPlay: + guiIntfStruct.Playing=1; +// if ( !gtkShowVideoWindow ) wsVisibleWindow( &appMPlayer.subWindow,wsHideWindow ); + break; + case guiSetStop: + guiIntfStruct.Playing=0; +// if ( !gtkShowVideoWindow ) wsVisibleWindow( &appMPlayer.subWindow,wsHideWindow ); + break; + case guiSetPause: guiIntfStruct.Playing=2; break; + } + mplState(); + break; + case guiSetState: + mplState(); + break; + case guiSetFileName: + if ( arg ) guiSetFilename( guiIntfStruct.Filename,arg ); + break; + case guiSetAudioOnly: + guiIntfStruct.AudioOnly=(int)arg; + if ( (int)arg ) { guiIntfStruct.NoWindow=True; wsVisibleWindow( &appMPlayer.subWindow,wsHideWindow ); } + else wsVisibleWindow( &appMPlayer.subWindow,wsShowWindow ); + break; + case guiSetContext: + guiIntfStruct.mpcontext=(void *)arg; + case guiSetDemuxer: + guiIntfStruct.demuxer=(void *)arg; + break; + case guiSetAfilter: + guiIntfStruct.afilter=(void *)arg; + break; + case guiSetShVideo: + { + if ( !appMPlayer.subWindow.isFullScreen ) + { + wsResizeWindow( &appMPlayer.subWindow,vo_dwidth,vo_dheight ); + wsMoveWindow( &appMPlayer.subWindow,True,appMPlayer.sub.x,appMPlayer.sub.y ); + } + guiIntfStruct.MovieWidth=vo_dwidth; + guiIntfStruct.MovieHeight=vo_dheight; + if (guiWinID>=0) + wsMoveWindow( &appMPlayer.mainWindow,0,0, vo_dheight); + } + break; +#ifdef USE_DVDREAD + case guiSetDVD: + guiIntfStruct.DVD.titles=dvdp->vmg_file->tt_srpt->nr_of_srpts; + guiIntfStruct.DVD.chapters=dvdp->vmg_file->tt_srpt->title[dvd_title].nr_of_ptts; + guiIntfStruct.DVD.angles=dvdp->vmg_file->tt_srpt->title[dvd_title].nr_of_angles; + guiIntfStruct.DVD.nr_of_audio_channels=dvdp->nr_of_channels; + memcpy( guiIntfStruct.DVD.audio_streams,dvdp->audio_streams,sizeof( dvdp->audio_streams ) ); + guiIntfStruct.DVD.nr_of_subtitles=dvdp->nr_of_subtitles; + memcpy( guiIntfStruct.DVD.subtitles,dvdp->subtitles,sizeof( dvdp->subtitles ) ); + guiIntfStruct.DVD.current_title=dvd_title + 1; + guiIntfStruct.DVD.current_chapter=dvd_chapter + 1; + guiIntfStruct.DVD.current_angle=dvd_angle + 1; + guiIntfStruct.Track=dvd_title + 1; + break; +#endif + case guiSetStream: + guiIntfStruct.StreamType=stream->type; + switch( stream->type ) + { +#ifdef USE_DVDREAD + case STREAMTYPE_DVD: + guiGetEvent( guiSetDVD,(char *)stream->priv ); + break; +#endif +#ifdef HAVE_VCD + case STREAMTYPE_VCD: + { + int i; + + if (!stream->priv) + { + guiIntfStruct.VCDTracks=0; + break; + } + for ( i=1;i < 100;i++ ) + if ( vcd_seek_to_track( stream->priv,i ) < 0 ) break; + vcd_seek_to_track( stream->priv,vcd_track ); + guiIntfStruct.VCDTracks=--i; + break; + } +#endif + default: break; + } + break; + case guiIEvent: + mp_msg( MSGT_GPLAYER,MSGL_V,"cmd: %d\n",(int)arg ); + switch( (int)arg ) + { + case MP_CMD_QUIT: + mplEventHandling( evExit,0 ); + break; + case MP_CMD_VO_FULLSCREEN: + mplEventHandling( evFullScreen,0 ); + break; + default: + mplEventHandling( guiCMDArray[ (int)arg - MP_CMD_GUI_EVENTS - 1 ],0 ); + } + break; + case guiReDraw: + mplEventHandling( evRedraw,0 ); + break; + case guiSetVolume: + if ( audio_out ) + { + float l,r; + mixer_get