<?php
include("config.php");

$file = str_replace("/","\\",$_GET['file']);
//$file = "mms://qstream-wm.qbrick.com/00928/kluster/20080313/AA_EP75_MASTER.wmv";

$commands = array(
                "del $vlcName",
                "new $vlcName broadcast enabled",
				//"new $vlcName vod enabled",
                "setup $vlcName input \"$file\"",
                "setup $vlcName output %23transcode{fps=25,vcodec=mp2v,vb=800,scale=1,acodec=mp2a,ab=256}:std{access=udp,mux=ts,dst=$vlcAddress}",
				//"setup $vlcName output %23transcode{fps=25,vcodec=mp2v,vb=1024,scale=1}",
                "control $vlcName play"
                );


if($_GET['play'] == "true")
{
        echo file_get_contents($vlcHttp."/requests/vlm_cmd.xml?command=control%20$vlcName%20play");

}
else if($_GET['stop'] == "true")
{
        echo file_get_contents($vlcHttp."/requests/vlm_cmd.xml?command=control%20$vlcName%20stop");
}
else if($_GET['pause'] == "true")
{
        echo file_get_contents($vlcHttp."/requests/vlm_cmd.xml?command=control%20$vlcName%20pause");
}
else if($_GET['fix'] == "true")
{
        echo file_get_contents($vlcHttp."/requests/vlm_cmd.xml?command=setup%20$vlcName%20output%20%23transcode{fps=25,vcodec=mp2v,vb=1000,scale=1,acodec=mp2a,ab=512}:std{access=udp,mux=ts,dst=$vlcAddress}");
}
else
{

        for($i=0;$i<count($commands);$i++)
        {
                $cmd = str_replace(" ", "%20", $commands[$i]);
                echo $i." -> ".file_get_contents($vlcHttp."/requests/vlm_cmd.xml?command=".$cmd)."<br />";
        }
}

?>
