public override void LiveStreamEnded(LiveStream liveStream)
 {
     if (_statusForm != null)
     {
         _statusForm.OnLiveStreamEnded(liveStream);
     }
 }
Exemplo n.º 2
0
 public override void LiveStreamEnded(LiveStream liveStream)
 {
     Log.Debug("EventListener: LiveStreamEnded()");
     OnLiveStreamEnded(liveStream,LiveStreamAbortReason.Unknown,null);
 }
Exemplo n.º 3
0
 private void OnLiveStreamChanged(LiveStream liveStream)
 {
     RefreshBotPersonalMessage();
 }
        private void AsyncStopLiveStreamThreadMain()
        {
            if (_streamToStopAsync != null)
            {
                for (int i = 0; i < 50 ;i++)
                {
                    if (!GUIGraphicsContext.IsPlaying)
                        break;

                    Thread.Sleep(100);
                    Log.Debug("ChannelNavigator: AsyncStopLiveStream wait 100ms {0}",_lastChannelChangeFailed);
                }
                Thread.Sleep(200);

                for (int i = 0; i < 10; i++)
                {
                    try
                    {
                        this.ControlAgent.StopLiveStream(_streamToStopAsync);
                    }
                    catch
                    {
                        Thread.Sleep(25);
                    }
                }
                _streamToStopAsync = null;
            }
        }
        /// <summary>
        /// Use this when you are sure that the livestream playback was stopped some time ago.
        /// </summary>
        public void StopLiveStream()
        {
            Log.Debug("ChannelNavigator: StopLiveStream()");
            if (_liveStream != null)
            {
                this.ControlAgent.StopLiveStream(_liveStream);
                _liveStream = null;

                if (_currentChannel != null)
                    _navigatorChannels[_currentChannel.ChannelType].PreviousChannel = _currentChannel;
            }

            if (!_doingChannelChange && !_lastChannelChangeFailed)
                _currentChannel = null;
        }
        private LiveStreamResult StartAndPlayNewLiveStream(Channel channel,LiveStream liveStream)
        {
            LiveStreamResult result = this.ControlAgent.TuneLiveStream(channel, ref liveStream);
            Log.Debug("ChannelNavigator: start a new live stream, result = {0}", result);

            if (result == LiveStreamResult.Succeeded)
            {
                result = PlayLiveStream(liveStream);
                if (result == LiveStreamResult.Succeeded)
                {
                    if (_autoFullScreen) g_Player.ShowFullScreenWindow();
                }
            }
            return result;
        }
Exemplo n.º 7
0
 public virtual ServiceTuning GetLiveStreamTuningDetails(LiveStream liveStream)
 {
     return null;
 }
Exemplo n.º 8
0
 public virtual LiveStreamResult TuneLiveStream(Channel channel, CardChannelAllocation upcomingRecordingAllocation, ref LiveStream liveStream)
 {
     liveStream = null;
     return LiveStreamResult.NotSupported;
 }
Exemplo n.º 9
0
 /// <summary>
 /// Request a teletext page/subpage from the recorder for the given live stream.
 /// </summary>
 /// <param name="liveStream">The live stream.</param>
 /// <param name="pageNumber">The teletext page number.</param>
 /// <param name="subPageNumber">The teletext subpage number.</param>
 /// <returns>The requested page content, or null if the page was not ready yet.</returns>
 public async Task<GetTeletextPageBytesResult> GetTeletextPageBytes(LiveStream liveStream, int pageNumber, int subPageNumber)
 {
     var request = NewRequest(HttpMethod.Put, "Live/Teletext/GetPage/{0}/{1}", pageNumber, subPageNumber);
     request.AddBody(liveStream);
     var data = await ExecuteAsync<InternalGetTeletextPageBytesResult>(request).ConfigureAwait(false);
     return new GetTeletextPageBytesResult
     {
         Bytes = Convert.FromBase64String(data.result),
         SubPageCount = data.subPageCount
     };
 }
