H.265 Stream Type over HTTP
+ many bug fixes and tweaks for client side stream creator function + allow coProcessor only in specific situationsmerge-requests/63/head
parent
9166d7e8a9
commit
653ac052af
|
|
@ -1603,7 +1603,7 @@ s.createStreamChannel = function(e,number,channel){
|
|||
//stream - custom flags
|
||||
if(channel.cust_stream&&channel.cust_stream!==''){x.cust_stream=' '+channel.cust_stream}else{x.cust_stream=''}
|
||||
//stream - preset
|
||||
if(channel.preset_stream&&channel.preset_stream!==''){x.preset_stream=' -preset '+channel.preset_stream;}else{x.preset_stream=''}
|
||||
if(channel.stream_type !== 'h265' && channel.preset_stream && channel.preset_stream!==''){x.preset_stream=' -preset '+channel.preset_stream;}else{x.preset_stream=''}
|
||||
//hardware acceleration
|
||||
if(e.details.accelerator&&e.details.accelerator==='1'){
|
||||
if(e.details.hwaccel&&e.details.hwaccel!==''){
|
||||
|
|
@ -1927,7 +1927,8 @@ s.ffmpeg = function(e){
|
|||
e.details.hwaccel !== 'vaapi' &&
|
||||
e.details.hwaccel_vcodec !== 'auto' &&
|
||||
e.isStreamer === false &&
|
||||
(!e.details.input_maps || e.details.input_maps.length === 0)
|
||||
(!e.details.input_maps || e.details.input_maps.length === 0) &&
|
||||
(e.details.snap === '1' || e.details.stream_type === 'mjpeg' || e.details.stream_type === 'b64' || e.details.detector === '1')
|
||||
){
|
||||
e.coProcessor = true
|
||||
}
|
||||
|
|
@ -2111,7 +2112,7 @@ s.ffmpeg = function(e){
|
|||
//stream - custom flags
|
||||
if(e.details.cust_stream&&e.details.cust_stream!==''){x.cust_stream=' '+e.details.cust_stream}else{x.cust_stream=''}
|
||||
//stream - preset
|
||||
if(e.details.preset_stream&&e.details.preset_stream!==''){x.preset_stream=' -preset '+e.details.preset_stream;}else{x.preset_stream=''}
|
||||
if(e.details.stream_type !== 'h265' && e.details.preset_stream && e.details.preset_stream !== ''){x.preset_stream=' -preset '+e.details.preset_stream;}else{x.preset_stream=''}
|
||||
//stream - quality
|
||||
//hardware acceleration
|
||||
if(e.details.accelerator && e.details.accelerator==='1' && e.isStreamer === false){
|
||||
|
|
@ -2221,6 +2222,7 @@ s.ffmpeg = function(e){
|
|||
}
|
||||
if(e.details.stream_channels){
|
||||
e.details.stream_channels.forEach(function(v,n){
|
||||
if(v.stream_type === 'mjpeg')e.coProcessor = true;
|
||||
x.pipe += s.createStreamChannel(e,n+config.pipeAddition,v)
|
||||
})
|
||||
}
|
||||
|
|
|
|||
11456
web/libs/js/libde265.js
11456
web/libs/js/libde265.js
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -773,8 +773,10 @@ switch($user.details.lang){
|
|||
ctx.drawImage(img, 0, 0,c.width,c.height);
|
||||
extend(atob(c.toDataURL('image/jpeg').split(',')[1]),c.width,c.height)
|
||||
break;
|
||||
case'pam':
|
||||
alert('Need to add')
|
||||
case'h265':
|
||||
var c = $('[mid='+e.mon.mid+'].monitor_item canvas')[0];
|
||||
var ctx = c.getContext('2d');
|
||||
extend(atob(c.toDataURL('image/jpeg').split(',')[1]),c.width,c.height)
|
||||
break;
|
||||
case'b64':
|
||||
base64 = e.mon.last_frame.split(',')[1];
|
||||
|
|
@ -2047,7 +2049,14 @@ $.ccio.globalWebsocket=function(d,user){
|
|||
clearInterval($.ccio.mon[d.ke+d.id+user.auth_token].signal);delete($.ccio.mon[d.ke+d.id+user.auth_token].signal);
|
||||
$.ccio.mon[d.ke+d.id+user.auth_token].watch=0;
|
||||
if($.ccio.mon[d.ke+d.id+user.auth_token].hls){$.ccio.mon[d.ke+d.id+user.auth_token].hls.destroy()}
|
||||
if($.ccio.mon[d.ke+d.id+user.auth_token].Poseidon){$.ccio.mon[d.ke+d.id+user.auth_token].Poseidon.destroy()}
|
||||
if($.ccio.mon[d.ke+d.id+user.auth_token].Base64){$.ccio.mon[d.ke+d.id+user.auth_token].Base64.disconnect()}
|
||||
if($.ccio.mon[d.ke+d.id+user.auth_token].h265Socket){$.ccio.mon[d.ke+d.id+user.auth_token].h265Socket.disconnect()}
|
||||
if($.ccio.mon[d.ke+d.id+user.auth_token].h265Player){$.ccio.mon[d.ke+d.id+user.auth_token].h265Player.stop()}
|
||||
if($.ccio.mon[d.ke+d.id+user.auth_token].dash){$.ccio.mon[d.ke+d.id+user.auth_token].dash.reset()}
|
||||
if($.ccio.mon[d.ke+d.id+user.auth_token].h265HttpStream && $.ccio.mon[d.ke+d.id+user.auth_token].abort){
|
||||
$.ccio.mon[d.ke+d.id+user.auth_token].h265HttpStream.abort()
|
||||
}
|
||||
$.grid.data().removeWidget($('#monitor_live_'+d.id+user.auth_token))
|
||||
}
|
||||
break;
|
||||
|
|
@ -2269,32 +2278,40 @@ $.ccio.globalWebsocket=function(d,user){
|
|||
if (player) {
|
||||
player.stop()
|
||||
}
|
||||
player = new libde265.RawPlayer(video)
|
||||
$.ccio.mon[d.ke+d.id+user.auth_token].h265Player = new libde265.RawPlayer(video)
|
||||
var player = $.ccio.mon[d.ke+d.id+user.auth_token].h265Player
|
||||
player.set_status_callback(function(msg, fps) {
|
||||
})
|
||||
player.launch()
|
||||
if($.ccio.mon[d.ke+d.id+user.auth_token].h265Socket && $.ccio.mon[d.ke+d.id+user.auth_token].h265Socket.connected){
|
||||
$.ccio.mon[d.ke+d.id+user.auth_token].h265Socket.disconnect()
|
||||
}
|
||||
$.ccio.mon[d.ke+d.id+user.auth_token].h265Socket = io(url,{transports: ['websocket'], forceNew: false})
|
||||
var ws = $.ccio.mon[d.ke+d.id+user.auth_token].h265Socket
|
||||
var buffer
|
||||
ws.on('diconnect',function(){
|
||||
console.log('h265Socket Stream Disconnected')
|
||||
})
|
||||
ws.on('connect',function(){
|
||||
ws.emit('h265',{
|
||||
url: url,
|
||||
auth: user.auth_token,
|
||||
uid: user.uid,
|
||||
ke: d.ke,
|
||||
id: d.id,
|
||||
// channel: channel
|
||||
})
|
||||
ws.on('data',function(imageData){
|
||||
player._handle_onChunk(imageData)
|
||||
})
|
||||
})
|
||||
if($.ccio.mon[d.ke+d.id+user.auth_token].h265HttpStream && $.ccio.mon[d.ke+d.id+user.auth_token].abort){
|
||||
$.ccio.mon[d.ke+d.id+user.auth_token].h265HttpStream.abort()
|
||||
}
|
||||
if(d.d.stream_flv_type==='ws'){
|
||||
$.ccio.mon[d.ke+d.id+user.auth_token].h265Socket = io(url,{transports: ['websocket'], forceNew: false})
|
||||
var ws = $.ccio.mon[d.ke+d.id+user.auth_token].h265Socket
|
||||
ws.on('diconnect',function(){
|
||||
console.log('h265Socket Stream Disconnected')
|
||||
})
|
||||
ws.on('connect',function(){
|
||||
ws.emit('h265',{
|
||||
url: url,
|
||||
auth: user.auth_token,
|
||||
uid: user.uid,
|
||||
ke: d.ke,
|
||||
id: d.id,
|
||||
// channel: channel
|
||||
})
|
||||
ws.on('data',function(imageData){
|
||||
player._handle_onChunk(imageData)
|
||||
})
|
||||
})
|
||||
}else{
|
||||
var url = $.ccio.init('location',user)+user.auth_token+'/h265/'+d.ke+'/'+d.id+'/s.hevc';
|
||||
$.ccio.mon[d.ke+d.id+user.auth_token].h265HttpStream = player.createHttpStream(url)
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ if(data.url.charAt(data.url.length - 1) !== '/'){
|
|||
<script src="<%=data.url%>libs/js/poseidon.js"></script>
|
||||
<script src="<%=data.url%>libs/js/hls.min.js"></script>
|
||||
<script src="<%=data.url%>libs/js/flv.min.js"></script>
|
||||
<script src="<%=data.url%>libs/js/libde265.js"></script>
|
||||
<script src="<%=data.url%>libs/js/libde265.min.js"></script>
|
||||
<% if(data.addon){
|
||||
var ar={}
|
||||
decodeURI(data.addon).split('|').forEach(function(v){
|
||||
|
|
@ -171,11 +171,30 @@ $(document).ready(function(){
|
|||
$.shinobi.mon={}
|
||||
};
|
||||
$.shinobi.init=function(d){
|
||||
if($.shinobi.mon[d.id].Base64 && $.shinobi.mon[d.id].Base64.connected){
|
||||
$.shinobi.mon[d.id].Base64.disconnect()
|
||||
}
|
||||
if($.shinobi.mon[d.id].Poseidon){
|
||||
$.shinobi.mon[d.id].Poseidon.destroy()
|
||||
}
|
||||
if ($.shinobi.mon[d.id].h265Player) {
|
||||
$.shinobi.mon[d.id].h265Player.stop()
|
||||
}
|
||||
if($.shinobi.mon[d.id].h265Socket && $.shinobi.mon[d.id].h265Socket.connected){
|
||||
$.shinobi.mon[d.id].h265Socket.disconnect()
|
||||
}
|
||||
if($.shinobi.mon[d.id].h265HttpStream && $.shinobi.mon[d.id].abort){
|
||||
$.shinobi.mon[d.id].h265HttpStream.abort()
|
||||
}
|
||||
if($.shinobi.mon[d.id].flv){
|
||||
$.shinobi.mon[d.id].flv.destroy()
|
||||
}
|
||||
if($.shinobi.mon[d.id].hls){
|
||||
$.shinobi.mon[d.id].hls.destroy()
|
||||
}
|
||||
clearInterval($.shinobi.mon[d.id].jpegInterval);
|
||||
switch($.shinobi.mon[d.id].details.stream_type){
|
||||
case'b64':
|
||||
if($.shinobi.mon[d.id].Base64 && $.shinobi.mon[d.id].Base64.connected){
|
||||
$.shinobi.mon[d.id].Base64.disconnect()
|
||||
}
|
||||
$.shinobi.mon[d.id].Base64 = io('<%=data.url%>',{transports: ['websocket'], forceNew: false})
|
||||
var ws = $.shinobi.mon[d.id].Base64
|
||||
ws.on('diconnect',function(){
|
||||
|
|
@ -233,9 +252,6 @@ $(document).ready(function(){
|
|||
case'mp4':
|
||||
var stream = $('#SHINOBI_'+d.ke+'_'+d.id+' .stream-element');
|
||||
if($.shinobi.mon[d.id].details.stream_flv_type==='ws'){
|
||||
if($.shinobi.mon[d.id].Poseidon){
|
||||
$.shinobi.mon[d.id].Poseidon.destroy()
|
||||
}
|
||||
var createPoseidon = function(){
|
||||
$.shinobi.mon[d.id].Poseidon = new Poseidon({
|
||||
video: stream[0],
|
||||
|
|
@ -265,41 +281,35 @@ $(document).ready(function(){
|
|||
case'h265':
|
||||
var player = $.shinobi.mon[d.id].h265Player
|
||||
var video = $('#SHINOBI_'+d.ke+'_'+d.id+' .stream-element')[0]
|
||||
if (player) {
|
||||
player.stop()
|
||||
}
|
||||
player = new libde265.RawPlayer(video)
|
||||
player.set_status_callback(function(msg, fps) {
|
||||
})
|
||||
player.launch()
|
||||
if($.shinobi.mon[d.id].h265Socket && $.shinobi.mon[d.id].h265Socket.connected){
|
||||
$.shinobi.mon[d.id].h265Socket.disconnect()
|
||||
if($.shinobi.mon[d.id].details.stream_flv_type==='ws'){
|
||||
$.shinobi.mon[d.id].h265Socket = io(url,{transports: ['websocket'], forceNew: false})
|
||||
var ws = $.shinobi.mon[d.id].h265Socket
|
||||
ws.on('diconnect',function(){
|
||||
console.log('h265Socket Stream Disconnected')
|
||||
})
|
||||
ws.on('connect',function(){
|
||||
ws.emit('h265',{
|
||||
auth:'<%=data.auth%>',
|
||||
ke:d.ke,
|
||||
uid:'<%=data.uid%>',
|
||||
id:d.id,
|
||||
url: '<%=data.url%>'
|
||||
// channel: channel
|
||||
})
|
||||
ws.on('data',function(imageData){
|
||||
player._handle_onChunk(imageData)
|
||||
})
|
||||
})
|
||||
}else{
|
||||
$.shinobi.mon[d.id].h265HttpStream = player.createHttpStream('<%=data.url%><%=data.auth%>/h265/'+d.ke+'/'+d.id+'/s.hevc')
|
||||
}
|
||||
$.shinobi.mon[d.id].h265Socket = io('<%=data.url%>',{transports: ['websocket'], forceNew: false})
|
||||
var ws = $.shinobi.mon[d.id].h265Socket
|
||||
var buffer
|
||||
ws.on('diconnect',function(){
|
||||
console.log('h265Socket Stream Disconnected')
|
||||
})
|
||||
ws.on('connect',function(){
|
||||
ws.emit('h265',{
|
||||
auth:'<%=data.auth%>',
|
||||
ke:d.ke,
|
||||
uid:'<%=data.uid%>',
|
||||
id:d.id,
|
||||
url: '<%=data.url%>'
|
||||
// channel: channel
|
||||
})
|
||||
ws.on('data',function(imageData){
|
||||
player._handle_onChunk(imageData)
|
||||
})
|
||||
})
|
||||
break;
|
||||
case'flv':
|
||||
if (flvjs.isSupported()) {
|
||||
if($.shinobi.mon[d.id].flv){
|
||||
$.shinobi.mon[d.id].flv.destroy()
|
||||
}
|
||||
var options = {};
|
||||
// if($.shinobi.mon[d.id].details.stream_flv_type==='ws'){
|
||||
// if($.shinobi.mon[d.id].details.stream_flv_maxLatency&&$.shinobi.mon[d.id].details.stream_flv_maxLatency!==''){
|
||||
|
|
@ -341,9 +351,9 @@ $(document).ready(function(){
|
|||
k=d.mon.details;
|
||||
k.jpegInterval=parseFloat(k.jpegInterval);
|
||||
if(!k.jpegInterval||k.jpegInterval===''||isNaN(k.jpegInterval)){k.jpegInterval=1}
|
||||
if(!$.shinobi.mon[d.mon.mid].jpegInterval){
|
||||
clearInterval($.shinobi.mon[d.mon.mid].jpegInterval);
|
||||
$.shinobi.mon[d.mon.mid].jpegInterval=setInterval(function(){
|
||||
if(!$.shinobi.mon[d.id].jpegInterval){
|
||||
clearInterval($.shinobi.mon[d.id].jpegInterval);
|
||||
$.shinobi.mon[d.id].jpegInterval=setInterval(function(){
|
||||
$('#SHINOBI_'+d.ke+'_'+d.id+' .stream-element').attr('src','<%=data.url%><%=data.auth%>/jpeg/'+d.mon.ke+'/'+d.mon.mid+'/s.jpg?time='+(new Date()).getTime())
|
||||
},1000/k.jpegInterval);
|
||||
}
|
||||
|
|
@ -351,9 +361,6 @@ $(document).ready(function(){
|
|||
case'hls':
|
||||
var video = $('#SHINOBI_'+d.ke+'_'+d.id+' .stream-element')[0];
|
||||
d.url='<%=data.url%><%=data.auth%>/hls/'+d.ke+'/'+d.id+'/s.m3u8';
|
||||
if($.shinobi.mon[d.id].hls){
|
||||
$.shinobi.mon[d.id].hls.destroy()
|
||||
}
|
||||
if (navigator.userAgent.match(/(iPod|iPhone|iPad)/)||(navigator.userAgent.match(/(Safari)/)&&!navigator.userAgent.match('Chrome'))) {
|
||||
video.src=d.url;
|
||||
video.play();
|
||||
|
|
@ -420,7 +427,7 @@ $(document).ready(function(){
|
|||
$(window).resize();
|
||||
// d.mon.details=JSON.stringify(d.mon.details);
|
||||
d.mon.id = d.mon.mid
|
||||
$.shinobi.mon[d.mon.mid]=d.mon;
|
||||
$.shinobi.mon[d.id] = d.mon;
|
||||
$.shinobi.init(d.mon);
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -180,7 +180,7 @@
|
|||
<script src="<%-originalURL%>libs/js/socket.io.js"></script>
|
||||
<script src="<%-originalURL%>libs/js/fullcalendar.min.js"></script>
|
||||
<script src="<%-originalURL%>libs/js/hls.min.js"></script>
|
||||
<script src="<%-originalURL%>libs/js/libde265.js"></script>
|
||||
<script src="<%-originalURL%>libs/js/libde265.min.js"></script>
|
||||
<script type="text/javascript" src="<%-originalURL%>libs/js/flv.shinobi.js">;</script>
|
||||
<script src="<%-originalURL%>libs/js/menu.js"></script>
|
||||
<script src="<%-originalURL%>libs/js/clock.js"></script>
|
||||
|
|
|
|||
Loading…
Reference in New Issue