www.pudn.com > AVideoCapture.rar > CastOprUnt.pas


unit CastOprUnt; 
 
interface 
uses 
  AVideoFunctionUnt, LogonUnt, LiveSrvCastUnt, MainUnt, SockUnt, AVideoStatusUnt, SFLIVESERVERLib_TLB, Windows, Forms, CoolTrayIcon, 
  Controls, Messages, Sysutils, Variants, Classes, Graphics, Dialogs, Menus, 
  ImgList, StdCtrls, ComCtrls, ExtCtrls, ScktComp, OleCtrls, ToolWin, Inifiles, Buttons; 
 
procedure TimerEnabled(); 
procedure MyEnter_Allow(ParStr: string); ////登录确认 
procedure MyQuery_Desktop(ParStr: string); 
procedure PowerOff(Force: Boolean = False); //重启,关闭工作站广播指令 
procedure MySet_Options(ParStr: string); 
procedure MyTCPListenPort(ParStr: string); //设置监听端口,特殊针对所有频道 
procedure MyMultiAddr(iChNO: Integer; ParStr: string); //设置组播地址 当iChNO=-1时为单独设立 
procedure MyMultiPort(iChNO: Integer; ParStr: string); 
procedure MyCapVideoDevice(iChNO: Integer; ParStr: string); 
procedure MyCapAudioDevice(iChNO: Integer; ParStr: string); 
procedure MySendIP(iChNO: Integer; ParStr: string); 
procedure MyTcpSendPort(iChNO: Integer; ParStr: string); 
procedure MyRunMode(iChNO: Integer; ParStr: string); 
procedure MyVideoBitRate(iChNO: Integer; ParStr: string); 
procedure MyAudioBitRate(iChNO: Integer; ParStr: string); 
procedure MyIsStereoAudio(iChNO: Integer; ParStr: string); 
procedure MyShowVideo(iChNO: Integer; ParStr: string); 
procedure MyShowAudio(iChNO: Integer; ParStr: string); 
procedure MyCheckTVSignal(ParStr: string); 
procedure MyChooseVideoFormat(iChNO: Integer; ParStr: string); 
procedure MySetVideoFormat(iChNO: Integer; ParStr: string); 
procedure MyVideoStandard(iChNO: Integer; ParStr: string); 
procedure MyVideoSource(iChNO: Integer; ParStr: string); 
procedure MyAudioSource(iChNO: Integer; ParStr: string); 
procedure MySendVideo(iChNO: Integer; ParStr: string); 
procedure MySendAudio(iChNO: Integer; ParStr: string); 
procedure MyChannelDescribe(iChNO: Integer; ParStr: string); 
procedure MyBottomText(iChNO: Integer; ParStr: string); 
procedure MyTopText(iChNO: Integer; ParStr: string); 
procedure MyTextColor(iChNO: Integer; ParStr: string); 
procedure MyBottomTextMode(iChNO: Integer; ParStr: string); 
procedure MyTextHeight(iChNO: Integer; ParStr: string); 
procedure MyTVChannel(iChNO: Integer; ParStr: string); 
procedure MyTVAudioMode(iChNO: Integer; ParStr: string); 
procedure MyQuery_ChannelStatus(ParStr: string); 
procedure MySelect_LiveChannels(ParStr: string); 
procedure MySelect_ResServer(ParStr: string); 
procedure MyCastFileName(iChNO: Integer; ParStr: string); 
procedure MyRecFileName(iChNO: Integer; ParStr: string); 
procedure MyRecTime(iChNO: Integer; ParStr: string); 
procedure MyReplay(iChNO: Integer; ParStr: string); 
procedure MyTaskTime(iChNO: Integer; ParStr: string); 
procedure MyStopSaveFile(ParStr: string); 
procedure myStopCast(ParStr: string); 
procedure MyTextMove(ParStr: string); 
procedure MyDesktopSaveFile(ParStr: string); 
implementation 
 
uses UserPowerUnt; 
 
procedure MySet_Options(ParStr: string); 
var 
  ChNO: Integer; 
  SubParStr, SubItem, SubCmd: string; //子项目,子命令 
begin 
  try 
    //parstr:=0:>MultiAddr->192.168.1.198|SetWndSizel->X1,Y1,Width1,Heigh1,|/D/1:>MultiAddr->192.168.1.199|SetWndSizel->X2,Y2,Width2,Heigh2,| 
    while Pos(RecordEnd, ParStr) > 0 do begin 
      SubParStr := Copy(ParStr, 1, Pos(RecordEnd, ParStr) - 1); 
      //SubParStr := 0:>MultiAddr->192.168.1.198|SetWndSizel->X,Y,Width,Heigh,| 
      Delete(ParStr, 1, Pos(RecordEnd, ParStr) + 2); 
      //Parstr:=1:>MultiAddr->192.168.1.199|SetWndSizel->X2,Y2,Width2,Heigh2,| 
      ChNO := StrToInt(Copy(SubParStr, 1, Pos(ChNoOpr, SubParStr) - 1)); 
      //取得频道号  ChNO := 0 
      Delete(SubParStr, 1, Pos(ChNoOpr, SubParStr) + 1); 
      //删除频道号及格式符  subParStr := MultiAddr->192.168.1.198|SetWndSizel->X,Y,Width,Heigh,| 
      while Pos(FieldEnd, SubParStr) > 0 do begin 
        SubItem := Copy(SubParStr, 1, Pos(FieldEnd, SubParStr) - 1); 
        //取得子项目 SubItem := MultiAddr->192.168.1.198 
        Delete(SubParStr, 1, Pos(FieldEnd, SubParStr) + 1); 
        //删除此项目 subParStr := SetWndSizel->X,Y,Width,Heigh,| 
        SubCmd := Copy(SubItem, 1, Pos(SubValueOpr, SubItem) - 1); 
        //取得子命令   SubCmd := Multiaddr 
        Delete(SubItem, 1, Pos(SubValueOpr, SubItem) + 1); 
        //删除子命令 此时参数为  SubItem := 192.168.1.198 
        if (SubCmd + OverStr) = MultiAddr then MyMultiAddr(ChNO, SubItem) 
        else if (SubCmd + OverStr) = MultiPort then MyMultiPort(ChNO, SubItem) 
        else if (SubCmd + OverStr) = CapVideoDevice then MyCapVideoDevice(ChNO, SubItem) 
        else if (SubCmd + OverStr) = CapAudioDevice then MyCapAudioDevice(ChNO, SubItem) 
        else if (SubCmd + OverStr) = RecFileName then MyRecFileName(ChNO, SubItem) 
        else if (SubCmd + OverStr) = RecTime then MyRecTime(ChNO, SubItem) 
        else if (SubCmd + OverStr) = SendIP then MySendIP(ChNO, SubItem) 
        else if (SubCmd + OverStr) = TcpSendPort then MyTcpSendPort(ChNO, SubItem) 
        else if (SubCmd + OverStr) = RunMode then MyRunMode(ChNO, SubItem) 
        else if (SubCmd + OverStr) = VideoBitRate then MyVideoBitRate(ChNO, SubItem) 
        else if (SubCmd + OverStr) = AudioBitRate then MyAudioBitRate(ChNO, SubItem) 
        else if (SubCmd + OverStr) = IsStereoAudio then MyIsStereoAudio(ChNO, SubItem) 
        else if (SubCmd + OverStr) = ShowVideo then MyShowVideo(ChNO, SubItem) 
        else if (SubCmd + OverStr) = showaudio then MyShowAudio(ChNO, SubItem) 
        else if (SubCmd + OverStr) = ChooseVideoFormat then MyChooseVideoFormat(ChNO, SubItem) 
        else if (SubCmd + OverStr) = SetVideoFormat then MySetVideoFormat(ChNO, SubItem) 
        else if (SubCmd + OverStr) = VideoStandard then MyVideoStandard(ChNO, SubItem) 
        else if (SubCmd + OverStr) = VideoSource then MyVideoSource(ChNO, SubItem) 
        else if (SubCmd + OverStr) = AudioSource then MyAudioSource(ChNO, SubItem) 
        else if (SubCmd + OverStr) = sendvideo then MySendVideo(ChNO, SubItem) 
        else if (SubCmd + OverStr) = sendaudio then MySendAudio(ChNO, SubItem) 
        else if (SubCmd + OverStr) = ChannelDescribe then MyChannelDescribe(ChNO, SubItem) 
        else if (SubCmd + OverStr) = CastFileName then MyCastFileName(ChNO, SubItem) 
        else if (SubCmd + OverStr) = BottomText then MyBottomText(ChNO, SubItem) 
        else if (SubCmd + OverStr) = TopText then MyTopText(ChNO, SubItem) 
        else if (SubCmd + OverStr) = TextColor then MyTextColor(ChNO, SubItem) 
        else if (SubCmd + OverStr) = BottomTextMode then MyBottomTextMode(ChNO, SubItem) 
        else if (SubCmd + OverStr) = TextHeight then MyTextHeight(ChNO, SubItem) 
        else if (SubCmd + OverStr) = TVChannel then MyTVChannel(ChNO, SubItem) 
        else if (SubCmd + OverStr) = TVAudioMode then MyTVAudioMode(ChNO, SubItem) 
        else if (SubCmd + OverStr) = Replay then MyReplay(ChNO, SubItem) 
        else if (SubCmd + OverStr) = TaskTime then MyTaskTime(ChNO, SubItem) 
      end; 
    end; 
  except 
  end; 
