FFProbeResult.cs 10.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354
  1. using MediaBrowser.Model.Entities;
  2. using ProtoBuf;
  3. using System.Collections.Generic;
  4. namespace MediaBrowser.Controller.MediaInfo
  5. {
  6. /// <summary>
  7. /// Provides a class that we can use to deserialize the ffprobe json output
  8. /// Sample output:
  9. /// http://stackoverflow.com/questions/7708373/get-ffmpeg-information-in-friendly-way
  10. /// </summary>
  11. [ProtoContract]
  12. public class FFProbeResult
  13. {
  14. /// <summary>
  15. /// Gets or sets the streams.
  16. /// </summary>
  17. /// <value>The streams.</value>
  18. [ProtoMember(1)]
  19. public FFProbeMediaStreamInfo[] streams { get; set; }
  20. /// <summary>
  21. /// Gets or sets the format.
  22. /// </summary>
  23. /// <value>The format.</value>
  24. [ProtoMember(2)]
  25. public FFProbeMediaFormatInfo format { get; set; }
  26. [ProtoMember(3)]
  27. public List<ChapterInfo> Chapters { get; set; }
  28. }
  29. /// <summary>
  30. /// Represents a stream within the output
  31. /// </summary>
  32. [ProtoContract]
  33. public class FFProbeMediaStreamInfo
  34. {
  35. /// <summary>
  36. /// Gets or sets the index.
  37. /// </summary>
  38. /// <value>The index.</value>
  39. [ProtoMember(1)]
  40. public int index { get; set; }
  41. /// <summary>
  42. /// Gets or sets the profile.
  43. /// </summary>
  44. /// <value>The profile.</value>
  45. [ProtoMember(2)]
  46. public string profile { get; set; }
  47. /// <summary>
  48. /// Gets or sets the codec_name.
  49. /// </summary>
  50. /// <value>The codec_name.</value>
  51. [ProtoMember(3)]
  52. public string codec_name { get; set; }
  53. /// <summary>
  54. /// Gets or sets the codec_long_name.
  55. /// </summary>
  56. /// <value>The codec_long_name.</value>
  57. [ProtoMember(4)]
  58. public string codec_long_name { get; set; }
  59. /// <summary>
  60. /// Gets or sets the codec_type.
  61. /// </summary>
  62. /// <value>The codec_type.</value>
  63. [ProtoMember(5)]
  64. public string codec_type { get; set; }
  65. /// <summary>
  66. /// Gets or sets the sample_rate.
  67. /// </summary>
  68. /// <value>The sample_rate.</value>
  69. [ProtoMember(6)]
  70. public string sample_rate { get; set; }
  71. /// <summary>
  72. /// Gets or sets the channels.
  73. /// </summary>
  74. /// <value>The channels.</value>
  75. [ProtoMember(7)]
  76. public int channels { get; set; }
  77. /// <summary>
  78. /// Gets or sets the avg_frame_rate.
  79. /// </summary>
  80. /// <value>The avg_frame_rate.</value>
  81. [ProtoMember(8)]
  82. public string avg_frame_rate { get; set; }
  83. /// <summary>
  84. /// Gets or sets the duration.
  85. /// </summary>
  86. /// <value>The duration.</value>
  87. [ProtoMember(9)]
  88. public string duration { get; set; }
  89. /// <summary>
  90. /// Gets or sets the bit_rate.
  91. /// </summary>
  92. /// <value>The bit_rate.</value>
  93. [ProtoMember(10)]
  94. public string bit_rate { get; set; }
  95. /// <summary>
  96. /// Gets or sets the width.
  97. /// </summary>
  98. /// <value>The width.</value>
  99. [ProtoMember(11)]
  100. public int width { get; set; }
  101. /// <summary>
  102. /// Gets or sets the height.
  103. /// </summary>
  104. /// <value>The height.</value>
  105. [ProtoMember(12)]
  106. public int height { get; set; }
  107. /// <summary>
  108. /// Gets or sets the display_aspect_ratio.
  109. /// </summary>
  110. /// <value>The display_aspect_ratio.</value>
  111. [ProtoMember(13)]
  112. public string display_aspect_ratio { get; set; }
  113. /// <summary>
  114. /// Gets or sets the tags.
  115. /// </summary>
  116. /// <value>The tags.</value>
  117. [ProtoMember(14)]
  118. public Dictionary<string, string> tags { get; set; }
  119. /// <summary>
  120. /// Gets or sets the bits_per_sample.
  121. /// </summary>
  122. /// <value>The bits_per_sample.</value>
  123. [ProtoMember(17)]
  124. public int bits_per_sample { get; set; }
  125. /// <summary>
  126. /// Gets or sets the r_frame_rate.
  127. /// </summary>
  128. /// <value>The r_frame_rate.</value>
  129. [ProtoMember(18)]
  130. public string r_frame_rate { get; set; }
  131. /// <summary>
  132. /// Gets or sets the has_b_frames.
  133. /// </summary>
  134. /// <value>The has_b_frames.</value>
  135. [ProtoMember(19)]
  136. public int has_b_frames { get; set; }
  137. /// <summary>
  138. /// Gets or sets the sample_aspect_ratio.
  139. /// </summary>
  140. /// <value>The sample_aspect_ratio.</value>
  141. [ProtoMember(20)]
  142. public string sample_aspect_ratio { get; set; }
  143. /// <summary>
  144. /// Gets or sets the pix_fmt.
  145. /// </summary>
  146. /// <value>The pix_fmt.</value>
  147. [ProtoMember(21)]
  148. public string pix_fmt { get; set; }
  149. /// <summary>
  150. /// Gets or sets the level.
  151. /// </summary>
  152. /// <value>The level.</value>
  153. [ProtoMember(22)]
  154. public int level { get; set; }
  155. /// <summary>
  156. /// Gets or sets the time_base.
  157. /// </summary>
  158. /// <value>The time_base.</value>
  159. [ProtoMember(23)]
  160. public string time_base { get; set; }
  161. /// <summary>
  162. /// Gets or sets the start_time.
  163. /// </summary>
  164. /// <value>The start_time.</value>
  165. [ProtoMember(24)]
  166. public string start_time { get; set; }
  167. /// <summary>
  168. /// Gets or sets the codec_time_base.
  169. /// </summary>
  170. /// <value>The codec_time_base.</value>
  171. [ProtoMember(25)]
  172. public string codec_time_base { get; set; }
  173. /// <summary>
  174. /// Gets or sets the codec_tag.
  175. /// </summary>
  176. /// <value>The codec_tag.</value>
  177. [ProtoMember(26)]
  178. public string codec_tag { get; set; }
  179. /// <summary>
  180. /// Gets or sets the codec_tag_string.
  181. /// </summary>
  182. /// <value>The codec_tag_string.</value>
  183. [ProtoMember(27)]
  184. public string codec_tag_string { get; set; }
  185. /// <summary>
  186. /// Gets or sets the sample_fmt.
  187. /// </summary>
  188. /// <value>The sample_fmt.</value>
  189. [ProtoMember(28)]
  190. public string sample_fmt { get; set; }
  191. /// <summary>
  192. /// Gets or sets the dmix_mode.
  193. /// </summary>
  194. /// <value>The dmix_mode.</value>
  195. [ProtoMember(29)]
  196. public string dmix_mode { get; set; }
  197. /// <summary>
  198. /// Gets or sets the start_pts.
  199. /// </summary>
  200. /// <value>The start_pts.</value>
  201. [ProtoMember(30)]
  202. public string start_pts { get; set; }
  203. /// <summary>
  204. /// Gets or sets the is_avc.
  205. /// </summary>
  206. /// <value>The is_avc.</value>
  207. [ProtoMember(31)]
  208. public string is_avc { get; set; }
  209. /// <summary>
  210. /// Gets or sets the nal_length_size.
  211. /// </summary>
  212. /// <value>The nal_length_size.</value>
  213. [ProtoMember(32)]
  214. public string nal_length_size { get; set; }
  215. /// <summary>
  216. /// Gets or sets the ltrt_cmixlev.
  217. /// </summary>
  218. /// <value>The ltrt_cmixlev.</value>
  219. [ProtoMember(33)]
  220. public string ltrt_cmixlev { get; set; }
  221. /// <summary>
  222. /// Gets or sets the ltrt_surmixlev.
  223. /// </summary>
  224. /// <value>The ltrt_surmixlev.</value>
  225. [ProtoMember(34)]
  226. public string ltrt_surmixlev { get; set; }
  227. /// <summary>
  228. /// Gets or sets the loro_cmixlev.
  229. /// </summary>
  230. /// <value>The loro_cmixlev.</value>
  231. [ProtoMember(35)]
  232. public string loro_cmixlev { get; set; }
  233. /// <summary>
  234. /// Gets or sets the loro_surmixlev.
  235. /// </summary>
  236. /// <value>The loro_surmixlev.</value>
  237. [ProtoMember(36)]
  238. public string loro_surmixlev { get; set; }
  239. /// <summary>
  240. /// Gets or sets the disposition.
  241. /// </summary>
  242. /// <value>The disposition.</value>
  243. [ProtoMember(37)]
  244. public Dictionary<string, string> disposition { get; set; }
  245. }
  246. /// <summary>
  247. /// Class MediaFormat
  248. /// </summary>
  249. [ProtoContract]
  250. public class FFProbeMediaFormatInfo
  251. {
  252. /// <summary>
  253. /// Gets or sets the filename.
  254. /// </summary>
  255. /// <value>The filename.</value>
  256. [ProtoMember(1)]
  257. public string filename { get; set; }
  258. /// <summary>
  259. /// Gets or sets the nb_streams.
  260. /// </summary>
  261. /// <value>The nb_streams.</value>
  262. [ProtoMember(2)]
  263. public int nb_streams { get; set; }
  264. /// <summary>
  265. /// Gets or sets the format_name.
  266. /// </summary>
  267. /// <value>The format_name.</value>
  268. [ProtoMember(3)]
  269. public string format_name { get; set; }
  270. /// <summary>
  271. /// Gets or sets the format_long_name.
  272. /// </summary>
  273. /// <value>The format_long_name.</value>
  274. [ProtoMember(4)]
  275. public string format_long_name { get; set; }
  276. /// <summary>
  277. /// Gets or sets the start_time.
  278. /// </summary>
  279. /// <value>The start_time.</value>
  280. [ProtoMember(5)]
  281. public string start_time { get; set; }
  282. /// <summary>
  283. /// Gets or sets the duration.
  284. /// </summary>
  285. /// <value>The duration.</value>
  286. [ProtoMember(6)]
  287. public string duration { get; set; }
  288. /// <summary>
  289. /// Gets or sets the size.
  290. /// </summary>
  291. /// <value>The size.</value>
  292. [ProtoMember(7)]
  293. public string size { get; set; }
  294. /// <summary>
  295. /// Gets or sets the bit_rate.
  296. /// </summary>
  297. /// <value>The bit_rate.</value>
  298. [ProtoMember(8)]
  299. public string bit_rate { get; set; }
  300. /// <summary>
  301. /// Gets or sets the tags.
  302. /// </summary>
  303. /// <value>The tags.</value>
  304. [ProtoMember(9)]
  305. public Dictionary<string, string> tags { get; set; }
  306. }
  307. }