subtitles - visible versus language switch; inconsistency with audio

91 views
Skip to first unread message

Hans

unread,
May 22, 2013, 12:18:45 PM5/22/13
to gnome-mplayer
Hi Kevin & all-

In gnome-mplayer, if I press the # key it rotates from the current
language track to the next, then to "no audio playing", and back to
the first audio track. I like that behavior a lot. It is good
usability - users do not have to remember a separate mute key.

For subtitles, the j key rotates between available subtitle tracks,
while the v key switches subtitles off and on.

I would like to change the subtitle behavior to be like audio: when j
rotates between subtitle tracks, add a "no subtitles" mode at position
0. Then we could retire the v key. (Or not, I don't care, but I could
cheerfully forget it)

Do you think this idea has merit?

Cheers

Hans

Brandon Snider

unread,
May 22, 2013, 2:44:04 PM5/22/13
to gnome-...@googlegroups.com
I agree. You have two keys doing the same thing. But this is an Mplayer shortcut, not Gnome-Mplayer. I think you should try to get this changed in Mplayer.

Hans Ecke

unread,
May 22, 2013, 2:58:07 PM5/22/13
to gnome-...@googlegroups.com
Looks to me like this is handled inside gnome-mplayer: see src/gui.c
around lines 2491 and 2374.
> --
> You received this message because you are subscribed to the Google Groups "gnome-mplayer" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to gnome-mplaye...@googlegroups.com.
> To post to this group, send email to gnome-...@googlegroups.com.
> Visit this group at http://groups.google.com/group/gnome-mplayer?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
> ᅵ
> ᅵ
>
>

--
Hans Ecke Department of Physics
he...@mines.edu Colorado School of Mines
(USA) 303-273-3850 Golden, Colorado

Drawing on my fine command of language, I said nothing. -- Mark Twain

Kevin DeKorte

unread,
May 24, 2013, 9:52:47 AM5/24/13
to gnome-...@googlegroups.com
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 05/22/2013 12:58 PM, Hans Ecke wrote:
> Looks to me like this is handled inside gnome-mplayer: see
> src/gui.c around lines 2491 and 2374.

Hans,

In gmtk we are handling the J key using the mplayer slave interface
sub_select


sub_select [value]
Display subtitle with index [value]. Turn subtitle display off if
[value] is -1 or greater than the highest available subtitle index.
Cycle through the available subtitles if [value] is omitted or less
than -1 (forward or backward respectively).
Supported subtitle sources are -sub options on the command
line, VOBsubs, DVD subtitles, and Ogg and Matroska text streams.
This command is mainly for cycling all subtitles, if you want to set
a specific subtitle, use sub_file, sub_vob, or sub_demux.



We are passing no value to it, so it cycles thru the existing set of
subtitles.

switch_audio is the command we use for changing audio tracks

switch_audio [value] (currently MPEG*, AVI, Matroska and streams
handled by libavformat)
Switch to the audio track with the ID [value]. Cycle through the
available tracks if [value] is omitted or negative.

So we are not really doing anything with the tracks. We do know the
tracks in gmtk

player->subtitles
player->audio_tracks

And you can traverse the list with something like this

iter = player->audio_tracks;
while (iter) {
track = (GmtkMediaPlayerAudioTrack *) iter->data;
if (track->id == player->audio_track_id)
value = track->label;
iter = iter->next;
}
break;

iter = player->subtitles;
while (iter) {
subtitle = (GmtkMediaPlayerSubtitle *) iter->data;
if (subtitle->id == player->subtitle_id &&
subtitle->is_file == player->subtitle_is_file)
value = subtitle->label;
iter = iter->next;
}
break;


So if you want to enhance GMTK and use some custom code instead of
sub_select and switch_audio... go for it.

Kevin
- --
Get my public GnuPG key from
http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x7D0BD5D1
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.13 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iEYEARECAAYFAlGfcK8ACgkQ6w2kMH0L1dE9DwCgjXJCodIB2HIGY8bURkAYw6y+
lMgAn2TG3LQjVOHGEACw3yM6T4ntrtaP
=TbQR
-----END PGP SIGNATURE-----

Hans Ecke