Exemplo n.º 10
0
 /// <summary>
 /// Ask the recorder whether it is grabbing teletext for the given live stream.
 /// </summary>
 /// <param name="liveStream">The live stream.</param>
 /// <returns>True if the recorder is grabbing teletext.</returns>
 public async Task<bool> IsGrabbingTeletext(LiveStream liveStream)
 {
     var request = NewRequest(HttpMethod.Put, "Live/Teletext/IsGrabbing");
     request.AddBody(liveStream);
     return await ExecuteResult<bool>(request).ConfigureAwait(false);
 }
Exemplo n.º 11
0
 /// <summary>
 /// Tell the recorder to stop grabbing teletext for the given live stream.
 /// </summary>
 /// <param name="liveStream">The live stream.</param>
 public async Task StopGrabbingTeletext(LiveStream liveStream)
 {
     var request = NewRequest(HttpMethod.Put, "Live/Teletext/StopGrabbing");
     request.AddBody(liveStream);
     await ExecuteAsync(request).ConfigureAwait(false);
 }
Exemplo n.º 12
0
 /// <summary>
 /// Ask the recorder for the give live stream's tuning details (if possible).
 /// </summary>
 /// <param name="liveStream">The active live stream.</param>
 /// <returns>The service tuning details, or null if none are available.</returns>
 public async Task<ServiceTuning> GetLiveStreamTuningDetails(LiveStream liveStream)
 {
     var request = NewRequest(HttpMethod.Put, "Live/TuningDetails");
     request.AddBody(liveStream);
     return await ExecuteResult<ServiceTuning>(request).ConfigureAwait(false);
 }
Exemplo n.º 13
0
 /// <summary>
 /// Get the live tuning state of a number of channels.
 /// </summary>
 /// <param name="channels">The channels to get the live state from.</param>
 /// <param name="liveStream">The live stream you want to be ignored (since it's yours), or null.</param>
 /// <returns>An array with all the live states for the given channels.</returns>
 public async Task<List<ChannelLiveState>> GetChannelsLiveState(IList<Channel> channels, LiveStream liveStream)
 {
     var request = NewRequest(HttpMethod.Put, "ChannelsLiveState");
     request.AddBody(new
     {
         channels = ChannelsAsArgument(channels),
         stream = liveStream
     });
     return await ExecuteResult<List<ChannelLiveState>>(request).ConfigureAwait(false);
 }
Exemplo n.º 14
0
 /// <summary>
 /// Tell the recorder we are still showing this stream and to keep it alive. Call this every 30 seconds or so.
 /// </summary>
 /// <param name="liveStream">The live stream that is stil in use.</param>
 /// <returns>True if the live stream is still running, false otherwise.</returns>
 public async Task<bool> KeepLiveStreamAlive(LiveStream liveStream)
 {
     var request = NewRequest(HttpMethod.Put, "Live/KeepAlive");
     request.AddBody(liveStream);
     return await ExecuteResult<bool>(request).ConfigureAwait(false);
 }
Exemplo n.º 15
0
 /// <summary>
 /// Tune to a channel, and get a live stream to that channel.
 /// </summary>
 /// <param name="channel">The channel to tune to.</param>
 /// <param name="upcomingRecordingAllocation">The allocation if the next upcoming recording, or null if there isn't one.</param>
 /// <param name="liveStream">A live stream that is either existing or null for a new one.</param>
 /// <returns>A LiveStreamResult value to indicate success or failure, and a new or updated live stream.</returns>
 public async Task<TuneLiveStreamResult> TuneLiveStream(Channel channel, CardChannelAllocation upcomingRecordingAllocation, LiveStream liveStream)
 {
     var request = NewRequest(HttpMethod.Post, "Live/Tune");
     request.AddBody(new
     {
         channel = channel,
         upcomingRecordingAllocation = upcomingRecordingAllocation,
         stream = liveStream
     });
     var data = await ExecuteAsync<InternalTuneLiveStreamResult>(request).ConfigureAwait(false);
     return new TuneLiveStreamResult
     {
         Result = data.result,
         Stream = data.stream
     };
 }
Exemplo n.º 16
0
 public virtual void StopGrabbingTeletext(LiveStream liveStream)
 {
 }
