Esempio n. 1
0
 public void FilePlay(uint reserveID)
 {
     if (Settings.Instance.FilePlay && Settings.Instance.FilePlayOnAirWithExe)
     {
         //ファイルパスを取得するため開いてすぐ閉じる
         var info = new NWPlayTimeShiftInfo();
         try
         {
             if (CreateSrvCtrl().SendNwTimeShiftOpen(reserveID, ref info) == ErrCode.CMD_SUCCESS)
             {
                 CreateSrvCtrl().SendNwPlayClose(info.ctrlID);
                 if (info.filePath != "")
                 {
                     FilePlay(info.filePath);
                     return;
                 }
             }
         }
         catch { }
         MessageBox.Show("録画ファイルの場所がわかりませんでした。", "追っかけ再生", MessageBoxButton.OK, MessageBoxImage.Information);
     }
     else
     {
         TVTestCtrl.StartStreamingPlay(null, reserveID);
     }
 }
Esempio n. 2
0
 /// <summary>ストリーム配信用ファイルをタイムシフトモードで開く</summary>
 public ErrCode SendNwTimeShiftOpen(uint val, ref NWPlayTimeShiftInfo resVal)
 {
     object o = resVal; return(SendAndReceiveCmdData(CtrlCmd.CMD_EPG_SRV_NWPLAY_TF_OPEN, val, ref o));
 }
Esempio n. 3
0
        public bool StartStreamingPlay(string filePath, uint reserveID)
        {
            try
            {
                if (Settings.Instance.TvTestExe.Length == 0)
                {
                    MessageBox.Show("TVTest.exeのパスが設定されていません");
                    return(false);
                }
                if (CommonManager.Instance.NWMode == false)
                {
                    if (IniFileHandler.GetPrivateProfileInt("SET", "EnableTCPSrv", 0, SettingPath.TimerSrvIniPath) == 0)
                    {
                        MessageBox.Show("動作設定でネットワーク接続を許可する必要があります。");
                        return(false);
                    }
                }
                var sendInfo = new TVTestStreamingInfo();
                if (filePath == null)
                {
                    var     playInfo = new NWPlayTimeShiftInfo();
                    ErrCode err      = CommonManager.CreateSrvCtrl().SendNwTimeShiftOpen(reserveID, ref playInfo);
                    if (err != ErrCode.CMD_SUCCESS)
                    {
                        MessageBox.Show(CommonManager.GetErrCodeText(err) ?? "まだ録画が開始されていません。");
                        return(false);
                    }
                    sendInfo.ctrlID   = playInfo.ctrlID;
                    sendInfo.filePath = playInfo.filePath;
                }
                else
                {
                    ErrCode err = CommonManager.CreateSrvCtrl().SendNwPlayOpen(filePath, ref sendInfo.ctrlID);
                    if (err != ErrCode.CMD_SUCCESS)
                    {
                        MessageBox.Show(CommonManager.GetErrCodeText(err) ?? "ファイルを開けませんでした。");
                        return(false);
                    }
                }

                OpenTVTest(1000, false);
                var cmdTvTest = new CtrlCmdUtil();
                cmdTvTest.SetPipeSetting("Global\\TvTest_Ctrl_BonConnect_" + process.Id, "TvTest_Ctrl_BonPipe_" + process.Id);
                cmdTvTest.SetConnectTimeOut(1000);

                sendInfo.enableMode = 1;
                if (CommonManager.Instance.NWMode == false)
                {
                    sendInfo.serverIP = 0x7F000001;
                    // 原作はここで自ホスト名を取得して解決したアドレスを格納している。(ないとは思うが)不具合があれば戻すこと
                    sendInfo.serverPort = (UInt32)IniFileHandler.GetPrivateProfileInt("SET", "TCPPort", 4510, SettingPath.TimerSrvIniPath);
                }
                else
                {
                    sendInfo.serverIP = 0x7F000001;
                    IPAddress srvIP = CommonManager.Instance.NWConnectedIP;
                    if (srvIP != null && srvIP.GetAddressBytes().Length == 4)
                    {
                        byte[] oct = srvIP.GetAddressBytes();
                        sendInfo.serverIP = (uint)oct[0] << 24 | (uint)oct[1] << 16 | (uint)oct[2] << 8 | oct[3];
                    }
                    sendInfo.serverPort = CommonManager.Instance.NWConnectedPort;
                }
                if (Settings.Instance.NwTvModeUDP == true)
                {
                    sendInfo.udpSend = 1;
                }
                if (Settings.Instance.NwTvModeTCP == true)
                {
                    sendInfo.tcpSend = 1;
                }
                for (int i = 0; i < 10 && cmdTvTest.SendViewSetStreamingInfo(sendInfo) != ErrCode.CMD_SUCCESS; i++)
                {
                    System.Threading.Thread.Sleep(1000);
                }

                WakeupWindow(process.MainWindowHandle);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace);
            }
            return(true);
        }