unread,
May 24, 2013, 11:55:15 AM5/24/13
to gnome-...@googlegroups.com
Hi Kevin,

Sounds good, I will look into it. Thank you for the hints.

Hans

Hans

unread,
Jun 4, 2013, 6:46:03 PM6/4/13
to gnome-...@googlegroups.com
It seems this has been fixed in newer mplayer. Could somebody with mplayer 1.0 or newer verify that it correctly cycles through all subtitles and "off"?

I was in the middle of doing it inside gmtk actually... There is a small amount of code that I used to keep track of what is going on. It might still be interesting. Kevin, should I post it here, or would you like me to commit it and you can then revert if you disagree?

Kevin DeKorte

unread,
Jun 5, 2013, 10:20:07 AM6/5/13
to gnome-...@googlegroups.com
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hans,

If you could post to the list I think it might be interesting.
Sometimes it is better to handle things like this in gmtk as we know
exactly what it is going to do rather than expecting what it should
do. Kinda what you are running into now with mplayer.

That said, mplayer 1.0 has been out for some time now. Any reason you
have not upgraded to it?

Kevin


- --
Get my public GnuPG key from
http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x7D0BD5D1
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.13 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iEYEARECAAYFAlGvSRcACgkQ6w2kMH0L1dFOGgCfRAAUP1ck4g11Iq5cdlmERkx9
qNUAoJZ3kiZGHDxVeOG/tL/A2pUngl4o
=Tj0I
-----END PGP SIGNATURE-----

Hans Ecke

unread,
Jun 5, 2013, 11:04:29 AM6/5/13
to gnome-...@googlegroups.com
> That said, mplayer 1.0 has been out for some time now. Any reason you
> have not upgraded to it?

That is the difference between my home media center setup (older but
stable) and my work and development computer which is newer. We noticed
the problem at home, so I started development at my development
computer. Only later did I notice that *there* it works as it should.

So far I've only done minor work - some gm_log() calls to better track
what is happening and extracting both of the calls

write_to_mplayer(player, "sub_select\n")

into a dediciated function gmtk_media_player_cycle_subtitles(). Then I
could do all necessary logic inside that function. And of course I
tracked all usages of the "subtitles" member field and how you query it.

Hans

Hans Ecke

unread,
Jun 5, 2013, 6:45:21 PM6/5/13
to gnome-...@googlegroups.com
Okay, below is how my source looks like currently:

* extract both calls to sub_select into one function, with a lot of docs
on top

* mark replies from mplayer with a "<" in front of the debug msg

* change write_to_mplayer() to output a matching ">" in front of the
command string

* print ANS replies from mplayer in loglevel DEBUG

Hans

Index: gmtk_media_player.c
===================================================================
--- gmtk_media_player.c (revision 221)
+++ gmtk_media_player.c (working copy)
@@ -624,6 +624,40 @@
return player_key_press_event_callback(GTK_WIDGET(widget), event,
data);
}

