0
0
mirror of https://github.com/mpv-player/mpv.git synced 2024-09-20 12:02:23 +02:00

add VCD support for GUI

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@6281 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
pontscho 2002-06-03 15:06:32 +00:00
parent 8d36b5de78
commit af8bd4f394
25 changed files with 177 additions and 29 deletions

View File

@ -43,7 +43,8 @@ evName evNames[] =
{ evSetBalance, "evSetBalance" },
{ evHelp, "evHelp" },
{ evLoadSubtitle, "evLoadSubtitle" },
{ evPlayDVD, "evPlayDVD" }
{ evPlayDVD, "evPlayDVD" },
{ evPlayVCD, "evPlayVCD" }
};
int evBoxs = sizeof( evNames ) / sizeof( evName );

View File

@ -48,6 +48,7 @@
#define evLoadSubtitle 38
#define evPlayDVD 39
#define evPlayVCD 40
#define evExit 1000
@ -65,6 +66,7 @@
#define evSetDVDTitle 5009
#define evSetDVDChapter 5010
#define evSubtitleLoaded 5011
#define evSetVCDTrack 5012
#define evFName 7000
#define evMovieTime 7001

View File

@ -1,4 +1,4 @@
#include <inttypes.h>
#include <stdlib.h>
#include <stdio.h>
@ -16,6 +16,9 @@
#include "../libvo/video_out.h"
#include "../input/input.h"
#include <inttypes.h>
#include <sys/types.h>
#include "../libmpdemux/stream.h"
#include "../libmpdemux/demuxer.h"
@ -64,6 +67,7 @@ typedef struct
void guiGetEvent( int type,char * arg )
{
stream_t * stream = (stream_t *) arg;
#ifdef USE_DVDREAD
dvd_priv_t * dvdp = (dvd_priv_t *) arg;
#endif
@ -122,6 +126,28 @@ void guiGetEvent( int type,char * arg )
guiIntfStruct.Track=dvd_title + 1;
break;
#endif
case guiSetStream:
guiIntfStruct.StreamType=stream->type;
switch( stream->type )
{
case STREAMTYPE_DVD:
guiGetEvent( guiSetDVD,(char *)stream->priv );
break;
#ifdef HAVE_VCD
case STREAMTYPE_VCD:
{
int i;
for ( i=1;i < 100;i++ )
if ( vcd_seek_to_track( stream->fd,i ) < 0 ) break;
vcd_seek_to_track( stream->fd,vcd_track );
guiIntfStruct.VCDTracks=--i;
mp_msg( MSGT_GPLAYER,MSGL_INFO,"[interface] vcd tracks: %d\n",guiIntfStruct.VCDTracks );
guiIntfStruct.Track=vcd_track;
break;
}
#endif
}
break;
#ifdef HAVE_NEW_INPUT
case guiIEvent:
printf( "cmd: %d\n",(int)arg );
@ -138,6 +164,14 @@ void guiGetEvent( int type,char * arg )
}
break;
#endif
case guiClearStruct:
#ifdef USE_DVDREAD
if ( (unsigned int)arg & guiDVD ) memset( &guiIntfStruct.DVD,0,sizeof( guiDVDStruct ) );
#endif
#ifdef HAVE_VCD
if ( (unsigned int)arg & guiVCD ) guiIntfStruct.VCDTracks=0;
#endif
break;
}
}

View File

@ -56,9 +56,15 @@ typedef struct
guiResizeStruct resize;
guiVideoStruct videodata;
guiUnknowErrorStruct error;
int DiskChanged;
#ifdef USE_DVDREAD
guiDVDStruct DVD;
int DVDChanged;
#endif
#ifdef HAVE_VCD
int VCDTracks;
#endif
int Playing;
@ -103,11 +109,17 @@ extern guiInterface_t guiIntfStruct;
#define guiSetAudioOnly 6
#define guiReDrawSubWindow 7
#define guiSetShVideo 8
#define guiSetStream 9
#define guiClearStruct 10
#define guiSetStop 0
#define guiSetPlay 1
#define guiSetPause 2
#define guiDVD 1
#define guiVCD 2
#define guiALL 0xffffffff
extern char *get_path(char *filename);
extern void guiInit( void );

