[MPlayer-dev-eng] [PATCH] gui/win32: Port X11 GUI changes of r37501

Alexander Strasser eclipse7 at gmx.net
Wed Dec 23 00:53:46 CET 2015


Support dynamic label variable $O (title name or file name).

Commit-r37501-by: Ingo Brückl
---

  I fear guiInfo.Title is never set in win32 GUI, so that
this does not really add new functionality.

  Still it seems better to have this patch in, as currently
the label variable $O is not evaluated at all, IOW practically
we have a loss of functionality, which was the initial reason
why I started looking into this.

 gui/win32/widgetrender.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

--- a/gui/win32/widgetrender.c
+++ b/gui/win32/widgetrender.c
@@ -128,7 +128,8 @@ static void stringreplace(char *dest, const char *what, const char *format, ...
  *
  * @param how 0 (cut file path and extension),
  *            1 (additionally, convert lower case) or
- *            2 (additionally, convert upper case)
+ *            2 (additionally, convert upper case) or
+ *            4 (unaltered title if available, otherwise like 0)
  * @param fname memory location of a buffer to receive the converted Filename
  * @param maxlen size of the @a fname buffer
  *
@@ -144,7 +145,9 @@ static char *TranslateFilename (int how, char *fname, size_t maxlen)
     {
         case STREAMTYPE_FILE:
 
-            if (guiInfo.Filename && *guiInfo.Filename)
+            if ((how == 4) && guiInfo.Title)
+                av_strlcpy(fname, guiInfo.Title, maxlen);
+            else if (guiInfo.Filename && *guiInfo.Filename)
             {
                 p = strrchr(guiInfo.Filename, '\\');
 
@@ -237,6 +240,7 @@ static char *generatetextfromlabel(widget *item)
     stringreplace(text, "$D", "%3.0f", guiInfo.Balance);
     stringreplace(text, "$t", "%.2i", guiInfo.Track);
     stringreplace(text, "$o", "%s", acp(TranslateFilename(0, tmp, sizeof(tmp))));
+    stringreplace(text, "$O", "%s", acp(TranslateFilename(4, tmp, sizeof(tmp))));
     stringreplace(text, "$x", "%i", guiInfo.VideoWidth);
     stringreplace(text, "$y", "%i", guiInfo.VideoHeight);
     stringreplace(text, "$C", "%s", guiInfo.sh_video ? codecname : "");
-- 


More information about the MPlayer-dev-eng mailing list