+/*
+ sub_select [value]
+ Display subtitle with index [value]. Turn subtitle display off if
+ [value] is -1 or greater than the highest available subtitle index.
+ Cycle through the available subtitles if [value] is omitted or less
+ than -1 (forward or backward respectively).
+ Supported subtitle sources are -sub options on the command
+ line, VOBsubs, DVD subtitles, and Ogg and Matroska text streams.
+ This command is mainly for cycling all subtitles, if you want to
set
+ a specific subtitle, use sub_file, sub_vob, or sub_demux.
+
+ GmtkMediaPlayerSubtitle
+
+ count: (gdouble) g_list_length(player->subtitles)
+
+ iter = player->subtitles;
+ while (iter) {
+ subtitle = (GmtkMediaPlayerSubtitle *) iter->data;
+ if (subtitle->id == player->subtitle_id && subtitle->is_file ==
player->subtitle_is_file)
+ value = subtitle->label;
+ iter = iter->next;
+ }
+
+ sub_visibility [0|1]
+
+ properties: sub
+ get_property <property>
+ set_property <property> <value>
+
+*/
+static void gmtk_media_player_cycle_subtitles(GmtkMediaPlayer * player)
{
+ write_to_mplayer(player, "sub_select\n");
+}
+
static gboolean player_key_press_event_callback(GtkWidget * widget,
GdkEventKey * event, gpointer data)
{
GmtkMediaPlayer *player;
@@ -742,7 +776,7 @@
gmtk_media_player_size_allocate(GTK_WIDGET(player),
&alloc);
break;
case GDK_j:
- write_to_mplayer(player, "sub_select\n");
+ gmtk_media_player_cycle_subtitles(player);
break;
case GDK_d:
write_to_mplayer(player, "frame_drop\n");
@@ -1111,7 +1145,7 @@
break;

case COMMAND_SUBTITLE_SELECT:
- write_to_mplayer(player, "sub_select\n");
+ gmtk_media_player_cycle_subtitles(player);
break;

case COMMAND_SUBTITLE_STEP_FORWARD:
@@ -3030,7 +3064,7 @@
return TRUE;
} else {
if (g_strrstr(mplayer_output->str, "ANS") == NULL) {
- gm_logsp(player->debug, G_LOG_LEVEL_INFO, "ERROR:",
mplayer_output->str);
+ gm_logsp(player->debug, G_LOG_LEVEL_INFO, "< ERROR:",
mplayer_output->str);
}

if (strstr(mplayer_output->str, "Couldn't open DVD device") !=
0) {
@@ -3242,7 +3276,9 @@
return TRUE;
} else {
if (g_strrstr(mplayer_output->str, "ANS") == NULL) {
- gm_logs(player->debug, G_LOG_LEVEL_INFO,
mplayer_output->str);
+ gm_logsp(player->debug, G_LOG_LEVEL_INFO, "<",
mplayer_output->str);
+ } else {
+ gm_logsp(player->debug, G_LOG_LEVEL_DEBUG, "<",
mplayer_output->str);
}

if (strstr(mplayer_output->str, "Cache fill") != 0) {
@@ -3975,7 +4011,7 @@
gchar *pkf_cmd;

/* ending \n is part of cmd */
- gm_logsp(player->debug, G_LOG_LEVEL_DEBUG, "write to mplayer =",
cmd);
+ gm_logsp(player->debug, G_LOG_LEVEL_DEBUG, ">", cmd);

if (player->channel_in) {
if (player->use_mplayer2) {

Kevin DeKorte

unread,
Jun 6, 2013, 9:27:01 AM6/6/13
to gnome-...@googlegroups.com
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 06/05/2013 04:45 PM, Hans Ecke wrote:
> Okay, below is how my source looks like currently:
>
> * extract both calls to sub_select into one function, with a lot of
> docs on top
>
> * mark replies from mplayer with a "<" in front of the debug msg
>
> * change write_to_mplayer() to output a matching ">" in front of
> the command string
>
> * print ANS replies from mplayer in loglevel DEBUG
>
> Hans


Ok, one little anomaly from mplayer that is going to make things
difficult.

The subtitle ids are not unique at runtime. There is one set of ids
for extracted subs and one set of ids for file subs. So when you
iterate thru them you have to know if you are looking for a file one
or an extracted one otherwise you can potentially pick the wrong subtitle.

So keeping track of the current one than then moving to the next one
can be difficult. especially at load time, because the id list is
being created.

Kevin


- --
Get my public GnuPG key from
http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x7D0BD5D1
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.13 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iEYEARECAAYFAlGwjiUACgkQ6w2kMH0L1dGtxACbBQQ2jMhOZOLowTzWelgK2nYi
LzEAn0Y2ByeZtFWPquy6n0Nagbd0kKd5
=vqz/
-----END PGP SIGNATURE-----

Hans Ecke

unread,
Jun 6, 2013, 11:11:05 AM6/6/13
to gnome-...@googlegroups.com
Yeah, I was wondering how this would work while we dynamically add and
remove external subtitle tracks. I'm personally content to just leave
this be since newer mplayer seems to behave sensibly.

I'd appreciate if somebody could check that "j" does indeed cycle
correctly through all the tracks and through "off".

Kevin, I'd like to know if I can apply some of the little debuging
tweaks etc I posted. They are not terribly important of course...

Reply all
Reply to author
Forward
0 new messages