stats: remove countless hardcoded strings

feels a bit better that way
This commit is contained in:
Julian 2015-07-07 14:03:49 +02:00 committed by wm4
parent 6ed69cb132
commit 3dbd031da0
1 changed files with 32 additions and 29 deletions

View File

@ -78,13 +78,14 @@ end
function add_file(s)
s.file = ""
local sec = "file"
s[sec] = ""
append_property(s, "file", "filename", {prefix="File:", nl="", indent=""})
append_property(s, "file", "metadata/title", {prefix="Title:"})
append_property(s, "file", "chapter", {prefix="Chapter:"})
if append_property(s, "file", "cache-used", {prefix="Cache:"}) then
append_property(s, "file", "demuxer-cache-duration",
append_property(s, sec, "filename", {prefix="File:", nl="", indent=""})
append_property(s, sec, "metadata/title", {prefix="Title:"})
append_property(s, sec, "chapter", {prefix="Chapter:"})
if append_property(s, sec, "cache-used", {prefix="Cache:"}) then
append_property(s, sec, "demuxer-cache-duration",
{prefix="+", suffix=" sec", nl="", indent=o.kv_sep,
prefix_sep="", no_prefix_markup=true})
end
@ -92,49 +93,51 @@ end
function add_video(s)
s.video = ""
local sec = "video"
s[sec] = ""
if not has_video() then
return
end
if append_property(s, "video", "video-codec", {prefix="Video:", nl="", indent=""}) then
append_property(s, "video", "hwdec-active",
if append_property(s, sec, "video-codec", {prefix="Video:", nl="", indent=""}) then
append_property(s, sec, "hwdec-active",
{prefix="(hwdec)", nl="", indent=" ",
no_prefix_markup=true, no_value=true},
{no=true})
end
append_property(s, "video", "avsync", {prefix="A-V:"})
if append_property(s, "video", "drop-frame-count", {prefix="Dropped:"}) then
append_property(s, "video", "vo-drop-frame-count", {prefix="VO:", nl=""})
append_property(s, sec, "avsync", {prefix="A-V:"})
if append_property(s, sec, "drop-frame-count", {prefix="Dropped:"}) then
append_property(s, sec, "vo-drop-frame-count", {prefix="VO:", nl=""})
end
if append_property(s, "video", "fps", {prefix="FPS:", suffix=" (specified)"}) then
append_property(s, "video", "estimated-vf-fps",
if append_property(s, sec, "fps", {prefix="FPS:", suffix=" (specified)"}) then
append_property(s, sec, "estimated-vf-fps",
{suffix=" (estimated)", nl="", indent=o.kv_sep, prefix_sep=""})
end
if append_property(s, "video", "video-params/w", {prefix="Native Resolution:"}) then
append_property(s, "video", "video-params/h",
if append_property(s, sec, "video-params/w", {prefix="Native Resolution:"}) then
append_property(s, sec, "video-params/h",
{prefix="x", nl="", indent=" ", prefix_sep=" ", no_prefix_markup=true})
end
append_property(s, "video", "window-scale", {prefix="Window Scale:"})
append_property(s, "video", "video-params/aspect", {prefix="Aspect Ratio:"})
append_property(s, "video", "video-params/pixelformat", {prefix="Pixel format:"})
append_property(s, "video", "video-params/colormatrix", {prefix="Colormatrix:"})
append_property(s, "video", "video-params/primaries", {prefix="Primaries:"})
append_property(s, "video", "video-params/colorlevels", {prefix="Levels:"})
append_property(s, "video", "packet-video-bitrate", {prefix="Bitrate:", suffix=" kbps"})
append_property(s, sec, "window-scale", {prefix="Window Scale:"})
append_property(s, sec, "video-params/aspect", {prefix="Aspect Ratio:"})
append_property(s, sec, "video-params/pixelformat", {prefix="Pixel format:"})
append_property(s, sec, "video-params/colormatrix", {prefix="Colormatrix:"})
append_property(s, sec, "video-params/primaries", {prefix="Primaries:"})
append_property(s, sec, "video-params/colorlevels", {prefix="Levels:"})
append_property(s, sec, "packet-video-bitrate", {prefix="Bitrate:", suffix=" kbps"})
end
function add_audio(s)
s.audio = ""
local sec = "audio"
s[sec] = ""
if not has_audio() then
return
end
append_property(s, "audio", "audio-codec", {prefix="Audio:", nl="", indent=""})
append_property(s, "audio", "audio-params/samplerate", {prefix="Sample Rate:", suffix=" Hz"})
append_property(s, "audio", "audio-params/channel-count", {prefix="Channels:"})
append_property(s, "audio", "packet-audio-bitrate", {prefix="Bitrate:", suffix=" kbps"})
append_property(s, sec, "audio-codec", {prefix="Audio:", nl="", indent=""})
append_property(s, sec, "audio-params/samplerate", {prefix="Sample Rate:", suffix=" Hz"})
append_property(s, sec, "audio-params/channel-count", {prefix="Channels:"})
append_property(s, sec, "packet-audio-bitrate", {prefix="Bitrate:", suffix=" kbps"})
end
@ -160,7 +163,7 @@ end
-- Returns `false` in case nothing was appended, otherwise `true`.
--
-- s : Table containing key `sec`.
-- sec : Existing key in table `s`, treated as a string.
-- sec : Existing key in table `s`, value treated as a string.
-- property: The property to query and format (based on its OSD representation).
-- attr : Optional table to overwrite certain (formatting) attributes for
-- this property.