end; 
 
procedure MyQuery_Desktop(ParStr: string); 
begin 
  sendcommand(SocketClient, Back + desktopstatus, BackBoolToStr(Desktop)); 
end; 
 
procedure PowerOff(Force: Boolean = False); 
var 
  hToken: THandle; 
  tkp: TTokenPrivileges; 
  tkpo: TTokenPrivileges; 
  zero: DWORD; 
begin 
  if Win32Platform = VER_PLATFORM_WIN32_NT then begin 
    zero := 0; 
    if not OpenProcessToken(GetCurrentProcess(), TOKEN_ADJUST_PRIVILEGES or TOKEN_QUERY, hToken) then begin 
      MessageBox(0, 'PowerOff Error', 'OpenProcessToken() Failed', MB_OK); 
      Exit; 
    end; 
    if not LookupPrivilegeValue(nil, 'SeShutdownPrivilege', tkp.Privileges[0].Luid) then begin 
      MessageBox(0, 'PowerOff Error', 'LookupPrivilegeValue() Failed', MB_OK); 
      Exit; 
    end; 
    tkp.PrivilegeCount := 1; 
    tkp.Privileges[0].Attributes := SE_PRIVILEGE_ENABLED; 
    AdjustTokenPrivileges(hToken, False, tkp, SizeOf(TTokenPrivileges), tkpo, zero); 
    if Boolean(GetLastError()) then begin 
      MessageBox(0, 'PowerOff Error', 'AdjustTokenPrivileges() Failed', MB_OK); 
      Exit; 
    end 
    else if Force then 
      ExitWindowsEx(EWX_POWEROFF, 1) 
    else ExitWindowsEx(EWX_REBOOT, 1); 
  end 
  else if Force then ExitWindowsEx(EWX_POWEROFF, 1) 
  else ExitWindowsEx(EWX_REBOOT, 1); 
end; 
 
procedure MyTCPListenPort(ParStr: string); 
begin 
  LiveSrvCast.LiveSrv.TCPListenPort := StrToInt(ParStr); 
end; 
 
procedure MyMultiAddr(iChNO: Integer; ParStr: string); //当iChNO=-1时为单独设立 
var 
  ChNO: Integer; 
begin 
  try 
    with LiveSrvCast.LiveSrv do begin 
      case iChNO of 
        -1: begin 
            ChNO := StrToInt(Copy(ParStr, 1, Pos(ChNoOpr, ParStr) - 1)); 
            //取得频道号 ChNO :=0 
            Delete(ParStr, 1, Pos(ChNoOpr, ParStr) + 1); 
            //ParStr := 192.168.1.198 
            MultiAddr[ChNO] := ParStr; 
          end; 
      else MultiAddr[iChNO] := ParStr; 
      end; 
    end; 
  except 
    sendcommand(SocketClient, Back + MultiAddr, BackBoolToStr(False)); 
  end; 
end; 
 
procedure MyCapVideoDevice(iChNO: Integer; ParStr: string); //是否采集视频(采集=1,不采集=0) 
var 
  ChNO: Integer; 
begin 
  try 
    with LiveSrvCast.LiveSrv do begin 
      case iChNO of 
        -1: begin 
            ChNO := StrToInt(Copy(ParStr, 1, Pos(ChNoOpr, ParStr) - 1)); 
            //取得频道号 ChNO :=0 
            Delete(ParStr, 1, Pos(ChNoOpr, ParStr) + 1); 
            //ParStr := 192.168.1.198 
            if ParStr = '0' then 
              CapVideoDevice[ChNO] := -1 
            else 
              CapVideoDevice[ChNO] := ChNO; 
          end; 
      else 
        if ParStr = '0' then 
          CapVideoDevice[iChNO] := -1 
        else 
          CapVideoDevice[iChNO] := iChNO; 
      end; 
    end; 
  except 
    sendcommand(SocketClient, Back + CapVideoDevice, BackBoolToStr(False)); 
  end; 
end; 
 
procedure MyCapAudioDevice(iChNO: Integer; ParStr: string); 
var 
  ChNO: Integer; 
begin 
  try 
    with LiveSrvCast.LiveSrv do begin 
      case iChNO of 
        -1: begin 
            ChNO := StrToInt(Copy(ParStr, 1, Pos(ChNoOpr, ParStr) - 1)); 
            //取得频道号 ChNO :=0 
            Delete(ParStr, 1, Pos(ChNoOpr, ParStr) + 1); 
            //ParStr := 192.168.1.198 
            if ParStr = '0' then 
              CapAudioDevice[ChNO] := -1 
            else 
              CapAudioDevice[ChNO] := ChNO; 
          end; 
      else 
        if ParStr = '0' then 
          CapAudioDevice[iChNO] := -1 
        else 
          CapAudioDevice[iChNO] := iChNO; 
      end; 
    end; 
  except 
    sendcommand(SocketClient, Back + CapAudioDevice, BackBoolToStr(False)); 
  end; 
end; 
 
procedure MyMultiPort(iChNO: Integer; ParStr: string); 
var 
  ChNO: Integer; 
begin 
  try 
    with LiveSrvCast.LiveSrv do begin 
      case iChNO of 
        -1: begin 
            ChNO := StrToInt(Copy(ParStr, 1, Pos(ChNoOpr, ParStr) - 1)); 
            //取得频道号 ChNO :=0 
            Delete(ParStr, 1, Pos(ChNoOpr, ParStr) + 1); 
            //ParStr := 192.168.1.198 
            MultiPort[ChNO] := StrToInt(ParStr); 
          end; 
      else MultiPort[iChNO] := StrToInt(ParStr); 
      end; 
    end; 
  except 
    sendcommand(SocketClient, Back + MultiPort, BackBoolToStr(False)); 
  end; 
end; 
 
procedure MySendIP(iChNO: Integer; ParStr: string); 
var 
  ChNO: Integer; 
