@@ -99,16 +99,22 @@ enum quality_e : int {
99
99
_default = 0 ,
100
100
speed,
101
101
balanced,
102
- // quality2,
103
102
};
104
103
105
- enum rc_e : int {
104
+ enum class rc_hevc_e : int {
106
105
constqp, /* *< Constant QP mode */
107
106
vbr_latency, /* *< Latency Constrained Variable Bitrate */
108
107
vbr_peak, /* *< Peak Contrained Variable Bitrate */
109
108
cbr, /* *< Constant bitrate mode */
110
109
};
111
110
111
+ enum class rc_h264_e : int {
112
+ constqp, /* *< Constant QP mode */
113
+ cbr, /* *< Constant bitrate mode */
114
+ vbr_peak, /* *< Peak Contrained Variable Bitrate */
115
+ vbr_latency, /* *< Latency Constrained Variable Bitrate */
116
+ };
117
+
112
118
enum coder_e : int {
113
119
_auto = 0 ,
114
120
cabac,
@@ -120,15 +126,25 @@ std::optional<quality_e> quality_from_view(const std::string_view &quality) {
120
126
if (quality == #x##sv) return x
121
127
_CONVERT_ (speed);
122
128
_CONVERT_ (balanced);
123
- // _CONVERT_(quality2);
124
129
if (quality == " default" sv) return _default;
125
130
#undef _CONVERT_
126
131
return std::nullopt;
127
132
}
128
133
129
- std::optional<rc_e> rc_from_view (const std::string_view &rc) {
134
+ std::optional<int > rc_h264_from_view (const std::string_view &rc) {
130
135
#define _CONVERT_ (x ) \
131
- if (rc == #x##sv) return x
136
+ if (rc == #x##sv) return (int )rc_h264_e::x
137
+ _CONVERT_ (constqp);
138
+ _CONVERT_ (vbr_latency);
139
+ _CONVERT_ (vbr_peak);
140
+ _CONVERT_ (cbr);
141
+ #undef _CONVERT_
142
+ return std::nullopt;
143
+ }
144
+
145
+ std::optional<int > rc_hevc_from_view (const std::string_view &rc) {
146
+ #define _CONVERT_ (x ) \
147
+ if (rc == #x##sv) return (int )rc_hevc_e::x
132
148
_CONVERT_ (constqp);
133
149
_CONVERT_ (vbr_latency);
134
150
_CONVERT_ (vbr_peak);
@@ -165,6 +181,7 @@ video_t video {
165
181
{
166
182
amd::balanced,
167
183
std::nullopt,
184
+ std::nullopt,
168
185
-1 }, // amd
169
186
170
187
{}, // encoder
@@ -659,8 +676,14 @@ void apply_config(std::unordered_map<std::string, std::string> &&vars) {
659
676
int_f (vars, " nv_coder" , video.nv .coder , nv::coder_from_view);
660
677
661
678
int_f (vars, " amd_quality" , video.amd .quality , amd::quality_from_view);
662
- int_f (vars, " amd_rc" , video.amd .rc , amd::rc_from_view);
679
+
680
+ std::string rc;
681
+ string_f (vars, " amd_rc" , rc);
663
682
int_f (vars, " amd_coder" , video.amd .coder , amd::coder_from_view);
683
+ if (!rc.empty ()) {
684
+ video.amd .rc_h264 = amd::rc_h264_from_view (rc);
685
+ video.amd .rc_hevc = amd::rc_hevc_from_view (rc);
686
+ }
664
687
665
688
string_f (vars, " encoder" , video.encoder );
666
689
string_f (vars, " adapter_name" , video.adapter_name );
0 commit comments