LSP: in preview > meta information, show if a video track has b frames

This commit is contained in:
Cat 2019-06-27 16:26:38 +02:00
parent 8a68738995
commit 6f06acfb00
2 changed files with 8 additions and 7 deletions

View file

@ -142,11 +142,11 @@ style:{flexShrink:1},children:[{"if":function(){return this.playerName&&this.sou
classes:["mistvideo-devbuttons"],style:{"flex-wrap":"wrap"},children:[{"if":function(){return!(!this.player||!this.player.api)},then:{type:"button",title:"Reload the video source",label:"Reload video",onclick:function(){this.player.api.load()}}},{type:"button",title:"Build MistVideo again",label:"Reload player",onclick:function(){this.reload()}},{type:"button",title:"Switch to the next available player and source combination",label:"Try next combination",onclick:function(){this.nextCombo()}}]},{type:"forcePlayer"}, classes:["mistvideo-devbuttons"],style:{"flex-wrap":"wrap"},children:[{"if":function(){return!(!this.player||!this.player.api)},then:{type:"button",title:"Reload the video source",label:"Reload video",onclick:function(){this.player.api.load()}}},{type:"button",title:"Build MistVideo again",label:"Reload player",onclick:function(){this.reload()}},{type:"button",title:"Switch to the next available player and source combination",label:"Try next combination",onclick:function(){this.nextCombo()}}]},{type:"forcePlayer"},
{type:"forceType"},{type:"forceSource"}]},{type:"log"}]}))};if(!(a!="Preview"||!c||c==""||g!=c)){N[0].addEventListener("initialized",f);N[0].addEventListener("initializeFailed",f);MistVideoObject.reference=mistPlay(g,{target:N[0],host:K,skin:"dev",loop:true,MistVideoObject:MistVideoObject})}d[0].removeChild(b)};MistVideoObject.reference={unload:function(){b.onload=function(){this.parentElement&&this.parentElement.removeChild(this)}}}};qa();o=$("<div>").append($("<h3>").text("Meta information"));var S= {type:"forceType"},{type:"forceSource"}]},{type:"log"}]}))};if(!(a!="Preview"||!c||c==""||g!=c)){N[0].addEventListener("initialized",f);N[0].addEventListener("initializeFailed",f);MistVideoObject.reference=mistPlay(g,{target:N[0],host:K,skin:"dev",loop:true,MistVideoObject:MistVideoObject})}d[0].removeChild(b)};MistVideoObject.reference={unload:function(){b.onload=function(){this.parentElement&&this.parentElement.removeChild(this)}}}};qa();o=$("<div>").append($("<h3>").text("Meta information"));var S=
$("<span>").text("Loading..");o.append(S);J.append(o);""!=C&&$.ajax({type:"GET",url:K+"json_"+C+".js",success:function(a){var b=function(a,b){return"maxbps"in a?UI.format.bytes(a[b],1):b=="maxbps"?UI.format.bytes(a.bps,1):"unknown"},c=a.meta;if(!c||!c.tracks)S.html("No meta information available.");else{a=[];a.push({label:"Type",type:"span",value:c.live?"Live":"Pre-recorded (VoD)"});"format"in c&&a.push({label:"Format",type:"span",value:c.format});c.live&&a.push({label:"Buffer window",type:"span", $("<span>").text("Loading..");o.append(S);J.append(o);""!=C&&$.ajax({type:"GET",url:K+"json_"+C+".js",success:function(a){var b=function(a,b){return"maxbps"in a?UI.format.bytes(a[b],1):b=="maxbps"?UI.format.bytes(a.bps,1):"unknown"},c=a.meta;if(!c||!c.tracks)S.html("No meta information available.");else{a=[];a.push({label:"Type",type:"span",value:c.live?"Live":"Pre-recorded (VoD)"});"format"in c&&a.push({label:"Format",type:"span",value:c.format});c.live&&a.push({label:"Buffer window",type:"span",
value:UI.format.addUnit(c.buffer_window,"ms")});var d={audio:{vheader:"Audio",labels:["Codec","Duration","Avg bitrate","Peak bitrate","Channels","Samplerate","Language","Track index"],content:[]},video:{vheader:"Video",labels:["Codec","Duration","Avg bitrate","Peak bitrate","Size","Framerate","Language","Track index"],content:[]},subtitle:{vheader:"Subtitles",labels:["Codec","Duration","Avg bitrate","Peak bitrate","Language","Track index"],content:[]}},g=Object.keys(c.tracks);g.sort(function(a,b){a= value:UI.format.addUnit(c.buffer_window,"ms")});var d={audio:{vheader:"Audio",labels:["Codec","Duration","Avg bitrate","Peak bitrate","Channels","Samplerate","Language","Track index"],content:[]},video:{vheader:"Video",labels:["Codec","Duration","Avg bitrate","Peak bitrate","Size","Framerate","Language","Track index","Has B-Frames"],content:[]},subtitle:{vheader:"Subtitles",labels:["Codec","Duration","Avg bitrate","Peak bitrate","Language","Track index"],content:[]}},g=Object.keys(c.tracks);g.sort(function(a,
a.split("_").pop();b=b.split("_").pop();return a-b});var f=1,e=1,i=1,h;for(h in g){var k=g[h],j=c.tracks[k];switch(j.type){case "audio":d.audio.content.push({header:"Track "+k.split("_").pop(),body:[j.codec,UI.format.duration((j.lastms-j.firstms)/1E3)+"<br><span class=description>"+UI.format.duration(j.firstms/1E3)+" to "+UI.format.duration(j.lastms/1E3)+"</span>",b(j,"bps"),b(j,"maxbps"),j.channels,UI.format.addUnit(UI.format.number(j.rate),"Hz"),"language"in j?j.language:"unknown",f]});f++;break; b){a=a.split("_").pop();b=b.split("_").pop();return a-b});var f=1,e=1,i=1,h;for(h in g){var k=g[h],j=c.tracks[k];switch(j.type){case "audio":d.audio.content.push({header:"Track "+k.split("_").pop(),body:[j.codec,UI.format.duration((j.lastms-j.firstms)/1E3)+"<br><span class=description>"+UI.format.duration(j.firstms/1E3)+" to "+UI.format.duration(j.lastms/1E3)+"</span>",b(j,"bps"),b(j,"maxbps"),j.channels,UI.format.addUnit(UI.format.number(j.rate),"Hz"),"language"in j?j.language:"unknown",f]});f++;
case "video":d.video.content.push({header:"Track "+k.split("_").pop(),body:[j.codec,UI.format.duration((j.lastms-j.firstms)/1E3)+"<br><span class=description>"+UI.format.duration(j.firstms/1E3)+" to "+UI.format.duration(j.lastms/1E3)+"</span>",b(j,"bps"),b(j,"maxbps"),UI.format.addUnit(j.width,"x ")+UI.format.addUnit(j.height,"px"),UI.format.addUnit(UI.format.number(j.fpks/1E3),"fps"),"language"in j?j.language:"unknown",e]});e++;break;case "meta":case "subtitle":if(j.codec=="subtitle"||j.type=="subtitle"){d.subtitle.content.push({header:"Track "+ break;case "video":d.video.content.push({header:"Track "+k.split("_").pop(),body:[j.codec,UI.format.duration((j.lastms-j.firstms)/1E3)+"<br><span class=description>"+UI.format.duration(j.firstms/1E3)+" to "+UI.format.duration(j.lastms/1E3)+"</span>",b(j,"bps"),b(j,"maxbps"),UI.format.addUnit(j.width,"x ")+UI.format.addUnit(j.height,"px"),UI.format.addUnit(UI.format.number(j.fpks/1E3),"fps"),"language"in j?j.language:"unknown",e,"bframes"in j?"yes":"no"]});e++;break;case "meta":case "subtitle":if(j.codec==
k.split("_").pop(),body:[j.codec,UI.format.duration((j.lastms-j.firstms)/1E3)+"<br><span class=description>"+UI.format.duration(j.firstms/1E3)+" to "+UI.format.duration(j.lastms/1E3)+"</span>",b(j,"bps"),b(j,"maxbps"),"language"in j?j.language:"unknown",i]});i++}}}b=["audio","video","subtitle"];h=$("<div>").css({display:"flex","flex-flow":"row wrap","font-size":"0.9em"});for(k in b)d[b[k]].content.length&&h.append(UI.buildVheaderTable(d[b[k]]).css("width","auto"));a.push($("<span>").text("Tracks:")); "subtitle"||j.type=="subtitle"){d.subtitle.content.push({header:"Track "+k.split("_").pop(),body:[j.codec,UI.format.duration((j.lastms-j.firstms)/1E3)+"<br><span class=description>"+UI.format.duration(j.firstms/1E3)+" to "+UI.format.duration(j.lastms/1E3)+"</span>",b(j,"bps"),b(j,"maxbps"),"language"in j?j.language:"unknown",i]});i++}}}b=["audio","video","subtitle"];h=$("<div>").css({display:"flex","flex-flow":"row wrap","font-size":"0.9em"});for(k in b)d[b[k]].content.length&&h.append(UI.buildVheaderTable(d[b[k]]).css("width",
a.push(h);S.html(UI.buildUI(a))}},error:function(){S.html("Error while retrieving stream info.")}});break;case "Embed":""==c&&UI.navTo("Streams");j="";-1==c.indexOf("+")&&(j=$("<button>").addClass("settings").text("Settings").click(function(){UI.navto("Edit",c)}));d.html($("<div>").addClass("bigbuttons").append(j).append($("<button>").text("Preview").addClass("preview").click(function(){UI.navto("Preview",c)})).append($("<button>").addClass("cancel").addClass("return").text("Return").click(function(){UI.navto("Streams")}))).append($("<h2>").text('Embed "'+ "auto"));a.push($("<span>").text("Tracks:"));a.push(h);S.html(UI.buildUI(a))}},error:function(){S.html("Error while retrieving stream info.")}});break;case "Embed":""==c&&UI.navTo("Streams");j="";-1==c.indexOf("+")&&(j=$("<button>").addClass("settings").text("Settings").click(function(){UI.navto("Edit",c)}));d.html($("<div>").addClass("bigbuttons").append(j).append($("<button>").text("Preview").addClass("preview").click(function(){UI.navto("Preview",c)})).append($("<button>").addClass("cancel").addClass("return").text("Return").click(function(){UI.navto("Streams")}))).append($("<h2>").text('Embed "'+
c+'"'));var O=$("<span>");d.append(O);C=encodeURIComponent(c);j=parseURL(mist.user.host);b={"":{port:":8080"}};for(o in mist.data.config.protocols){t=mist.data.config.protocols[o];if("HTTP"==t.connector||"HTTP.exe"==t.connector)b[""].port=t.port?":"+t.port:":8080";if("HTTPS"==t.connector||"HTTPS.exe"==t.connector)b.s={},b.s.port=t.port?":"+t.port:":4433"}var H=K="http://"+j.host+b[""].port+"/";if(otherhost.host||otherhost.https)H=(otherhost.https&&"s"in b?"https://":"http://")+(otherhost.host?otherhost.host: c+'"'));var O=$("<span>");d.append(O);C=encodeURIComponent(c);j=parseURL(mist.user.host);b={"":{port:":8080"}};for(o in mist.data.config.protocols){t=mist.data.config.protocols[o];if("HTTP"==t.connector||"HTTP.exe"==t.connector)b[""].port=t.port?":"+t.port:":8080";if("HTTPS"==t.connector||"HTTPS.exe"==t.connector)b.s={},b.s.port=t.port?":"+t.port:":4433"}var H=K="http://"+j.host+b[""].port+"/";if(otherhost.host||otherhost.https)H=(otherhost.https&&"s"in b?"https://":"http://")+(otherhost.host?otherhost.host:
j.host)+(otherhost.https&&"s"in b?b.s.port:b[""].port)+"/";var P=!1,aa={forcePlayer:"",forceType:"",controls:!0,autoplay:!0,loop:!1,muted:!1,fillSpace:!1,poster:"",urlappend:"",setTracks:{}},q=$.extend({},aa);o=UI.stored.getOpts();"embedoptions"in o&&(q=$.extend(q,o.embedoptions,!0),"object"!=typeof q.setTracks&&(q.setTracks={}));o={};switch(q.controls){case "stock":o.controls="stock";break;case !0:o.controls=1;break;case !1:o.controls=0}var x=function(){function a(b){switch(typeof b){case "string":return $.isNumeric(b)? j.host)+(otherhost.https&&"s"in b?b.s.port:b[""].port)+"/";var P=!1,aa={forcePlayer:"",forceType:"",controls:!0,autoplay:!0,loop:!1,muted:!1,fillSpace:!1,poster:"",urlappend:"",setTracks:{}},q=$.extend({},aa);o=UI.stored.getOpts();"embedoptions"in o&&(q=$.extend(q,o.embedoptions,!0),"object"!=typeof q.setTracks&&(q.setTracks={}));o={};switch(q.controls){case "stock":o.controls="stock";break;case !0:o.controls=1;break;case !1:o.controls=0}var x=function(){function a(b){switch(typeof b){case "string":return $.isNumeric(b)?
b:'"'+b+'"';case "object":return JSON.stringify(b);default:return b}}P&&UI.stored.saveOpt("embedoptions",q);for(var b=c+"_",d=12,g="";d--;){var f;f=Math.floor(Math.random()*62);f=f<10?f:f<36?String.fromCharCode(f+55):String.fromCharCode(f+61);g=g+f}var b=b+g,d=['target: document.getElementById("'+b+'")'],e;for(e in q)e=="prioritize_type"?q[e]&&q[e]!=""&&d.push("forcePriority: "+JSON.stringify({source:[["type",[q[e]]]]})):e=="monitor_action"?q[e]&&q[e]!=""&&q[e]=="nextCombo"&&d.push('monitor: {\n action: function(){\n this.MistVideo.log("Switching to nextCombo because of poor playback in "+this.MistVideo.source.type+" ("+Math.round(this.vars.score*1000)/10+"%)");\n this.MistVideo.nextCombo();\n }\n }'): b:'"'+b+'"';case "object":return JSON.stringify(b);default:return b}}P&&UI.stored.saveOpt("embedoptions",q);for(var b=c+"_",d=12,g="";d--;){var f;f=Math.floor(Math.random()*62);f=f<10?f:f<36?String.fromCharCode(f+55):String.fromCharCode(f+61);g=g+f}var b=b+g,d=['target: document.getElementById("'+b+'")'],e;for(e in q)e=="prioritize_type"?q[e]&&q[e]!=""&&d.push("forcePriority: "+JSON.stringify({source:[["type",[q[e]]]]})):e=="monitor_action"?q[e]&&q[e]!=""&&q[e]=="nextCombo"&&d.push('monitor: {\n action: function(){\n this.MistVideo.log("Switching to nextCombo because of poor playback in "+this.MistVideo.source.type+" ("+Math.round(this.vars.score*1000)/10+"%)");\n this.MistVideo.nextCombo();\n }\n }'):

View file

@ -4205,7 +4205,7 @@ var UI = {
}, },
video: { video: {
vheader: 'Video', vheader: 'Video',
labels: ['Codec','Duration','Avg bitrate','Peak bitrate','Size','Framerate','Language','Track index'], labels: ['Codec','Duration','Avg bitrate','Peak bitrate','Size','Framerate','Language','Track index','Has B-Frames'],
content: [] content: []
}, },
subtitle: { subtitle: {
@ -4263,7 +4263,8 @@ var UI = {
UI.format.addUnit(track.width,'x ')+UI.format.addUnit(track.height,'px'), UI.format.addUnit(track.width,'x ')+UI.format.addUnit(track.height,'px'),
UI.format.addUnit(UI.format.number(track.fpks/1000),'fps'), UI.format.addUnit(UI.format.number(track.fpks/1000),'fps'),
('language' in track ? track.language : 'unknown'), ('language' in track ? track.language : 'unknown'),
(trackindex.video) (trackindex.video),
("bframes" in track ? "yes" : "no")
] ]
}); });
trackindex.video++ trackindex.video++