begin 
  try 
    with LiveSrvCast.LiveSrv do begin 
      case iChNO of 
        -1: begin 
            ChNO := StrToInt(Copy(ParStr, 1, Pos(ChNoOpr, ParStr) - 1)); 
            //取得频道号 ChNO :=0 
            Delete(ParStr, 1, Pos(ChNoOpr, ParStr) + 1); 
            //ParStr := 192.168.1.198 
            SendIP[ChNO] := ParStr; 
          end; 
      else 
        SendIP[iChNO] := ParStr; 
      end; 
    end; 
  except 
    sendcommand(SocketClient, Back + SendIP, BackBoolToStr(False)); 
  end; 
end; 
 
procedure MyTcpSendPort(iChNO: Integer; ParStr: string); 
var 
  ChNO: Integer; 
begin 
  try 
    with LiveSrvCast.LiveSrv do begin 
      case iChNO of 
        -1: begin 
            ChNO := StrToInt(Copy(ParStr, 1, Pos(ChNoOpr, ParStr) - 1)); 
            //取得频道号 ChNO :=0 
            Delete(ParStr, 1, Pos(ChNoOpr, ParStr) + 1); 
            //ParStr := 192.168.1.198 
            TcpSendPort[ChNO] := StrToInt(ParStr); 
          end; 
      else 
        TcpSendPort[iChNO] := StrToInt(ParStr); 
      end; 
    end; 
  except 
    sendcommand(SocketClient, Back + TcpSendPort, BackBoolToStr(False)); 
  end; 
end; 
 
procedure MyRunMode(iChNO: Integer; ParStr: string); 
var 
  ChNO: Integer; 
begin 
  try 
    with LiveSrvCast.LiveSrv do begin 
      case iChNO of 
        -1: begin 
            ChNO := StrToInt(Copy(ParStr, 1, Pos(ChNoOpr, ParStr) - 1)); 
            //取得频道号 ChNO :=0 
            Delete(ParStr, 1, Pos(ChNoOpr, ParStr) + 1); 
            //ParStr := 192.168.1.198 
            RunMode[ChNO] := StrToInt(ParStr); 
          end; 
      else 
        RunMode[iChNO] := StrToInt(ParStr); 
      end; 
    end; 
  except 
    sendcommand(SocketClient, Back + RunMode, BackBoolToStr(False)); 
  end; 
end; 
 
procedure MyVideoBitRate(iChNO: Integer; ParStr: string); 
var 
  ChNO: Integer; 
begin 
  try 
    with LiveSrvCast.LiveSrv do begin 
      case iChNO of 
        -1: begin 
            ChNO := StrToInt(Copy(ParStr, 1, Pos(ChNoOpr, ParStr) - 1)); 
            //取得频道号 ChNO :=0 
            Delete(ParStr, 1, Pos(ChNoOpr, ParStr) + 1); 
            //ParStr := 192.168.1.198 
            VideoBitRate[ChNO] := StrToInt(ParStr); 
          end; 
      else 
        VideoBitRate[iChNO] := StrToInt(ParStr); 
      end; 
    end; 
  except 
    sendcommand(SocketClient, Back + VideoBitRate, BackBoolToStr(False)); 
  end; 
end; 
 
procedure MyAudioBitRate(iChNO: Integer; ParStr: string); 
var 
  ChNO: Integer; 
begin 
  try 
    with LiveSrvCast.LiveSrv do begin 
      case iChNO of 
        -1: begin 
            ChNO := StrToInt(Copy(ParStr, 1, Pos(ChNoOpr, ParStr) - 1)); 
            //取得频道号 ChNO :=0 
            Delete(ParStr, 1, Pos(ChNoOpr, ParStr) + 1); 
            //ParStr := 192.168.1.198 
            AudioBitRate[ChNO] := StrToInt(ParStr); 
          end; 
      else 
        AudioBitRate[iChNO] := StrToInt(ParStr); 
      end; 
    end; 
  except 
    sendcommand(SocketClient, Back + AudioBitRate, BackBoolToStr(False)); 
  end; 
end; 
 
procedure MyIsStereoAudio(iChNO: Integer; ParStr: string); 
var 
  ChNO: Integer; 
begin 
  try 
    with LiveSrvCast.LiveSrv do begin 
      case iChNO of 
        -1: begin 
            ChNO := StrToInt(Copy(ParStr, 1, Pos(ChNoOpr, ParStr) - 1)); 
            //取得频道号 ChNO :=0 
            Delete(ParStr, 1, Pos(ChNoOpr, ParStr) + 1); 
            //ParStr := 192.168.1.198 
            IsStereoAudio[ChNO] := BackStrToBool(ParStr) 
          end; 
      else 
        IsStereoAudio[iChNO] := BackStrToBool(ParStr) 
      end; 
    end; 
  except 
    sendcommand(SocketClient, Back + IsStereoAudio, BackBoolToStr(False)); 
  end; 
end; 
 
procedure MyShowVideo(iChNO: Integer; ParStr: string); 
var 
  ChNO: Integer; 
begin 
  try 
    with LiveSrvCast.LiveSrv do begin 
      case iChNO of 
        -1: begin 
            ChNO := StrToInt(Copy(ParStr, 1, Pos(ChNoOpr, ParStr) - 1)); 
            //取得频道号 ChNO :=0 
            Delete(ParStr, 1, Pos(ChNoOpr, ParStr) + 1); 
            //ParStr := 192.168.1.198 
            ShowVideo[ChNO] := BackStrToBool(ParStr); 
          end; 
      else 
        ShowVideo[iChNO] := BackStrToBool(ParStr); 
      end; 
    end; 
  except 
    sendcommand(SocketClient, Back + ShowVideo, BackBoolToStr(False)); 
  end; 
end; 
 
procedure MyShowAudio(iChNO: Integer; ParStr: string); 
var 
  ChNO: Integer; 
begin 
  try 
    with LiveSrvCast.LiveSrv do begin 
      case iChNO of 
        -1: begin 
            ChNO := StrToInt(Copy(ParStr, 1, Pos(ChNoOpr, ParStr) - 1)); 
            //取得频道号 ChNO :=0 
            Delete(ParStr, 1, Pos(ChNoOpr, ParStr) + 1); 
            //ParStr := 192.168.1.198 
            showaudio[ChNO] := BackStrToBool(ParStr); 
          end; 
      else 
        showaudio[iChNO] := BackStrToBool(ParStr); 
      end; 
    end; 
  except 
    sendcommand(SocketClient, Back + showaudio, BackBoolToStr(False)); 
  end; 
end; 
 
procedure MyCheckTVSignal(ParStr: string); 
var 
  ChNO: Integer; 
begin 
  try 
    ChNO := StrToInt(Copy(ParStr, 1, Pos(ChNoOpr, ParStr) - 1)); 
    //取得频道号 ChNO :=0 
    Delete(ParStr, 1, Pos(ChNoOpr, ParStr) + 1); 
    //ParStr := 192.168.1.198 
    if LiveSrvCast.LiveSrv.CheckTVSignal(ChNO, StrToInt(ParStr)) then 
      sendcommand(SocketClient, Back + CheckTVSignal, BackBoolToStr(True)) 
    else 
      sendcommand(SocketClient, Back + CheckTVSignal, BackBoolToStr(False)); 
  except 
    sendcommand(SocketClient, Back + CheckTVSignal, BackBoolToStr(False)); 
  end; 
end; 
 
procedure MySetVideoFormat(iChNO: Integer; ParStr: string); 
var 
  i, ChNO: Integer; 
  Width_Height_FrameRate: array[0..2] of Integer; 
