Commit 9199f356 authored by Antoine Cellerier's avatar Antoine Cellerier

src/misc/vlm.c : export the current playlist item's index for each instance

share/http/* : display instances for vlm media elements
               some layout changes (inputs and outputs)
parent bb9aa7c2
...@@ -58,7 +58,7 @@ function format_time( s ) ...@@ -58,7 +58,7 @@ function format_time( s )
{ {
var hours = Math.floor(s/3600); var hours = Math.floor(s/3600);
var minutes = Math.floor((s/60)%60); var minutes = Math.floor((s/60)%60);
var seconds = s%60; var seconds = Math.floor(s%60);
if( hours < 10 ) hours = "0"+hours; if( hours < 10 ) hours = "0"+hours;
if( minutes < 10 ) minutes = "0"+minutes; if( minutes < 10 ) minutes = "0"+minutes;
if( seconds < 10 ) seconds = "0"+seconds; if( seconds < 10 ) seconds = "0"+seconds;
......
...@@ -400,18 +400,11 @@ function parse_vlm_elements() ...@@ -400,18 +400,11 @@ function parse_vlm_elements()
nb.appendChild( create_button( 'Delete', 'vlm_delete("'+elt.getAttribute( 'name' ) + '");' ) ); nb.appendChild( create_button( 'Delete', 'vlm_delete("'+elt.getAttribute( 'name' ) + '");' ) );
var list = document.createElement( "ul" ); var list = document.createElement( "ul" );
/* begin input list */ /* begin input list */
var inputs = elt.getElementsByTagName( 'input' );
for( i = 0; i < inputs.length; i++ )
{
var item = document.createElement( "li" ); var item = document.createElement( "li" );
item.appendChild( document.createTextNode( "Input: " + inputs[i].firstChild.data + " " ) );
item.appendChild( create_button( "Delete", 'vlm_delete_input("' + elt.getAttribute( 'name' ) + '", '+(i+1)+' );' ) );
list.appendChild( item ); list.appendChild( item );
} item.appendChild( document.createTextNode( "Inputs: " ) );
/* Add input */
var item = document.createElement( "li" );
var text = document.createElement( "input" ); var text = document.createElement( "input" );
text.setAttribute( 'type', 'text' ); text.setAttribute( 'type', 'text' );
text.setAttribute( 'size', '40' ); text.setAttribute( 'size', '40' );
...@@ -422,7 +415,20 @@ function parse_vlm_elements() ...@@ -422,7 +415,20 @@ function parse_vlm_elements()
item.appendChild( document.createTextNode( ' ' ) ); item.appendChild( document.createTextNode( ' ' ) );
item.appendChild( create_button( 'Add input', 'vlm_add_input("'+elt.getAttribute('name')+'",document.getElementById("vlm_elt_'+elt.getAttribute('name')+'_input").value );' ) ); item.appendChild( create_button( 'Add input', 'vlm_add_input("'+elt.getAttribute('name')+'",document.getElementById("vlm_elt_'+elt.getAttribute('name')+'_input").value );' ) );
list.appendChild( item ); var inputs = elt.getElementsByTagName( 'input' );
if( inputs.length > 0 )
{
var ilist = document.createElement( "ol" );
ilist.setAttribute( 'start', '0' );
item.appendChild( ilist );
for( i = 0; i < inputs.length; i++ )
{
var item = document.createElement( "li" );
item.appendChild( document.createTextNode( inputs[i].firstChild.data + " " ) );
item.appendChild( create_button( "Delete", 'vlm_delete_input("' + elt.getAttribute( 'name' ) + '", '+(i+1)+' );' ) );
ilist.appendChild( item );
}
}
/* end of input list */ /* end of input list */
/* output */ /* output */
...@@ -452,17 +458,10 @@ function parse_vlm_elements() ...@@ -452,17 +458,10 @@ function parse_vlm_elements()
/* end of output */ /* end of output */
/* begin options list */ /* begin options list */
var options = elt.getElementsByTagName( 'option' );
for( i = 0; i < options.length; i++ )
{
var item = document.createElement( "li" ); var item = document.createElement( "li" );
item.appendChild( document.createTextNode( "Option: " + options[i].firstChild.data ) );
list.appendChild( item ); list.appendChild( item );
} item.appendChild( document.createTextNode( "Options: " ) );
/* Add option */ /* Add option */
var item = document.createElement( "li" );
item.appendChild( document.createTextNode( ' ' ) );
var text = document.createElement( "input" ); var text = document.createElement( "input" );
text.setAttribute( 'type', 'text' ); text.setAttribute( 'type', 'text' );
text.setAttribute( 'size', '40' ); text.setAttribute( 'size', '40' );
...@@ -471,9 +470,48 @@ function parse_vlm_elements() ...@@ -471,9 +470,48 @@ function parse_vlm_elements()
item.appendChild( document.createTextNode( ' ' ) ); item.appendChild( document.createTextNode( ' ' ) );
item.appendChild( create_button( 'Add option', 'vlm_option("'+elt.getAttribute('name')+'",document.getElementById("vlm_elt_'+elt.getAttribute('name')+'_option").value );' ) ); item.appendChild( create_button( 'Add option', 'vlm_option("'+elt.getAttribute('name')+'",document.getElementById("vlm_elt_'+elt.getAttribute('name')+'_option").value );' ) );
list.appendChild( item ); var options = elt.getElementsByTagName( 'option' );
if( options.length > 0 )
{
var olist = document.createElement( "ul" );
item.appendChild( olist );
for( i = 0; i < options.length; i++ )
{
var item = document.createElement( "li" );
item.appendChild( document.createTextNode( options[i].firstChild.data ) );
olist.appendChild( item );
}
}
/* end of options */ /* end of options */
/* Instances list */
var instances = elt.getElementsByTagName( 'instance' );
if( instances.length > 0 )
{
var item = document.createElement("li");
var ilist = document.createElement("ul");
list.appendChild( item );
item.appendChild(document.createTextNode("Instances:"));
item.appendChild( ilist );
for( i = 0; i < instances.length; i++ )
{
var iname = instances[i].getAttribute( 'name' );
var istate = instances[i].getAttribute( 'state' );
var iposition = Number( instances[i].getAttribute( 'position' ) * 100);
var itime = Math.floor( instances[i].getAttribute( 'time' ) / 1000000);
var ilength = Math.floor( instances[i].getAttribute( 'length' ) / 1000000);
var irate = instances[i].getAttribute( 'rate' );
var ititle = instances[i].getAttribute( 'title' );
var ichapter = instances[i].getAttribute( 'chapter' );
var iseekable = instances[i].getAttribute( 'seekable' );
var item = document.createElement( "li" );
item.appendChild( document.createTextNode( iname + ": " + istate + " " + (iposition.toFixed(2)) + "%" + " " + format_time( itime ) + "/" + format_time( ilength ) ) );
ilist.appendChild( item );
}
}
/* end of instances list */
nb.appendChild( list ); nb.appendChild( list );
} }
......
...@@ -41,7 +41,7 @@ ...@@ -41,7 +41,7 @@
</options> </options>
<instances> <instances>
<vlc id="foreach" param1="inst" param2="el.instances" /> <vlc id="foreach" param1="inst" param2="el.instances" />
<instance><vlc id="value" param1="inst"/></instance> <instance name="<vlc id="value" param1="inst.name"/>" state="<vlc id="value" param1="inst.state"/>" position="<vlc id="value" param1="inst.position"/>" time="<vlc id="value" param1="inst.time"/>" length="<vlc id="value" param1="inst.length"/>" rate="<vlc id="value" param1="inst.rate"/>" title="<vlc id="value" param1="inst.title"/>" chapter="<vlc id="value" param1="inst.chapter"/>" seekable="<vlc id="value" param1="inst.seekable"/>" playlistindex="<vlc id="value" param1="inst.playlistindex"/>" />
<vlc id="end" /> <vlc id="end" />
</instances> </instances>
</broadcast> </broadcast>
...@@ -61,7 +61,7 @@ ...@@ -61,7 +61,7 @@
</options> </options>
<instances> <instances>
<vlc id="foreach" param1="inst" param2="el.instances" /> <vlc id="foreach" param1="inst" param2="el.instances" />
<instance><vlc id="value" param1="inst"/></instance> <instance name="<vlc id="value" param1="inst.name"/>" state="<vlc id="value" param1="inst.state"/>" position="<vlc id="value" param1="inst.position"/>" time="<vlc id="value" param1="inst.time"/>" length="<vlc id="value" param1="inst.length"/>" rate="<vlc id="value" param1="inst.rate"/>" title="<vlc id="value" param1="inst.title"/>" chapter="<vlc id="value" param1="inst.chapter"/>" seekable="<vlc id="value" param1="inst.seekable"/>" playlistindex="<vlc id="value" param1="inst.playlistindex"/>" />
<vlc id="end" /> <vlc id="end" />
</instances> </instances>
</vod> </vod>
......
...@@ -1683,6 +1683,9 @@ static vlm_message_t *vlm_Show( vlm_t *vlm, vlm_media_t *media, ...@@ -1683,6 +1683,9 @@ static vlm_message_t *vlm_Show( vlm_t *vlm, vlm_media_t *media,
APPEND_INPUT_INFO( "chapter", "%d", Integer ); APPEND_INPUT_INFO( "chapter", "%d", Integer );
APPEND_INPUT_INFO( "seekable", "%d", Bool ); APPEND_INPUT_INFO( "seekable", "%d", Bool );
#undef APPEND_INPUT_INFO #undef APPEND_INPUT_INFO
asprintf( &psz_tmp, "%d", p_instance->i_index );
vlm_MessageAdd( msg_instance, vlm_MessageNew( "playlistindex", psz_tmp ) );
free( psz_tmp );
vlm_MessageAdd( msg_child, msg_instance ); vlm_MessageAdd( msg_child, msg_instance );
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment