Пример #1
0
        public bool Stop()
        {
            StreamLog.Debug(context.Identifier, "VLCManagedEncoder: Stopping transcoding");
            try
            {
                DataOutputStream.Close();
            }
            catch (Exception e)
            {
                StreamLog.Info(context.Identifier, "VLCManagedEncoder: Failed to close data output stream", e);
            }

            inputTimer.Enabled = false;
            StreamLog.Trace(context.Identifier, "VLCManagedEncoder: Trying to stop vlc");
            transcoder.StopTranscoding();
            transcoder = null;
            StreamLog.Debug(context.Identifier, "VLCManagedEncoder: Stopped transcoding");

            return(true);
        }
Пример #2
0
        public bool Stop()
        {
            Log.Debug("VLCManagedEncoder: Stopping transcoding");
            try
            {
                DataOutputStream.Close();
            }
            catch (Exception e)
            {
                Log.Info("VLCManagedEncoder: Failed to close data output stream", e);
            }

            infoReader.Abort();
            Log.Trace("VLCManagedEncoder: Trying to stop vlc");
            transcoder.StopTranscoding();
            transcoder = null;
            Log.Debug("VLCManagedEncoder: Stopped transcoding");

            return(true);
        }
Пример #3
0
        public bool Setup()
        {
            // setup output named pipe
            DataOutputStream = new NamedPipe();
            string output = ((NamedPipe)DataOutputStream).Url;

            StreamLog.Info(context.Identifier, "VLCManagedEncoder: starting output named pipe {0}", output);
            ((NamedPipe)DataOutputStream).Start(false);

            // prepare sout, needs some trickery for vlc
            string realSout = sout.Replace("#OUT#", @"\" + output);

            // debug
            StreamLog.Debug(context.Identifier, "VLCManagedEncoder: sout {0}", realSout);
            StreamLog.Debug(context.Identifier, "VLCManagedEncoder: arguments {0}", String.Join("|", arguments));

            // start vlc
            transcoder = new VLCTranscoder();
            transcoder.SetArguments(arguments);
            transcoder.SetMediaName(Guid.NewGuid().ToString());
            transcoder.SetSout(realSout);

            // setup input
            if (inputMethod == InputMethod.NamedPipe)
            {
                transcoderInputStream = new NamedPipe();
                StreamLog.Info(context.Identifier, "VLCManagedEncoder: starting input named pipe {0}", transcoderInputStream);
                ((NamedPipe)transcoderInputStream).Start(false);
                inputPath = "stream://" + transcoderInputStream.Url; // use special syntax for VLC to pick up named pipe
            }
            StreamLog.Debug(context.Identifier, "VLCManagedEncoder: input {0}", inputPath);
            transcoder.SetInput(inputPath);

            // start transcoding
            transcoder.StartTranscoding();
            // doesn't work
            //transcoder.Seek(startPos * 1.0 / context.MediaInfo.Duration * 1000);

            context.TranscodingInfo.Supported = true;
            return(true);
        }
Пример #4
0
        public bool Stop()
        {
            Log.Debug("VLCManagedEncoder: Stopping transcoding");
            try
            {
                DataOutputStream.Close();
            }
            catch (Exception e)
            {
                Log.Info("VLCManagedEncoder: Failed to close data output stream", e);
            }

            inputTimer.Enabled = false;
            Log.Trace("VLCManagedEncoder: Trying to stop vlc");
            transcoder.StopTranscoding();
            transcoder = null;
            Log.Debug("VLCManagedEncoder: Stopped transcoding");

            return true;
        }
Пример #5
0
        public bool Setup()
        {
            // setup output named pipe
            DataOutputStream = new NamedPipe();
            string output = ((NamedPipe)DataOutputStream).Url;
            Log.Info("VLCManagedEncoder: starting output named pipe {0}", output);
            ((NamedPipe)DataOutputStream).Start(false);

            // prepare sout, needs some trickery for vlc
            string realSout = sout.Replace("#OUT#", @"\" + output);

            // debug
            Log.Debug("VLCManagedEncoder: sout {0}", realSout);
            Log.Debug("VLCManagedEncoder: arguments {0}", String.Join("|", arguments));

            // start vlc
            transcoder = new VLCTranscoder();
            transcoder.SetArguments(arguments);
            transcoder.SetMediaName(Guid.NewGuid().ToString());
            transcoder.SetSout(realSout);

            // setup input
            if (inputMethod == InputMethod.NamedPipe)
            {
                transcoderInputStream = new NamedPipe();
                Log.Info("VLCManagedEncoder: starting input named pipe {0}", transcoderInputStream);
                ((NamedPipe)transcoderInputStream).Start(false);
                inputPath = "stream://" + transcoderInputStream.Url; // use special syntax for VLC to pick up named pipe
            }
            Log.Debug("VLCManagedEncoder: input {0}", inputPath);
            transcoder.SetInput(inputPath);

            // start transcoding
            transcoder.StartTranscoding();
            // doesn't work
            //transcoder.Seek(startPos * 1.0 / context.MediaInfo.Duration * 1000);

            context.TranscodingInfo.Supported = true;
            return true;
        }