begin 
  try 
    with LiveSrvCast.LiveSrv do begin 
      case iChNO of 
        -1: begin 
            ChNO := StrToInt(Copy(ParStr, 1, Pos(ChNoOpr, ParStr) - 1)); 
            //取得频道号 ChNO :=0 
            Delete(ParStr, 1, Pos(ChNoOpr, ParStr) + 1); 
            //ParStr := 192.168.1.198 
            for i := 0 to 2 do 
              if Pos(SubItemOpr, ParStr) > 0 then begin 
                Width_Height_FrameRate[i] := StrToInt(Copy(ParStr, 1, Pos(SubItemOpr, ParStr) - 1)); 
                CaptureWidth[ChNO, i] := Width_Height_FrameRate[i]; 
                Delete(ParStr, 1, Pos(SubItemOpr, ParStr)); 
              end; 
            TempCaptureWidth[ChNO] := CaptureWidth[ChNO, 0]; 
            SetVideoFormat(ChNO, Width_Height_FrameRate[0], Width_Height_FrameRate[1], Width_Height_FrameRate[2]); 
          end; 
      else begin 
          for i := 0 to 2 do 
            if Pos(SubItemOpr, ParStr) > 0 then begin 
              Width_Height_FrameRate[i] := StrToInt(Copy(ParStr, 1, Pos(SubItemOpr, ParStr) - 1)); 
              CaptureWidth[iChNO, i] := Width_Height_FrameRate[i]; 
              Delete(ParStr, 1, Pos(SubItemOpr, ParStr)); 
            end; 
          TempCaptureWidth[iChNO] := CaptureWidth[iChNO, 0]; 
          SetVideoFormat(iChNO, Width_Height_FrameRate[0], Width_Height_FrameRate[1], Width_Height_FrameRate[2]); 
        end; 
      end; 
    end; 
  except 
    sendcommand(SocketClient, Back + SetVideoFormat, BackBoolToStr(False)); 
  end; 
end; 
 
procedure MyVideoStandard(iChNO: Integer; ParStr: string); 
var 
  ChNO: Integer; 
begin 
  try 
    with LiveSrvCast.LiveSrv do begin 
      case iChNO of 
        -1: begin 
            ChNO := StrToInt(Copy(ParStr, 1, Pos(ChNoOpr, ParStr) - 1)); 
            //取得频道号 ChNO :=0 
            Delete(ParStr, 1, Pos(ChNoOpr, ParStr) + 1); 
            //ParStr := 192.168.1.198 
            VideoStandard[ChNO] := StrToInt(ParStr); 
          end; 
      else 
        VideoStandard[iChNO] := StrToInt(ParStr); 
      end; 
    end; 
  except 
    sendcommand(SocketClient, Back + VideoStandard, BackBoolToStr(False)); 
  end; 
end; 
 
procedure MyVideoSource(iChNO: Integer; ParStr: string); 
var 
  ChNO: Integer; 
begin 
  try 
    with LiveSrvCast.LiveSrv do begin 
      case iChNO of 
        -1: begin 
            ChNO := StrToInt(Copy(ParStr, 1, Pos(ChNoOpr, ParStr) - 1)); 
            //取得频道号 ChNO :=0 
            Delete(ParStr, 1, Pos(ChNoOpr, ParStr) + 1); 
            //ParStr := 192.168.1.198 
            VideoSource[ChNO] := StrToInt(ParStr); 
          end; 
      else 
        VideoSource[iChNO] := StrToInt(ParStr); 
      end; 
    end; 
  except 
    sendcommand(SocketClient, Back + VideoSource, BackBoolToStr(False)); 
  end; 
end; 
 
procedure MyAudioSource(iChNO: Integer; ParStr: string); 
var 
  ChNO: Integer; 
begin 
  try 
    with LiveSrvCast.LiveSrv do begin 
      case iChNO of 
        -1: begin 
            ChNO := StrToInt(Copy(ParStr, 1, Pos(ChNoOpr, ParStr) - 1)); 
            //取得频道号 ChNO :=0 
            Delete(ParStr, 1, Pos(ChNoOpr, ParStr) + 1); 
            //ParStr := 192.168.1.198 
            AudioSource[ChNO] := StrToInt(ParStr); 
          end; 
      else 
        AudioSource[iChNO] := StrToInt(ParStr); 
      end; 
    end; 
  except 
    sendcommand(SocketClient, Back + AudioSource, BackBoolToStr(False)); 
  end; 
end; 
 
procedure MySendVideo(iChNO: Integer; ParStr: string); 
var 
  ChNO: Integer; 
begin 
  try 
    with LiveSrvCast.LiveSrv do begin 
      case iChNO of 
        -1: begin 
            ChNO := StrToInt(Copy(ParStr, 1, Pos(ChNoOpr, ParStr) - 1)); 
            //取得频道号 ChNO :=0 
            Delete(ParStr, 1, Pos(ChNoOpr, ParStr) + 1); 
            //ParStr := 192.168.1.198 
            sendvideo[ChNO] := BackStrToBool(ParStr); 
          end; 
      else 
        sendvideo[iChNO] := BackStrToBool(ParStr); 
      end; 
    end; 
  except 
    sendcommand(SocketClient, Back + sendvideo, BackBoolToStr(False)); 
  end; 
end; 
 
procedure MySendAudio(iChNO: Integer; ParStr: string); 
var 
  ChNO: Integer; 
begin 
  try 
    with LiveSrvCast.LiveSrv do begin 
      case iChNO of 
        -1: begin 
            ChNO := StrToInt(Copy(ParStr, 1, Pos(ChNoOpr, ParStr) - 1)); 
            //取得频道号 ChNO :=0 
            Delete(ParStr, 1, Pos(ChNoOpr, ParStr) + 1); 
            //ParStr := 192.168.1.198 
            sendaudio[ChNO] := BackStrToBool(ParStr); 
          end; 
      else 
        sendaudio[iChNO] := BackStrToBool(ParStr); 
      end; 
    end; 
  except 
    sendcommand(SocketClient, Back + sendaudio, BackBoolToStr(False)); 
  end; 
end; 
 
procedure MyChannelDescribe(iChNO: Integer; ParStr: string); 
var 
  ChNO: Integer; 
begin 
  try 
    with LiveSrvCast.LiveSrv do begin 
      case iChNO of 
        -1: begin 
            ChNO := StrToInt(Copy(ParStr, 1, Pos(ChNoOpr, ParStr) - 1)); 
            //取得频道号 ChNO :=0 
            Delete(ParStr, 1, Pos(ChNoOpr, ParStr) + 1); 
            //ParStr := 192.168.1.198 
            ChannelDescribe[ChNO] := ParStr; 
          end; 
      else 
        ChannelDescribe[iChNO] := ParStr; 
      end; 
    end; 
  except 
    sendcommand(SocketClient, Back + ChannelDescribe, BackBoolToStr(False)); 
  end; 
end; 
 
procedure MyCastFileName(iChNO: Integer; ParStr: string); 
var 
  ChNO: Integer; 
begin 
  try 
    with LiveSrvCast.LiveSrv do begin 
      case iChNO of 
        -1: begin 
            ChNO := StrToInt(Copy(ParStr, 1, Pos(ChNoOpr, ParStr) - 1)); 
            //取得频道号 ChNO :=0 
            Delete(ParStr, 1, Pos(ChNoOpr, ParStr) + 1); 
            //ParStr := 192.168.1.198 
            FilesId[ChNO] := 0; 
            FilesList[ChNO].Clear; 
            while Pos(SubItemOpr, ParStr) > 0 do begin 
              FilesList[ChNO].Add(Copy(ParStr, 1, Pos(SubItemOpr, ParStr) - 1)); 
              Delete(ParStr, 1, Pos(SubItemOpr, ParStr)); 
            end; 
            CastFileName[ChNO] := FilesList[ChNO].Strings[FilesId[ChNO]]; 
          end; 
      else begin 
          FilesId[iChNO] := 0; 
          FilesList[iChNO].Clear; 
          while Pos(SubItemOpr, ParStr) > 0 do begin 
            FilesList[iChNO].Add(Copy(ParStr, 1, Pos(SubItemOpr, ParStr) - 1)); 
            Delete(ParStr, 1, Pos(SubItemOpr, ParStr)); 
          end; 
          CastFileName[iChNO] := FilesList[iChNO].Strings[FilesId[iChNO]]; 
        end; 
      end; 
    end; 
  except 
    sendcommand(SocketClient, Back + CastFileName, BackBoolToStr(False)); 
  end; 
