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/packet_sequence_state_generation.h" 27 #include "src/trace_processor/importers/proto/proto_importer_module.h" 28 #include "src/trace_processor/tables/sched_tables_py.h" 29 #include "src/trace_processor/tables/slice_tables_py.h" 30 #include "src/trace_processor/tables/track_tables_py.h" 31 #include "src/trace_processor/types/trace_processor_context.h" 32 33 namespace perfetto { 34 namespace trace_processor { 35 36 class AndroidCameraEventModule : public ProtoImporterModule { 37 public: 38 explicit AndroidCameraEventModule(TraceProcessorContext* context); 39 40 ~AndroidCameraEventModule() override; 41 42 ModuleResult TokenizePacket( 43 const protos::pbzero::TracePacket::Decoder& decoder, 44 TraceBlobView* packet, 45 int64_t packet_timestamp, 46 RefPtr<PacketSequenceStateGeneration> state, 47 uint32_t field_id) override; 48 49 void ParseTracePacketData(const protos::pbzero::TracePacket::Decoder& decoder, 50 int64_t ts, 51 const TracePacketData&, 52 uint32_t field_id) override; 53 54 private: 55 void InsertCameraFrameSlice(protozero::ConstBytes bytes); 56 57 TraceProcessorContext* context_; 58 }; 59 60 } // namespace trace_processor 61 } // namespace perfetto 62 63 #endif // SRC_TRACE_PROCESSOR_IMPORTERS_PROTO_ANDROID_CAMERA_EVENT_MODULE_H_ 64