View File

@ -254,6 +254,9 @@ GtkWidget * DVDChapterMenu;
GtkWidget * DVDAudioLanguageMenu;
GtkWidget * DVDSubtitleLanguageMenu;
GtkWidget * VCDSubMenu;
GtkWidget * VCDTitleMenu;
GtkWidget * create_PopUpMenu( void )
{
GtkWidget * Menu = NULL;
@ -266,7 +269,9 @@ GtkWidget * create_PopUpMenu( void )
AddSeparator( Menu );
SubMenu=AddSubMenu( Menu,MSGTR_MENU_Open );
AddMenuItem( SubMenu,MSGTR_MENU_PlayFile" ", evLoadPlay );
AddMenuItem( SubMenu,MSGTR_MENU_PlayVCD, evNone );
#ifdef HAVE_VCD
AddMenuItem( SubMenu,MSGTR_MENU_PlayVCD, evPlayVCD );
#endif
#ifdef USE_DVDREAD
AddMenuItem( SubMenu,MSGTR_MENU_PlayDVD, evPlayDVD );
#endif
@ -287,6 +292,26 @@ GtkWidget * create_PopUpMenu( void )
AddMenuItem( SubMenu,MSGTR_MENU_NormalSize" ", evNormalSize );
AddMenuItem( SubMenu,MSGTR_MENU_DoubleSize, evDoubleSize );
AddMenuItem( SubMenu,MSGTR_MENU_FullScreen, evFullScreen );
#ifdef HAVE_VCD
VCDSubMenu=AddSubMenu( Menu,MSGTR_MENU_VCD );
AddMenuItem( VCDSubMenu,MSGTR_MENU_PlayDisc,evPlayVCD );
AddSeparator( VCDSubMenu );
VCDTitleMenu=AddSubMenu( VCDSubMenu,MSGTR_MENU_Titles );
if ( guiIntfStruct.VCDTracks )
{
char tmp[32]; int i;
for ( i=0;i < guiIntfStruct.VCDTracks;i++ )
{
sprintf( tmp,MSGTR_MENU_Title,i+1 );
AddMenuItem( VCDTitleMenu,tmp,( (i+1) << 16 ) + evSetVCDTrack );
}
}
else
{
MenuItem=AddMenuItem( VCDTitleMenu,MSGTR_MENU_None,evNone );
gtk_widget_set_sensitive( MenuItem,FALSE );
}
#endif
#ifdef USE_DVDREAD
DVDSubMenu=AddSubMenu( Menu,MSGTR_MENU_DVD );
AddMenuItem( DVDSubMenu,MSGTR_MENU_PlayDisc" ", evPlayDVD );

View File

@ -71,8 +71,9 @@ void mplInit( void * disp )
vo_setwindow( appMPlayer.subWindow.WindowID, appMPlayer.subWindow.wGC );
i=wsHideFrame|wsMaxSize|wsHideWindow;
if ( appMPlayer.mainDecoration ) i=wsShowFrame|wsMaxSize|wsHideWindow;
// 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" ); //wsMinSize|
@ -114,6 +115,8 @@ void mplInit( void * disp )
guiIntfStruct.Playing=0;
if ( !appMPlayer.mainDecoration ) wsWindowDecoration( &appMPlayer.mainWindow,0 );
wsVisibleWindow( &appMPlayer.mainWindow,wsShowWindow );
wsVisibleWindow( &appMPlayer.subWindow,wsShowWindow );
}

View File