end; 
 
procedure MyTaskTime(iChNO: Integer; ParStr: string); 
var 
  ChNO: Integer; 
  StopCastTimer: TTimer; 
begin 
  try 
    case iChNO of //独立设置 
      -1: begin 
          ChNO := StrToInt(Copy(ParStr, 1, Pos(ChNoOpr, ParStr) - 1)); 
          //取得频道号 ChNO :=0 
          Delete(ParStr, 1, Pos(ChNoOpr, ParStr) + 1); 
          //ParStr := 192.168.1.198 
          with Main do 
            StopCastTimer := FindComponent('StopCast' + IntToStr(ChNO) + 'Timer') as TTimer; 
          if StopCastTimer = nil then begin 
            StopCastTimer := TTimer.Create(Main); 
            StopCastTimer.Name := 'StopCast' + IntToStr(ChNO) + 'Timer'; 
            StopCastTimer.tag := 20 + ChNO; 
          end; 
          if LiveSrvCast.LiveSrv.BeginCast(ChNO) then begin 
            sendcommand(SocketClient, Back + Status, IntToStr(ChNO) + ChNoOpr + BackBoolToStr(True)); 
            StopCastTimer.Enabled := False; 
            StopCastTimer.OnTimer := Main.StopCastTimerTimer; 
            StopCastTimer.Interval := StrToInt(ParStr) * 1000; 
            StopCastTimer.Enabled := True; 
          end; 
        end; 
    else begin 
        with Main do 
          StopCastTimer := FindComponent('StopCast' + IntToStr(iChNO) + 'Timer') as TTimer; 
        if StopCastTimer = nil then begin 
          StopCastTimer := TTimer.Create(Main); 
          StopCastTimer.Name := 'StopCast' + IntToStr(iChNO) + 'Timer'; 
          StopCastTimer.tag := 20 + iChNO; 
        end; 
        if LiveSrvCast.LiveSrv.BeginCast(iChNO) then begin 
          sendcommand(SocketClient, Back + Status, IntToStr(iChNO) + ChNoOpr + BackBoolToStr(True)); 
          StopCastTimer.Enabled := False; 
          StopCastTimer.OnTimer := Main.StopCastTimerTimer; 
          StopCastTimer.Interval := StrToInt(ParStr) * 1000; 
          StopCastTimer.Enabled := True; 
        end; 
      end; 
    end; 
  except 
    sendcommand(SocketClient, Back + TaskTime, BackBoolToStr(False)) 
  end; 
end; 
 
procedure MyRecTime(iChNO: Integer; ParStr: string); 
var 
  ChNO: Integer; 
  StopSaveFileTimer: TTimer; 
begin 
  try 
    case iChNO of 
      -1: begin 
          ChNO := StrToInt(Copy(ParStr, 1, Pos(ChNoOpr, ParStr) - 1)); 
          //取得频道号 ChNO :=0 
          Delete(ParStr, 1, Pos(ChNoOpr, ParStr) + 1); 
          //ParStr := 192.168.1.198 
          with Main do 
            StopSaveFileTimer := FindComponent('StopSaveFile' + IntToStr(ChNO) + 'Timer') as TTimer; 
          if StopSaveFileTimer = nil then begin 
            StopSaveFileTimer := TTimer.Create(Main); 
            StopSaveFileTimer.Name := 'StopSaveFile' + IntToStr(ChNO) + 'Timer'; 
            StopSaveFileTimer.tag := 10 + ChNO; 
          end; 
          StopSaveFileTimer.Enabled := False; 
          StopSaveFileTimer.OnTimer := Main.StopSaveFileTimerTimer; 
          StopSaveFileTimer.Interval := StrToInt(ParStr) * 1000; 
          StopSaveFileTimer.Enabled := True; 
        end; 
    else 
      with Main do 
        StopSaveFileTimer := FindComponent('StopSaveFile' + IntToStr(iChNO) + 'Timer') as TTimer; 
      if StopSaveFileTimer = nil then begin 
        StopSaveFileTimer := TTimer.Create(Main); 
        StopSaveFileTimer.Name := 'StopSaveFile' + IntToStr(iChNO) + 'Timer'; 
        StopSaveFileTimer.tag := 10 + iChNO; 
      end; 
      StopSaveFileTimer.Enabled := False; 
      StopSaveFileTimer.OnTimer := Main.StopSaveFileTimerTimer; 
      StopSaveFileTimer.Interval := StrToInt(ParStr) * 1000; 
      StopSaveFileTimer.Enabled := True; 
    end; 
  except 
    sendcommand(SocketClient, Back + SaveFileName, BackBoolToStr(False)); 
  end; 
end; 
 
procedure MyRecFileName(iChNO: Integer; ParStr: string); 
var 
  ChNO: Integer; 
begin 
  try 
    with LiveSrvCast.LiveSrv do begin 
      case iChNO of 
        -1: begin 
            ChNO := StrToInt(Copy(ParStr, 1, Pos(ChNoOpr, ParStr) - 1)); 
            //取得频道号 ChNO :=0 
            Delete(ParStr, 1, Pos(ChNoOpr, ParStr) + 1); 
            //ParStr := 192.168.1.198 
            SaveFileName[ChNO] := ParStr; 
          end; 
      else 
        SaveFileName[iChNO] := ParStr; 
      end; 
    end; 
  except 
    sendcommand(SocketClient, Back + SaveFileName, BackBoolToStr(False)); 
  end; 
end; 
 
procedure MyBottomText(iChNO: Integer; ParStr: string); 
var 
  ChNO: Integer; 
  TextMoveTimer: TTimer; 
begin 
  try 
    case iChNO of 
      -1: begin 
          ChNO := StrToInt(Copy(ParStr, 1, Pos(ChNoOpr, ParStr) - 1)); 
          //取得频道号 ChNO :=0 
          TempCaptureWidth[ChNO] := CaptureWidth[ChNO, 0]; 
          Delete(ParStr, 1, Pos(ChNoOpr, ParStr) + 1); 
          with Main do 
            TextMoveTimer := FindComponent('TextMove' + IntToStr(ChNO) + 'Timer') as TTimer; 
          if TextMoveTimer = nil then begin 
            TextMoveTimer := TTimer.Create(Main); 
            TextMoveTimer.Name := 'TextMove' + IntToStr(ChNO) + 'Timer'; 
            TextMoveTimer.tag := 30 + ChNO; 
          end; 
          //ParStr := 192.168.1.198 
          LiveSrvCast.LiveSrv.BottomText[ChNO] := ParStr; 
          MsgLength := Length(ParStr); 
          if ParStr <> '' then begin 
            TextMoveTimer.Enabled := False; 
            TextMoveTimer.OnTimer := Main.TextMoveTimerTimer; 
            TextMoveTimer.Interval := appliini.ReadInteger('Scroll', 'Interval', 250); 
            iSpeed := appliini.ReadInteger('Scroll', 'Speed', 20); 
            iHeight := appliini.ReadInteger('Scroll', 'Height', 40); 
            TextMoveTimer.Enabled := True; 
          end 
          else 
            TextMoveTimer.Enabled := False; 
        end; 
    else begin 
        TempCaptureWidth[iChNO] := CaptureWidth[iChNO, 0]; 
        with Main do 
          TextMoveTimer := FindComponent('TextMove' + IntToStr(iChNO) + 'Timer') as TTimer; 
        if TextMoveTimer = nil then begin 
          TextMoveTimer := TTimer.Create(Main); 
          TextMoveTimer.Name := 'TextMove' + IntToStr(iChNO) + 'Timer'; 
          TextMoveTimer.tag := 30 + iChNO; 
        end; 
        LiveSrvCast.LiveSrv.BottomText[iChNO] := ParStr; 
        MsgLength := Length(ParStr); 
        if ParStr <> '' then begin 
          TextMoveTimer.Enabled := False; 
          TextMoveTimer.OnTimer := Main.TextMoveTimerTimer; 
          TextMoveTimer.Interval := appliini.ReadInteger('Scroll', 'Interval', 250); 
          iSpeed := appliini.ReadInteger('Scroll', 'Speed', 20); 
          iHeight := appliini.ReadInteger('Scroll', 'Height', 40); 
          TextMoveTimer.Enabled := True; 
        end 
        else 
          TextMoveTimer.Enabled := False; 
      end; 
    end; 
  except 
    sendcommand(SocketClient, Back + BottomText, BackBoolToStr(False)); 
  end; 
