react-native-alpha-video 0.0.0-stage → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (283) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +903 -2
  3. package/THIRD_PARTY_NOTICES.md +30 -0
  4. package/android/av1/build.gradle +67 -0
  5. package/android/av1/consumer-rules.pro +4 -0
  6. package/android/av1/src/main/cpp/Av1Codec_jni.cpp +8 -0
  7. package/android/av1/src/main/cpp/CMakeLists.txt +34 -0
  8. package/android/av1/src/main/java/dev/mediacache/alphavideo/av1/Av1Codec.java +21 -0
  9. package/android/build.gradle +85 -0
  10. package/android/consumer-rules.pro +2 -0
  11. package/android/gradle.properties +1 -0
  12. package/android/publish.gradle +82 -0
  13. package/android/settings.gradle +5 -0
  14. package/android/src/main/AndroidManifest.xml +1 -0
  15. package/android/src/main/cpp/CMakeLists.txt +59 -0
  16. package/android/src/main/java/dev/mediacache/alphavideo/AlphaVideoCodecs.java +73 -0
  17. package/android/src/main/java/dev/mediacache/alphavideo/AlphaVideoView.java +1966 -0
  18. package/android/src/main/java/dev/mediacache/alphavideo/BufferedDualStreamPlayer.java +978 -0
  19. package/android/src/main/java/dev/mediacache/alphavideo/Fetcher.java +37 -0
  20. package/android/src/main/java/dev/mediacache/alphavideo/HttpFetcher.java +156 -0
  21. package/android/src/main/java/dev/mediacache/alphavideo/MediaCodecColor.java +47 -0
  22. package/android/src/main/java/dev/mediacache/alphavideo/MediaCodecDecoders.java +135 -0
  23. package/android/src/main/java/dev/mediacache/alphavideo/RangeSourceLink.java +54 -0
  24. package/android/src/main/java/dev/mediacache/alphavideo/SourceReader.java +174 -0
  25. package/android/src/main/java/dev/mediacache/alphavideo/SurfaceTextureVideoDecoder.java +802 -0
  26. package/android/src/main/java/dev/mediacache/alphavideo/WebMAlphaPlayerNative.java +95 -0
  27. package/android/src/main/java/dev/mediacache/alphavideo/WebMFrame.java +54 -0
  28. package/android/src/main/java/dev/mediacache/alphavideo/WebMSource.java +160 -0
  29. package/android/src/rangesource/java/dev/mediacache/alphavideo/AppDataSource.java +50 -0
  30. package/android/vpx/build.gradle +67 -0
  31. package/android/vpx/consumer-rules.pro +4 -0
  32. package/android/vpx/src/main/cpp/CMakeLists.txt +34 -0
  33. package/android/vpx/src/main/cpp/VpxCodec_jni.cpp +8 -0
  34. package/android/vpx/src/main/java/dev/mediacache/alphavideo/vpx/VpxCodec.java +21 -0
  35. package/codecs/av1/Dav1dDecoderPlugin.cpp +157 -0
  36. package/codecs/av1/Dav1dDecoderPlugin.h +17 -0
  37. package/codecs/vpx/VpxDecoderPlugin.cpp +103 -0
  38. package/codecs/vpx/VpxDecoderPlugin.h +17 -0
  39. package/cpp/AlphaDemuxer.cpp +984 -0
  40. package/cpp/AlphaDemuxer.h +123 -0
  41. package/cpp/AlphaVideoDecoderPlugin.h +84 -0
  42. package/cpp/Av1SequenceHeader.cpp +175 -0
  43. package/cpp/Av1SequenceHeader.h +25 -0
  44. package/cpp/ByteSource.cpp +116 -0
  45. package/cpp/ByteSource.h +59 -0
  46. package/cpp/RangeSourceClient.h +40 -0
  47. package/cpp/VideoDecoder.cpp +157 -0
  48. package/cpp/VideoDecoder.h +83 -0
  49. package/cpp/WebMAlphaPlayer.cpp +1666 -0
  50. package/cpp/WebMAlphaPlayer.h +389 -0
  51. package/cpp/WebMAlphaPlayer_jni.cpp +1380 -0
  52. package/cpp/YuvToRgb.cpp +39 -0
  53. package/cpp/YuvToRgb.h +40 -0
  54. package/ios/Sources/AlphaVideo/AlphaVideoCodecs.mm +63 -0
  55. package/ios/Sources/AlphaVideo/AlphaVideoInternal.h +70 -0
  56. package/ios/Sources/AlphaVideo/AlphaVideoPlayer.mm +994 -0
  57. package/ios/Sources/AlphaVideo/AlphaVideoSource.mm +476 -0
  58. package/ios/Sources/AlphaVideo/AlphaVideoView.mm +374 -0
  59. package/ios/Sources/AlphaVideo/include/AlphaVideo.h +303 -0
  60. package/ios/Sources/AlphaVideoAV1/AlphaVideoAV1Codec.mm +16 -0
  61. package/ios/Sources/AlphaVideoAV1/include/AlphaVideoAV1.h +18 -0
  62. package/ios/Sources/AlphaVideoVPX/AlphaVideoVPXCodec.mm +16 -0
  63. package/ios/Sources/AlphaVideoVPX/include/AlphaVideoVPX.h +17 -0
  64. package/lib/commonjs/AlphaVideoView.js +187 -0
  65. package/lib/commonjs/AlphaVideoView.js.map +1 -0
  66. package/lib/commonjs/AlphaVideoViewNativeComponent.js +47 -0
  67. package/lib/commonjs/AlphaVideoViewNativeComponent.js.map +1 -0
  68. package/lib/commonjs/AlphaVideoViewNativeComponent.web.js +11 -0
  69. package/lib/commonjs/AlphaVideoViewNativeComponent.web.js.map +1 -0
  70. package/lib/commonjs/NativeAlphaVideoModule.js +10 -0
  71. package/lib/commonjs/NativeAlphaVideoModule.js.map +1 -0
  72. package/lib/commonjs/NativeAlphaVideoModule.web.js +9 -0
  73. package/lib/commonjs/NativeAlphaVideoModule.web.js.map +1 -0
  74. package/lib/commonjs/WebPlayer.js +12 -0
  75. package/lib/commonjs/WebPlayer.js.map +1 -0
  76. package/lib/commonjs/WebPlayer.web.js +92 -0
  77. package/lib/commonjs/WebPlayer.web.js.map +1 -0
  78. package/lib/commonjs/index.js +124 -0
  79. package/lib/commonjs/index.js.map +1 -0
  80. package/lib/module/AlphaVideoView.js +187 -0
  81. package/lib/module/AlphaVideoView.js.map +1 -0
  82. package/lib/module/AlphaVideoViewNativeComponent.js +47 -0
  83. package/lib/module/AlphaVideoViewNativeComponent.js.map +1 -0
  84. package/lib/module/AlphaVideoViewNativeComponent.web.js +11 -0
  85. package/lib/module/AlphaVideoViewNativeComponent.web.js.map +1 -0
  86. package/lib/module/NativeAlphaVideoModule.js +10 -0
  87. package/lib/module/NativeAlphaVideoModule.js.map +1 -0
  88. package/lib/module/NativeAlphaVideoModule.web.js +9 -0
  89. package/lib/module/NativeAlphaVideoModule.web.js.map +1 -0
  90. package/lib/module/WebPlayer.js +12 -0
  91. package/lib/module/WebPlayer.js.map +1 -0
  92. package/lib/module/WebPlayer.web.js +92 -0
  93. package/lib/module/WebPlayer.web.js.map +1 -0
  94. package/lib/module/index.js +124 -0
  95. package/lib/module/index.js.map +1 -0
  96. package/lib/typescript/react-native/src/AlphaVideoView.d.ts +189 -0
  97. package/lib/typescript/react-native/src/AlphaVideoView.d.ts.map +1 -0
  98. package/lib/typescript/react-native/src/AlphaVideoViewNativeComponent.d.ts +109 -0
  99. package/lib/typescript/react-native/src/AlphaVideoViewNativeComponent.d.ts.map +1 -0
  100. package/lib/typescript/react-native/src/AlphaVideoViewNativeComponent.web.d.ts +5 -0
  101. package/lib/typescript/react-native/src/AlphaVideoViewNativeComponent.web.d.ts.map +1 -0
  102. package/lib/typescript/react-native/src/NativeAlphaVideoModule.d.ts +21 -0
  103. package/lib/typescript/react-native/src/NativeAlphaVideoModule.d.ts.map +1 -0
  104. package/lib/typescript/react-native/src/NativeAlphaVideoModule.web.d.ts +3 -0
  105. package/lib/typescript/react-native/src/NativeAlphaVideoModule.web.d.ts.map +1 -0
  106. package/lib/typescript/react-native/src/WebPlayer.d.ts +3 -0
  107. package/lib/typescript/react-native/src/WebPlayer.d.ts.map +1 -0
  108. package/lib/typescript/react-native/src/WebPlayer.web.d.ts +9 -0
  109. package/lib/typescript/react-native/src/WebPlayer.web.d.ts.map +1 -0
  110. package/lib/typescript/react-native/src/index.d.ts +77 -0
  111. package/lib/typescript/react-native/src/index.d.ts.map +1 -0
  112. package/licenses/dav1d-COPYING.txt +23 -0
  113. package/licenses/libvpx-LICENSE.txt +31 -0
  114. package/licenses/libvpx-PATENTS.txt +23 -0
  115. package/licenses/libwebm-LICENSE.txt +30 -0
  116. package/licenses/libwebm-PATENTS.txt +23 -0
  117. package/package.json +150 -4
  118. package/prebuilt/android/arm64-v8a/lib/libdav1d.a +0 -0
  119. package/prebuilt/android/arm64-v8a/lib/libvpx.a +0 -0
  120. package/prebuilt/android/armeabi-v7a/lib/libdav1d.a +0 -0
  121. package/prebuilt/android/armeabi-v7a/lib/libvpx.a +0 -0
  122. package/prebuilt/android/x86_64/lib/libdav1d.a +0 -0
  123. package/prebuilt/android/x86_64/lib/libvpx.a +0 -0
  124. package/prebuilt/include/dav1d/common.h +94 -0
  125. package/prebuilt/include/dav1d/data.h +117 -0
  126. package/prebuilt/include/dav1d/dav1d.h +329 -0
  127. package/prebuilt/include/dav1d/headers.h +440 -0
  128. package/prebuilt/include/dav1d/picture.h +157 -0
  129. package/prebuilt/include/dav1d/version.h +50 -0
  130. package/prebuilt/include/vpx/vp8.h +136 -0
  131. package/prebuilt/include/vpx/vp8dx.h +228 -0
  132. package/prebuilt/include/vpx/vpx_codec.h +475 -0
  133. package/prebuilt/include/vpx/vpx_decoder.h +365 -0
  134. package/prebuilt/include/vpx/vpx_frame_buffer.h +83 -0
  135. package/prebuilt/include/vpx/vpx_image.h +209 -0
  136. package/prebuilt/include/vpx/vpx_integer.h +40 -0
  137. package/prebuilt/ios/lib/libdav1d.a +0 -0
  138. package/prebuilt/ios/lib/libvpx.a +0 -0
  139. package/prebuilt/ios-simulator/include/dav1d/common.h +94 -0
  140. package/prebuilt/ios-simulator/include/dav1d/data.h +117 -0
  141. package/prebuilt/ios-simulator/include/dav1d/dav1d.h +329 -0
  142. package/prebuilt/ios-simulator/include/dav1d/headers.h +440 -0
  143. package/prebuilt/ios-simulator/include/dav1d/picture.h +157 -0
  144. package/prebuilt/ios-simulator/include/dav1d/version.h +50 -0
  145. package/prebuilt/ios-simulator/include/vpx/vp8.h +136 -0
  146. package/prebuilt/ios-simulator/include/vpx/vp8dx.h +228 -0
  147. package/prebuilt/ios-simulator/include/vpx/vpx_codec.h +475 -0
  148. package/prebuilt/ios-simulator/include/vpx/vpx_decoder.h +365 -0
  149. package/prebuilt/ios-simulator/include/vpx/vpx_frame_buffer.h +83 -0
  150. package/prebuilt/ios-simulator/include/vpx/vpx_image.h +209 -0
  151. package/prebuilt/ios-simulator/include/vpx/vpx_integer.h +40 -0
  152. package/prebuilt/ios-simulator/lib/libdav1d.a +0 -0
  153. package/prebuilt/ios-simulator/lib/libvpx.a +0 -0
  154. package/react-native/android/CMakeLists.txt +14 -0
  155. package/react-native/android/build.gradle +110 -0
  156. package/react-native/android/src/main/AndroidManifest.xml +1 -0
  157. package/react-native/android/src/main/java/dev/mediacache/alphavideo/reactnative/AlphaVideoModule.java +102 -0
  158. package/react-native/android/src/main/java/dev/mediacache/alphavideo/reactnative/AlphaVideoPackage.java +50 -0
  159. package/react-native/android/src/main/java/dev/mediacache/alphavideo/reactnative/AlphaVideoViewManager.java +317 -0
  160. package/react-native/android/src/newarch/java/dev/mediacache/alphavideo/reactnative/AlphaVideoModuleSpec.java +10 -0
  161. package/react-native/android/src/newarch/java/dev/mediacache/alphavideo/reactnative/AlphaVideoViewManagerSpec.java +23 -0
  162. package/react-native/android/src/norangesource/java/dev/mediacache/alphavideo/AppDataSource.java +15 -0
  163. package/react-native/android/src/oldarch/java/dev/mediacache/alphavideo/reactnative/AlphaVideoModuleSpec.java +30 -0
  164. package/react-native/android/src/oldarch/java/dev/mediacache/alphavideo/reactnative/AlphaVideoViewManagerSpec.java +61 -0
  165. package/react-native/ios/RNAlphaVideoViewComponentView.mm +173 -0
  166. package/react-native/ios/RNAlphaVideoViewManager.mm +147 -0
  167. package/react-native/src/AlphaVideoView.tsx +329 -0
  168. package/react-native/src/AlphaVideoViewNativeComponent.ts +132 -0
  169. package/react-native/src/AlphaVideoViewNativeComponent.web.ts +5 -0
  170. package/react-native/src/NativeAlphaVideoModule.ts +22 -0
  171. package/react-native/src/NativeAlphaVideoModule.web.ts +2 -0
  172. package/react-native/src/WebPlayer.tsx +7 -0
  173. package/react-native/src/WebPlayer.web.tsx +60 -0
  174. package/react-native/src/index.tsx +144 -0
  175. package/react-native-alpha-video.podspec +99 -0
  176. package/react-native.config.js +12 -0
  177. package/scripts/build_codecs_android.sh +246 -0
  178. package/scripts/build_codecs_ios.sh +31 -0
  179. package/scripts/build_codecs_ios_device.sh +210 -0
  180. package/scripts/build_codecs_ios_simulator.sh +256 -0
  181. package/scripts/build_wasm.sh +230 -0
  182. package/scripts/build_xcframework.sh +49 -0
  183. package/scripts/fetch-prebuilt.sh +48 -0
  184. package/scripts/package_release.sh +107 -0
  185. package/scripts/publish-android.sh +85 -0
  186. package/scripts/vendor_range_source.sh +47 -0
  187. package/third_party/libwebm/AUTHORS.TXT +5 -0
  188. package/third_party/libwebm/LICENSE.TXT +30 -0
  189. package/third_party/libwebm/PATENTS.TXT +23 -0
  190. package/third_party/libwebm/README.md +7 -0
  191. package/third_party/libwebm/webm_parser/include/webm/buffer_reader.h +138 -0
  192. package/third_party/libwebm/webm_parser/include/webm/callback.h +363 -0
  193. package/third_party/libwebm/webm_parser/include/webm/dom_types.h +1781 -0
  194. package/third_party/libwebm/webm_parser/include/webm/element.h +208 -0
  195. package/third_party/libwebm/webm_parser/include/webm/file_reader.h +103 -0
  196. package/third_party/libwebm/webm_parser/include/webm/id.h +1085 -0
  197. package/third_party/libwebm/webm_parser/include/webm/istream_reader.h +99 -0
  198. package/third_party/libwebm/webm_parser/include/webm/reader.h +94 -0
  199. package/third_party/libwebm/webm_parser/include/webm/status.h +166 -0
  200. package/third_party/libwebm/webm_parser/include/webm/webm_parser.h +133 -0
  201. package/third_party/libwebm/webm_parser/src/ancestory.cc +334 -0
  202. package/third_party/libwebm/webm_parser/src/ancestory.h +83 -0
  203. package/third_party/libwebm/webm_parser/src/audio_parser.h +84 -0
  204. package/third_party/libwebm/webm_parser/src/bit_utils.cc +26 -0
  205. package/third_party/libwebm/webm_parser/src/bit_utils.h +24 -0
  206. package/third_party/libwebm/webm_parser/src/block_additions_parser.h +30 -0
  207. package/third_party/libwebm/webm_parser/src/block_group_parser.h +71 -0
  208. package/third_party/libwebm/webm_parser/src/block_header_parser.cc +76 -0
  209. package/third_party/libwebm/webm_parser/src/block_header_parser.h +65 -0
  210. package/third_party/libwebm/webm_parser/src/block_more_parser.h +32 -0
  211. package/third_party/libwebm/webm_parser/src/block_parser.cc +285 -0
  212. package/third_party/libwebm/webm_parser/src/block_parser.h +126 -0
  213. package/third_party/libwebm/webm_parser/src/bool_parser.h +95 -0
  214. package/third_party/libwebm/webm_parser/src/buffer_reader.cc +110 -0
  215. package/third_party/libwebm/webm_parser/src/byte_parser.h +144 -0
  216. package/third_party/libwebm/webm_parser/src/callback.cc +155 -0
  217. package/third_party/libwebm/webm_parser/src/chapter_atom_parser.h +42 -0
  218. package/third_party/libwebm/webm_parser/src/chapter_display_parser.h +34 -0
  219. package/third_party/libwebm/webm_parser/src/chapters_parser.h +28 -0
  220. package/third_party/libwebm/webm_parser/src/cluster_parser.h +48 -0
  221. package/third_party/libwebm/webm_parser/src/colour_parser.h +55 -0
  222. package/third_party/libwebm/webm_parser/src/content_enc_aes_settings_parser.h +32 -0
  223. package/third_party/libwebm/webm_parser/src/content_encoding_parser.h +38 -0
  224. package/third_party/libwebm/webm_parser/src/content_encodings_parser.h +30 -0
  225. package/third_party/libwebm/webm_parser/src/content_encryption_parser.h +37 -0
  226. package/third_party/libwebm/webm_parser/src/cue_point_parser.h +38 -0
  227. package/third_party/libwebm/webm_parser/src/cue_track_positions_parser.h +39 -0
  228. package/third_party/libwebm/webm_parser/src/cues_parser.h +27 -0
  229. package/third_party/libwebm/webm_parser/src/date_parser.cc +72 -0
  230. package/third_party/libwebm/webm_parser/src/date_parser.h +64 -0
  231. package/third_party/libwebm/webm_parser/src/ebml_parser.h +48 -0
  232. package/third_party/libwebm/webm_parser/src/edition_entry_parser.h +35 -0
  233. package/third_party/libwebm/webm_parser/src/element_parser.h +102 -0
  234. package/third_party/libwebm/webm_parser/src/file_reader.cc +142 -0
  235. package/third_party/libwebm/webm_parser/src/float_parser.cc +77 -0
  236. package/third_party/libwebm/webm_parser/src/float_parser.h +65 -0
  237. package/third_party/libwebm/webm_parser/src/id_element_parser.cc +49 -0
  238. package/third_party/libwebm/webm_parser/src/id_element_parser.h +56 -0
  239. package/third_party/libwebm/webm_parser/src/id_parser.cc +75 -0
  240. package/third_party/libwebm/webm_parser/src/id_parser.h +45 -0
  241. package/third_party/libwebm/webm_parser/src/info_parser.h +44 -0
  242. package/third_party/libwebm/webm_parser/src/int_parser.h +121 -0
  243. package/third_party/libwebm/webm_parser/src/istream_reader.cc +133 -0
  244. package/third_party/libwebm/webm_parser/src/master_parser.cc +298 -0
  245. package/third_party/libwebm/webm_parser/src/master_parser.h +230 -0
  246. package/third_party/libwebm/webm_parser/src/master_value_parser.h +533 -0
  247. package/third_party/libwebm/webm_parser/src/mastering_metadata_parser.h +57 -0
  248. package/third_party/libwebm/webm_parser/src/parser.h +34 -0
  249. package/third_party/libwebm/webm_parser/src/parser_utils.cc +34 -0
  250. package/third_party/libwebm/webm_parser/src/parser_utils.h +64 -0
  251. package/third_party/libwebm/webm_parser/src/projection_parser.h +40 -0
  252. package/third_party/libwebm/webm_parser/src/recursive_parser.h +93 -0
  253. package/third_party/libwebm/webm_parser/src/seek_head_parser.h +27 -0
  254. package/third_party/libwebm/webm_parser/src/seek_parser.h +37 -0
  255. package/third_party/libwebm/webm_parser/src/segment_parser.cc +86 -0
  256. package/third_party/libwebm/webm_parser/src/segment_parser.h +53 -0
  257. package/third_party/libwebm/webm_parser/src/simple_tag_parser.h +37 -0
  258. package/third_party/libwebm/webm_parser/src/size_parser.cc +56 -0
  259. package/third_party/libwebm/webm_parser/src/size_parser.h +43 -0
  260. package/third_party/libwebm/webm_parser/src/skip_callback.h +63 -0
  261. package/third_party/libwebm/webm_parser/src/skip_parser.cc +59 -0
  262. package/third_party/libwebm/webm_parser/src/skip_parser.h +35 -0
  263. package/third_party/libwebm/webm_parser/src/slices_parser.h +30 -0
  264. package/third_party/libwebm/webm_parser/src/tag_parser.h +37 -0
  265. package/third_party/libwebm/webm_parser/src/tags_parser.h +27 -0
  266. package/third_party/libwebm/webm_parser/src/targets_parser.h +35 -0
  267. package/third_party/libwebm/webm_parser/src/time_slice_parser.h +30 -0
  268. package/third_party/libwebm/webm_parser/src/track_entry_parser.h +65 -0
  269. package/third_party/libwebm/webm_parser/src/tracks_parser.h +27 -0
  270. package/third_party/libwebm/webm_parser/src/unknown_parser.cc +49 -0
  271. package/third_party/libwebm/webm_parser/src/unknown_parser.h +38 -0
  272. package/third_party/libwebm/webm_parser/src/var_int_parser.cc +71 -0
  273. package/third_party/libwebm/webm_parser/src/var_int_parser.h +56 -0
  274. package/third_party/libwebm/webm_parser/src/video_parser.h +122 -0
  275. package/third_party/libwebm/webm_parser/src/virtual_block_parser.cc +72 -0
  276. package/third_party/libwebm/webm_parser/src/virtual_block_parser.h +69 -0
  277. package/third_party/libwebm/webm_parser/src/void_parser.cc +49 -0
  278. package/third_party/libwebm/webm_parser/src/void_parser.h +41 -0
  279. package/third_party/libwebm/webm_parser/src/webm_parser.cc +282 -0
  280. package/third_party/range-source/LICENSE +21 -0
  281. package/third_party/range-source/README.md +8 -0
  282. package/third_party/range-source/include/range_source.h +395 -0
  283. package/third_party/range-source/include/range_source_download.h +309 -0
