MediaTrackInfoExpanded.cs 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. using System.Text;
  2. namespace UMP
  3. {
  4. public abstract class MediaTrackInfoExpanded : MediaTrackInfo
  5. {
  6. private readonly int _trackCodec;
  7. private readonly int _trackProfile;
  8. private readonly int _trackLevel;
  9. /// <summary>
  10. /// Create a new expanded track info.
  11. /// </summary>
  12. /// <param name="trackId">Track id</param>
  13. /// <param name="trackCodec">Track Codec (fourcc)</param>
  14. /// <param name="trackProfile">Track Profile</param>
  15. /// <param name="trackLevel">Track Level</param>
  16. internal MediaTrackInfoExpanded(int trackId, int trackCodec, int trackProfile, int trackLevel) : base(trackId, trackCodec != 0 ? Encoding.ASCII.GetString(new byte[] { (byte)trackCodec, (byte)(trackCodec >> 8), (byte)(trackCodec >> 16), (byte)(trackCodec >> 24) }).Trim() : null)
  17. {
  18. _trackCodec = trackCodec;
  19. _trackProfile = trackProfile;
  20. _trackLevel = trackLevel;
  21. }
  22. /// <summary>
  23. /// Get the codec (fourcc).
  24. /// </summary>
  25. public int Codec
  26. {
  27. get { return _trackCodec; }
  28. }
  29. /// <summary>
  30. /// Get the profile.
  31. /// </summary>
  32. public int Profile
  33. {
  34. get { return _trackProfile; }
  35. }
  36. /// <summary>
  37. /// Get the level.
  38. /// </summary>
  39. public int Level
  40. {
  41. get { return _trackLevel; }
  42. }
  43. public override string ToString()
  44. {
  45. StringBuilder sb = new StringBuilder(100);
  46. sb.Append("TrackInfoExpanded").Append('[');
  47. sb.Append("ID=").Append(Id).Append(", ");
  48. sb.Append("NAME=").Append(Name).Append(", ");
  49. sb.Append("CODEC=").Append(Codec).Append(", ");
  50. sb.Append("PROFILE=").Append(Profile).Append(", ");
  51. sb.Append("LEVEL=").Append(Level).Append(']');
  52. return sb.ToString();
  53. }
  54. }
  55. }