mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-23 02:01:12 +00:00
tools: gst-play: don't print 64 whitespaces next to the time indication
Printing 64 whitespaces to erase the "Paused" message (after \r) would make it wrap to the next line on shorter terminals. Instead we only print the amount of spaces needed. Also mark the "Paused" string for translation while we're at it.
This commit is contained in:
parent
199d81088f
commit
0aacd7f393
1 changed files with 10 additions and 5 deletions
|
@ -458,7 +458,8 @@ play_timeout (gpointer user_data)
|
|||
{
|
||||
GstPlay *play = user_data;
|
||||
gint64 pos = -1, dur = -1;
|
||||
gchar status[64] = { 0, };
|
||||
const gchar *paused = _("Paused");
|
||||
gchar *status;
|
||||
|
||||
if (play->buffering)
|
||||
return TRUE;
|
||||
|
@ -466,10 +467,14 @@ play_timeout (gpointer user_data)
|
|||
gst_element_query_position (play->playbin, GST_FORMAT_TIME, &pos);
|
||||
gst_element_query_duration (play->playbin, GST_FORMAT_TIME, &dur);
|
||||
|
||||
if (play->desired_state == GST_STATE_PAUSED)
|
||||
g_snprintf (status, sizeof (status), "Paused");
|
||||
else
|
||||
memset (status, ' ', sizeof (status) - 1);
|
||||
if (play->desired_state == GST_STATE_PAUSED) {
|
||||
status = (gchar *) paused;
|
||||
} else {
|
||||
gint len = g_utf8_strlen (paused, -1);
|
||||
status = g_newa (gchar, len + 1);
|
||||
memset (status, ' ', len);
|
||||
status[len] = '\0';
|
||||
}
|
||||
|
||||
if (pos >= 0 && dur > 0) {
|
||||
gchar dstr[32], pstr[32];
|
||||
|
|
Loading…
Reference in a new issue