xref: /aosp_15_r20/external/v4l2_codec2/v4l2/include/v4l2_codec2/v4l2/V4L2EncodeComponent.h (revision 0ec5a0ec62797f775085659156625e7f1bdb369f)
1 // Copyright 2020 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #ifndef ANDROID_V4L2_CODEC2_V4L2_V4L2_ENCODE_COMPONENT_H
6 #define ANDROID_V4L2_CODEC2_V4L2_V4L2_ENCODE_COMPONENT_H
7 
8 #include <v4l2_codec2/components/EncodeComponent.h>
9 
10 namespace android {
11 
12 class V4L2EncodeComponent : public EncodeComponent {
13 public:
14     // Create a new instance of the V4L2EncodeComponent.
15     static std::shared_ptr<C2Component> create(C2String name, c2_node_id_t id,
16                                                std::shared_ptr<EncodeInterface> intfImpl,
17                                                C2ComponentFactory::ComponentDeleter deleter);
18 
19     virtual ~V4L2EncodeComponent() override;
20 
21 protected:
22     bool initializeEncoder() override;
23 
24 private:
25     // The number of concurrent encoder instances currently created.
26     static std::atomic<int32_t> sConcurrentInstances;
27 
28     V4L2EncodeComponent(C2String name, c2_node_id_t id, std::shared_ptr<EncodeInterface> interface);
29 };
30 
31 }  // namespace android
32 
33 #endif  // ANDROID_V4L2_CODEC2_V4L2_V4L2_ENCODE_COMPONENT_H