/// <summary> /// Should be called when graph is about to stop. /// stops any timeshifting/recording on this channel /// </summary> public override void OnGraphStop() { if (_mpRecord != null) { _mpRecord.StopRecord(_subChannelId); _mpRecord.StopTimeShifting(_subChannelId); } }
/// <summary> /// Stops the current graph /// </summary> /// <returns></returns> public override void StopGraph() { if (!CheckThreadId()) { return; } FreeAllSubChannels(); FilterState state; if (_graphBuilder == null) { return; } IMediaControl mediaCtl = (_graphBuilder as IMediaControl); if (mediaCtl == null) { throw new TvException("Can not convert graphBuilder to IMediaControl"); } mediaCtl.GetState(10, out state); Log.Log.WriteFile("analog: StopGraph state:{0}", state); _isScanning = false; if (_tsFileSink != null) { IMPRecord record = _tsFileSink as IMPRecord; if (record != null) { record.StopTimeShifting(_subChannelId); record.StopRecord(_subChannelId); } } if (state == FilterState.Stopped) { _graphState = GraphState.Created; return; } int hr = mediaCtl.Stop(); if (hr < 0 || hr > 1) { Log.Log.WriteFile("analog: RunGraph returns:0x{0:X}", hr); throw new TvException("Unable to stop graph"); } Log.Log.WriteFile("analog: Graph stopped"); }