From dean@arctic.org Tue Mar 29 19:54:13 2005 Date: Tue, 29 Mar 2005 19:54:13 -0800 (PST) From: dean gaudet To: Christian Marillat Subject: mplayer tty update suppress patch hi there... i wasn't sure if there is an mplayer bug tracker so i figured i'd mail you directly. below is a patch to 1.0-pre6-0.4 which suppress status updates on stdout unless the update is different from the previous status line. the problem is that mplayer spews a lot of redundant output to stdout -- and if mplayer is running over a network shell, or inside screen(1) this can cause all sorts of trouble. screen(1) has various blocking behaviours which cause it to not service ttys for periods of several seconds... lame... but at any rate, when mplayer is inside a screen it can fill up its tty and block, disturbing playback. (if you want to test it try screen's visual bell crud... or cause screen to issue a bell message in another window other than the current one -- then it'll block for seconds.) thanks -dean --- mplayer-1.0-pre6/mplayer.c.orig 2004-12-25 02:57:58.000000000 -0800 +++ mplayer-1.0-pre6/mplayer.c 2005-03-29 19:29:44.823426516 -0800 @@ -829,6 +829,7 @@ static void print_status(float a_pos, fl { int width; char *line; + static char *last_line = NULL; unsigned pos = 0; get_screen_size(); if (screen_width > 0) @@ -911,8 +912,14 @@ static void print_status(float a_pos, fl // end memset(&line[pos], ' ', width - pos); line[width] = 0; - mp_msg(MSGT_AVSYNC, MSGL_STATUS, "%s\r", line); - free(line); + if (last_line == NULL || strcmp(last_line, line)) { + mp_msg(MSGT_AVSYNC, MSGL_STATUS, "%s\r", line); + if (last_line) free(last_line); + last_line = line; + } + else { + free(line); + } } /**