EncodingJobOptions.cs 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. using MediaBrowser.Model.Dlna;
  2. namespace MediaBrowser.Controller.MediaEncoding
  3. {
  4. public class EncodingJobOptions
  5. {
  6. public string OutputContainer { get; set; }
  7. public string OutputDirectory { get; set; }
  8. public long? StartTimeTicks { get; set; }
  9. public int? Width { get; set; }
  10. public int? Height { get; set; }
  11. public int? MaxWidth { get; set; }
  12. public int? MaxHeight { get; set; }
  13. public bool Static = false;
  14. public float? Framerate { get; set; }
  15. public float? MaxFramerate { get; set; }
  16. public string Profile { get; set; }
  17. public int? Level { get; set; }
  18. public string DeviceId { get; set; }
  19. public string ItemId { get; set; }
  20. public string MediaSourceId { get; set; }
  21. public string AudioCodec { get; set; }
  22. public bool EnableAutoStreamCopy { get; set; }
  23. public int? MaxAudioChannels { get; set; }
  24. public int? AudioChannels { get; set; }
  25. public int? AudioBitRate { get; set; }
  26. public int? AudioSampleRate { get; set; }
  27. public DeviceProfile DeviceProfile { get; set; }
  28. public EncodingContext Context { get; set; }
  29. public string VideoCodec { get; set; }
  30. public int? VideoBitRate { get; set; }
  31. public int? AudioStreamIndex { get; set; }
  32. public int? VideoStreamIndex { get; set; }
  33. public int? SubtitleStreamIndex { get; set; }
  34. public int? MaxRefFrames { get; set; }
  35. public int? MaxVideoBitDepth { get; set; }
  36. public int? CpuCoreLimit { get; set; }
  37. public bool ReadInputAtNativeFramerate { get; set; }
  38. public SubtitleDeliveryMethod SubtitleMethod { get; set; }
  39. /// <summary>
  40. /// Gets a value indicating whether this instance has fixed resolution.
  41. /// </summary>
  42. /// <value><c>true</c> if this instance has fixed resolution; otherwise, <c>false</c>.</value>
  43. public bool HasFixedResolution
  44. {
  45. get
  46. {
  47. return Width.HasValue || Height.HasValue;
  48. }
  49. }
  50. public bool? Cabac { get; set; }
  51. public EncodingJobOptions()
  52. {
  53. }
  54. public EncodingJobOptions(StreamInfo info, DeviceProfile deviceProfile)
  55. {
  56. OutputContainer = info.Container;
  57. StartTimeTicks = info.StartPositionTicks;
  58. MaxWidth = info.MaxWidth;
  59. MaxHeight = info.MaxHeight;
  60. MaxFramerate = info.MaxFramerate;
  61. Profile = info.VideoProfile;
  62. Level = info.VideoLevel;
  63. ItemId = info.ItemId;
  64. MediaSourceId = info.MediaSourceId;
  65. AudioCodec = info.AudioCodec;
  66. MaxAudioChannels = info.MaxAudioChannels;
  67. AudioBitRate = info.AudioBitrate;
  68. AudioSampleRate = info.TargetAudioSampleRate;
  69. DeviceProfile = deviceProfile;
  70. VideoCodec = info.VideoCodec;
  71. VideoBitRate = info.VideoBitrate;
  72. AudioStreamIndex = info.AudioStreamIndex;
  73. MaxRefFrames = info.MaxRefFrames;
  74. MaxVideoBitDepth = info.MaxVideoBitDepth;
  75. SubtitleMethod = info.SubtitleDeliveryMethod;
  76. Cabac = info.Cabac;
  77. Context = info.Context;
  78. if (info.SubtitleDeliveryMethod == SubtitleDeliveryMethod.Encode ||
  79. info.SubtitleDeliveryMethod == SubtitleDeliveryMethod.Embed)
  80. {
  81. SubtitleStreamIndex = info.SubtitleStreamIndex;
  82. }
  83. }
  84. }
  85. }