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
2076 return m_property_read_sub(props, action, arg);2076 return m_property_read_sub(props, action, arg);
2077}2077}
2078 2078
2079static const char *track_type_name(enum stream_type t)2079static const char *track_type_name(struct track *t)
2080{2080{
2081 switch (t) {2081 if (t->image)
2082 return "Image";
2083
2084 switch (t->type) {
2082 case STREAM_VIDEO: return "Video";2085 case STREAM_VIDEO: return "Video";
2083 case STREAM_AUDIO: return "Audio";2086 case STREAM_AUDIO: return "Audio";
2084 case STREAM_SUB: return "Sub";2087 case STREAM_SUB: return "Sub";
@@ -2100,7 +2103,7 @@ static int property_list_tracks(void *ctx, struct m_property *prop, · 15 unmodified lines
2100 continue;2103 continue;
2101 2104
2102 res = talloc_asprintf_append(res, "%s: ",2105 res = talloc_asprintf_append(res, "%s: ",
2103 track_type_name(track->type));2106 track_type_name(track));
2104 res = talloc_strdup_append(res,2107 res = talloc_strdup_append(res,
2105 track->selected ? list_current : list_normal);2108 track->selected ? list_current : list_normal);
2106 res = talloc_asprintf_append(res, "(%d) ", track->user_tid);2109 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
252 const char *langopt = "?";252 const char *langopt = "?";
253 switch (t->type) {253 switch (t->type) {
254 case STREAM_VIDEO:254 case STREAM_VIDEO:
255 tname = "Video"; selopt = "vid"; langopt = "vlang";255 tname = t->image ? "Image" : "Video"; selopt = "vid"; langopt = "vlang";
256 break;256 break;
257 case STREAM_AUDIO:257 case STREAM_AUDIO:
258 tname = "Audio"; selopt = "aid"; langopt = "alang";258 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
87 local tracks = {}87 local tracks = {}
88 88
89 for i, track in ipairs(mp.get_property_native("track-list")) do89 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)) .. ": " ..
91 format_track(track)92 format_track(track)
92 end93 end
93 94
player/lua/stats.lua+4−3
@@ -952,9 +952,10 @@ local function add_video(s) · 951 unmodified lines
952 return952 return
953 end953 end
954 954
955 append(s, "", {prefix="Video:", nl=o.nl .. o.nl, indent=""})
956 local track = mp.get_property_native("current-tracks/video")955 local track = mp.get_property_native("current-tracks/video")
957 if track and append(s, track["codec-desc"], {prefix_sep="", nl="", indent=""}) then956 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=""})
958 append(s, track["codec-profile"], {prefix="[", nl="", indent=" ", prefix_sep="",959 append(s, track["codec-profile"], {prefix="[", nl="", indent=" ", prefix_sep="",
959 no_prefix_markup=true, suffix="]"})960 no_prefix_markup=true, suffix="]"})
960 if track["codec"] ~= track["decoder"] then961 if track["codec"] ~= track["decoder"] then
@@ -1217,7 +1218,7 @@ local function add_track(c, t, i) · 256 unmodified lines
1217 return1218 return
1218 end1219 end
1219 1220
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)
1221 append(c, "", {prefix=type .. ":", nl=o.nl .. o.nl, indent=""})1222 append(c, "", {prefix=type .. ":", nl=o.nl .. o.nl, indent=""})
1222 append(c, t["title"], {prefix_sep="", nl="", indent=""})1223 append(c, t["title"], {prefix_sep="", nl="", indent=""})
1223 append(c, t["id"], {prefix="ID:"})1224 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