Esempio n. 1
0
 private void InfoTimerTick(object source, ElapsedEventArgs args)
 {
     while (true)
     {
         try
         {
             // let's ignore the time here, for reasons detailed in VLCWrapperParsingUnit.cs around line 115
             float position = transcoder.GetPosition();
             StreamLog.Trace(context.Identifier, "VLCManagedInfo: calling NewPercentage with position {0}", position);
             calculator.NewPercentage(position);
             calculator.SaveStats(infoReference);
         }
         catch (Exception ex)
         {
             StreamLog.Warn(context.Identifier, "Failed to get VLC data", ex);
         }
     }
 }
Esempio n. 2
0
        private void InfoThread(object passedPosition)
        {
            var einfo = new Reference <WebTranscodingInfo>(() => context.TranscodingInfo, x => { context.TranscodingInfo = x; });
            TranscodingInfoCalculator calculator;

            if (context.MediaInfo.Duration > 0)
            {
                Log.Trace("VLCManagedInfo: duration known; is {0}", context.MediaInfo.Duration);
                calculator = new TranscodingInfoCalculator((int)passedPosition, 25, POLL_DATA_TIME, context.MediaInfo.Duration);
            }
            else
            {
                Log.Trace("VLCManagedInfo: duration unknown");
                calculator = new TranscodingInfoCalculator((int)passedPosition, 25, POLL_DATA_TIME);
            }

            while (true)
            {
                try
                {
                    // let's ignore the time here, for reasons detailed in VLCWrapperParsingUnit.cs around line 115
                    float position = transcoder.GetPosition();
                    Log.Trace("VLCManagedInfo: calling NewPercentage with position {0}", position);
                    calculator.NewPercentage(position);
                    calculator.SetStats(einfo);
                }
                catch (ThreadAbortException)
                {
                    break;
                }
                catch (Exception ex)
                {
                    Log.Warn("Failed to get VLC data", ex);
                }

                Thread.Sleep(POLL_DATA_TIME);
            }
        }