Exemplo n.º 17
0
 public virtual void StopLiveStream(LiveStream liveStream)
 {
 }
 public override void LiveStreamEnded(LiveStream liveStream)
 {
     if (OnLiveStreamEnded != null)
     {
         OnLiveStreamEnded(liveStream);
     }
 }
Exemplo n.º 19
0
 public virtual IList<ChannelLiveState> GetChannelsLiveState(IList<Channel> channels, LiveStream liveStream)
 {
     return null;
 }
Exemplo n.º 20
0
        private float DrawliveStreamText(Graphics g, SolidBrush textBrush, float left, float top, LiveStream liveStream)
        {
            left = DrawAndMeasureString(g, SystemFonts.MessageBoxFont, textBrush, left, top, "• ");

            StringFormat trimmedFormat = (StringFormat)StringFormat.GenericTypographic.Clone();
            trimmedFormat.Trimming = StringTrimming.EllipsisCharacter;

            g.DrawString(liveStream.Channel.DisplayName, SystemFonts.MessageBoxFont, Brushes.Black,
                new RectangleF(left, top, this.Width - left - 8, SystemFonts.MessageBoxFont.Height), trimmedFormat);

            return top + SystemFonts.MessageBoxFont.Height + _programsGap;
        }
Exemplo n.º 21
0
 private void SilentlyStopLiveStream(LiveStream liveStream)
 {
     Log.Debug("ChannelNavigator: SilentlyStopLiveStream()");
     g_Player.Stop();
     _liveStream = liveStream;
     StopLiveStream();
 }
Exemplo n.º 22
0
        public void Show(Point location, ServerStatus serverStatus, ActiveRecording[] activeRecordings, LiveStream[] liveStreams, UpcomingRecording upcomingRecording)
        {
            _serverStatus = serverStatus;
            _activeRecordings = activeRecordings;
            _liveStreams = liveStreams;
            _upcomingRecording = upcomingRecording;

            int fontHeight = SystemFonts.MessageBoxFont.Height;
            int height = _programsTop;
            if (_serverStatus != ServerStatus.NotConnected)
            {
                if (activeRecordings.Length > 0)
                {
                    height += fontHeight;
                    height += (2 * fontHeight + _programsGap) * activeRecordings.Length;
                    if (liveStreams.Length > 0
                        || upcomingRecording != null)
                    {
                        height += _programsExtraGap;
                    }
                }
                if (liveStreams.Length > 0)
                {
                    height += fontHeight;
                    height += (fontHeight + _programsGap) * liveStreams.Length;
                    if (upcomingRecording != null)
                    {
                        height += _programsExtraGap;
                    }
                }
                if (upcomingRecording != null)
                {
                    height += 2 * fontHeight + _programsGap;
                }
            }
            height += fontHeight;
            height += 10;
            this.Size = new Size(this.Width, height);

            int left = location.X;
            int top;
            Rectangle workArea = Screen.GetWorkingArea(location);
            if (workArea.Contains(location))
            {
                top = location.Y - 12 - this.Height;
            }
            else
            {
                top = int.MaxValue;
            }

            this.Opacity = 0.0;
            SetBounds(Math.Min(left, workArea.Width - this.Width - 1), Math.Min(top, workArea.Height - this.Height),
                this.Width, this.Height);

            this.Show();
        }
Exemplo n.º 23
0
        /// <summary>
        /// Use this when the livestream playback just stopped.
        /// </summary>
        public void AsyncStopLiveStream()
        {
            if (_liveStream != null)
            {
                _streamToStopAsync = _liveStream;
                _liveStream = null;

                if (_currentChannel != null)
                    _navigatorChannels[_currentChannel.ChannelType].PreviousChannel = _currentChannel;

                _asyncStopLiveStreamThread = new Thread(new ThreadStart(AsyncStopLiveStreamThreadMain));
                _asyncStopLiveStreamThread.Start();
            }

            if (!_doingChannelChange && !_lastChannelChangeFailed)
                _currentChannel = null;
        }
