Gazebo Common

API Reference

5.6.0
HWEncoder.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 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 GZ_COMMON_HWENCODER_HH
17 #define GZ_COMMON_HWENCODER_HH
18 
19 #include <memory>
20 #include <string>
21 #include <optional>
22 
23 #include <gz/common/FlagSet.hh>
24 #include <gz/common/av/Export.hh>
25 #include <gz/common/HWVideo.hh>
26 #include <gz/common/ffmpeg_inc.hh>
27 #include <gz/utils/ImplPtr.hh>
28 
31 namespace gz::common
32 {
36  class GZ_COMMON_AV_HIDDEN HWEncoder
37  {
49  public: HWEncoder(FlagSet<HWEncoderType> _allowedHwEncoders,
50  const std::string& _hwAccelDevice,
51  std::optional<bool> _useHwSurface);
52  public: virtual ~HWEncoder();
53 
59  public: AVCodec* FindEncoder(AVCodecID _codecId);
60 
68  public: void ConfigHWAccel(AVCodecContext* _encoderContext);
69 
76  public: AVFrame* GetFrameForEncoder(AVFrame* _inFrame);
77 
80  public: HWEncoderType GetEncoderType() const;
81 
83  GZ_UTILS_UNIQUE_IMPL_PTR(dataPtr)
84  };
85 }
86 
87 #endif