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_SKIP_CALLBACK_H_ 9 #define SRC_SKIP_CALLBACK_H_ 10 11 #include "webm/callback.h" 12 #include "webm/dom_types.h" 13 #include "webm/reader.h" 14 #include "webm/status.h" 15 16 namespace webm { 17 18 // An implementation of Callback that skips all elements. Every method that 19 // yields an action will yield Action::kSkip, and Reader::Skip will be called 20 // if the callback ever needs to process data from the byte stream. 21 class SkipCallback : public Callback { 22 public: OnElementBegin(const ElementMetadata &,Action * action)23 Status OnElementBegin(const ElementMetadata& /* metadata */, 24 Action* action) override { 25 *action = Action::kSkip; 26 return Status(Status::kOkCompleted); 27 } 28 OnSegmentBegin(const ElementMetadata &,Action * action)29 Status OnSegmentBegin(const ElementMetadata& /* metadata */, 30 Action* action) override { 31 *action = Action::kSkip; 32 return Status(Status::kOkCompleted); 33 } 34 OnClusterBegin(const ElementMetadata &,const Cluster &,Action * action)35 Status OnClusterBegin(const ElementMetadata& /* metadata */, 36 const Cluster& /* cluster */, Action* action) override { 37 *action = Action::kSkip; 38 return Status(Status::kOkCompleted); 39 } 40 OnSimpleBlockBegin(const ElementMetadata &,const SimpleBlock &,Action * action)41 Status OnSimpleBlockBegin(const ElementMetadata& /* metadata */, 42 const SimpleBlock& /* simple_block */, 43 Action* action) override { 44 *action = Action::kSkip; 45 return Status(Status::kOkCompleted); 46 } 47 OnBlockGroupBegin(const ElementMetadata &,Action * action)48 Status OnBlockGroupBegin(const ElementMetadata& /* metadata */, 49 Action* action) override { 50 *action = Action::kSkip; 51 return Status(Status::kOkCompleted); 52 } 53 OnBlockBegin(const ElementMetadata &,const Block &,Action * action)54 Status OnBlockBegin(const ElementMetadata& /* metadata */, 55 const Block& /* block */, Action* action) override { 56 *action = Action::kSkip; 57 return Status(Status::kOkCompleted); 58 } 59 }; 60 61 } // namespace webm 62 63 #endif // SRC_SKIP_CALLBACK_H_ 64