Exemplo n.º 24
0
 public virtual byte[] GetTeletextPageBytes(LiveStream liveStream, int pageNumber, int subPageNumber, out int subPageCount)
 {
     subPageCount = 0;
     return null;
 }
Exemplo n.º 25
0
        private static void GetPlayerFileNameAndOffset(LiveStream liveStream, out string fileName, out bool isRTSP)
        {
            Log.Debug("ChannelNavigator: GetPlayerFileNameAndOffset()");
            fileName = liveStream.TimeshiftFile;
            isRTSP = false;

            //TODO: temporary workaround to play radio over UNC instead of RTSP (some problems with tsreader in combination with rtsp radio)
            if (liveStream.Channel.ChannelType == ChannelType.Television)
            {
                if (String.IsNullOrEmpty(fileName)
                    || (PluginMain.PreferRtspForLiveTv && liveStream.RtspUrl.StartsWith("rtsp://", StringComparison.CurrentCultureIgnoreCase)))
                {
                    isRTSP = true;
                    fileName = liveStream.RtspUrl;
                }
            }
            Log.Debug("ChannelNavigator: filename = {0}", fileName);
        }
Exemplo n.º 26
0
 public virtual bool HasTeletext(LiveStream liveStream)
 {
     return false;
 }
Exemplo n.º 27
0
        private LiveStreamResult PlayLiveStream(LiveStream liveStream)
        {
            Log.Debug("ChannelNavigator: PlayLiveStream()");
            LiveStreamResult result = LiveStreamResult.Succeeded;
            string fileName;
            bool isRTSP;
            GetPlayerFileNameAndOffset(liveStream, out fileName, out isRTSP);

            if (liveStream != null)
                _isAnalog = (ControlAgent.GetLiveStreamTuningDetails(liveStream).CardType == CardType.Analog);

            if (!isRTSP)
            {
                for (int i = 0; i < 10; i++)
                {
                    if (System.IO.File.Exists(fileName))
                        break;

                    Thread.Sleep(100);
                    Log.Info("Channelnavigator: startplay: waiting for TS file {0}", fileName);
                }
                if (!System.IO.File.Exists(fileName))
                {
                    result = LiveStreamResult.UnknownError;
                    g_Player.Stop();
                }
            }

            if (result == LiveStreamResult.Succeeded)
            {
                for (int i = 0; i < 50; i++)
                {
                    if (g_Player.Play(fileName, liveStream.Channel.ChannelType == ChannelType.Television ? g_Player.MediaType.TV : g_Player.MediaType.Radio))
                    {
                        double duration = g_Player.Duration;
                        if (duration > 0.0)
                        {
                            result = LiveStreamResult.Succeeded;
                            g_Player.SeekAbsolute(duration);
                            _liveStream = liveStream;
                            break;
                        }
                        else
                        {
                            result = LiveStreamResult.UnknownError;
                            g_Player.Stop();
                            Thread.Sleep(50);
                            Log.Debug("ChannelNavigator: PlayLiveStream_timeout = {0}", i);
                        }
                    }
                    else
                    {
                        result = LiveStreamResult.UnknownError;
                        break;
                    }
                }
            }
            Log.Debug("ChannelNavigator: PlayLiveStream_Result = {0}", result);
            return result;
        }
Exemplo n.º 28
0
 public virtual bool IsGrabbingTeletext(LiveStream liveStream)
 {
     return false;
 }
Exemplo n.º 29
0
 private void OnLiveStreamEnded(LiveStream liveStream, LiveStreamAbortReason reason, UpcomingProgram program)
 {
     GUIMessage msg = new GUIMessage(GUIMessage.MessageType.GUI_MSG_STOP_SERVER_TIMESHIFTING, 0, 0, 0, 0, 0, null);
     msg.Object = liveStream;
     msg.Object2 = program;
     msg.Label = reason.ToString();
     msg.Param1 = 4321;//indentification
     GUIGraphicsContext.SendMessage(msg);
     msg = null;
 }
Exemplo n.º 30
0
 public virtual bool KeepLiveStreamAlive(LiveStream liveTvStream)
 {
     return false;
 }