EncodingJobOptions.cs 3.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  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 SubtitleDeliveryMethod SubtitleMethod { get; set; }
  37. /// <summary>
  38. /// Gets a value indicating whether this instance has fixed resolution.
  39. /// </summary>
  40. /// <value><c>true</c> if this instance has fixed resolution; otherwise, <c>false</c>.</value>
  41. public bool HasFixedResolution
  42. {
  43. get
  44. {
  45. return Width.HasValue || Height.HasValue;
  46. }
  47. }
  48. public bool? Cabac { get; set; }
  49. public EncodingJobOptions()
  50. {
  51. }
  52. public EncodingJobOptions(StreamInfo info, DeviceProfile deviceProfile)
  53. {
  54. OutputContainer = info.Container;
  55. StartTimeTicks = info.StartPositionTicks;
  56. MaxWidth = info.MaxWidth;
  57. MaxHeight = info.MaxHeight;
  58. MaxFramerate = info.MaxFramerate;
  59. Profile = info.VideoProfile;
  60. Level = info.VideoLevel;
  61. ItemId = info.ItemId;
  62. MediaSourceId = info.MediaSourceId;
  63. AudioCodec = info.AudioCodec;
  64. MaxAudioChannels = info.MaxAudioChannels;
  65. AudioBitRate = info.AudioBitrate;
  66. AudioSampleRate = info.TargetAudioSampleRate;
  67. DeviceProfile = deviceProfile;
  68. VideoCodec = info.VideoCodec;
  69. VideoBitRate = info.VideoBitrate;
  70. AudioStreamIndex = info.AudioStreamIndex;
  71. MaxRefFrames = info.MaxRefFrames;
  72. MaxVideoBitDepth = info.MaxVideoBitDepth;
  73. SubtitleMethod = info.SubtitleDeliveryMethod;
  74. Cabac = info.Cabac;
  75. Context = info.Context;
  76. if (info.SubtitleDeliveryMethod == SubtitleDeliveryMethod.Encode ||
  77. info.SubtitleDeliveryMethod == SubtitleDeliveryMethod.Embed)
  78. {
  79. SubtitleStreamIndex = info.SubtitleStreamIndex;
  80. }
  81. }
  82. }
  83. }