]> git.sesse.net Git - vlc/blobdiff - modules/gui/ncurses.c
macosx: move the resizing code to VLCVideoWindowCommon as its related to vout
[vlc] / modules / gui / ncurses.c
index 2c0ceb2022af6682c98899edc194aa915d19592a..f266415c38ef4ed575b05d171db9bc161f6e2c2d 100644 (file)
@@ -38,9 +38,8 @@
 
 #include <assert.h>
 #include <wchar.h>
-#ifdef HAVE_SYS_STAT_H
-#   include <sys/stat.h>
-#endif
+#include <sys/stat.h>
+#include <math.h>
 
 #include <vlc_common.h>
 #include <vlc_plugin.h>
@@ -192,7 +191,7 @@ struct intf_sys_t
     int             box_start;        // first line of box displayed
     int             box_idx;          // selected line
 
-    msg_subscription_t  *sub;         // message bank subscription
+    msg_subscription_t sub;         // message bank subscription
     struct
     {
         int              type;
@@ -1070,7 +1069,7 @@ static int DrawStatus(intf_thread_t *intf)
             };
             char buf1[MSTRTIME_MAX_SIZE];
             char buf2[MSTRTIME_MAX_SIZE];
-            unsigned i_volume;
+            float volume;
 
         case INIT_S:
         case END_S:
@@ -1091,9 +1090,13 @@ static int DrawStatus(intf_thread_t *intf)
 
             mvnprintw(y++, 0, COLS, _(" Position : %s/%s"), buf1, buf2);
 
-            i_volume = aout_VolumeGet(p_playlist);
-            mvnprintw(y++, 0, COLS, _(" Volume   : %u%%"),
-                      i_volume*100/AOUT_VOLUME_DEFAULT);
+            volume = aout_VolumeGet(p_playlist);
+            if (volume >= 0.f)
+                mvnprintw(y++, 0, COLS, _(" Volume   : %3ld%%"),
+                          lroundf(volume * 100.f));
+            else
+                mvnprintw(y++, 0, COLS, _(" Volume   : ----"),
+                          lroundf(volume * 100.f));
 
             if (!var_Get(p_input, "title", &val)) {
                 int i_title_count = var_CountChoices(p_input, "title");
@@ -1406,8 +1409,7 @@ static bool HandleBrowseKey(intf_thread_t *intf, int key)
             return true;
         }
 
-        char *uri = make_URI(path, dir_entry->file ? "file"
-                                                             : "directory");
+        char *uri = vlc_path2uri(path, "file");
         free(path);
         if (uri == NULL)
             return true;
@@ -1444,7 +1446,7 @@ static bool HandleBrowseKey(intf_thread_t *intf, int key)
 static void OpenSelection(intf_thread_t *intf)
 {
     intf_sys_t *sys = intf->p_sys;
-    char *uri = make_URI(sys->open_chain, NULL);
+    char *uri = vlc_path2uri(sys->open_chain, NULL);
     if (uri == NULL)
         return;
 
@@ -1791,7 +1793,7 @@ static int Open(vlc_object_t *p_this)
     vlc_mutex_init(&sys->pl_lock);
 
     sys->verbosity = var_InheritInteger(intf, "verbose");
-    sys->sub = vlc_Subscribe(MsgCallback, sys);
+    vlc_Subscribe(&sys->sub, MsgCallback, sys);
 
     sys->box_type = BOX_PLAYLIST;
     sys->plidx_follow = true;
@@ -1844,7 +1846,7 @@ static void Close(vlc_object_t *p_this)
 
     endwin();   /* Close the ncurses interface */
 
-    vlc_Unsubscribe(sys->sub);
+    vlc_Unsubscribe(&sys->sub);
     vlc_mutex_destroy(&sys->msg_lock);
     vlc_mutex_destroy(&sys->pl_lock);
     for(unsigned i = 0; i < sizeof sys->msgs / sizeof *sys->msgs; i++) {