FFProbeResult.cs 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. using System.Collections.Generic;
  2. using ProtoBuf;
  3. namespace MediaBrowser.Controller.FFMpeg
  4. {
  5. /// <summary>
  6. /// Provides a class that we can use to deserialize the ffprobe json output
  7. /// Sample output:
  8. /// http://stackoverflow.com/questions/7708373/get-ffmpeg-information-in-friendly-way
  9. /// </summary>
  10. [ProtoContract]
  11. public class FFProbeResult
  12. {
  13. [ProtoMember(1)]
  14. public MediaStream[] streams { get; set; }
  15. [ProtoMember(2)]
  16. public MediaFormat format { get; set; }
  17. }
  18. /// <summary>
  19. /// Represents a stream within the output
  20. /// A number of properties are commented out to improve deserialization performance
  21. /// Enable them as needed.
  22. /// </summary>
  23. [ProtoContract]
  24. public class MediaStream
  25. {
  26. [ProtoMember(1)]
  27. public int index { get; set; }
  28. [ProtoMember(2)]
  29. public string profile { get; set; }
  30. [ProtoMember(3)]
  31. public string codec_name { get; set; }
  32. [ProtoMember(4)]
  33. public string codec_long_name { get; set; }
  34. [ProtoMember(5)]
  35. public string codec_type { get; set; }
  36. //public string codec_time_base { get; set; }
  37. //public string codec_tag { get; set; }
  38. //public string codec_tag_string { get; set; }
  39. //public string sample_fmt { get; set; }
  40. [ProtoMember(6)]
  41. public string sample_rate { get; set; }
  42. [ProtoMember(7)]
  43. public int channels { get; set; }
  44. //public int bits_per_sample { get; set; }
  45. //public string r_frame_rate { get; set; }
  46. [ProtoMember(8)]
  47. public string avg_frame_rate { get; set; }
  48. //public string time_base { get; set; }
  49. //public string start_time { get; set; }
  50. [ProtoMember(9)]
  51. public string duration { get; set; }
  52. [ProtoMember(10)]
  53. public string bit_rate { get; set; }
  54. [ProtoMember(11)]
  55. public int width { get; set; }
  56. [ProtoMember(12)]
  57. public int height { get; set; }
  58. //public int has_b_frames { get; set; }
  59. //public string sample_aspect_ratio { get; set; }
  60. [ProtoMember(13)]
  61. public string display_aspect_ratio { get; set; }
  62. //public string pix_fmt { get; set; }
  63. //public int level { get; set; }
  64. [ProtoMember(14)]
  65. public Dictionary<string, string> tags { get; set; }
  66. }
  67. [ProtoContract]
  68. public class MediaFormat
  69. {
  70. [ProtoMember(1)]
  71. public string filename { get; set; }
  72. [ProtoMember(2)]
  73. public int nb_streams { get; set; }
  74. [ProtoMember(3)]
  75. public string format_name { get; set; }
  76. [ProtoMember(4)]
  77. public string format_long_name { get; set; }
  78. [ProtoMember(5)]
  79. public string start_time { get; set; }
  80. [ProtoMember(6)]
  81. public string duration { get; set; }
  82. [ProtoMember(7)]
  83. public string size { get; set; }
  84. [ProtoMember(8)]
  85. public string bit_rate { get; set; }
  86. [ProtoMember(9)]
  87. public Dictionary<string, string> tags { get; set; }
  88. }
  89. }