0
0
mirror of https://github.com/mpv-player/mpv.git synced 2024-09-19 19:42:24 +02:00

various: print Image instead or Video for image tracks

Fixes #8561.
This commit is contained in:
Guido Cella 2024-06-27 16:32:53 +02:00 committed by Kacper Michajłow
parent 21df853624
commit 2fd88ffbae
4 changed files with 13 additions and 8 deletions

View File

@ -2076,9 +2076,12 @@ static int get_track_entry(int item, int action, void *arg, void *ctx)
return m_property_read_sub(props, action, arg);
}
static const char *track_type_name(enum stream_type t)
static const char *track_type_name(struct track *t)
{
switch (t) {
if (t->image)
return "Image";
switch (t->type) {
case STREAM_VIDEO: return "Video";
case STREAM_AUDIO: return "Audio";
case STREAM_SUB: return "Sub";
@ -2100,7 +2103,7 @@ static int property_list_tracks(void *ctx, struct m_property *prop,
continue;
res = talloc_asprintf_append(res, "%s: ",
track_type_name(track->type));
track_type_name(track));
res = talloc_strdup_append(res,
track->selected ? list_current : list_normal);
res = talloc_asprintf_append(res, "(%d) ", track->user_tid);

View File

@ -252,7 +252,7 @@ static void print_stream(struct MPContext *mpctx, struct track *t, bool indent)
const char *langopt = "?";
switch (t->type) {
case STREAM_VIDEO:
tname = "Video"; selopt = "vid"; langopt = "vlang";
tname = t->image ? "Image" : "Video"; selopt = "vid"; langopt = "vlang";
break;
case STREAM_AUDIO:
tname = "Audio"; selopt = "aid"; langopt = "alang";

View File

@ -87,7 +87,8 @@ mp.add_forced_key_binding(nil, "select-track", function ()
local tracks = {}
for i, track in ipairs(mp.get_property_native("track-list")) do
tracks[i] = track.type:sub(1, 1):upper() .. track.type:sub(2) .. ": " ..
tracks[i] = (track.image and "Image" or
track.type:sub(1, 1):upper() .. track.type:sub(2)) .. ": " ..
format_track(track)
end

View File

@ -952,9 +952,10 @@ local function add_video(s)
return
end
append(s, "", {prefix="Video:", nl=o.nl .. o.nl, indent=""})
local track = mp.get_property_native("current-tracks/video")
if track and append(s, track["codec-desc"], {prefix_sep="", nl="", indent=""}) then
if track then
append(s, "", {prefix=track.image and "Image:" or "Video:", nl=o.nl .. o.nl, indent=""})
append(s, track["codec-desc"], {prefix_sep="", nl="", indent=""})
append(s, track["codec-profile"], {prefix="[", nl="", indent=" ", prefix_sep="",
no_prefix_markup=true, suffix="]"})
if track["codec"] ~= track["decoder"] then
@ -1217,7 +1218,7 @@ local function add_track(c, t, i)
return
end
local type = t["type"]:sub(1,1):upper() .. t["type"]:sub(2)
local type = t.image and "Image" or t["type"]:sub(1, 1):upper() .. t["type"]:sub(2)
append(c, "", {prefix=type .. ":", nl=o.nl .. o.nl, indent=""})
append(c, t["title"], {prefix_sep="", nl="", indent=""})
append(c, t["id"], {prefix="ID:"})