1
mirror of https://github.com/mpv-player/mpv synced 2024-11-18 21:16:10 +01:00

Adds "cheap" subtitle switching for non-DVD playouts (for ex. OGG or MKV).

Patch by Stanislav Maslovski <stanislav POIS maslovski AH gmail POIS com>
Original thread:
Date: Apr 12, 2006 1:50 PM
Subject: [MPlayer-dev-eng] [PATCH] GUI: add cheap subtitle switching for non-DVD


git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@18119 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
gpoirier 2006-04-16 16:58:36 +00:00
parent 1e390288ed
commit 6a425eee5c
5 changed files with 44 additions and 1 deletions

View File

@ -60,7 +60,8 @@
#define evSetAspect 44
#define evSetAudio 45
#define evSetVideo 46
// 47 ...
#define evSetSubtitle 47
// 48 ...
#define evExit 1000

View File

@ -377,6 +377,8 @@ char * GetLanguage( int language )
return NULL;
}
extern int global_sub_size;
GtkWidget * DVDSubMenu;
GtkWidget * DVDTitleMenu;
GtkWidget * DVDChapterMenu;
@ -569,6 +571,20 @@ GtkWidget * create_PopUpMenu( void )
}
}
}
/* cheap subtitle switching for non-DVD streams */
if ( global_sub_size && guiIntfStruct.StreamType != STREAMTYPE_DVD )
{
int i;
SubMenu=AddSubMenu( window1, (const char*)empty_xpm, Menu, MSGTR_MENU_Subtitles );
AddMenuItem( window1, (const char*)empty_xpm, SubMenu, MSGTR_MENU_None, (-1 << 16) + evSetSubtitle );
for ( i=0;i < global_sub_size;i++ )
{
char tmp[32];
snprintf( tmp, 32, MSGTR_MENU_Track, i );
AddMenuItem( window1,(const char*)empty_xpm,SubMenu,tmp,( i << 16 ) + evSetSubtitle );
}
}
AddSeparator( Menu );
MenuItem=AddMenuCheckItem( window1, (const char*)sound_xpm, Menu,MSGTR_MENU_Mute,mixer.muted,evMute );

View File

@ -32,6 +32,12 @@
#include "widgets.h"
extern mixer_t mixer; // mixer from mplayer.c
extern int global_sub_size;
extern int global_sub_pos;
extern int global_sub_indices[];
extern int sub_source(void);
#define SUB_SOURCE_VOBSUB 1
#define SUB_SOURCE_DEMUX 2
extern unsigned int GetTimerMS( void );
@ -110,6 +116,24 @@ void mplEventHandling( int msg,float param )
video_id=iparam;
goto play;
case evSetSubtitle:
if ( !guiIntfStruct.demuxer || global_sub_pos == iparam ) break;
global_sub_pos = iparam;
if ( global_sub_pos >= 0 )
switch ( sub_source() )
{
case SUB_SOURCE_VOBSUB:
vobsub_id = global_sub_pos - global_sub_indices[SUB_SOURCE_VOBSUB];
goto play;
case SUB_SOURCE_DEMUX:
vobsub_id = -1;
dvdsub_id = global_sub_pos - global_sub_indices[SUB_SOURCE_DEMUX];
goto play;
}
vobsub_id = -1;
dvdsub_id = -2;
goto play;
#ifdef HAVE_VCD
case evSetVCDTrack:
guiIntfStruct.Track=iparam;

View File

@ -788,6 +788,7 @@ static char help_text[]=
#define MSGTR_MENU_AudioTrack "Audio track"
#define MSGTR_MENU_Track "Track %d"
#define MSGTR_MENU_VideoTrack "Video track"
#define MSGTR_MENU_Subtitles "Subtitles"
// --- equalizer
// Note: If you change MSGTR_EQU_Audio please see if it still fits MSGTR_PREFERENCES_Audio

View File

@ -684,6 +684,7 @@ static char help_text[]=
#define MSGTR_MENU_AudioTrack "áÕÄÉÏ ÄÏÒÏÖËÁ"
#define MSGTR_MENU_Track "ÄÏÒÏÖËÁ %d"
#define MSGTR_MENU_VideoTrack "÷ÉÄÅÏ ÄÏÒÏÖËÁ"
#define MSGTR_MENU_Subtitles "óÕÂÔÉÔÒÙ"
// --- equalizer
#define MSGTR_EQU_Audio "áÕÄÉÏ"