end; 
 
procedure MyTopText(iChNO: Integer; ParStr: string); 
var 
  ChNO: Integer; 
begin 
  try 
    with LiveSrvCast.LiveSrv do begin 
      case iChNO of 
        -1: begin 
            ChNO := StrToInt(Copy(ParStr, 1, Pos(ChNoOpr, ParStr) - 1)); 
            //取得频道号 ChNO :=0 
            Delete(ParStr, 1, Pos(ChNoOpr, ParStr) + 1); 
            //ParStr := 192.168.1.198 
            TopText[ChNO] := ParStr; 
          end; 
      else 
        TopText[iChNO] := ParStr; 
      end; 
    end; 
  except 
    sendcommand(SocketClient, Back + TopText, BackBoolToStr(False)); 
  end; 
end; 
 
procedure MyTextColor(iChNO: Integer; ParStr: string); 
var 
  ChNO: Integer; 
begin 
  try 
    with LiveSrvCast.LiveSrv do begin 
      case iChNO of 
        -1: begin 
            ChNO := StrToInt(Copy(ParStr, 1, Pos(ChNoOpr, ParStr) - 1)); 
            //取得频道号 ChNO :=0 
            Delete(ParStr, 1, Pos(ChNoOpr, ParStr) + 1); 
            //ParStr := 192.168.1.198 
            TextColor[ChNO] := StrToInt(ParStr); 
          end; 
      else 
        TextColor[iChNO] := StrToInt(ParStr); 
      end; 
    end; 
  except 
    sendcommand(SocketClient, Back + TextColor, BackBoolToStr(False)); 
  end; 
end; 
 
procedure MyBottomTextMode(iChNO: Integer; ParStr: string); 
var 
  ChNO: Integer; 
begin 
  try 
    with LiveSrvCast.LiveSrv do begin 
      case iChNO of 
        -1: begin 
            ChNO := StrToInt(Copy(ParStr, 1, Pos(ChNoOpr, ParStr) - 1)); 
            //取得频道号 ChNO :=0 
            Delete(ParStr, 1, Pos(ChNoOpr, ParStr) + 1); 
            //ParStr := 192.168.1.198 
            BottomTextMode[ChNO] := StrToInt(ParStr); 
          end; 
      else 
        BottomTextMode[iChNO] := StrToInt(ParStr); 
      end; 
    end; 
  except 
    sendcommand(SocketClient, Back + BottomTextMode, BackBoolToStr(False)); 
  end; 
end; 
 
procedure MyTextHeight(iChNO: Integer; ParStr: string); 
var 
  ChNO: Integer; 
begin 
  try 
    with LiveSrvCast.LiveSrv do begin 
      case iChNO of 
        -1: begin 
            ChNO := StrToInt(Copy(ParStr, 1, Pos(ChNoOpr, ParStr) - 1)); 
            //取得频道号 ChNO :=0 
            Delete(ParStr, 1, Pos(ChNoOpr, ParStr) + 1); 
            //ParStr := 192.168.1.198 
            TextHeight[ChNO] := StrToInt(ParStr); 
          end; 
      else 
        TextHeight[iChNO] := StrToInt(ParStr); 
      end; 
    end; 
  except 
    sendcommand(SocketClient, Back + TextHeight, BackBoolToStr(False)); 
  end; 
end; 
 
procedure MyTVChannel(iChNO: Integer; ParStr: string); 
var 
  ChNO: Integer; 
begin 
  try 
    with LiveSrvCast.LiveSrv do begin 
      case iChNO of 
        -1: begin 
            ChNO := StrToInt(Copy(ParStr, 1, Pos(ChNoOpr, ParStr) - 1)); 
            //取得频道号 ChNO :=0 
            Delete(ParStr, 1, Pos(ChNoOpr, ParStr) + 1); 
            //ParStr := 192.168.1.198 
            TVChannel[ChNO] := StrToInt(ParStr); 
          end; 
      else 
        TVChannel[iChNO] := StrToInt(ParStr); 
      end; 
    end; 
  except 
    sendcommand(SocketClient, Back + TVChannel, BackBoolToStr(False)); 
  end; 
end; 
 
procedure MyTVAudioMode(iChNO: Integer; ParStr: string); 
var 
  ChNO: Integer; 
begin 
  try 
    with LiveSrvCast.LiveSrv do begin 
      case iChNO of 
        -1: begin 
            ChNO := StrToInt(Copy(ParStr, 1, Pos(ChNoOpr, ParStr) - 1)); 
            //取得频道号 ChNO :=0 
            Delete(ParStr, 1, Pos(ChNoOpr, ParStr) + 1); 
            //ParStr := 192.168.1.198 
            TVAudioMode[ChNO] := StrToInt(ParStr); 
          end; 
      else 
        TVAudioMode[iChNO] := StrToInt(ParStr); 
      end; 
    end; 
  except 
    sendcommand(SocketClient, Back + TVAudioMode, BackBoolToStr(False)); 
  end; 
end; 
 
procedure MyChooseVideoFormat(iChNO: Integer; ParStr: string); 
begin 
  try 
    with LiveSrvCast.LiveSrv do begin 
      case iChNO of 
        -1: begin 
            //ChNO := StrToInt(Copy(ParStr, 1, Pos(ChNoOpr, ParStr) - 1)); 
            //取得频道号 ChNO :=0 
            //Delete(ParStr, 1, Pos(ChNoOpr, ParStr) + 1); 
            //ParStr := 192.168.1.198 
            ChooseVideoFormat(StrToInt(ParStr)); 
          end; 
      else 
        ChooseVideoFormat(iChNO); 
      end; 
    end; 
  except 
    sendcommand(SocketClient, Back + ChooseVideoFormat, BackBoolToStr(False)); 
  end; 
end; 
 
procedure MyStopSaveFile(ParStr: string); 
var 
  StopSaveFileTimer: TTimer; 
begin 
  try 
    with Main do 
      StopSaveFileTimer := FindComponent('StopSaveFile' + ParStr + 'Timer') as TTimer; 
    with LiveSrvCast.LiveSrv do begin 
      if IsChannelRunning(StrToInt(ParStr)) then begin 
        LiveSrvCast.LiveSrv.SaveFileName[StrToInt(ParStr)] := ''; 
        sendcommand(SocketClient, Back + FileSave, ParStr); 
        StopSaveFileTimer.Enabled := False; 
      end; 
    end; 
  except 
  end; 