Esempio n. 4
0
        public bool StartTimeShift(UInt32 reserveID)
        {
            try
            {
                if (Settings.Instance.TvTestExe.Length == 0)
                {
                    MessageBox.Show("TVTest.exeのパスが設定されていません");
                    return(false);
                }
                if (CommonManager.Instance.NWMode == false)
                {
                    if (IniFileHandler.GetPrivateProfileInt("SET", "EnableTCPSrv", 0, SettingPath.TimerSrvIniPath) == 0)
                    {
                        MessageBox.Show("追っかけ再生を行うには、動作設定でネットワーク接続を許可する必要があります。");
                        return(false);
                    }
                }
                NWPlayTimeShiftInfo playInfo = new NWPlayTimeShiftInfo();
                UInt32 err = cmd.SendNwTimeShiftOpen(reserveID, ref playInfo);
                if (err == 205)
                {
                    MessageBox.Show("サーバーに接続できませんでした");
                    return(false);
                }
                else if (err != 1)
                {
                    MessageBox.Show("まだ録画が開始されていません");
                    return(false);
                }

                if (IsOpenTVTest() == false)
                {
                    processID = FindTVTestProcess();
                    if (processID == -1)
                    {
                        Process process;
                        process   = System.Diagnostics.Process.Start(Settings.Instance.TvTestExe, Settings.Instance.TvTestCmd);
                        processID = process.Id;
                        System.Threading.Thread.Sleep(1000);
                    }
                }
                cmdTvTest.SetPipeSetting("Global\\TvTest_Ctrl_BonConnect_" + processID.ToString(), "\\\\.\\pipe\\TvTest_Ctrl_BonPipe_" + processID.ToString());
                cmdTvTest.SetConnectTimeOut(1000);

                TVTestStreamingInfo sendInfo = new TVTestStreamingInfo();
                sendInfo.enableMode = 1;
                sendInfo.ctrlID     = playInfo.ctrlID;
                if (CommonManager.Instance.NWMode == false)
                {
                    sendInfo.serverIP = 0x7F000001;

                    string      hostname = Dns.GetHostName();
                    IPAddress[] adrList  = Dns.GetHostAddresses(hostname);
                    foreach (IPAddress address in adrList)
                    {
                        if (address.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork)
                        {
                            UInt32 ip    = 0;
                            Int32  shift = 24;
                            foreach (string word in address.ToString().Split('.'))
                            {
                                ip    |= Convert.ToUInt32(word) << shift;
                                shift -= 8;
                            }
                            sendInfo.serverIP = ip;
                            break;
                        }
                    }

                    sendInfo.serverPort = (UInt32)IniFileHandler.GetPrivateProfileInt("SET", "TCPPort", 4510, SettingPath.TimerSrvIniPath);
                }
                else
                {
                    UInt32 ip    = 0;
                    Int32  shift = 24;
                    String srvIP = CommonManager.Instance.NW.ConnectedIP;
                    foreach (IPAddress address in Dns.GetHostAddresses(CommonManager.Instance.NW.ConnectedIP))
                    {
                        srvIP = address.ToString();
                    }
                    foreach (string word in srvIP.Split('.'))
                    {
                        ip    |= Convert.ToUInt32(word) << shift;
                        shift -= 8;
                    }
                    sendInfo.serverIP   = ip;
                    sendInfo.serverPort = CommonManager.Instance.NW.ConnectedPort;
                }
                sendInfo.filePath = playInfo.filePath;
                if (Settings.Instance.NwTvModeUDP == true)
                {
                    sendInfo.udpSend = 1;
                }
                if (Settings.Instance.NwTvModeTCP == true)
                {
                    sendInfo.tcpSend = 1;
                }
                if (cmdTvTest.SendViewSetStreamingInfo(sendInfo) != 1)
                {
                    System.Threading.Thread.Sleep(5 * 1000);
                    cmdTvTest.SendViewSetStreamingInfo(sendInfo);
                }

                WakeupWindow(processID);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace);
            }
            return(true);
        }
