encoder: Use ffmpeg::tools::get_error_description
This commit is contained in:
+19
-12
@@ -558,7 +558,8 @@ void obsffmpeg::encoder_factory::get_properties(obs_properties_t* props, bool hw
|
||||
}
|
||||
if (!hw_encode) {
|
||||
{
|
||||
auto p = obs_properties_add_int(grp, ST_FFMPEG_GPU, TRANSLATE(ST_FFMPEG_GPU), 0, std::numeric_limits<uint8_t>::max(), 1);
|
||||
auto p = obs_properties_add_int(grp, ST_FFMPEG_GPU, TRANSLATE(ST_FFMPEG_GPU), 0,
|
||||
std::numeric_limits<uint8_t>::max(), 1);
|
||||
obs_property_set_long_description(p, TRANSLATE(DESC(ST_FFMPEG_GPU)));
|
||||
}
|
||||
if (avcodec_ptr->pix_fmts) {
|
||||
@@ -885,7 +886,6 @@ void obsffmpeg::encoder::get_properties(obs_properties_t* props, bool hw_encode)
|
||||
obs_property_set_enabled(obs_properties_get(props, ST_FFMPEG_THREADS), false);
|
||||
obs_property_set_enabled(obs_properties_get(props, ST_FFMPEG_STANDARDCOMPLIANCE), false);
|
||||
obs_property_set_enabled(obs_properties_get(props, ST_FFMPEG_GPU), false);
|
||||
|
||||
}
|
||||
|
||||
bool obsffmpeg::encoder::update(obs_data_t* settings)
|
||||
@@ -1011,13 +1011,13 @@ bool obsffmpeg::encoder::update(obs_data_t* settings)
|
||||
} else {
|
||||
value = std::string(&opts[p_value], &opts[p]);
|
||||
}
|
||||
int ret = 0;
|
||||
if ((ret = av_opt_set(_context, key.c_str(), value.c_str(),
|
||||
AV_OPT_SEARCH_CHILDREN))
|
||||
< 0) {
|
||||
char sterror[AV_ERROR_MAX_STRING_SIZE];
|
||||
av_make_error_string(sterror, AV_ERROR_MAX_STRING_SIZE, ret);
|
||||
PLOG_WARNING("Option '%s' could not be set to '%s'. (%s)", key.c_str(), value.c_str(), sterror);
|
||||
int res = av_opt_set(_context, key.c_str(), value.c_str(),
|
||||
AV_OPT_SEARCH_CHILDREN);
|
||||
if (res < 0) {
|
||||
PLOG_WARNING(
|
||||
"Failed setting option '%s' to '%s' due to error: %s",
|
||||
key.c_str(), value.c_str(),
|
||||
ffmpeg::tools::get_error_description(res));
|
||||
}
|
||||
have_param = false;
|
||||
have_key = false;
|
||||
@@ -1176,10 +1176,14 @@ bool obsffmpeg::encoder::video_encode_texture(uint32_t handle, int64_t pts, uint
|
||||
|
||||
int obsffmpeg::encoder::receive_packet(bool* received_packet, struct encoder_packet* packet)
|
||||
{
|
||||
auto gctx = obsffmpeg::obs_graphics();
|
||||
int res = 0;
|
||||
|
||||
av_packet_unref(&_current_packet);
|
||||
|
||||
int res = avcodec_receive_packet(_context, &_current_packet);
|
||||
{
|
||||
auto gctx = obsffmpeg::obs_graphics();
|
||||
res = avcodec_receive_packet(_context, &_current_packet);
|
||||
}
|
||||
if (res != 0) {
|
||||
return res;
|
||||
}
|
||||
@@ -1240,9 +1244,12 @@ int obsffmpeg::encoder::receive_packet(bool* received_packet, struct encoder_pac
|
||||
}
|
||||
|
||||
int obsffmpeg::encoder::send_frame(std::shared_ptr<AVFrame> const frame)
|
||||
{
|
||||
int res = 0;
|
||||
{
|
||||
auto gctx = obsffmpeg::obs_graphics();
|
||||
int res = avcodec_send_frame(_context, frame.get());
|
||||
res = avcodec_send_frame(_context, frame.get());
|
||||
}
|
||||
if (res == 0) {
|
||||
push_used_frame(frame);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user