@ -34,6 +34,11 @@ inline void TranslateFilename( int c,char * tmp )
if ( guiIntfStruct.DVD.current_chapter ) sprintf( tmp,"chapter %d",guiIntfStruct.DVD.current_chapter );
else strcat( tmp,"no chapter" );
break;
#endif
#ifdef HAVE_VCD
case STREAMTYPE_VCD:
sprintf( tmp,"VCD track %d",guiIntfStruct.Track );
break;
#endif
default: strcpy( tmp,"no media opened" );
}
@ -102,7 +107,9 @@ calclengthmmmmss:
switch ( guiIntfStruct.StreamType )
{
case STREAMTYPE_FILE: strcat( trbuf,"f" ); break;
#ifdef HAVE_VCD
case STREAMTYPE_VCD: strcat( trbuf,"v" ); break;
#endif
case STREAMTYPE_STREAM: strcat( trbuf,"u" ); break;
#ifdef USE_DVDREAD
case STREAMTYPE_DVD: strcat( trbuf,"d" ); break;
@ -200,6 +207,8 @@ extern void exit_player(char* how);
extern int audio_id;
extern int dvdsub_id;
extern char * dvd_device;
extern int vcd_track;
extern char * cdrom_device;
void mplEventHandling( int msg,float param )
{
@ -212,6 +221,13 @@ void mplEventHandling( int msg,float param )
exit_player( "Exit" );
break;
#ifdef HAVE_VCD
case evSetVCDTrack:
guiIntfStruct.Track=(int)param;
case evPlayVCD:
guiIntfStruct.StreamType=STREAMTYPE_VCD;
goto play;
#endif
#ifdef USE_DVDREAD
case evPlayDVD:
guiIntfStruct.DVD.current_title=1;
@ -222,18 +238,41 @@ play_dvd_2:
#endif
case evPlay:
case evPlaySwitchToPause:
play:
mplMainAutoPlay=0;
if ( ( msg == evPlaySwitchToPause )&&( guiIntfStruct.Playing == 1 ) ) goto NoPause;
vcd_track=0;
dvd_title=0;
switch ( guiIntfStruct.StreamType )
{
case STREAMTYPE_STREAM:
case STREAMTYPE_FILE:
guiGetEvent( guiClearStruct,guiALL );
break;
#ifdef HAVE_VCD
case STREAMTYPE_VCD:
case STREAMTYPE_FILE:
dvd_title=0;
break;
guiGetEvent( guiClearStruct,guiALL - guiVCD );
if ( !cdrom_device )
{
cdrom_device=DEFAULT_CDROM_DEVICE;
guiSetFilename( guiIntfStruct.Filename,cdrom_device );
}
if ( guiIntfStruct.Playing != 2 )
{
if ( !guiIntfStruct.Track )
{
if ( guiIntfStruct.VCDTracks == 1 ) guiIntfStruct.Track=1;
else guiIntfStruct.Track=2;
}
vcd_track=guiIntfStruct.Track;
guiIntfStruct.DiskChanged=1;
}
break;
#endif
#ifdef USE_DVDREAD
case STREAMTYPE_DVD:
guiGetEvent( guiClearStruct,guiALL - guiDVD );
if ( !dvd_device )
{
dvd_device=DEFAULT_DVD_DEVICE;
@ -244,7 +283,7 @@ play_dvd_2:
dvd_title=guiIntfStruct.DVD.current_title;
dvd_angle=guiIntfStruct.DVD.current_angle;
dvd_chapter=guiIntfStruct.DVD.current_chapter;
guiIntfStruct.DVDChanged=1;
guiIntfStruct.DiskChanged=1;
}
break;
#endif
@ -287,6 +326,7 @@ NoPause:
case evLoadPlay:
mplMainAutoPlay=1;
// guiIntfStruct.StreamType=STREAMTYPE_FILE;
case evLoad:
mplMainRender=1;
gtkShow( evLoad,NULL );

View File

@ -230,31 +230,38 @@ void mplSetFileName( char * fname )
void mplPrev( void )
{
int stop = 0;
if ( guiIntfStruct.Playing == 2 ) return;
switch ( guiIntfStruct.StreamType )
{
// case STREAMTYPE_FILE:
#ifdef USE_DVDREAD
case STREAMTYPE_DVD:
if ( guiIntfStruct.Playing == 2 ) break;
if ( --guiIntfStruct.DVD.current_chapter == 0 )
{
guiIntfStruct.DVD.current_chapter=1;
if ( --guiIntfStruct.DVD.current_title <= 0 ) { guiIntfStruct.DVD.current_title=1; stop=1; }
}
guiIntfStruct.Track=guiIntfStruct.DVD.current_title;
if ( stop ) mplEventHandling( evStop,0 );
if ( guiIntfStruct.Playing == 1 ) mplEventHandling( evPlay,0 );
break;
#endif
#ifdef HAVE_VCD
case STREAMTYPE_VCD:
if ( --guiIntfStruct.Track == 0 ) { guiIntfStruct.Track=1; stop=1; }
break;
#endif
default: return;
}
if ( stop ) mplEventHandling( evStop,0 );
if ( guiIntfStruct.Playing == 1 ) mplEventHandling( evPlay,0 );
}
void mplNext( void )
{
int stop = 0;
if ( guiIntfStruct.Playing == 2 ) return;
switch ( guiIntfStruct.StreamType )
{
// case STREAMTYPE_FILE:
#ifdef USE_DVDREAD
case STREAMTYPE_DVD:
if ( guiIntfStruct.DVD.current_chapter++ == guiIntfStruct.DVD.chapters )
@ -263,9 +270,15 @@ void mplNext( void )
if ( ++guiIntfStruct.DVD.current_title > guiIntfStruct.DVD.titles ) { guiIntfStruct.DVD.current_title=guiIntfStruct.DVD.titles; stop=1; }
}
guiIntfStruct.Track=guiIntfStruct.DVD.current_title;
if ( stop ) mplEventHandling( evStop,0 );
if ( guiIntfStruct.Playing == 1 ) mplEventHandling( evPlay,0 );
break;
#endif
#ifdef HAVE_VCD
case STREAMTYPE_VCD:
if ( ++guiIntfStruct.Track > guiIntfStruct.VCDTracks ) { guiIntfStruct.Track=guiIntfStruct.VCDTracks; stop=1; }
break;
#endif
default: return;
}
if ( stop ) mplEventHandling( evStop,0 );
if ( guiIntfStruct.Playing == 1 ) mplEventHandling( evPlay,0 );
}

View File

@ -292,6 +292,7 @@ static char help_text[]=
#define MSGTR_MENU_DoubleSize "Dvojnásobná velikost"
#define MSGTR_MENU_FullScreen "Celá obrazovka"
#define MSGTR_MENU_DVD "DVD"
#define MSGTR_MENU_VCD "VCD"
#define MSGTR_MENU_PlayDisc "Pøehrát disk ..."
#define MSGTR_MENU_ShowDVDMenu "Zobrazit DVD menu"
#define MSGTR_MENU_Titles "Tituly"

View File

@ -293,6 +293,7 @@ static char help_text[]=
#define MSGTR_MENU_DoubleSize "Doppelte Größe"
#define MSGTR_MENU_FullScreen "Vollbild"
#define MSGTR_MENU_DVD "DVD"
#define MSGTR_MENU_VCD "VCD"
#define MSGTR_MENU_PlayDisc "Spiele Disk ..."
#define MSGTR_MENU_ShowDVDMenu "Zeige DVD Menü"
#define MSGTR_MENU_Titles "Titel"

View File

@ -290,6 +290,7 @@ static char help_text[]=
#define MSGTR_MENU_DoubleSize "Double størrelse"
#define MSGTR_MENU_FullScreen "Fuld skærm"
#define MSGTR_MENU_DVD "DVD"
#define MSGTR_MENU_VCD "VCD"
#define MSGTR_MENU_PlayDisc "Afspiller disk ..."
#define MSGTR_MENU_ShowDVDMenu "Vis DVD menu"
#define MSGTR_MENU_Titles "Titler"

View File

@ -294,6 +294,7 @@ static char help_text[]=
#define MSGTR_MENU_DoubleSize "Double size"
#define MSGTR_MENU_FullScreen "Fullscreen"
#define MSGTR_MENU_DVD "DVD"
#define MSGTR_MENU_VCD "VCD"
#define MSGTR_MENU_PlayDisc "Play disc ..."
#define MSGTR_MENU_ShowDVDMenu "Show DVD menu"
#define MSGTR_MENU_Titles "Titles"

View File

@ -293,6 +293,7 @@ static char help_text[]=
#define MSGTR_MENU_DoubleSize "Tamaño doble"
#define MSGTR_MENU_FullScreen "Fullscreen"
#define MSGTR_MENU_DVD "DVD"
#define MSGTR_MENU_VCD "VCD"
#define MSGTR_MENU_PlayDisc "Reproducir disco ..."
#define MSGTR_MENU_ShowDVDMenu "Mostrar menú DVD"
#define MSGTR_MENU_Titles "Títulos"

View File

@ -292,6 +292,7 @@ static char help_text[]=
#define MSGTR_MENU_DoubleSize "Taille double"
#define MSGTR_MENU_FullScreen "Plein écran"
#define MSGTR_MENU_DVD "DVD"
#define MSGTR_MENU_VCD "VCD"
#define MSGTR_MENU_PlayDisc "Lire un disque..."
#define MSGTR_MENU_ShowDVDMenu "Afficher le menu DVD"
#define MSGTR_MENU_Titles "Titres"

View File

@ -288,6 +288,7 @@ static char help_text[]=
#define MSGTR_MENU_DoubleSize "Dupla méret"
#define MSGTR_MENU_FullScreen "Teljesképernyõ"
#define MSGTR_MENU_DVD "DVD"
#define MSGTR_MENU_VCD "VCD"
#define MSGTR_MENU_PlayDisc "Lemez lejátszása ..."
#define MSGTR_MENU_ShowDVDMenu "DVD menû"
#define MSGTR_MENU_Titles "Sávok"

View File

@ -293,6 +293,7 @@ static char help_text[]=
#define MSGTR_MENU_DoubleSize "Dimensione doppia"
#define MSGTR_MENU_FullScreen "Schermo intero"
#define MSGTR_MENU_DVD "DVD"
#define MSGTR_MENU_VCD "VCD"
#define MSGTR_MENU_PlayDisc "Disco in riproduzione..."
#define MSGTR_MENU_ShowDVDMenu "Mostra il menu del DVD"
#define MSGTR_MENU_Titles "Titoli"

View File

@ -293,6 +293,7 @@ static char help_text[]=
#define MSGTR_MENU_DoubleSize "두배 크기"
#define MSGTR_MENU_FullScreen "전체 화면"
#define MSGTR_MENU_DVD "DVD"
#define MSGTR_MENU_VCD "VCD"
#define MSGTR_MENU_PlayDisc "디스크 재생 ..."
#define MSGTR_MENU_ShowDVDMenu "DVD 메뉴보기"
#define MSGTR_MENU_Titles "타이틀"

View File

@ -290,6 +290,7 @@ static char help_text[]=
#define MSGTR_MENU_DoubleSize "Dubbele grootte"
#define MSGTR_MENU_FullScreen "Volledig scherm"
#define MSGTR_MENU_DVD "DVD"
#define MSGTR_MENU_VCD "VCD"
#define MSGTR_MENU_PlayDisc "Speel disc ..."
#define MSGTR_MENU_ShowDVDMenu "Toon DVD menu"
#define MSGTR_MENU_Titles "Titels"

View File

@ -293,6 +293,7 @@ static char help_text[]=
#define MSGTR_MENU_DoubleSize "Dobbel størrelse"
#define MSGTR_MENU_FullScreen "Fullskjerm"
#define MSGTR_MENU_DVD "DVD"
#define MSGTR_MENU_VCD "VCD"
#define MSGTR_MENU_PlayDisc "Spill Plate ..."
#define MSGTR_MENU_ShowDVDMenu "Vis DVD meny"
#define MSGTR_MENU_Titles "Titler"

View File

@ -292,6 +292,7 @@ static char help_text[]=
#define MSGTR_MENU_DoubleSize "Podwójna wielko¶æ"
#define MSGTR_MENU_FullScreen "Pe³en Ekran"
#define MSGTR_MENU_DVD "DVD"
#define MSGTR_MENU_VCD "VCD"
#define MSGTR_MENU_PlayDisc "Odtwarzaj dysk ..."
#define MSGTR_MENU_ShowDVDMenu "Poka¿ menu DVD"
#define MSGTR_MENU_Titles "Tytu³y"

View File

@ -298,6 +298,7 @@ static char help_text[]=
#define MSGTR_MENU_DoubleSize "Tamanho dobrado"
#define MSGTR_MENU_FullScreen "Tela cheia"
#define MSGTR_MENU_DVD "DVD"
#define MSGTR_MENU_VCD "VCD"
#define MSGTR_MENU_PlayDisc "Reproduzir disco ..."
#define MSGTR_MENU_ShowDVDMenu "Mostrar menu do DVD"
#define MSGTR_MENU_Titles "Títulos"

View File

@ -290,6 +290,7 @@ static char help_text[]=
#define MSGTR_MENU_DoubleSize "ä×ÏÊÎÏÊ ÒÁÚÍÅÒ"
#define MSGTR_MENU_FullScreen "ðÏÌÎÙÊ ÜËÒÁÎ"
#define MSGTR_MENU_DVD "DVD"
#define MSGTR_MENU_VCD "VCD"
#define MSGTR_MENU_PlayDisc "éÇÒÁÔØ ÄÉÓË ..."
#define MSGTR_MENU_ShowDVDMenu "ðÏËÁÚÁÔØ DVD ÍÅÎÀ"
#define MSGTR_MENU_Titles "ôÉÔÒÙ"

View File

@ -290,6 +290,7 @@ static char help_text[]=
#define MSGTR_MENU_DoubleSize "Dvojnásobná veµkos»"
#define MSGTR_MENU_FullScreen "Celá obrazovka"
#define MSGTR_MENU_DVD "DVD"
#define MSGTR_MENU_VCD "VCD"
#define MSGTR_MENU_PlayDisc "Prehra» disk ..."
#define MSGTR_MENU_ShowDVDMenu "Zobrazi» DVD menu"
#define MSGTR_MENU_Titles "Tituly"

View File

@ -206,7 +206,7 @@ int vobsub_id=-1;
char* audio_lang=NULL;
char* dvdsub_lang=NULL;
static char* spudec_ifo=NULL;
static int vcd_track=0;
int vcd_track=0;
// cache2:
static int stream_cache_size=0;
@ -813,12 +813,17 @@ if(!use_stdin && !slave_mode){
#endif
}
#ifdef USE_DVDREAD
if ( guiIntfStruct.DVDChanged )
#if defined( HAVE_VCD ) && defined( USE_DVDREAD )
if ( guiIntfStruct.DiskChanged )
{
guiIntfStruct.DVDChanged=0;
#ifdef USE_DVDREAD
switch ( guiIntfStruct.StreamType )
{
case STREAMTYPE_DVD: filename=DEFAULT_DVD_DEVICE; break;
}
#endif
guiIntfStruct.DiskChanged=0;
guiGetEvent( guiCEvent,(char *)guiSetPlay );
filename=DEFAULT_DVD_DEVICE;
}
#endif
@ -1383,12 +1388,9 @@ fflush(stdout);
if ( use_gui )
{
guiGetEvent( guiSetFileName,filename );
guiIntfStruct.StreamType=stream->type;
guiGetEvent( guiSetStream,(char *)stream );
if ( sh_audio ) guiIntfStruct.AudioType=sh_audio->channels; else guiIntfStruct.AudioType=0;
if ( !sh_video && sh_audio ) guiGetEvent( guiSetAudioOnly,1 ); else guiGetEvent( guiSetAudioOnly,0 );
#ifdef USE_DVDREAD
if ( stream->type == STREAMTYPE_DVD ) guiGetEvent( guiSetDVD,(char *)stream->priv );
#endif
}
#endif
@ -2881,8 +2883,8 @@ if(rel_seek_secs || abs_seek_pos){
#endif
}
guiIntfStruct.Volume=(float)mixer_getbothvolume();
if ( guiIntfStruct.DiskChanged ) goto goto_next_file;
#ifdef USE_DVDREAD
if ( guiIntfStruct.DVDChanged ) goto goto_next_file;
if ( stream->type == STREAMTYPE_DVD )
{
dvd_priv_t * dvdp = stream->priv;
@ -3061,7 +3063,7 @@ while(playtree_iter != NULL) {
if( use_gui && !playtree_iter )
{
#ifdef USE_DVDREAD
if ( !guiIntfStruct.DVDChanged )
if ( !guiIntfStruct.DiskChanged )
#endif
mplStop();
}

View File

@ -5,6 +5,7 @@
extern int use_gui;
extern char* current_module;
extern int fullscreen;
extern int vcd_track;
extern void exit_player(char* how);