Esempio n. 5
0
        public bool StartTimeShift(UInt32 reserveID)
        {
            try
            {
                if (Settings.Instance.TvTestExe.Length == 0)
                {
                    MessageBox.Show("TVTest.exeのパスが設定されていません");
                    return false;
                }
                if (CommonManager.Instance.NWMode == false)
                {
                    if (IniFileHandler.GetPrivateProfileInt("SET", "EnableTCPSrv", 0, SettingPath.TimerSrvIniPath) == 0)
                    {
                        MessageBox.Show("追っかけ再生を行うには、動作設定でネットワーク接続を許可する必要があります。");
                        return false;
                    }
                }
                NWPlayTimeShiftInfo playInfo = new NWPlayTimeShiftInfo();
                UInt32 err = cmd.SendNwTimeShiftOpen(reserveID, ref playInfo);
                if (err == 205)
                {
                    MessageBox.Show("サーバーに接続できませんでした");
                    return false;
                }
                else if( err != 1 )
                {
                    MessageBox.Show("まだ録画が開始されていません");
                    return false;
                }

                if (IsOpenTVTest() == false)
                {
                    processID = FindTVTestProcess();
                    if (processID == -1)
                    {
                        Process process;
                        process = System.Diagnostics.Process.Start(Settings.Instance.TvTestExe, Settings.Instance.TvTestCmd);
                        processID = process.Id;
                        System.Threading.Thread.Sleep(1000);
                    }
                }
                cmdTvTest.SetPipeSetting("Global\\TvTest_Ctrl_BonConnect_" + processID.ToString(), "\\\\.\\pipe\\TvTest_Ctrl_BonPipe_" + processID.ToString());
                cmdTvTest.SetConnectTimeOut(1000);

                TVTestStreamingInfo sendInfo = new TVTestStreamingInfo();
                sendInfo.enableMode = 1;
                sendInfo.ctrlID = playInfo.ctrlID;
                if (CommonManager.Instance.NWMode == false)
                {
                    sendInfo.serverIP = 0x7F000001;

                    string hostname = Dns.GetHostName();
                    IPAddress[] adrList = Dns.GetHostAddresses(hostname);
                    foreach (IPAddress address in adrList)
                    {
                        if (address.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork)
                        {
                            UInt32 ip = 0;
                            Int32 shift = 24;
                            foreach (string word in address.ToString().Split('.'))
                            {
                                ip |= Convert.ToUInt32(word) << shift;
                                shift -= 8;
                            }
                            sendInfo.serverIP = ip;
                            break;
                        }
                    }

                    sendInfo.serverPort = (UInt32)IniFileHandler.GetPrivateProfileInt("SET", "TCPPort", 4510, SettingPath.TimerSrvIniPath);
                }
                else
                {
                    UInt32 ip = 0;
                    Int32 shift = 24;
                    String srvIP = CommonManager.Instance.NW.ConnectedIP;
                    foreach (IPAddress address in Dns.GetHostAddresses(CommonManager.Instance.NW.ConnectedIP))
                    {
                        srvIP = address.ToString();
                    }
                    foreach (string word in srvIP.Split('.'))
                    {
                        ip |= Convert.ToUInt32(word) << shift;
                        shift -= 8;
                    }
                    sendInfo.serverIP = ip;
                    sendInfo.serverPort = CommonManager.Instance.NW.ConnectedPort;
                }
                sendInfo.filePath = playInfo.filePath;
                if (Settings.Instance.NwTvModeUDP == true)
                {
                    sendInfo.udpSend = 1;
                }
                if (Settings.Instance.NwTvModeTCP == true)
                {
                    sendInfo.tcpSend = 1;
                }
                if (cmdTvTest.SendViewSetStreamingInfo(sendInfo) != 1)
                {
                    System.Threading.Thread.Sleep(5 * 1000);
                    cmdTvTest.SendViewSetStreamingInfo(sendInfo);
                }

                WakeupWindow(processID);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace);
            }
            return true;
        }
