Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
WEB TV Player: update to use stream profiles, fix transcode muxer typ…
…e bug
  • Loading branch information
perexg committed Oct 11, 2014
1 parent 1abcfda commit 801ac87
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 58 deletions.
28 changes: 19 additions & 9 deletions src/profile.c
Expand Up @@ -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));
Expand Down
63 changes: 14 additions & 49 deletions src/webui/static/tv.js
Expand Up @@ -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"'
}
};
Expand All @@ -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
});
},
Expand Down Expand Up @@ -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;
},
Expand Down Expand Up @@ -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>'),

Expand Down Expand Up @@ -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%');
Expand All @@ -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',
Expand All @@ -468,6 +432,7 @@ tv.app = function() {
title:'Channels',
items: chList,
cls: 'tv-channel-list',
autoScroll: true,
renderTo: Ext.getBody()
});

Expand Down

0 comments on commit 801ac87

Please sign in to comment.