var cell_width = 0;
var cell_height = 0;
-var streams = Object;
-var cells = Object;
+var streams = Object();
+var cells = Object();
function mosaic_init()
{
- document.getElementById( 'sout_extra' ).value = ",sfilter=mosaic";
+ document.getElementById( 'sout_transcode_extra' ).value = ",sfilter=mosaic}:bridge-in{offset=100";
mosaic_size_change();
+
+ /* Force usage of transcode in sout */
+ document.getElementById( 'sout_vcodec_s' ).checked = 'checked';
+ disable( 'sout_vcodec_s' );
+ update_sout();
}
function mosaic_size_change()
var mlayout = document.getElementById( "mosaic_layout" );
- /* TODO: keep 'common' cells when resizing */
while( mlayout.hasChildNodes() )
mlayout.removeChild( mlayout.firstChild );
{
var mdt = document.createElement( 'div' );
mdt.setAttribute( 'id', 'mosaic_dt' );
- mdt.setAttribute( 'class', 'mosaic_tbl' );
+ setclass( mdt, 'mosaic_tbl' );
mdt.style.width = mosaic_width + "px";
mdt.style.height = mosaic_height + "px";
mtable.style.borderSpacing = mosaic_hborder + "px " +
mosaic_vborder + "px";
+ var mtbody = document.createElement( 'tbody' );
+
for( y = 0; y < mosaic_rows; y++ )
{
var mrow = document.createElement( 'tr' );
for( x = 0; x < mosaic_cols; x++ )
{
var mcell = document.createElement( 'td' );
- mcell.setAttribute( 'class', 'mosaic_itm' );
+ setclass( mcell, 'mosaic_itm' );
mcell.style.width = cell_width + "px";
mcell.style.height = cell_height + "px";
- var melt = document.createElement( 'input' );
- melt.setAttribute( 'type', 'button' );
var id = x+'_'+y;
+ var melt = create_button( cells[id] ? cells[id] : '?', 'mosaic_elt_choose(\"'+id+'\");' );
melt.setAttribute( 'id', id );
- melt.setAttribute( 'onclick', 'mosaic_elt_choose(\''+id+'\');' );
- if( cells[id] )
- melt.setAttribute( 'value', cells[id] );
- else
- melt.setAttribute( 'value', '?' );
melt.setAttribute( 'title', 'Click to choose stream' );
mcell.appendChild( melt );
mrow.appendChild( mcell );
}
- mtable.appendChild( mrow );
+ mtbody.appendChild( mrow );
}
+ mtable.appendChild( mtbody );
mdt.appendChild( mtable );
mlayout.appendChild( mdt );
}
streams[ addunderscores( value('mosaic_input_name') ) ] =
value('mosaic_input');
+ mosaic_feedback( addunderscores( value('mosaic_input_name') ) + " ( " + value('mosaic_input') + " ) added to input list.", true );
+
var mlist = document.getElementById( "mosaic_list_content" );
while( mlist.hasChildNodes() )
mlist.removeChild( mlist.firstChild );
minput.setAttribute( 'href', 'javascript:mosaic_elt_select(\''+name+'\');');
minput.setAttribute( 'id', name );
minput.setAttribute( 'value', mrl );
- minput.setAttribute( 'title', mrl );
var minputtxt = document.createTextNode( name );
minput.appendChild( minputtxt );
mlist.appendChild( minput );
+ mlist.appendChild( document.createTextNode( " ( "+mrl+" )" ) );
mlist.appendChild( document.createElement( 'br' ) );
}
}
function mosaic_elt_select( id )
{
hide( 'mosaic_list' );
- document.getElementById( document.getElementById( 'mosaic_list' ).value ).value = id;
- cells[ document.getElementById( 'mosaic_list' ).value ] = id;
- mosaic_code_update();
+ var ml = document.getElementById( 'mosaic_list' ).value;
+ if( ml )
+ {
+ document.getElementById( ml ).value = id;
+ cells[ ml ] = id;
+ mosaic_code_update();
+ }
}
function mosaic_elt_choose( id )
"## HTTP interface mosaic wizard ##\n"+
"##################################\n"+
"\n"+
-"# Comment the following line if you don't want to reset you VLM configuration\n"+
+"# Comment the following line if you don't want to reset your VLM configuration\n"+
"del all\n"+
"\n"+
"# Background options\n"+
"new bg broadcast enabled\n"+
-"setup bg input " + value( 'mosaic_bg_input' ) + "\n";
+"setup bg input " + sanitize_input( value( 'mosaic_bg_input' ) ) + "\n";
if( value( 'mosaic_output' ) )
{
code.value +=
if(! o.test( value( 'mosaic_output' ) ) )
{
code.value +=
-"setup bg option sub-filter=mosaic\n";
+"setup bg option sub-filter=mosaic\n"+
+"setup bg output #bridge-in{offset=100}:display\n";
}
code.value+=
"\n"+
var s = cells[id];
code.value +=
"new " + s + " broadcast enabled\n"+
-"setup " + s + " input " + streams[s] + "\n"+
-"setup " + s + " output #duplicate{dst=mosaic-bridge{id=" + s + ",width="+cell_width+",height="+cell_height+"},select=video,dst=bridge-out,select=audio}\n"+
+"setup " + s + " input " + sanitize_input( streams[s] ) + "\n"+
+"setup " + s + " output #duplicate{dst=mosaic-bridge{id=" + s + ",width="+cell_width+",height="+cell_height+"},select=video,dst=bridge-out{id="+(y*mosaic_cols+x)+"},select=audio}\n"+
"\n";
}
}
}
}
mosaic_batch( cmd );
-}
+}
+
+function mosaic_feedback( msg, ok )
+{
+ var f = document.getElementById( "mosaic_feedback" );
+ while( f.hasChildNodes() )
+ f.removeChild( f.firstChild );
+
+ f.style.fontWeight = "bold";
+ if( ok )
+ f.style.color = "#0f0";
+ else
+ f.style.color = "#f00";
+
+ var t = document.createTextNode( ( ok ? "Info: " : "Error: " ) + msg );
+ f.appendChild( t );
+
+}