You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

232 lines
9.3KB

  1. #ifndef _mkv_format_h_
  2. #define _mkv_format_h_
  3. #ifdef __cplusplus
  4. extern "C" {
  5. #endif
  6. #define MKV_MIME_AUDIO "audio/x-matroska" // mka
  7. #define MKV_MIME_VIDEO "video/x-matroska" // mkv
  8. #define MKV_MIME_VIDEO_3D "video/x-matroska-3d"
  9. // https://www.matroska.org/technical/codec_specs.html
  10. enum mkv_codec_t
  11. {
  12. MKV_CODEC_UNKNOWN = 0,
  13. MKV_CODEC_VIDEO_VCM, // Microsoft (TM) Video Codec Manager (VCM)
  14. MKV_CODEC_VIDEO_UNCOMPRESSED, // Video, raw uncompressed video frames
  15. MKV_CODEC_VIDEO_DIVX4, // MPEG4 ISO simple profile (DivX4)
  16. MKV_CODEC_VIDEO_DIVX5, // MPEG4 ISO advanced simple profile (DivX5, XviD, FFMPEG)
  17. MKV_CODEC_VIDEO_MPEG4, // MPEG4 ISO advanced profile
  18. MKV_CODEC_VIDEO_MPEG4_MSV3, // Microsoft (TM) MPEG4 V3
  19. MKV_CODEC_VIDEO_MPEG1, // MPEG 1 Elementary Stream (ES)
  20. MKV_CODEC_VIDEO_MPEG2, // MPEG 2 Elementary Stream (ES)
  21. MKV_CODEC_VIDEO_H264, // AVC/H.264
  22. MKV_CODEC_VIDEO_H265, // HEVC/H.265
  23. MKV_CODEC_VIDEO_RV10, // RealVideo 1.0 aka RealVideo 5
  24. MKV_CODEC_VIDEO_RV20, // RealVideo G2 and RealVideo G2+SVT
  25. MKV_CODEC_VIDEO_RV30, // RealVideo 8
  26. MKV_CODEC_VIDEO_RV40, // RealVideo 9
  27. MKV_CODEC_VIDEO_QUICKTIME, // Video taken from QuickTime(TM) files
  28. MKV_CODEC_VIDEO_THEORA, // Theora
  29. MKV_CODEC_VIDEO_PRORES, // Apple ProRes
  30. MKV_CODEC_VIDEO_VP8, // VP8 Codec format
  31. MKV_CODEC_VIDEO_VP9, // VP9 Codec format
  32. MKV_CODEC_VIDEO_FFV1, // FF Video Codec 1
  33. MKV_CODEC_VIDEO_AV1, // AV1 Codec format
  34. MKV_CODEC_VIDEO_DIRAC, // ffmpeg
  35. MKV_CODEC_VIDEO_MJPEG, // ffmpeg
  36. MKV_CODEC_AUDIO_MP3 = 0x1000, // MPEG Audio 1, 2, 2.5 Layer III
  37. MKV_CODEC_AUDIO_MP2, // MPEG Audio 1, 2 Layer II
  38. MKV_CODEC_AUDIO_MP1, // MPEG Audio 1, 2 Layer I
  39. MKV_CODEC_AUDIO_PCM_BE, // PCM Integer Big Endian
  40. MKV_CODEC_AUDIO_PCM_LE, // PCM Integer Little Endian
  41. MKV_CODEC_AUDIO_PCM_FLOAT, // Floating Point, IEEE compatible(32/64 bits)
  42. MKV_CODEC_AUDIO_MPC, // MPC (musepack) SV8
  43. MKV_CODEC_AUDIO_AC3, // (Dolby) AC3
  44. MKV_CODEC_AUDIO_ALAC, // ALAC (Apple Lossless Audio Codec)
  45. MKV_CODEC_AUDIO_DTS, // Digital Theatre System
  46. MKV_CODEC_AUDIO_DTS_EXPRESS, // Digital Theatre System Express
  47. MKV_CODEC_AUDIO_DTS_LOSSLESS, // Digital Theatre System Lossless
  48. MKV_CODEC_AUDIO_VORBIS, // Vorbis
  49. MKV_CODEC_AUDIO_FLAC, // FLAC (Free Lossless Audio Codec)
  50. MKV_CODEC_AUDIO_RA1, // Real Audio 1
  51. MKV_CODEC_AUDIO_RA2, // Real Audio 2
  52. MKV_CODEC_AUDIO_COOK, // Real Audio Cook Codec (codename: Gecko)
  53. MKV_CODEC_AUDIO_SIPR, // Sipro Voice Codec
  54. MKV_CODEC_AUDIO_RALF, // Real Audio Lossless Format
  55. MKV_CODEC_AUDIO_ATRC, // Sony Atrac3 Codec
  56. MKV_CODEC_AUDIO_ACM, // Microsoft(TM) Audio Codec Manager (ACM)
  57. MKV_CODEC_AUDIO_AAC, // AAC MPEG2/MPEG4 MAIN/LC/SBR/SSR/LTP
  58. MKV_CODEC_AUDIO_QUICKTIME, // Audio taken from QuickTime(TM) files
  59. MKV_CODEC_AUDIO_TTA1, // The True Audio lossless audio compressor
  60. MKV_CODEC_AUDIO_WAVPACK4, // WavPack lossless audio compressor
  61. MKV_CODEC_AUDIO_OPUS, // Opus
  62. MKV_CODEC_AUDIO_TRUEHD, // ffmpeg
  63. MKV_CODEC_AUDIO_EAC3, // ffmpeg
  64. MKV_CODEC_SUBTITLE_TEXT = 0x2000,// UTF-8 Plain Text
  65. MKV_CODEC_SUBTITLE_SSA, // Subtitles Format
  66. MKV_CODEC_SUBTITLE_ASS, // Advanced Subtitles Format
  67. MKV_CODEC_SUBTITLE_USF, // Universal Subtitle Format
  68. MKV_CODEC_SUBTITLE_WEBVTT, // Web Video Text Tracks Format (WebVTT)
  69. MKV_CODEC_SUBTITLE_BMP, // Bitmap
  70. MKV_CODEC_SUBTITLE_DVBSUB, // Digital Video Broadcasting (DVB) subtitles
  71. MKV_CODEC_SUBTITLE_VOBSUB, // VobSub subtitles
  72. MKV_CODEC_SUBTITLE_PGS, // HDMV presentation graphics subtitles (PGS)
  73. MKV_CODEC_SUBTITLE_TEXTST, // HDMV text subtitles
  74. MKV_CODEC_SUBTITLE_KATE, // Karaoke And Text Encapsulation
  75. };
  76. enum
  77. {
  78. MKV_FLAGS_KEYFRAME = 0x0001, // Keyframe
  79. MKV_FLAGS_INVISIBLE = 0x0002, // Invisible, the codec SHOULD decode this frame but not display it
  80. MKV_FLAGS_DISCARDABLE = 0x0004, // Discardable, the frames of the Block can be discarded during playing if needed
  81. };
  82. enum
  83. {
  84. MKV_OPTION_WEBM = 0x00010000, // webm file
  85. MKV_OPTION_LIVE = 0x80000000, // live stream
  86. };
  87. enum ebml_video_interlaced_e
  88. {
  89. EBML_VIDEO_FLAG_UNDETERMINED = 0,
  90. EBML_VIDEO_FLAG_INTERLACED = 1,
  91. EBML_VIDEO_FLAG_PROGRESSIVE = 2,
  92. };
  93. enum ebml_video_field_order_e
  94. {
  95. EBML_VIDEO_FIELD_ORDER_PROGRESSIVE = 0,
  96. EBML_VIDEO_FIELD_ORDER_TTF = 1,
  97. EBML_VIDEO_FIELD_ORDER_UNDETERMINED = 2,
  98. EBML_VIDEO_FIELD_ORDER_BFF = 6,
  99. EBML_VIDEO_FIELD_ORDER_BFF_SWAPPED = 9,
  100. EBML_VIDEO_FIELD_ORDER_TTF_SWAPPED = 14,
  101. };
  102. enum ebml_video_stereo_mode_e
  103. {
  104. EBML_VIDEO_STEREO_MODE_MONO = 0,
  105. EBML_VIDEO_STEREO_MODE_SIDE_BY_SIDE_LEFT = 1, // left eye first
  106. EBML_VIDEO_STEREO_MODE_TOP_BOTTOM_RIGHT = 2, // right eye first
  107. EBML_VIDEO_STEREO_MODE_TOP_BOTTOM_LEFT = 3, // left eye first
  108. EBML_VIDEO_STEREO_MODE_CHECKBOARD_RIGHT = 4, // right eye first
  109. EBML_VIDEO_STEREO_MODE_CHECKBOARD_LEFT = 5, // left eye first
  110. EBML_VIDEO_STEREO_MODE_ROW_INTERLEAVED_RIGHT = 6, // right eye first
  111. EBML_VIDEO_STEREO_MODE_ROW_INTERLEAVED_LEFT = 7, // left eye first
  112. EBML_VIDEO_STEREO_MODE_COLUMN_INTERLEAVED_RIGHT = 8, // right eye first
  113. EBML_VIDEO_STEREO_MODE_COLUMN_INTERLEAVED_LEFT = 9, // left eye first
  114. EBML_VIDEO_STEREO_MODE_ANAGLYPH_CYAN_RED = 10, // cyan/red
  115. EBML_VIDEO_STEREO_MODE_SIDE_BY_SIDE_RIGHT = 11, // right eye first
  116. EBML_VIDEO_STEREO_MODE_ANAGLYPH_GREEN_MAGENTA = 12, // green/megenta
  117. EBML_VIDEO_STEREO_MODE_BOTH_EYES_LACED_IN_ONE_BLOCK_LEFT = 13, // left eye first
  118. EBML_VIDEO_STEREO_MODE_BOTH_EYES_LACED_IN_ONE_BLOCK_RIGHT = 14, // right eye first
  119. };
  120. enum ebml_video_display_unit_e
  121. {
  122. EBML_VIDEO_DISPLAY_UNIT_PIXELS = 0,
  123. EBML_VIDEO_DISPLAY_UNIT_CETIMETERS = 1,
  124. EBML_VIDEO_DISPLAY_UNIT_INCHES = 2,
  125. EBML_VIDEO_DISPLAY_UNIT_ASPECT_RATION = 3,
  126. EBML_VIDEO_DISPLAY_UNIT_UNKNOWN = 4,
  127. };
  128. enum ebml_video_aspect_ratio_type_e
  129. {
  130. EBML_VIDEO_ASPECT_RATIO_TYPE_FREE_RESIZING = 0,
  131. EBML_VIDEO_ASPECT_RATIO_TYPE_KEEP_ASPECT_RATIOn = 1,
  132. EBML_VIDEO_ASPECT_RATIO_TYPE_FIXED = 2,
  133. };
  134. enum ebml_video_color_matrix_coefficients_t
  135. {
  136. EBML_VIDEO_COLOR_MATRIX_COEFFICIENTS_IDENTIY = 0,
  137. EBML_VIDEO_COLOR_MATRIX_COEFFICIENTS_ITU_R_BT709 = 1,
  138. EBML_VIDEO_COLOR_MATRIX_COEFFICIENTS_UNSPECIFIED = 2,
  139. EBML_VIDEO_COLOR_MATRIX_COEFFICIENTS_RESERVED = 3,
  140. EBML_VIDEO_COLOR_MATRIX_COEFFICIENTS_US_FCC_73_682 = 4,
  141. EBML_VIDEO_COLOR_MATRIX_COEFFICIENTS_ITU_R_BT_470BG = 5,
  142. EBML_VIDEO_COLOR_MATRIX_COEFFICIENTS_SMPTE_170M = 6,
  143. EBML_VIDEO_COLOR_MATRIX_COEFFICIENTS_SMPTE_240M = 7,
  144. EBML_VIDEO_COLOR_MATRIX_COEFFICIENTS_YCOCG = 8,
  145. EBML_VIDEO_COLOR_MATRIX_COEFFICIENTS_BT2020_NON_CONSTANT_LUMINANCE = 9,
  146. EBML_VIDEO_COLOR_MATRIX_COEFFICIENTS_BT2020_CONSTANT_LUMINANCE = 10,
  147. EBML_VIDEO_COLOR_MATRIX_COEFFICIENTS_SMPTE_ST_2085 = 11,
  148. EBML_VIDEO_COLOR_MATRIX_COEFFICIENTS_CHROMA_DERIVED_NON_CONSTANT_LUMINANCE = 12,
  149. EBML_VIDEO_COLOR_MATRIX_COEFFICIENTS_CHROMA_DERIVED_CONSTANT_LUMINANCE = 13,
  150. EBML_VIDEO_COLOR_MATRIX_COEFFICIENTS_ITU_R_BT_2100_0 = 14,
  151. };
  152. enum ebml_video_color_range_e
  153. {
  154. EBML_VIDEO_COLOR_RANGE_UNSPECIFIED = 0,
  155. EBML_VIDEO_COLOR_RNAGE_BROADCAST_RANGE,
  156. EBML_VIDEO_COLOR_RNAGE_FULL_RANGE,
  157. EBML_VIDEO_COLOR_RNAGE_MATRIX_COEFFICIENTS,
  158. };
  159. enum ebml_video_color_transfer_characteristics_e
  160. {
  161. EBML_VIDEO_COLOR_TRANSFER_CHARACTERISTICS_RESERVED = 0,
  162. EBML_VIDEO_COLOR_TRANSFER_CHARACTERISTICS_ITU_R_BT_709 = 1,
  163. EBML_VIDEO_COLOR_TRANSFER_CHARACTERISTICS_UNSPECIFIED = 2,
  164. EBML_VIDEO_COLOR_TRANSFER_CHARACTERISTICS_GAMMA_2_2_CURVE_BT_470M = 4,
  165. EBML_VIDEO_COLOR_TRANSFER_CHARACTERISTICS_GAMMA_2_8_CURVE_BT_470BG = 5,
  166. EBML_VIDEO_COLOR_TRANSFER_CHARACTERISTICS_SMPTE_170M = 6,
  167. EBML_VIDEO_COLOR_TRANSFER_CHARACTERISTICS_SMPTE_240M = 7,
  168. EBML_VIDEO_COLOR_TRANSFER_CHARACTERISTICS_LINEAR = 8,
  169. EBML_VIDEO_COLOR_TRANSFER_CHARACTERISTICS_LOG = 9,
  170. EBML_VIDEO_COLOR_TRANSFER_CHARACTERISTICS_LOG_SQRT = 10,
  171. EBML_VIDEO_COLOR_TRANSFER_CHARACTERISTICS_IEC_61966_2_4 = 11,
  172. EBML_VIDEO_COLOR_TRANSFER_CHARACTERISTICS_ITU_R_BT_1361_EXTENDED_COLOUR_GAMUT = 12,
  173. EBML_VIDEO_COLOR_TRANSFER_CHARACTERISTICS_IEC_61966_2_1 = 13,
  174. EBML_VIDEO_COLOR_TRANSFER_CHARACTERISTICS_ITU_R_BT_2020_10BIT = 14,
  175. EBML_VIDEO_COLOR_TRANSFER_CHARACTERISTICS_ITU_R_BT_2020_12BIT = 15,
  176. EBML_VIDEO_COLOR_TRANSFER_CHARACTERISTICS_ITU_R_BT_2100_PERCEPTUAL_QUANTIZATION = 16,
  177. EBML_VIDEO_COLOR_TRANSFER_CHARACTERISTICS_SMPTE_ST_428_1 = 17,
  178. EBML_VIDEO_COLOR_TRANSFER_CHARACTERISTICS_ARIB_STD_B67_HLG = 18,
  179. };
  180. enum ebml_video_color_primaries_e
  181. {
  182. EBML_VIDEO_COLOR_PRIMARIES_RESERVED = 0,
  183. EBML_VIDEO_COLOR_PRIMARIES_ITU_R_BT_709 = 1,
  184. EBML_VIDEO_COLOR_PRIMARIES_UNSPECIFIED = 2,
  185. EBML_VIDEO_COLOR_PRIMARIES_ITU_R_BT_470M = 4,
  186. EBML_VIDEO_COLOR_PRIMARIES_ITU_R_BT_470BG_BT_601_625 = 5,
  187. EBML_VIDEO_COLOR_PRIMARIES_ITU_R_BT_601_525_TMPTE_170M = 6,
  188. EBML_VIDEO_COLOR_PRIMARIES_SMPTE_240M = 7,
  189. EBML_VIDEO_COLOR_PRIMARIES_FILM = 8,
  190. EBML_VIDEO_COLOR_PRIMARIES_ITU_R_BT_2020 = 9,
  191. EBML_VIDEO_COLOR_PRIMARIES_SMPTE_ST_428_1 = 10,
  192. EBML_VIDEO_COLOR_PRIMARIES_SMPTE_RP_432_2 = 11,
  193. EBML_VIDEO_COLOR_PRIMARIES_SMPTE_EG_432_2 = 12,
  194. EBML_VIDEO_COLOR_PRIMARIES_EBU_TECH_3212E_JEDEC_P22_PHOSPHORS = 22,
  195. };
  196. enum ebml_video_projection_type_e
  197. {
  198. EBML_VIDEO_PROJECTION_RECTANGULAR = 0,
  199. EBML_VIDEO_PROJECTION_EQUIRECTANGULAR = 1,
  200. EBML_VIDEO_PROJECTION_CUBEMAP = 2,
  201. EBML_VIDEO_PROJECTION_MESH = 3,
  202. };
  203. const char* mkv_codec_find_name(enum mkv_codec_t codec);
  204. enum mkv_codec_t mkv_codec_find_id(const char* name);
  205. int mkv_codec_is_video(enum mkv_codec_t codec);
  206. int mkv_codec_is_audio(enum mkv_codec_t codec);
  207. int mkv_codec_is_subtitle(enum mkv_codec_t codec);
  208. #ifdef __cplusplus
  209. }
  210. #endif
  211. #endif /* !_mkv_format_h_ */