ITunerHost.cs 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. using MediaBrowser.Model.Dto;
  2. using MediaBrowser.Model.LiveTv;
  3. using System.Collections.Generic;
  4. using System.Threading;
  5. using System.Threading.Tasks;
  6. namespace MediaBrowser.Controller.LiveTv
  7. {
  8. public interface ITunerHost
  9. {
  10. /// <summary>
  11. /// Gets the name.
  12. /// </summary>
  13. /// <value>The name.</value>
  14. string Name { get; }
  15. /// <summary>
  16. /// Gets the type.
  17. /// </summary>
  18. /// <value>The type.</value>
  19. string Type { get; }
  20. /// <summary>
  21. /// Gets the channels.
  22. /// </summary>
  23. /// <returns>Task&lt;IEnumerable&lt;ChannelInfo&gt;&gt;.</returns>
  24. Task<List<ChannelInfo>> GetChannels(bool enableCache, CancellationToken cancellationToken);
  25. /// <summary>
  26. /// Gets the tuner infos.
  27. /// </summary>
  28. /// <param name="cancellationToken">The cancellation token.</param>
  29. /// <returns>Task&lt;List&lt;LiveTvTunerInfo&gt;&gt;.</returns>
  30. Task<List<LiveTvTunerInfo>> GetTunerInfos(CancellationToken cancellationToken);
  31. /// <summary>
  32. /// Gets the channel stream.
  33. /// </summary>
  34. /// <param name="channelId">The channel identifier.</param>
  35. /// <param name="streamId">The stream identifier.</param>
  36. /// <param name="cancellationToken">The cancellation token.</param>
  37. /// <returns>Task&lt;MediaSourceInfo&gt;.</returns>
  38. Task<ILiveStream> GetChannelStream(string channelId, string streamId, CancellationToken cancellationToken);
  39. /// <summary>
  40. /// Gets the channel stream media sources.
  41. /// </summary>
  42. /// <param name="channelId">The channel identifier.</param>
  43. /// <param name="cancellationToken">The cancellation token.</param>
  44. /// <returns>Task&lt;List&lt;MediaSourceInfo&gt;&gt;.</returns>
  45. Task<List<MediaSourceInfo>> GetChannelStreamMediaSources(string channelId, CancellationToken cancellationToken);
  46. Task<List<TunerHostInfo>> DiscoverDevices(int discoveryDurationMs, CancellationToken cancellationToken);
  47. }
  48. public interface IConfigurableTunerHost
  49. {
  50. /// <summary>
  51. /// Validates the specified information.
  52. /// </summary>
  53. /// <param name="info">The information.</param>
  54. /// <returns>Task.</returns>
  55. Task Validate(TunerHostInfo info);
  56. }
  57. public interface ILiveStream
  58. {
  59. Task Open(CancellationToken cancellationToken);
  60. Task Close();
  61. int ConsumerCount { get; }
  62. string OriginalStreamId { get; set; }
  63. bool EnableStreamSharing { get; set; }
  64. ITunerHost TunerHost { get; set; }
  65. MediaSourceInfo OpenedMediaSource { get; set; }
  66. string UniqueId { get; }
  67. List<string> SharedStreamIds { get; }
  68. }
  69. }