end; 
 
procedure MyTextMove(ParStr: string); 
begin 
  try 
    LiveSrvCast.LiveSrv.SetBottomTextPos(StrToInt(ParStr), TempCaptureWidth[StrToInt(ParStr)], CaptureWidth[StrToInt(ParStr), 1] - iHeight); 
    if TempCaptureWidth[StrToInt(ParStr)] < (-MsgLength * 8) then 
      TempCaptureWidth[StrToInt(ParStr)] := CaptureWidth[StrToInt(ParStr), 0] //到最左,则重新从右开始 
    else 
      TempCaptureWidth[StrToInt(ParStr)] := TempCaptureWidth[StrToInt(ParStr)] - iSpeed; //向左移动20像素 
  except 
  end; 
end; 
 
procedure MyDesktopSaveFile(ParStr: string); 
begin 
  if not Main.RECCast.Checked then 
    MySet_Options(ParStr) // 把桌面直播录制 
  else 
    sendcommand(SocketClient, Desktop_FileSave, ''); 
  //桌面直播已由本机录制 
end; 
 
procedure myStopCast(ParStr: string); 
var 
  StopCastTimer, StopSaveFileTimer, TextMoveTimer: TTimer; 
begin 
  try 
    with Main do begin 
      StopCastTimer := FindComponent('StopCast' + ParStr + 'Timer') as TTimer; 
      StopSaveFileTimer := FindComponent('StopSaveFile' + ParStr + 'Timer') as TTimer; 
      TextMoveTimer := FindComponent('TextMove' + ParStr + 'Timer') as TTimer; 
    end; 
    if (StopCastTimer <> nil) and StopCastTimer.Enabled then 
      StopCastTimer.Enabled := False; 
    if (StopSaveFileTimer <> nil) and StopSaveFileTimer.Enabled then begin 
      StopSaveFileTimer.Enabled := False; 
      sendcommand(SocketClient, Back + FileSave, BackBoolToStr(False)); 
    end; 
    if (TextMoveTimer <> nil) and TextMoveTimer.Enabled then 
      TextMoveTimer.Enabled := False; 
    with LiveSrvCast.LiveSrv do 
      if IsChannelRunning(StrToInt(ParStr)) then begin 
        StopCast(StrToInt(ParStr)); 
        livesrvdefaultpar(StrToInt(ParStr), LiveSrvCast.LiveSrv); 
        sendcommand(SocketClient, Back + Status, ParStr + ChNoOpr + BackBoolToStr(False)); 
      end; 
  except 
  end; 
end; 
 
procedure MyReplay(iChNO: Integer; ParStr: string); 
var 
  ChNO: Integer; 
begin 
  try 
    with LiveSrvCast.LiveSrv do begin 
      case iChNO of 
        -1: begin 
            ChNO := StrToInt(Copy(ParStr, 1, Pos(ChNoOpr, ParStr) - 1)); 
            //取得频道号 ChNO :=0 
            Delete(ParStr, 1, Pos(ChNoOpr, ParStr) + 1); 
            //ParStr := 192.168.1.198 
            if ParStr = '0' then 
              If_RePlay[ChNO] := False 
            else 
              If_RePlay[ChNO] := True; 
          end; 
      else 
        if ParStr = '0' then 
          If_RePlay[iChNO] := False 
        else 
          If_RePlay[iChNO] := True; 
      end; 
    end; 
  except 
    sendcommand(SocketClient, Back + TVAudioMode, BackBoolToStr(False)); 
  end; 
end; 
 
procedure MyQuery_ChannelStatus(ParStr: string); 
var 
  iParStr: Integer; 
begin 
  iParStr := StrToInt(ParStr); 
  try 
    if LiveSrvCast.LiveSrv.IsChannelCreated(iParStr) then begin 
      if LiveSrvCast.LiveSrv.IsChannelRunning(iParStr) then 
        sendcommand(SocketClient, Back + Query_ChannelStatus, ParStr + ChNoOpr + 'Running') 
      else 
        sendcommand(SocketClient, Back + Query_ChannelStatus, ParStr + ChNoOpr + 'NoRun'); 
      //0:>MultiAddr->192.168.1.198|SetWndSizel->X,Y,Width,Heigh,| 
      with LiveSrvCast.LiveSrv do 
        sendcommand(SocketClient, Back + Query_ChannelStatus, ParStr + ChNoOpr 
          + 'TCPListenPort' + SubValueOpr + IntToStr(TCPListenPort) + FieldEnd 
          + 'CapVideoDevice' + SubValueOpr + IntToStr(CapVideoDevice[iParStr]) + FieldEnd 
          + 'CapAudioDevice' + SubValueOpr + IntToStr(CapAudioDevice[iParStr]) + FieldEnd 
          + 'MultiAddr' + SubValueOpr + MultiAddr[iParStr] + FieldEnd 
          + 'MultiPort' + SubValueOpr + IntToStr(MultiPort[iParStr]) + FieldEnd 
          + 'SendIP' + SubValueOpr + SendIP[iParStr] + FieldEnd 
          + 'TcpSendPort' + SubValueOpr + IntToStr(TcpSendPort[iParStr]) + FieldEnd 
          + 'RunMode' + SubValueOpr + IntToStr(RunMode[iParStr]) + FieldEnd 
          + 'VideoBitRate' + SubValueOpr + IntToStr(VideoBitRate[iParStr]) + FieldEnd 
          + 'AudioBitRate' + SubValueOpr + IntToStr(AudioBitRate[iParStr]) + FieldEnd 
          + 'IsStereoAudio' + SubValueOpr + BackBoolToStr(IsStereoAudio[iParStr]) + FieldEnd 
          + 'ShowVideo' + SubValueOpr + BackBoolToStr(ShowVideo[iParStr]) + FieldEnd 
          + 'ShowAudio' + SubValueOpr + BackBoolToStr(showaudio[iParStr]) + FieldEnd 
          + 'VideoStandard' + SubValueOpr + IntToStr(LiveSrvCast.LiveSrv.VideoStandard[iParStr]) + FieldEnd 
          + 'VideoSource' + SubValueOpr + IntToStr(LiveSrvCast.LiveSrv.VideoSource[iParStr]) + FieldEnd 
          + 'AudioSource' + SubValueOpr + IntToStr(LiveSrvCast.LiveSrv.AudioSource[iParStr]) + FieldEnd 
          + 'SendVideo' + SubValueOpr + BackBoolToStr(LiveSrvCast.LiveSrv.sendvideo[iParStr]) + FieldEnd 
          + 'SendAudio' + SubValueOpr + BackBoolToStr(LiveSrvCast.LiveSrv.sendaudio[iParStr]) + FieldEnd 
          + 'ChannelDescribe' + SubValueOpr + ChannelDescribe[iParStr] + FieldEnd 
          + 'CastFileName' + SubValueOpr + CastFileName[iParStr] + FieldEnd 
          + 'SaveFileName' + SubValueOpr + SaveFileName[iParStr] + FieldEnd 
          + 'BottomText' + SubValueOpr + BottomText[iParStr] + FieldEnd 
          + 'TopText' + SubValueOpr + TopText[iParStr] + FieldEnd 
          + 'TextColor' + SubValueOpr + IntToStr(TextColor[iParStr]) + FieldEnd 
          + 'BottomTextMode' + SubValueOpr + IntToStr(BottomTextMode[iParStr]) + FieldEnd 
          + 'TextHeight' + SubValueOpr + IntToStr(TextHeight[iParStr]) + FieldEnd 
          + 'TVChannel' + SubValueOpr + IntToStr(TVChannel[iParStr]) + FieldEnd 
          + 'TVAudioMode' + SubValueOpr + IntToStr(TVAudioMode[iParStr]) + FieldEnd); 
    end 
    else 
      sendcommand(SocketClient, Back + Query_ChannelStatus, ParStr + ChNoOpr + 'NoCreate'); 
  except 
    LiveSrvCast.LiveSrv.VideoSource[1] := 1; 
    sendcommand(SocketClient, Back + Query_ChannelStatus, BackBoolToStr(False)); 
  end; 
