WEB TV Player: update to use stream profiles, fix transcode muxer type bug

This commit is contained in:
Jaroslav Kysela 2014-10-11 21:24:42 +02:00
parent 1abcfda491
commit 801ac876c2
2 changed files with 33 additions and 58 deletions

View file

@ -772,25 +772,35 @@ profile_transcode_work(profile_t *_pro, streaming_target_t *src,
return st;
}
static int
profile_transcode_mc_valid(int mc)
{
switch (mc) {
case MC_MATROSKA:
case MC_WEBM:
case MC_MPEGTS:
case MC_MPEGPS:
return 1;
default:
return 0;
}
}
static int
profile_transcode_open(profile_t *_pro, profile_chain_t *prch,
muxer_config_t *m_cfg, int flags, size_t qsize)
{
profile_transcode_t *pro = (profile_transcode_t *)_pro;
muxer_config_t c;
if (m_cfg)
c = *m_cfg; /* do not alter the original parameter */
else
memset(&c, 0, sizeof(c));
switch (c.m_type) {
case MC_MATROSKA:
case MC_WEBM:
case MC_MPEGTS:
case MC_MPEGPS:
break;
default:
c.m_type = MC_MATROSKA;
break;
if (!profile_transcode_mc_valid(c.m_type)) {
c.m_type = pro->pro_mc;
if (!profile_transcode_mc_valid(c.m_type))
c.m_type = MC_MATROSKA;
}
memset(prch, 0, sizeof(*prch));

View file

@ -49,51 +49,31 @@ tv.ui.VideoPlayer = Ext.extend(Ext.Panel, (function() {
var profiles = {
pass: {
muxer: 'pass',
mimetype: 'video/MP2T'
profile: 'pass',
mimetype: 'video/MP2T'
},
hls: {
muxer: 'mpegts',
transcode: true,
audio: 'AAC',
video: 'H264',
subs: 'NONE',
profile: 'webtv-h264-aac-mpegts',
playlist: true,
mimetype: 'application/x-mpegURL; codecs="avc1.42E01E, mp4a.40.2"'
},
apple: {
muxer: 'mpegts',
transcode: true,
audio: 'AAC',
video: 'H264',
subs: 'NONE',
profile: 'webtv-h264-aac-mpegts',
playlist: true,
mimetype: 'application/vnd.apple.mpegURL; codecs="avc1.42E01E, mp4a.40.2"'
},
ts: {
muxer: 'mpegts',
transcode: true,
audio: 'AAC',
video: 'H264',
subs: 'NONE',
profile: 'webtv-h264-aac-mpegts',
playlist: false,
mimetype: 'video/MP2T; codecs="avc1.42E01E, mp4a.40.2"'
},
mkv: {
muxer: 'matroska',
transcode: true,
audio: 'AAC',
video: 'H264',
subs: 'NONE',
profile: 'webtv-h264-aac-matroska',
playlist: false,
mimetype: 'video/x-matroska; codecs="avc1.42E01E, mp4a.40.2"'
},
webm: {
muxer: 'webm',
transcode: true,
audio: 'VORBIS',
video: 'VP8',
subs: 'NONE',
profile: 'webtv-vp8-vorbis-webm',
mimetype: 'video/webm; codecs="vp8.0, vorbis"'
}
};
@ -104,15 +84,7 @@ tv.ui.VideoPlayer = Ext.extend(Ext.Panel, (function() {
tv.ui.VideoPlayer.superclass.constructor.call(this, config);
Ext.applyIf(this.params, {
transcode : 0,
resolution: 288,
channels : 0, // same as source
bandwidth : 0, // same as source
language : '', // same as source
audio : 'UNKNOWN', // same as source
video : 'UNKNOWN', // same as source
subs : 'UNKNOWN', // same as source
muxer : '', // default dvr config
profile : '', // stream profile
playlist : false // don't use m3u8 playlist
});
},
@ -177,14 +149,8 @@ tv.ui.VideoPlayer = Ext.extend(Ext.Panel, (function() {
url += 'stream/channel/'
url += uuid;
url += "?transcode=" + new Number(params.transcode);
url += "&mux=" + params.muxer;
url += "&acodec=" + params.audio;
url += "&vcodec=" + params.video;
url += "&scodec=" + params.subs;
url += "&resolution=" + params.resolution;
url += "&bandwidth=" + params.bandwidth;
url += "&language=" + params.language;
if (params.profile)
url += "?profile=" + params.profile;
return url;
},
@ -337,7 +303,7 @@ tv.ui.ChannelList = Ext.extend(Ext.DataView, {
tpl: new Ext.XTemplate(
'<tpl for=".">',
'<div class="tv-list-item" id="{uuid}">',
'<img src="{icon}" title="{name}">{name}',
'<img src="{icon_public_url}" title="{name}">{name}',
'</div>',
'</tpl>'),
@ -443,9 +409,7 @@ tv.app = function() {
init: function() {
var videoPlayer = new tv.ui.VideoPlayer({
params: {
resolution: 384
},
params: { },
renderTo: Ext.getBody()
});
videoPlayer.setDisplaySize('100%', '00%');
@ -454,7 +418,7 @@ tv.app = function() {
store: new Ext.data.JsonStore({
autoLoad : true,
root : 'entries',
fields : ['icon', 'number', 'name', 'uuid'],
fields : ['icon_public_url', 'number', 'name', 'uuid'],
id : 'uuid',
sortInfo : {
field : 'number',
@ -468,6 +432,7 @@ tv.app = function() {
title:'Channels',
items: chList,
cls: 'tv-channel-list',
autoScroll: true,
renderTo: Ext.getBody()
});