History

various: print Image instead or Video for image tracks

Fixes #8561.

Guido Cella committed 2 years ago

Commit 2fd88ff1 parent 21df8534 files · +13 −8Browse files

Unified · Split

4 files
  1. player/command.c +6 −3
  2. player/loadfile.c +1 −1
  3. player/lua/select.lua +2 −1
  4. player/lua/stats.lua +4 −3
player/command.c+6−3
@@ -2076,9 +2076,12 @@ static int get_track_entry(int item, int action, void *arg, void *ctx) · 2075 unmodified lines
20762076 return m_property_read_sub(props, action, arg);
20772077 }
20782078
2079−static const char *track_type_name(enum stream_type t)
2079+static const char *track_type_name(struct track *t)
20802080 {
2081− switch (t) {
2081+ if (t->image)
2082+ return "Image";
2083+
2084+ switch (t->type) {
20822085 case STREAM_VIDEO: return "Video";
20832086 case STREAM_AUDIO: return "Audio";
20842087 case STREAM_SUB: return "Sub";
@@ -2100,7 +2103,7 @@ static int property_list_tracks(void *ctx, struct m_property *prop, · 15 unmodified lines
21002103 continue;
21012104
21022105 res = talloc_asprintf_append(res, "%s: ",
2103− track_type_name(track->type));
2106+ track_type_name(track));
21042107 res = talloc_strdup_append(res,
21052108 track->selected ? list_current : list_normal);
21062109 res = talloc_asprintf_append(res, "(%d) ", track->user_tid);
player/loadfile.c+1−1
@@ -252,7 +252,7 @@ static void print_stream(struct MPContext *mpctx, struct track *t, bool indent) · 251 unmodified lines
252252 const char *langopt = "?";
253253 switch (t->type) {
254254 case STREAM_VIDEO:
255− tname = "Video"; selopt = "vid"; langopt = "vlang";
255+ tname = t->image ? "Image" : "Video"; selopt = "vid"; langopt = "vlang";
256256 break;
257257 case STREAM_AUDIO:
258258 tname = "Audio"; selopt = "aid"; langopt = "alang";
player/lua/select.lua+2−1
@@ -87,7 +87,8 @@ mp.add_forced_key_binding(nil, "select-track", function () · 86 unmodified lines
8787 local tracks = {}
8888
8989 for i, track in ipairs(mp.get_property_native("track-list")) do
90− tracks[i] = track.type:sub(1, 1):upper() .. track.type:sub(2) .. ": " ..
90+ tracks[i] = (track.image and "Image" or
91+ track.type:sub(1, 1):upper() .. track.type:sub(2)) .. ": " ..
9192 format_track(track)
9293 end
9394
player/lua/stats.lua+4−3
@@ -952,9 +952,10 @@ local function add_video(s) · 951 unmodified lines
952952 return
953953 end
954954
955− append(s, "", {prefix="Video:", nl=o.nl .. o.nl, indent=""})
956955 local track = mp.get_property_native("current-tracks/video")
957− if track and append(s, track["codec-desc"], {prefix_sep="", nl="", indent=""}) then
956+ if track then
957+ append(s, "", {prefix=track.image and "Image:" or "Video:", nl=o.nl .. o.nl, indent=""})
958+ append(s, track["codec-desc"], {prefix_sep="", nl="", indent=""})
958959 append(s, track["codec-profile"], {prefix="[", nl="", indent=" ", prefix_sep="",
959960 no_prefix_markup=true, suffix="]"})
960961 if track["codec"] ~= track["decoder"] then
@@ -1217,7 +1218,7 @@ local function add_track(c, t, i) · 256 unmodified lines
12171218 return
12181219 end
12191220
1220− local type = t["type"]:sub(1,1):upper() .. t["type"]:sub(2)
1221+ local type = t.image and "Image" or t["type"]:sub(1, 1):upper() .. t["type"]:sub(2)
12211222 append(c, "", {prefix=type .. ":", nl=o.nl .. o.nl, indent=""})
12221223 append(c, t["title"], {prefix_sep="", nl="", indent=""})
12231224 append(c, t["id"], {prefix="ID:"})

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t