end; 
 
procedure TimerEnabled(); 
var 
  i: Integer; 
  StopCastTimer, StopSaveFileTimer, TextMoveTimer: array[0..2] of TTimer; 
begin 
  try 
    for i := 0 to 2 do begin 
      with Main do begin 
        StopCastTimer[i] := FindComponent('StopCast' + IntToStr(i) + 'Timer') as TTimer; 
        StopSaveFileTimer[i] := FindComponent('StopSaveFile' + IntToStr(i) + 'Timer') as TTimer; 
        TextMoveTimer[i] := FindComponent('TextMove' + IntToStr(i) + 'Timer') as TTimer; 
      end; 
      if StopCastTimer[i] <> nil then 
        sendcommand(SocketClient, 'TimerEnabled/*/', 'StopCastTimer' + IntToStr(i) + ':>' + BackBoolToStr(StopCastTimer[i].Enabled)); 
      if StopSaveFileTimer[i] <> nil then 
        sendcommand(SocketClient, 'TimerEnabled/*/', 'StopSaveFileTimer' + IntToStr(i) + ':>' + BackBoolToStr(StopSaveFileTimer[i].Enabled)); 
      if TextMoveTimer[i] <> nil then 
        sendcommand(SocketClient, 'TimerEnabled/*/', 'TextMoveTimer' + IntToStr(i) + ':>' + BackBoolToStr(TextMoveTimer[i].Enabled)); 
    end; 
  except 
  end; 
end; 
 
procedure MyEnter_Allow(ParStr: string); 
begin 
  AVideoCapture_ID := StrToInt(ParStr); 
  sendcommand(Operate_Data, Select_LiveChannels, Select_EditRec + OperParEnd 
    + 'select Channels,ChannelsName,VideoSrcList,AudioSrcList from LiveChannels where Direct_id = ' + IntToStr(AVideoCapture_ID) + ' order by Channels' + SQLEnd); 
  TrayIconHint(8); 
end; 
 
procedure MySelect_LiveChannels(ParStr: string); 
var 
  i, j: Integer; 
  SQLPar, SQLRec: string; 
  ParRecStr: array[0..2, 0..3] of string; 
  ChannelsExist: array[0..2] of Boolean; 
begin 
  if ParStr = '' then begin //无数据则,添加 
    for i := 0 to 2 do 
      if videoCard[i].Name <> '' then //本地需有视频卡 
        SQLPar := SQLPar + IntToStr(i) + FieldEnd + videoCard[i].Name + FieldEnd + IntToStr(AVideoCapture_ID) + FieldEnd + videoCard[i].VideoSrcList + FieldEnd + audeoCard[i].AudeoSrcList + FieldEnd + RecordEnd; 
    sendcommand(Operate_Data, Opr_LiveChannels, AddRec + OperParEnd 
      + 'select Channels,ChannelsName,Direct_id,VideoSrcList,AudioSrcList from LiveChannels' 
      + SQLEnd + SQLPar); 
    TrayIconHint(9); 
  end 
  else begin 
    for i := 0 to 2 do begin 
      SQLRec := Copy(ParStr, 1, Pos(RecordEnd, ParStr) - 1); 
      Delete(ParStr, 1, Pos(RecordEnd, ParStr) + 2); 
      for j := 0 to 3 do begin 
        if Pos(FieldEnd, SQLRec) > 0 then begin 
          ParRecStr[i, j] := Copy(SQLRec, 1, Pos(FieldEnd, SQLRec) - 1); 
          Delete(SQLRec, 1, Pos(FieldEnd, SQLRec) + 1); 
        end; 
      end; 
      if (ParRecStr[i, 0] <> '') then begin 
        ChannelsExist[StrToInt(ParRecStr[i, 0])] := True; 
        if (videoCard[StrToInt(ParRecStr[i, 0])].Name <> '') and (((ParRecStr[i, 2] <> videoCard[StrToInt(ParRecStr[i, 0])].VideoSrcList) or (ParRecStr[i, 3] <> audeoCard[StrToInt(ParRecStr[i, 0])].AudeoSrcList))) then begin 
          //数据库有频道,本地视频卡不同,则修改 
          sendcommand(Operate_Data, Opr_LiveChannels, Select_EditRec + OperParEnd 
            + 'select id,VideoSrcList,AudioSrcList from LiveChannels where Direct_id = ' + IntToStr(AVideoCapture_ID) + ' and Channels = ' + ParRecStr[i, 0] + ' order by id' 
            + SQLEnd + videoCard[StrToInt(ParRecStr[i, 0])].VideoSrcList + FieldEnd + audeoCard[StrToInt(ParRecStr[i, 0])].AudeoSrcList + FieldEnd + RecordEnd); 
          TrayIconHint(10); 
        end 
        else if (videoCard[StrToInt(ParRecStr[i, 0])].Name = '') then begin 
          //数据库有频道,本地无视频卡,则删除 
          sendcommand(Operate_Data, Opr_LiveChannels, DeleteRec + OperParEnd 
            + 'select * from LiveChannels where Direct_id = ' + IntToStr(AVideoCapture_ID) + ' and Channels = ' + ParRecStr[i, 0] + SQLEnd); 
          TrayIconHint(17); 
        end; 
      end; 
    end; 
    for i := 0 to 2 do 
      if (ChannelsExist[i] <> True) and (videoCard[i].Name <> '') then begin 
        //数据库无频道,本地有视频卡,则添加 
        sendcommand(Operate_Data, Opr_LiveChannels, AddRec + OperParEnd 
          + 'select Channels,ChannelsName,Direct_id,VideoSrcList,AudioSrcList from LiveChannels' 
          + SQLEnd + IntToStr(i) + FieldEnd + videoCard[i].Name + FieldEnd + IntToStr(AVideoCapture_ID) + FieldEnd + videoCard[i].VideoSrcList + FieldEnd + audeoCard[i].AudeoSrcList + FieldEnd + RecordEnd); 
        TrayIconHint(9); 
      end; 
  end; 
  sendcommand(Operate_Data, Select_ResServer, Select_EditRec + OperParEnd 
    + 'select ShareUser,SharePasswd,Media_Path from ResServer' + SQLEnd); 
  TrayIconHint(11); 
end; 
 
procedure MySelect_ResServer(ParStr: string); //设置共享路径 
var 
  i: Integer; 
  SubPar: array[0..2] of string; 
begin 
  try 
    while Pos(RecordEnd, ParStr) > 0 do begin 
      for i := 0 to 2 do begin 
        SubPar[i] := Copy(ParStr, 1, Pos(FieldEnd, ParStr) - 1); 
        Delete(ParStr, 1, Pos(FieldEnd, ParStr) + 1); 
      end; 
      Delete(ParStr, 1, Pos(RecordEnd, ParStr) + 2); 
      MySharePath(SubPar[0], SubPar[1], SubPar[2]); 
    end; 
    for i := 0 to 2 do 
      livesrvdefaultpar(i, LiveSrvCast.LiveSrv); 
    sendcommand(SocketClient, Init_Set, BackBoolToStr(True)); 
    TrayIconHint(14); 
  except 
    sendcommand(SocketClient, Init_Set, BackBoolToStr(False)); 
  end; 
end; 
 
end.