function update_sout()
{
    var option = "";
    /* Remove all options starting with :sout since we're going to write them
     * again. */
    remove_input_options( ":sout" );

    check_and_replace_int( 'sout_http_port', 8080 );
    check_and_replace_int( 'sout_mmsh_port', 8080 );
    check_and_replace_int( 'sout_rtp_port', 1234 );
    check_and_replace_int( 'sout_udp_port', 1234 );
    check_and_replace_int( 'sout_ttl', 1 );

    if( checked( 'sout_soverlay' ) )
    {
        disable( 'sout_scodec' );
        disable( 'sout_sub' );
    }
    else
    {
        enable( 'sout_scodec' );
        enable( 'sout_sub' );
    }

    var transcode =  checked( 'sout_vcodec_s' ) || checked( 'sout_acodec_s' )
                  || checked( 'sout_sub' )      || checked( 'sout_soverlay' );

    if( transcode )
    {
        option = ":sout=#transcode{";
        var alot = false; /* alot == at least one transcode */
        if( checked( 'sout_vcodec_s' ) )
        {
            option += "vcodec="+value( 'sout_vcodec' )+",vb="+value( 'sout_vb' )+",scale="+value( 'sout_scale' );
            alot = true;
        }
        if( checked( 'sout_acodec_s' ) )
        {
            if( alot ) option += ",";
            option += "acodec="+value( 'sout_acodec' )+",ab="+value( 'sout_ab' );
            if( value( 'sout_channels' ) )
                option += ",channels="+value( 'sout_channels' );
            alot = true;
        }
        if( checked( 'sout_soverlay' ) )
        {
            if( alot ) option += ",";
            option += "soverlay";
            alot = true;
        }
        else if( checked( 'sout_sub' ) )
        {
            if( alot ) option += ",";
            option += "scodec="+value( 'sout_scodec' );
            alot = true;
        }
        option += value( 'sout_transcode_extra' );
            
        option += "}";

    }

    var output = checked( 'sout_display' ) + checked( 'sout_file' )
               + checked( 'sout_http' )    + checked( 'sout_mmsh' )
               + checked( 'sout_rtp' )     + checked( 'sout_udp' );

    if( output )
    {
        if( transcode )
            option += ":";
        else
            option += ":sout=#";
        var aloo = false; /* aloo == at least one output */
        var mux = radio_value( 'sout_mux' );
        var ttl = parseInt( value( 'sout_ttl' ) );
        if( output > 1 ) option += "duplicate{";
        if( checked( 'sout_display' ) )
        {
            if( output > 1 ) option += "dst="
            option += "display";
            aloo = true;
        }
        if( checked( 'sout_file' ) )
        {
            if( aloo ) option += ",";
            if( output > 1 ) option += "dst="
            option += "std{access=file,mux="+mux+",dst="+value( 'sout_file_filename' )+"}";
            aloo = true;
        }
        if( checked( 'sout_http' ) )
        {
            if( aloo ) option += ",";
            if( output > 1 ) option += "dst="
            option += "std{access=http,mux="+mux+",dst="+value( 'sout_http_addr' );
            if( value( 'sout_http_port' ) )
                option += ":"+value( 'sout_http_port' );
            option += "}";
            aloo = true;
        }
        if( checked( 'sout_mmsh' ) )
        {
            if( aloo ) option += ",";
            if( output > 1 ) option += "dst="
            option += "std{access=mmsh,mux="+mux+",dst="+value( 'sout_mmsh_addr' );
            if( value( 'sout_mmsh_port' ) )
                option += ":"+value( 'sout_mmsh_port' );
            option += "}";
            aloo = true;
        }
        if( checked( 'sout_rtp' ) )
        {
            if( aloo ) option += ",";
            if( output > 1 ) option += "dst="
            option += "std{access=rtp";
            if( ttl ) option += "{ttl="+ttl+"}";
            option += ",mux="+mux+",dst="+value( 'sout_rtp_addr' );
            if( value( 'sout_rtp_port' ) )
                option += ":"+value( 'sout_rtp_port' );
            if( checked( 'sout_sap' ) )
            {
                option += ",sap";
                if( value( 'sout_sap_group' ) != '' )
                {
                    option += ",group=\""+value( 'sout_sap_group' )+"\"";
                }
                option += ",name=\""+value( 'sout_sap_name' )+"\"";
            }
            option += "}";
            aloo = true;
        }
        if( checked( 'sout_udp' ) )
        {
            if( aloo ) option += ",";
            if( output > 1 ) option += "dst="
            option += "std{access=udp";
            if( ttl ) option += "{ttl="+ttl+"}";
            option += ",mux="+mux+",dst="+value( 'sout_udp_addr' );
            if( value('sout_udp_port' ) )
                option += ":"+value( 'sout_udp_port' );
            if( checked( 'sout_sap' ) )
            {
                option += ",sap";
                if( value( 'sout_sap_group' ) != '' )
                {
                    option += ",group=\""+value( 'sout_sap_group' )+"\"";
                }
                option += ",name=\""+value( 'sout_sap_name' )+"\"";
            }
            option += "}";
            aloo = true;
        }
        if( output > 1 ) option += "}";
    }

    if( option != "" )
        input_options.push( option );

    if( ( transcode || output ) && checked( 'sout_all' ) )
        input_options.push( ":sout-all" );

    var mrl = document.getElementById( 'sout_mrl' );
    mrl.value = option;

    refresh_input_options_list();
}
/* update the sout MRL using data from the sout_helper */
update the sout MRL using data from the sout_helper
update the sout MRL using data from the sout_helper
function update_sout()
{
    var option = "";
    remove_input_options( ":sout" );
    check_and_replace_int( 'sout_http_port', 8080 );
    check_and_replace_int( 'sout_mmsh_port', 8080 );
    check_and_replace_int( 'sout_rtp_port', 1234 );
    check_and_replace_int( 'sout_udp_port', 1234 );
    check_and_replace_int( 'sout_ttl', 1 );
    if( checked( 'sout_soverlay' ) )
    {
        disable( 'sout_scodec' );
        disable( 'sout_sub' );
    }
    else
    {
        enable( 'sout_scodec' );
        enable( 'sout_sub' );
    }
    var transcode =  checked( 'sout_vcodec_s' ) || checked( 'sout_acodec_s' )
                  || checked( 'sout_sub' )      || checked( 'sout_soverlay' );
    if( transcode )
    {
        option = ":sout=#transcode{";
        var alot = false; 
        if( checked( 'sout_vcodec_s' ) )
        {
            option += "vcodec="+value( 'sout_vcodec' )+",vb="+value( 'sout_vb' )+",scale="+value( 'sout_scale' );
            alot = true;
        }
        if( checked( 'sout_acodec_s' ) )
        {
            if( alot ) option += ",";
            option += "acodec="+value( 'sout_acodec' )+",ab="+value( 'sout_ab' );
            if( value( 'sout_channels' ) )
                option += ",channels="+value( 'sout_channels' );
            alot = true;
        }
        if( checked( 'sout_soverlay' ) )
        {
            if( alot ) option += ",";
            option += "soverlay";
            alot = true;
        }
        else if( checked( 'sout_sub' ) )
        {
            if( alot ) option += ",";
            option += "scodec="+value( 'sout_scodec' );
            alot = true;
        }
        option += value( 'sout_transcode_extra' );
        option += "}";
    }
    var output = checked( 'sout_display' ) + checked( 'sout_file' )
               + checked( 'sout_http' )    + checked( 'sout_mmsh' )
               + checked( 'sout_rtp' )     + checked( 'sout_udp' );
    if( output )
    {
        if( transcode )
            option += ":";
        else
            option += ":sout=#";
        var aloo = false; 
        var mux = radio_value( 'sout_mux' );
        var ttl = parseInt( value( 'sout_ttl' ) );
        if( output > 1 ) option += "duplicate{";
        if( checked( 'sout_display' ) )
        {
            if( output > 1 ) option += "dst="
            option += "display";
            aloo = true;
        }
        if( checked( 'sout_file' ) )
        {
            if( aloo ) option += ",";
            if( output > 1 ) option += "dst="
            option += "std{access=file,mux="+mux+",dst="+value( 'sout_file_filename' )+"}";
            aloo = true;
        }
        if( checked( 'sout_http' ) )
        {
            if( aloo ) option += ",";
            if( output > 1 ) option += "dst="
            option += "std{access=http,mux="+mux+",dst="+value( 'sout_http_addr' );
            if( value( 'sout_http_port' ) )
                option += ":"+value( 'sout_http_port' );
            option += "}";
            aloo = true;
        }
        if( checked( 'sout_mmsh' ) )
        {
            if( aloo ) option += ",";
            if( output > 1 ) option += "dst="
            option += "std{access=mmsh,mux="+mux+",dst="+value( 'sout_mmsh_addr' );
            if( value( 'sout_mmsh_port' ) )
                option += ":"+value( 'sout_mmsh_port' );
            option += "}";
            aloo = true;
        }
        if( checked( 'sout_rtp' ) )
        {
            if( aloo ) option += ",";
            if( output > 1 ) option += "dst="
            option += "std{access=rtp";
            if( ttl ) option += "{ttl="+ttl+"}";
            option += ",mux="+mux+",dst="+value( 'sout_rtp_addr' );
            if( value( 'sout_rtp_port' ) )
                option += ":"+value( 'sout_rtp_port' );
            if( checked( 'sout_sap' ) )
            {
                option += ",sap";
                if( value( 'sout_sap_group' ) != '' )
                {
                    option += ",group=\""+value( 'sout_sap_group' )+"\"";
                }
                option += ",name=\""+value( 'sout_sap_name' )+"\"";
            }
            option += "}";
            aloo = true;
        }
        if( checked( 'sout_udp' ) )
        {
            if( aloo ) option += ",";
            if( output > 1 ) option += "dst="
            option += "std{access=udp";
            if( ttl ) option += "{ttl="+ttl+"}";
            option += ",mux="+mux+",dst="+value( 'sout_udp_addr' );
            if( value('sout_udp_port' ) )
                option += ":"+value( 'sout_udp_port' );
            if( checked( 'sout_sap' ) )
            {
                option += ",sap";
                if( value( 'sout_sap_group' ) != '' )
                {
                    option += ",group=\""+value( 'sout_sap_group' )+"\"";
                }
                option += ",name=\""+value( 'sout_sap_name' )+"\"";
            }
            option += "}";
            aloo = true;
        }
        if( output > 1 ) option += "}";
    }
    if( option != "" )
        input_options.push( option );
    if( ( transcode || output ) && checked( 'sout_all' ) )
        input_options.push( ":sout-all" );
    var mrl = document.getElementById( 'sout_mrl' );
    mrl.value = option;
    refresh_input_options_list();
}
function update_sout ( ) { var option = "" ; remove_input_options ( ":sout" ) ; check_and_replace_int ( 'sout_http_port' , 8080 ) ; check_and_replace_int ( 'sout_mmsh_port' , 8080 ) ; check_and_replace_int ( 'sout_rtp_port' , 1234 ) ; check_and_replace_int ( 'sout_udp_port' , 1234 ) ; check_and_replace_int ( 'sout_ttl' , 1 ) ; if ( checked ( 'sout_soverlay' ) ) { disable ( 'sout_scodec' ) ; disable ( 'sout_sub' ) ; } else { enable ( 'sout_scodec' ) ; enable ( 'sout_sub' ) ; } var transcode = checked ( 'sout_vcodec_s' ) || checked ( 'sout_acodec_s' ) || checked ( 'sout_sub' ) || checked ( 'sout_soverlay' ) ; if ( transcode ) { option = ":sout=#transcode{" ; var alot = false ; if ( checked ( 'sout_vcodec_s' ) ) { option += "vcodec=" + value ( 'sout_vcodec' ) + ",vb=" + value ( 'sout_vb' ) + ",scale=" + value ( 'sout_scale' ) ; alot = true ; } if ( checked ( 'sout_acodec_s' ) ) { if ( alot ) option += "," ; option += "acodec=" + value ( 'sout_acodec' ) + ",ab=" + value ( 'sout_ab' ) ; if ( value ( 'sout_channels' ) ) option += ",channels=" + value ( 'sout_channels' ) ; alot = true ; } if ( checked ( 'sout_soverlay' ) ) { if ( alot ) option += "," ; option += "soverlay" ; alot = true ; } else if ( checked ( 'sout_sub' ) ) { if ( alot ) option += "," ; option += "scodec=" + value ( 'sout_scodec' ) ; alot = true ; } option += value ( 'sout_transcode_extra' ) ; option += "}" ; } var output = checked ( 'sout_display' ) + checked ( 'sout_file' ) + checked ( 'sout_http' ) + checked ( 'sout_mmsh' ) + checked ( 'sout_rtp' ) + checked ( 'sout_udp' ) ; if ( output ) { if ( transcode ) option += ":" ; else option += ":sout=#" ; var aloo = false ; var mux = radio_value ( 'sout_mux' ) ; var ttl = parseInt ( value ( 'sout_ttl' ) ) ; if ( output > 1 ) option += "duplicate{" ; if ( checked ( 'sout_display' ) ) { if ( output > 1 ) option += "dst=" option += "display" ; aloo = true ; } if ( checked ( 'sout_file' ) ) { if ( aloo ) option += "," ; if ( output > 1 ) option += "dst=" option += "std{access=file,mux=" + mux + ",dst=" + value ( 'sout_file_filename' ) + "}" ; aloo = true ; } if ( checked ( 'sout_http' ) ) { if ( aloo ) option += "," ; if ( output > 1 ) option += "dst=" option += "std{access=http,mux=" + mux + ",dst=" + value ( 'sout_http_addr' ) ; if ( value ( 'sout_http_port' ) ) option += ":" + value ( 'sout_http_port' ) ; option += "}" ; aloo = true ; } if ( checked ( 'sout_mmsh' ) ) { if ( aloo ) option += "," ; if ( output > 1 ) option += "dst=" option += "std{access=mmsh,mux=" + mux + ",dst=" + value ( 'sout_mmsh_addr' ) ; if ( value ( 'sout_mmsh_port' ) ) option += ":" + value ( 'sout_mmsh_port' ) ; option += "}" ; aloo = true ; } if ( checked ( 'sout_rtp' ) ) { if ( aloo ) option += "," ; if ( output > 1 ) option += "dst=" option += "std{access=rtp" ; if ( ttl ) option += "{ttl=" + ttl + "}" ; option += ",mux=" + mux + ",dst=" + value ( 'sout_rtp_addr' ) ; if ( value ( 'sout_rtp_port' ) ) option += ":" + value ( 'sout_rtp_port' ) ; if ( checked ( 'sout_sap' ) ) { option += ",sap" ; if ( value ( 'sout_sap_group' ) != '' ) { option += ",group=\"" + value ( 'sout_sap_group' ) + "\"" ; } option += ",name=\"" + value ( 'sout_sap_name' ) + "\"" ; } option += "}" ; aloo = true ; } if ( checked ( 'sout_udp' ) ) { if ( aloo ) option += "," ; if ( output > 1 ) option += "dst=" option += "std{access=udp" ; if ( ttl ) option += "{ttl=" + ttl + "}" ; option += ",mux=" + mux + ",dst=" + value ( 'sout_udp_addr' ) ; if ( value ( 'sout_udp_port' ) ) option += ":" + value ( 'sout_udp_port' ) ; if ( checked ( 'sout_sap' ) ) { option += ",sap" ; if ( value ( 'sout_sap_group' ) != '' ) { option += ",group=\"" + value ( 'sout_sap_group' ) + "\"" ; } option += ",name=\"" + value ( 'sout_sap_name' ) + "\"" ; } option += "}" ; aloo = true ; } if ( output > 1 ) option += "}" ; } if ( option != "" ) input_options . push ( option ) ; if ( ( transcode || output ) && checked ( 'sout_all' ) ) input_options . push ( ":sout-all" ) ; var mrl = document . getElementById ( 'sout_mrl' ) ; mrl . value = option ; refresh_input_options_list ( ) ; }
update the sout MRL using data from the sout_helper
update the sout MRL using data from the sout_helper
/* Remove all options starting with :sout since we're going to write them
     * again. */ /* alot == at least one transcode */ /* aloo == at least one output */