コード例 #1
0
ファイル: VlcDriverTests.cs プロジェクト: jonlawley/VlcDriver
 public void EnsureTheSameInstanceOfPortAllocatorIsAlwaysUsedWhenOnceIsSpecifiedInTheConstructor()
 {
     var portAllocator = new PortAllocator(MockRepository.GenerateMock<ILogger>());
     var driver = new VlcDriver(null, portAllocator);
     var job = driver.CreateAudioJob();
     Assert.AreEqual(portAllocator, job.PortAllocator);
 }
コード例 #2
0
ファイル: VlcJob.cs プロジェクト: PlumpMath/VlcDriver
        //Todo, Generate New FileName based on input file

        public string GetVlcArguments()
        {
            if (InputFile == null)
            {
                var noInputFileSpecifiedForJob = "No Input File Specified for job";
                logger.Error(noInputFileSpecifiedForJob);
                throw new InvalidOperationException(noInputFileSpecifiedForJob);
            }
            if (OutputFile == null)
            {
                var noOutputFileSpecifiedForJob = "No Output File Specified for job";
                logger.Error(noOutputFileSpecifiedForJob);
                throw new InvalidOperationException(noOutputFileSpecifiedForJob);
            }

            if (!InputFile.Exists)
            {
                var fileNotFoundException = new FileNotFoundException("Input file didn't exist", InputFile.FullName);
                logger.Error(fileNotFoundException);
                throw fileNotFoundException;
            }

            const string vlcQuitString = " vlc://quit";

            AllocatedPort = PortAllocator.NewPort();
            var interfaceArguments = string.Format("-I http --http-password {0} --http-port {1}", Properties.Settings.Default.VlcHttpPassword, AllocatedPort);

            var transcodeArgs = GetSpecificJobTypeArguments();
            var quitAfter     = QuitAfer ? vlcQuitString : string.Empty;
            var arguments     = string.Format("{0} \"{1}\" \":sout=#transcode{{{2}}}:std{{dst='{3}',access=file}}\"{4}", interfaceArguments, InputFile.FullName, transcodeArgs, OutputFile.FullName, quitAfter);

            return(arguments);
        }
コード例 #3
0
 public void EnsurePortAllocatorAlwaysAllocatesTheLowestPortNumber()
 {
     var allocator = new PortAllocator(MockRepository.GenerateMock<ILogger>())
     {
         StartPort = 1
     };
     Assert.AreEqual(1, allocator.NewPort());
     Assert.AreEqual(2, allocator.NewPort());
     Assert.AreEqual(3, allocator.NewPort());
     allocator.ReleasePort(3);
     Assert.AreEqual(3, allocator.NewPort());
     allocator.ReleasePort(1);
     Assert.AreEqual(1, allocator.NewPort());
 }
コード例 #4
0
ファイル: VlcJob.cs プロジェクト: PlumpMath/VlcDriver
 public void SetJobComplete()
 {
     State = JobState.Finished;
     PortAllocator.ReleasePort(AllocatedPort);
 }