Esempio n. 6
0
        public bool StartTimeShift(UInt32 reserveID)
        {
            try
            {
                if (Settings.Instance.TvTestExe.Length == 0)
                {
                    MessageBox.Show("TVTest.exeのパスが設定されていません");
                    return false;
                }
                if (CommonManager.Instance.NWMode == false)
                {
                    if (IniFileHandler.GetPrivateProfileInt("SET", "EnableTCPSrv", 0, SettingPath.TimerSrvIniPath) == 0)
                    {
                        MessageBox.Show("追っかけ再生を行うには、動作設定でネットワーク接続を許可する必要があります。");
                        return false;
                    }
                }
                NWPlayTimeShiftInfo playInfo = new NWPlayTimeShiftInfo();
                ErrCode err = cmd.SendNwTimeShiftOpen(reserveID, ref playInfo);
                if (err == ErrCode.CMD_ERR_CONNECT)
                {
                    MessageBox.Show("サーバーに接続できませんでした");
                    return false;
                }
                else if( err != ErrCode.CMD_SUCCESS )
                {
                    MessageBox.Show("まだ録画が開始されていません");
                    return false;
                }

                OpenTVTest(1000, "TvTest");
                var cmdTvTest = new CtrlCmdUtil();
                cmdTvTest.SetPipeSetting("Global\\TvTest_Ctrl_BonConnect_" + process.Id, "\\\\.\\pipe\\TvTest_Ctrl_BonPipe_" + process.Id);
                cmdTvTest.SetConnectTimeOut(1000);

                TVTestStreamingInfo sendInfo = new TVTestStreamingInfo();
                sendInfo.enableMode = 1;
                sendInfo.ctrlID = playInfo.ctrlID;
                if (CommonManager.Instance.NWMode == false)
                {
                    sendInfo.serverIP = 0x7F000001;
                    // 原作はここで自ホスト名を取得して解決したアドレスを格納している。(ないとは思うが)不具合があれば戻すこと
                    sendInfo.serverPort = (UInt32)IniFileHandler.GetPrivateProfileInt("SET", "TCPPort", 4510, SettingPath.TimerSrvIniPath);
                }
                else
                {
                    sendInfo.serverIP = 0x7F000001;
                    IPAddress srvIP = CommonManager.Instance.NW.ConnectedIP;
                    if (srvIP != null && srvIP.GetAddressBytes().Length == 4)
                    {
                        byte[] oct = srvIP.GetAddressBytes();
                        sendInfo.serverIP = (uint)oct[0] << 24 | (uint)oct[1] << 16 | (uint)oct[2] << 8 | oct[3];
                    }
                    sendInfo.serverPort = CommonManager.Instance.NW.ConnectedPort;
                }
                sendInfo.filePath = playInfo.filePath;
                if (Settings.Instance.NwTvModeUDP == true)
                {
                    sendInfo.udpSend = 1;
                }
                if (Settings.Instance.NwTvModeTCP == true)
                {
                    sendInfo.tcpSend = 1;
                }
                for (int i = 0; i < 10 && cmdTvTest.SendViewSetStreamingInfo(sendInfo) != ErrCode.CMD_SUCCESS; i++)
                {
                    System.Threading.Thread.Sleep(1000);
                }

                WakeupWindow(process.MainWindowHandle);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace);
            }
            return true;
        }
Esempio n. 7
0
        public void FilePlay(ReserveData data)
        {
            if (data == null || data.RecSetting == null || data.IsEnabled == false) return;
            if (data.IsOnRec() == false)
            {
                MessageBox.Show("まだ録画が開始されていません。", "追っかけ再生", MessageBoxButton.OK, MessageBoxImage.Information);
                return;
            }
            if (data.RecSetting.RecMode == 4)//視聴モード
            {
                TVTestCtrl.SetLiveCh(data.OriginalNetworkID, data.TransportStreamID, data.ServiceID);
                return;
            }

            if (Settings.Instance.FilePlayOnAirWithExe)
            {
                //ファイルパスを取得するため開いてすぐ閉じる
                var info = new NWPlayTimeShiftInfo();
                if (CtrlCmd.SendNwTimeShiftOpen(data.ReserveID, ref info) == ErrCode.CMD_SUCCESS)
                {
                    CtrlCmd.SendNwPlayClose(info.ctrlID);
                    if (info.filePath != "")
                    {
                        FilePlay(info.filePath);
                        return;
                    }
                }
                MessageBox.Show("録画ファイルの場所がわかりませんでした。", "追っかけ再生", MessageBoxButton.OK, MessageBoxImage.Information);
            }
            else
            {
                TVTestCtrl.StartTimeShift(data.ReserveID);
            }
        }