Ejemplo n.º 1
0
        public IMedia Capture(IPlayoutServerChannel channel, TimeSpan tcIn, TimeSpan tcOut, bool narrowMode, string mediaName, string fileName)
        {
            _tcFormat = channel.VideoFormat;
            var directory = (ServerDirectory)_ownerServer.MediaDirectory;
            var newMedia  = new ServerMedia(directory, Guid.NewGuid(), 0, ArchiveDirectory)
            {
                FileName    = fileName,
                MediaName   = mediaName,
                TcStart     = tcIn,
                TcPlay      = tcIn,
                Duration    = tcOut - tcIn,
                MediaStatus = TMediaStatus.Copying,
                LastUpdated = DateTime.UtcNow,
                MediaType   = TMediaType.Movie
            };

            if (_recorder?.Capture(channel.Id, tcIn.ToSMPTETimecodeString(channel.VideoFormat), tcOut.ToSMPTETimecodeString(channel.VideoFormat), narrowMode, fileName) == true)
            {
                RecordingMedia = newMedia;
                Logger.Debug("Started recording from {0} file {1} TcIn {2} TcOut {3}", channel.ChannelName, fileName, tcIn, tcOut);
                return(newMedia);
            }
            Logger.Error("Unsuccessfull recording from {0} file {1} TcIn {2} TcOut {3}", channel.ChannelName, fileName, tcIn, tcOut);
            return(null);
        }
        public IMedia Capture(IPlayoutServerChannel channel, TimeSpan tcIn, TimeSpan tcOut, bool narrowMode, string fileName)
        {
            _tcFormat = channel.VideoFormat;
            var directory = (ServerDirectory)_ownerServer.MediaDirectory;
            var newMedia  = new ServerMedia(directory, Guid.NewGuid(), 0, ArchiveDirectory)
            {
                FileName = fileName, MediaName = fileName, TcStart = tcIn, TcPlay = tcIn, Duration = tcOut - tcIn, MediaStatus = TMediaStatus.Copying, LastUpdated = DateTime.UtcNow, MediaType = TMediaType.Movie
            };

            if (_recorder?.Capture(channel.Id, tcIn.ToSMPTETimecodeString(channel.VideoFormat), tcOut.ToSMPTETimecodeString(channel.VideoFormat), narrowMode, fileName) == true)
            {
//                directory.MediaAdd(newMedia);
                RecordingMedia    = newMedia;
                CaptureFileName   = fileName;
                CaptureTcIn       = tcIn;
                CaptureTcOut      = tcOut;
                CaptureTimeLimit  = tcOut - tcIn;
                CaptureNarrowMode = narrowMode;
                return(newMedia);
            }
            return(null);
        }