• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2022 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef SRC_TRACE_PROCESSOR_IMPORTERS_PROTO_ANDROID_CAMERA_EVENT_MODULE_H_
18 #define SRC_TRACE_PROCESSOR_IMPORTERS_PROTO_ANDROID_CAMERA_EVENT_MODULE_H_
19 
20 #include <cstdint>
21 #include <optional>
22 #include <unordered_map>
23 
24 #include "protos/perfetto/trace/trace_packet.pbzero.h"
25 #include "src/trace_processor/importers/common/parser_types.h"
26 #include "src/trace_processor/importers/proto/proto_importer_module.h"
27 #include "src/trace_processor/tables/slice_tables_py.h"
28 #include "src/trace_processor/tables/track_tables_py.h"
29 #include "src/trace_processor/types/trace_processor_context.h"
30 
31 namespace perfetto {
32 namespace trace_processor {
33 
34 class AndroidCameraEventModule : public ProtoImporterModule {
35  public:
36   explicit AndroidCameraEventModule(TraceProcessorContext* context);
37 
38   ~AndroidCameraEventModule() override;
39 
40   ModuleResult TokenizePacket(
41       const protos::pbzero::TracePacket::Decoder& decoder,
42       TraceBlobView* packet,
43       int64_t packet_timestamp,
44       PacketSequenceState* state,
45       uint32_t field_id) override;
46 
47   void ParseTracePacketData(const protos::pbzero::TracePacket::Decoder& decoder,
48                             int64_t ts,
49                             const TracePacketData&,
50                             uint32_t field_id) override;
51 
52  private:
53   void InsertCameraFrameSlice(protozero::ConstBytes bytes);
54 
55   TraceProcessorContext* context_;
56 };
57 
58 }  // namespace trace_processor
59 }  // namespace perfetto
60 
61 #endif  // SRC_TRACE_PROCESSOR_IMPORTERS_PROTO_ANDROID_CAMERA_EVENT_MODULE_H_
62