Gazebo Common

API Reference

4.7.0
HWEncoder.hh
Go to the documentation of this file.
1 /*
2  * Copyright 2020 Martin Pecka
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 #ifndef IGNITION_COMMON_HWENCODER_HH
17 #define IGNITION_COMMON_HWENCODER_HH
18 
19 #include <memory>
20 #include <string>
21 #include <optional>
22 
23 #include <gz/common/config.hh>
24 #include <gz/common/FlagSet.hh>
25 #include <gz/common/av/Export.hh>
27 #include <gz/common/HWVideo.hh>
28 #include <gz/common/ffmpeg_inc.hh>
29 
32 namespace ignition::common
33 {
34  // Forward declare private data class
35  class HWVideoPrivate;
36 
40  class IGNITION_COMMON_AV_HIDDEN HWEncoder
41  {
53  public: HWEncoder(FlagSet<HWEncoderType> _allowedHwEncoders,
54  const std::string& _hwAccelDevice,
55  std::optional<bool> _useHwSurface);
56  public: virtual ~HWEncoder();
57 
63  public: AVCodec* FindEncoder(AVCodecID _codecId);
64 
72  public: void ConfigHWAccel(AVCodecContext* _encoderContext);
73 
80  public: AVFrame* GetFrameForEncoder(AVFrame* _inFrame);
81 
84  public: HWEncoderType GetEncoderType() const;
85 
86  private: std::unique_ptr<HWVideoPrivate> dataPtr;
87  };
88 }
89 
90 #endif
STL class.
Set of flags defined by a C++11 enum class.
Definition: gz/common/FlagSet.hh:61
Definition: gz/common/Base64.hh:27
Representation of a GPU video encoder and its configuration.
Definition: HWEncoder.hh:40