@@ -0,0 +1,334 @@
1
+ // Copyright (c) 2016 The WebM project authors. All Rights Reserved.
2
+ //
3
+ // Use of this source code is governed by a BSD-style license
4
+ // that can be found in the LICENSE file in the root of the source
5
+ // tree. An additional intellectual property rights grant can be found
6
+ // in the file PATENTS. All contributing project authors may
7
+ // be found in the AUTHORS file in the root of the source tree.
8
+ #include "src/ancestory.h"
9
+
10
+ #include "webm/id.h"
11
+
12
+ namespace webm {
13
+
14
+ bool Ancestory::ById(Id id, Ancestory* ancestory) {
15
+ // These lists of IDs were generated and must match the switch statement and
16
+ // have static storage duration. They were generated as follows:
17
+ //
18
+ // 1. List all the master elements:
19
+ // kEbml
20
+ // kSegment
21
+ // kSeekHead
22
+ // kSeek
23
+ // kInfo
24
+ // kCluster
25
+ // kBlockGroup
26
+ // kBlockAdditions
27
+ // kBlockMore
28
+ // kSlices
29
+ // kTimeSlice
30
+ // etc.
31
+ //
32
+ // 2. Now prefix each entry with its full ancestory:
33
+ // kEbml
34
+ // kSegment
35
+ // kSegment, kSeekHead
36
+ // kSegment, kSeekHead, kSeek
37
+ // kSegment, kInfo
38
+ // kSegment, kCluster
39
+ // kSegment, kCluster, kBlockGroup
40
+ // kSegment, kCluster, kBlockGroup, kBlockAdditions
41
+ // kSegment, kCluster, kBlockGroup, kBlockAdditions, kBlockMore
42
+ // kSegment, kCluster, kBlockGroup, kSlices
43
+ // kSegment, kCluster, kBlockGroup, kSlices, kTimeSlice
44
+ // etc.
45
+ //
46
+ // 3. Now remove entries that are just subsets of others:
47
+ // kEbml
48
+ // kSegment, kSeekHead, kSeek
49
+ // kSegment, kInfo
50
+ // kSegment, kCluster, kBlockGroup, kBlockAdditions, kBlockMore
51
+ // kSegment, kCluster, kBlockGroup, kSlices, kTimeSlice
52
+ // etc.
53
+ static constexpr Id kEbmlAncestory[] = {
54
+ Id::kEbml,
55
+ };
56
+ static constexpr Id kSeekAncestory[] = {
57
+ Id::kSegment,
58
+ Id::kSeekHead,
59
+ Id::kSeek,
60
+ };
61
+ static constexpr Id kInfoAncestory[] = {
62
+ Id::kSegment,
63
+ Id::kInfo,
64
+ };
65
+ static constexpr Id kBlockMoreAncestory[] = {
66
+ Id::kSegment, Id::kCluster, Id::kBlockGroup,
67
+ Id::kBlockAdditions, Id::kBlockMore,
68
+ };
69
+ static constexpr Id kTimeSliceAncestory[] = {
70
+ Id::kSegment, Id::kCluster, Id::kBlockGroup, Id::kSlices, Id::kTimeSlice,
71
+ };
72
+ static constexpr Id kVideoAncestory[] = {
73
+ Id::kSegment,
74
+ Id::kTracks,
75
+ Id::kTrackEntry,
76
+ Id::kVideo,
77
+ };
78
+ static constexpr Id kAudioAncestory[] = {
79
+ Id::kSegment,
80
+ Id::kTracks,
81
+ Id::kTrackEntry,
82
+ Id::kAudio,
83
+ };
84
+ static constexpr Id kContentEncAesSettingsAncestory[] = {
85
+ Id::kSegment,
86
+ Id::kTracks,
87
+ Id::kTrackEntry,
88
+ Id::kContentEncodings,
89
+ Id::kContentEncoding,
90
+ Id::kContentEncryption,
91
+ Id::kContentEncAesSettings,
92
+ };
93
+ static constexpr Id kCueTrackPositionsAncestory[] = {
94
+ Id::kSegment,
95
+ Id::kCues,
96
+ Id::kCuePoint,
97
+ Id::kCueTrackPositions,
98
+ };
99
+ static constexpr Id kChapterDisplayAncestory[] = {
100
+ Id::kSegment, Id::kChapters, Id::kEditionEntry,
101
+ Id::kChapterAtom, Id::kChapterDisplay,
102
+ };
103
+ static constexpr Id kTargetsAncestory[] = {
104
+ Id::kSegment,
105
+ Id::kTags,
106
+ Id::kTag,
107
+ Id::kTargets,
108
+ };
109
+ static constexpr Id kSimpleTagAncestory[] = {
110
+ Id::kSegment,
111
+ Id::kTags,
112
+ Id::kTag,
113
+ Id::kSimpleTag,
114
+ };
115
+
116
+ switch (id) {
117
+ case Id::kEbmlVersion:
118
+ case Id::kEbmlReadVersion:
119
+ case Id::kEbmlMaxIdLength:
120
+ case Id::kEbmlMaxSizeLength:
121
+ case Id::kDocType:
122
+ case Id::kDocTypeVersion:
123
+ case Id::kDocTypeReadVersion:
124
+ *ancestory = Ancestory(kEbmlAncestory, 1);
125
+ return true;
126
+
127
+ case Id::kSeekHead:
128
+ case Id::kInfo:
129
+ case Id::kCluster:
130
+ case Id::kTracks:
131
+ case Id::kCues:
132
+ case Id::kChapters:
133
+ case Id::kTags:
134
+ *ancestory = Ancestory(kSeekAncestory, 1);
135
+ return true;
136
+
137
+ case Id::kSeek:
138
+ *ancestory = Ancestory(kSeekAncestory, 2);
139
+ return true;
140
+
141
+ case Id::kSeekId:
142
+ case Id::kSeekPosition:
143
+ *ancestory = Ancestory(kSeekAncestory, 3);
144
+ return true;
145
+
146
+ case Id::kTimecodeScale:
147
+ case Id::kDuration:
148
+ case Id::kDateUtc:
149
+ case Id::kTitle:
150
+ case Id::kMuxingApp:
151
+ case Id::kWritingApp:
152
+ *ancestory = Ancestory(kInfoAncestory, 2);
153
+ return true;
154
+
155
+ case Id::kTimecode:
156
+ case Id::kPrevSize:
157
+ case Id::kSimpleBlock:
158
+ case Id::kBlockGroup:
159
+ *ancestory = Ancestory(kBlockMoreAncestory, 2);
160
+ return true;
161
+
162
+ case Id::kBlock:
163
+ case Id::kBlockVirtual:
164
+ case Id::kBlockAdditions:
165
+ case Id::kBlockDuration:
166
+ case Id::kReferenceBlock:
167
+ case Id::kDiscardPadding:
168
+ case Id::kSlices:
169
+ *ancestory = Ancestory(kBlockMoreAncestory, 3);
170
+ return true;
171
+
172
+ case Id::kBlockMore:
173
+ *ancestory = Ancestory(kBlockMoreAncestory, 4);
174
+ return true;
175
+
176
+ case Id::kBlockAddId:
177
+ case Id::kBlockAdditional:
178
+ *ancestory = Ancestory(kBlockMoreAncestory, 5);
179
+ return true;
180
+
181
+ case Id::kTimeSlice:
182
+ *ancestory = Ancestory(kTimeSliceAncestory, 4);
183
+ return true;
184
+
185
+ case Id::kLaceNumber:
186
+ *ancestory = Ancestory(kTimeSliceAncestory, 5);
187
+ return true;
188
+
189
+ case Id::kTrackEntry:
190
+ *ancestory = Ancestory(kVideoAncestory, 2);
191
+ return true;
192
+
193
+ case Id::kTrackNumber:
194
+ case Id::kTrackUid:
195
+ case Id::kTrackType:
196
+ case Id::kFlagEnabled:
197
+ case Id::kFlagDefault:
198
+ case Id::kFlagForced:
199
+ case Id::kFlagLacing:
200
+ case Id::kDefaultDuration:
201
+ case Id::kName:
202
+ case Id::kLanguage:
203
+ case Id::kCodecId:
204
+ case Id::kCodecPrivate:
205
+ case Id::kCodecName:
206
+ case Id::kCodecDelay:
207
+ case Id::kSeekPreRoll:
208
+ case Id::kVideo:
209
+ case Id::kAudio:
210
+ case Id::kContentEncodings:
211
+ *ancestory = Ancestory(kVideoAncestory, 3);
212
+ return true;
213
+
214
+ case Id::kFlagInterlaced:
215
+ case Id::kStereoMode:
216
+ case Id::kAlphaMode:
217
+ case Id::kPixelWidth:
218
+ case Id::kPixelHeight:
219
+ case Id::kPixelCropBottom:
220
+ case Id::kPixelCropTop:
221
+ case Id::kPixelCropLeft:
222
+ case Id::kPixelCropRight:
223
+ case Id::kDisplayWidth:
224
+ case Id::kDisplayHeight:
225
+ case Id::kDisplayUnit:
226
+ case Id::kAspectRatioType:
227
+ case Id::kFrameRate:
228
+ *ancestory = Ancestory(kVideoAncestory, 4);
229
+ return true;
230
+
231
+ case Id::kSamplingFrequency:
232
+ case Id::kOutputSamplingFrequency:
233
+ case Id::kChannels:
234
+ case Id::kBitDepth:
235
+ *ancestory = Ancestory(kAudioAncestory, 4);
236
+ return true;
237
+
238
+ case Id::kContentEncoding:
239
+ *ancestory = Ancestory(kContentEncAesSettingsAncestory, 4);
240
+ return true;
241
+
242
+ case Id::kContentEncodingOrder:
243
+ case Id::kContentEncodingScope:
244
+ case Id::kContentEncodingType:
245
+ case Id::kContentEncryption:
246
+ *ancestory = Ancestory(kContentEncAesSettingsAncestory, 5);
247
+ return true;
248
+
249
+ case Id::kContentEncAlgo:
250
+ case Id::kContentEncKeyId:
251
+ case Id::kContentEncAesSettings:
252
+ *ancestory = Ancestory(kContentEncAesSettingsAncestory, 6);
253
+ return true;
254
+
255
+ case Id::kAesSettingsCipherMode:
256
+ *ancestory = Ancestory(kContentEncAesSettingsAncestory, 7);
257
+ return true;
258
+
259
+ case Id::kCuePoint:
260
+ *ancestory = Ancestory(kCueTrackPositionsAncestory, 2);
261
+ return true;
262
+
263
+ case Id::kCueTime:
264
+ case Id::kCueTrackPositions:
265
+ *ancestory = Ancestory(kCueTrackPositionsAncestory, 3);
266
+ return true;
267
+
268
+ case Id::kCueTrack:
269
+ case Id::kCueClusterPosition:
270
+ case Id::kCueRelativePosition:
271
+ case Id::kCueDuration:
272
+ case Id::kCueBlockNumber:
273
+ *ancestory = Ancestory(kCueTrackPositionsAncestory, 4);
274
+ return true;
275
+
276
+ case Id::kEditionEntry:
277
+ *ancestory = Ancestory(kChapterDisplayAncestory, 2);
278
+ return true;
279
+
280
+ case Id::kChapterAtom:
281
+ *ancestory = Ancestory(kChapterDisplayAncestory, 3);
282
+ return true;
283
+
284
+ case Id::kChapterUid:
285
+ case Id::kChapterStringUid:
286
+ case Id::kChapterTimeStart:
287
+ case Id::kChapterTimeEnd:
288
+ case Id::kChapterDisplay:
289
+ *ancestory = Ancestory(kChapterDisplayAncestory, 4);
290
+ return true;
291
+
292
+ case Id::kChapString:
293
+ case Id::kChapLanguage:
294
+ case Id::kChapCountry:
295
+ *ancestory = Ancestory(kChapterDisplayAncestory, 5);
296
+ return true;
297
+
298
+ case Id::kTag:
299
+ *ancestory = Ancestory(kTargetsAncestory, 2);
300
+ return true;
301
+
302
+ case Id::kTargets:
303
+ case Id::kSimpleTag:
304
+ *ancestory = Ancestory(kTargetsAncestory, 3);
305
+ return true;
306
+
307
+ case Id::kTargetTypeValue:
308
+ case Id::kTargetType:
309
+ case Id::kTagTrackUid:
310
+ *ancestory = Ancestory(kTargetsAncestory, 4);
311
+ return true;
312
+
313
+ case Id::kTagName:
314
+ case Id::kTagLanguage:
315
+ case Id::kTagDefault:
316
+ case Id::kTagString:
317
+ case Id::kTagBinary:
318
+ *ancestory = Ancestory(kSimpleTagAncestory, 4);
319
+ return true;
320
+
321
+ case Id::kEbml:
322
+ case Id::kSegment:
323
+ *ancestory = {};
324
+ return true;
325
+
326
+ default:
327
+ // This is an unknown element or a global element (i.e. Void); its
328
+ // ancestory cannot be deduced.
329
+ *ancestory = {};
330
+ return false;
331
+ }
332
+ }
333
+
334
+ } // namespace webm
@@ -0,0 +1,83 @@
1
+ // Copyright (c) 2016 The WebM project authors. All Rights Reserved.
2
+ //
3
+ // Use of this source code is governed by a BSD-style license
4
+ // that can be found in the LICENSE file in the root of the source
5
+ // tree. An additional intellectual property rights grant can be found
6
+ // in the file PATENTS. All contributing project authors may
7
+ // be found in the AUTHORS file in the root of the source tree.
8
+ #ifndef SRC_ANCESTORY_H_
9
+ #define SRC_ANCESTORY_H_
10
+
11
+ #include <cassert>
12
+ #include <cstddef>
13
+ #include <iterator>
14
+
15
+ #include "webm/id.h"
16
+
17
+ namespace webm {
18
+
19
+ // Represents an element's ancestory in descending order. For example, the
20
+ // Id::kTrackNumber element has an ancestory of {Id::kSegment, Id::kTracks,
21
+ // Id::kTrackEntry}.
22
+ class Ancestory {
23
+ public:
24
+ // Constructs an empty ancestory.
25
+ Ancestory() = default;
26
+
27
+ Ancestory(const Ancestory&) = default;
28
+ Ancestory(Ancestory&&) = default;
29
+ Ancestory& operator=(const Ancestory&) = default;
30
+ Ancestory& operator=(Ancestory&&) = default;
31
+
32
+ // Returns the ancestory with the top-level parent removed. For example, if
33
+ // the current ancestory is {Id::kSegment, Id::kTracks, Id::kTrackEntry}, next
34
+ // will return {Id::kTracks, Id::kTrackEntry}. This must not be called if the
35
+ // ancestory is empty.
36
+ Ancestory next() const {
37
+ assert(begin_ < end_);
38
+ Ancestory copy = *this;
39
+ ++copy.begin_;
40
+ return copy;
41
+ }
42
+
43
+ // Gets the Id of the top-level parent. For example, if the current ancestory
44
+ // is {Id::kSegment, Id::kTracks, Id::kTrackEntry}, id will return
45
+ // Id::kSegment. This must not be called if the ancestory is empty.
46
+ Id id() const {
47
+ assert(begin_ < end_);
48
+ return *begin_;
49
+ }
50
+
51
+ // Returns true if the ancestory is empty.
52
+ bool empty() const { return begin_ == end_; }
53
+
54
+ // Looks up the ancestory of the given id. Returns true and sets ancestory if
55
+ // the element's ancestory could be deduced. Global elements (i.e. Id::kVoid)
56
+ // and unknown elements can't have their ancestory deduced.
57
+ static bool ById(Id id, Ancestory* ancestory);
58
+
59
+ private:
60
+ // Constructs an Ancestory using the first count elements of ancestory.
61
+ // ancestory must have static storage duration.
62
+ template <std::size_t N>
63
+ Ancestory(const Id (&ancestory)[N], std::size_t count)
64
+ : begin_(ancestory), end_(ancestory + count) {
65
+ assert(count <= N);
66
+ }
67
+
68
+ // The following invariants apply to begin_ and end_:
69
+ // begin_ <= end_
70
+ // (begin_ == end_) || (std::begin(kIds) <= begin_ && end_ <= std::end(kIds))
71
+
72
+ // The beginning (inclusive) of the sequence of IDs in kIds that defines the
73
+ // ancestory.
74
+ const Id* begin_ = nullptr;
75
+
76
+ // The ending (exclusive) of the sequence of IDs in kIds that defines the
77
+ // ancestory.
78
+ const Id* end_ = nullptr;
79
+ };
80
+
81
+ } // namespace webm
82
+
83
+ #endif // SRC_ANCESTORY_H_
@@ -0,0 +1,84 @@
1
+ // Copyright (c) 2016 The WebM project authors. All Rights Reserved.
2
+ //
3
+ // Use of this source code is governed by a BSD-style license
4
+ // that can be found in the LICENSE file in the root of the source
5
+ // tree. An additional intellectual property rights grant can be found
6
+ // in the file PATENTS. All contributing project authors may
7
+ // be found in the AUTHORS file in the root of the source tree.
8
+ #ifndef SRC_AUDIO_PARSER_H_
9
+ #define SRC_AUDIO_PARSER_H_
10
+
11
+ #include <cassert>
12
+ #include <cstdint>
13
+
14
+ #include "src/float_parser.h"
15
+ #include "src/int_parser.h"
16
+ #include "src/master_value_parser.h"
17
+ #include "webm/callback.h"
18
+ #include "webm/dom_types.h"
19
+ #include "webm/id.h"
20
+ #include "webm/reader.h"
21
+ #include "webm/status.h"
22
+
23
+ namespace webm {
24
+
25
+ // Spec reference:
26
+ // http://matroska.org/technical/specs/index.html#Audio
27
+ // http://www.webmproject.org/docs/container/#Audio
28
+ class AudioParser : public MasterValueParser<Audio> {
29
+ public:
30
+ AudioParser()
31
+ : MasterValueParser<Audio>(
32
+ MakeChild<FloatParser>(Id::kSamplingFrequency,
33
+ &Audio::sampling_frequency),
34
+ MakeChild<FloatParser>(Id::kOutputSamplingFrequency,
35
+ &Audio::output_frequency)
36
+ .NotifyOnParseComplete(),
37
+ MakeChild<UnsignedIntParser>(Id::kChannels, &Audio::channels),
38
+ MakeChild<UnsignedIntParser>(Id::kBitDepth, &Audio::bit_depth)) {}
39
+
40
+ Status Init(const ElementMetadata& metadata,
41
+ std::uint64_t max_size) override {
42
+ output_frequency_has_value_ = false;
43
+
44
+ return MasterValueParser::Init(metadata, max_size);
45
+ }
46
+
47
+ void InitAfterSeek(const Ancestory& child_ancestory,
48
+ const ElementMetadata& child_metadata) override {
49
+ output_frequency_has_value_ = false;
50
+
51
+ return MasterValueParser::InitAfterSeek(child_ancestory, child_metadata);
52
+ }
53
+
54
+ Status Feed(Callback* callback, Reader* reader,
55
+ std::uint64_t* num_bytes_read) override {
56
+ const Status status =
57
+ MasterValueParser::Feed(callback, reader, num_bytes_read);
58
+ if (status.completed_ok()) {
59
+ FixMissingOutputFrequency();
60
+ }
61
+ return status;
62
+ }
63
+
64
+ protected:
65
+ void OnChildParsed(const ElementMetadata& metadata) override {
66
+ assert(metadata.id == Id::kOutputSamplingFrequency);
67
+
68
+ output_frequency_has_value_ = metadata.size > 0;
69
+ }
70
+
71
+ private:
72
+ bool output_frequency_has_value_;
73
+
74
+ void FixMissingOutputFrequency() {
75
+ if (!output_frequency_has_value_) {
76
+ *mutable_value()->output_frequency.mutable_value() =
77
+ value().sampling_frequency.value();
78
+ }
79
+ }
80
+ };
81
+
82
+ } // namespace webm
83
+
84
+ #endif // SRC_AUDIO_PARSER_H_
@@ -0,0 +1,26 @@
1
+ // Copyright (c) 2016 The WebM project authors. All Rights Reserved.
2
+ //
3
+ // Use of this source code is governed by a BSD-style license
4
+ // that can be found in the LICENSE file in the root of the source
5
+ // tree. An additional intellectual property rights grant can be found
6
+ // in the file PATENTS. All contributing project authors may
7
+ // be found in the AUTHORS file in the root of the source tree.
8
+ #include "src/bit_utils.h"
9
+
10
+ #include <cstdint>
11
+
12
+ namespace webm {
13
+
14
+ std::uint8_t CountLeadingZeros(std::uint8_t value) {
15
+ // Special case for 0 since we can't shift by sizeof(T) * 8 bytes.
16
+ if (value == 0)
17
+ return 8;
18
+
19
+ std::uint8_t count = 0;
20
+ while (!(value & (0x80 >> count))) {
21
+ ++count;
22
+ }
23
+ return count;
24
+ }
25
+
26
+ } // namespace webm
@@ -0,0 +1,24 @@
1
+ // Copyright (c) 2016 The WebM project authors. All Rights Reserved.
2
+ //
3
+ // Use of this source code is governed by a BSD-style license
4
+ // that can be found in the LICENSE file in the root of the source
5
+ // tree. An additional intellectual property rights grant can be found
6
+ // in the file PATENTS. All contributing project authors may
7
+ // be found in the AUTHORS file in the root of the source tree.
8
+ #ifndef SRC_BIT_UTILS_H_
9
+ #define SRC_BIT_UTILS_H_
10
+
11
+ #include <cstdint>
12
+
13
+ namespace webm {
14
+
15
+ // Counts the number of leading zero bits.
16
+ // For example:
17
+ // assert(8 == CountLeadingZeros(0x00));
18
+ // assert(4 == CountLeadingZeros(0x0f));
19
+ // assert(0 == CountLeadingZeros(0xf0));
20
+ std::uint8_t CountLeadingZeros(std::uint8_t value);
21
+
22
+ } // namespace webm
23
+
24
+ #endif // SRC_BIT_UTILS_H_
@@ -0,0 +1,30 @@
1
+ // Copyright (c) 2016 The WebM project authors. All Rights Reserved.
2
+ //
3
+ // Use of this source code is governed by a BSD-style license
4
+ // that can be found in the LICENSE file in the root of the source
5
+ // tree. An additional intellectual property rights grant can be found
6
+ // in the file PATENTS. All contributing project authors may
7
+ // be found in the AUTHORS file in the root of the source tree.
8
+ #ifndef SRC_BLOCK_ADDITIONS_PARSER_H_
9
+ #define SRC_BLOCK_ADDITIONS_PARSER_H_
10
+
11
+ #include "src/block_more_parser.h"
12
+ #include "src/master_value_parser.h"
13
+ #include "webm/dom_types.h"
14
+ #include "webm/id.h"
15
+
16
+ namespace webm {
17
+
18
+ // Spec reference:
19
+ // http://matroska.org/technical/specs/index.html#BlockAdditions
20
+ // http://www.webmproject.org/docs/container/#BlockAdditions
21
+ class BlockAdditionsParser : public MasterValueParser<BlockAdditions> {
22
+ public:
23
+ BlockAdditionsParser()
24
+ : MasterValueParser<BlockAdditions>(MakeChild<BlockMoreParser>(
25
+ Id::kBlockMore, &BlockAdditions::block_mores)) {}
26
+ };
27
+
28
+ } // namespace webm
29
+
30
+ #endif // SRC_BLOCK_ADDITIONS_PARSER_H_
@@ -0,0 +1,71 @@
1
+ // Copyright (c) 2016 The WebM project authors. All Rights Reserved.
2
+ //
3
+ // Use of this source code is governed by a BSD-style license
4
+ // that can be found in the LICENSE file in the root of the source
5
+ // tree. An additional intellectual property rights grant can be found
6
+ // in the file PATENTS. All contributing project authors may
7
+ // be found in the AUTHORS file in the root of the source tree.
8
+ #ifndef SRC_BLOCK_GROUP_PARSER_H_
9
+ #define SRC_BLOCK_GROUP_PARSER_H_
10
+
11
+ #include "src/block_additions_parser.h"
12
+ #include "src/block_parser.h"
13
+ #include "src/int_parser.h"
14
+ #include "src/master_value_parser.h"
15
+ #include "src/slices_parser.h"
16
+ #include "src/virtual_block_parser.h"
17
+ #include "webm/dom_types.h"
18
+ #include "webm/id.h"
19
+
20
+ namespace webm {
21
+
22
+ // Spec reference:
23
+ // http://matroska.org/technical/specs/index.html#BlockGroup
24
+ // http://www.webmproject.org/docs/container/#BlockGroup
25
+ class BlockGroupParser : public MasterValueParser<BlockGroup> {
26
+ public:
27
+ BlockGroupParser()
28
+ : MasterValueParser<BlockGroup>(
29
+ MakeChild<BlockParser>(Id::kBlock, &BlockGroup::block),
30
+ MakeChild<VirtualBlockParser>(Id::kBlockVirtual,
31
+ &BlockGroup::virtual_block),
32
+ MakeChild<BlockAdditionsParser>(Id::kBlockAdditions,
33
+ &BlockGroup::additions),
34
+ MakeChild<UnsignedIntParser>(Id::kBlockDuration,
35
+ &BlockGroup::duration),
36
+ MakeChild<SignedIntParser>(Id::kReferenceBlock,
37
+ &BlockGroup::references),
38
+ MakeChild<SignedIntParser>(Id::kDiscardPadding,
39
+ &BlockGroup::discard_padding),
40
+ MakeChild<SlicesParser>(Id::kSlices, &BlockGroup::slices)) {}
41
+
42
+ Status Feed(Callback* callback, Reader* reader,
43
+ std::uint64_t* num_bytes_read) override {
44
+ *num_bytes_read = 0;
45
+
46
+ if (!parse_started_event_completed()) {
47
+ Action action = Action::kRead;
48
+ Status status = OnParseStarted(callback, &action);
49
+ if (!status.completed_ok()) {
50
+ return status;
51
+ }
52
+
53
+ set_parse_started_event_completed_with_action(action);
54
+ }
55
+
56
+ return MasterValueParser::Feed(callback, reader, num_bytes_read);
57
+ }
58
+
59
+ protected:
60
+ Status OnParseStarted(Callback* callback, Action* action) override {
61
+ return callback->OnBlockGroupBegin(metadata(Id::kBlockGroup), action);
62
+ }
63
+
64
+ Status OnParseCompleted(Callback* callback) override {
65
+ return callback->OnBlockGroupEnd(metadata(Id::kBlockGroup), value());
66
+ }
67
+ };
68
+
69
+ } // namespace webm
70
+
71
+ #endif // SRC_BLOCK_GROUP_PARSER_H_