SegmentInfo.h 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. #pragma once
  2. #include "mkv_date.h"
  3. #include "mkv_reader.h"
  4. #include <bfc/platform/guid.h>
  5. /*
  6. Time Scale: 986946
  7. Muxing App: libebml v0.7.7 + libmatroska v0.8.1
  8. Writing App: mkvmerge v2.0.2 ('You're My Flame') built on Sep 20 2007 09:35:09
  9. Duration: 60257
  10. Date UTC: Sun Nov 18 20:23:18 2007
  11. Segment UID: binary size 16
  12. */
  13. const uint32_t mkv_segment_segmentinfo = 0x549a966;
  14. const uint32_t mkv_segmentinfo_timecodescale = 0xad7b1;
  15. const uint32_t mkv_segmentinfo_muxingapp=0xd80;
  16. const uint32_t mkv_segmentinfo_writingapp=0x1741;
  17. const uint32_t mkv_segmentinfo_duration=0x489;
  18. const uint32_t mkv_segmentinfo_dateutc=0x461;
  19. const uint32_t mkv_segmentinfo_segmentuid=0x33a4;
  20. const uint32_t mkv_segmentinfo_nextuid=0x1eb923;
  21. const uint32_t mkv_segmentinfo_prevuid=0x1cb923;
  22. const uint32_t mkv_segmentinfo_nextfilename=0x1e83bb;
  23. const uint32_t mkv_segmentinfo_prevfilename=0x1c83ab;
  24. const uint32_t mkv_segmentinfo_title=0x3ba9;
  25. namespace nsmkv
  26. {
  27. class SegmentInfo
  28. {
  29. public:
  30. SegmentInfo() :
  31. time_code_scale(1000000),
  32. muxing_app(0),
  33. writing_app(0),
  34. duration(0),
  35. production_date(0),
  36. segment_uid(INVALID_GUID),
  37. next_uid(INVALID_GUID),
  38. prev_uid(INVALID_GUID),
  39. next_filename(0),
  40. prev_filename(0),
  41. title(0)
  42. #ifdef WA_VALIDATE
  43. ,
  44. time_code_scale_found(false),
  45. muxing_app_found(false),
  46. writing_app_found(false),
  47. duration_found(false),
  48. production_date_found(false),
  49. segment_uid_found(false),
  50. next_uid_found(false),
  51. prev_uid_found(false),
  52. next_filename_found(false),
  53. prev_filename_found(false),
  54. title_found(false)
  55. #endif
  56. {
  57. }
  58. ~SegmentInfo()
  59. {
  60. free(muxing_app);
  61. free(writing_app);
  62. free(title);
  63. }
  64. void Own(char *&field, char *value)
  65. {
  66. if (field)
  67. free(field);
  68. field = value;
  69. }
  70. int GetDurationMilliseconds() const;
  71. uint64_t ConvertMillisecondsToTime(int milliseconds) const;
  72. uint64_t time_code_scale;
  73. char *muxing_app;
  74. char *writing_app;
  75. char *title;
  76. double duration;
  77. mkv_date_t production_date;
  78. GUID segment_uid;
  79. GUID prev_uid;
  80. GUID next_uid;
  81. char *prev_filename;
  82. char *next_filename;
  83. #ifdef WA_VALIDATE
  84. bool segment_uid_found;
  85. bool prev_uid_found;
  86. bool next_uid_found;
  87. bool prev_filename_found;
  88. bool next_filename_found;
  89. bool time_code_scale_found;
  90. bool duration_found;
  91. bool muxing_app_found;
  92. bool writing_app_found;
  93. bool production_date_found;
  94. bool title_found;
  95. #endif
  96. };
  97. uint64_t ReadSegmentInfo(nsmkv::MKVReader *reader, uint64_t size, nsmkv::SegmentInfo &segment_info);
  98. }