project: Apply patches from const correctness checks
This commit is contained in:
@@ -803,7 +803,7 @@ int encoder::generic::receive_packet(bool* received_packet, struct encoder_packe
|
||||
return res;
|
||||
}
|
||||
|
||||
int encoder::generic::send_frame(std::shared_ptr<AVFrame> frame)
|
||||
int encoder::generic::send_frame(std::shared_ptr<AVFrame> const frame)
|
||||
{
|
||||
int res = avcodec_send_frame(this->context, frame.get());
|
||||
switch (res) {
|
||||
|
||||
@@ -45,7 +45,7 @@ ffmpeg::avframe_queue::~avframe_queue()
|
||||
clear();
|
||||
}
|
||||
|
||||
void ffmpeg::avframe_queue::set_resolution(uint32_t width, uint32_t height)
|
||||
void ffmpeg::avframe_queue::set_resolution(uint32_t const width, uint32_t const height)
|
||||
{
|
||||
this->resolution.first = width;
|
||||
this->resolution.second = height;
|
||||
@@ -67,7 +67,7 @@ uint32_t ffmpeg::avframe_queue::get_height()
|
||||
return this->resolution.second;
|
||||
}
|
||||
|
||||
void ffmpeg::avframe_queue::set_pixel_format(AVPixelFormat format)
|
||||
void ffmpeg::avframe_queue::set_pixel_format(AVPixelFormat const format)
|
||||
{
|
||||
this->format = format;
|
||||
}
|
||||
@@ -90,7 +90,7 @@ void ffmpeg::avframe_queue::clear()
|
||||
frames.clear();
|
||||
}
|
||||
|
||||
void ffmpeg::avframe_queue::push(std::shared_ptr<AVFrame> frame)
|
||||
void ffmpeg::avframe_queue::push(std::shared_ptr<AVFrame> const frame)
|
||||
{
|
||||
std::unique_lock<std::mutex> ulock(this->lock);
|
||||
frames.push_back(frame);
|
||||
|
||||
@@ -176,8 +176,8 @@ bool ffmpeg::swscale::initialize(int flags)
|
||||
}
|
||||
|
||||
sws_setColorspaceDetails(this->context, sws_getCoefficients(source_colorspace), source_full_range ? 1 : 0,
|
||||
sws_getCoefficients(target_colorspace), target_full_range ? 1 : 0, 1l << 16 | 0l,
|
||||
1l << 16 | 0l, 1l << 16 | 0l);
|
||||
sws_getCoefficients(target_colorspace), target_full_range ? 1 : 0, 1L << 16 | 0l,
|
||||
1L << 16 | 0l, 1L << 16 | 0l);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -64,7 +64,7 @@ std::string ffmpeg::tools::translate_encoder_capabilities(int capabilities)
|
||||
};
|
||||
|
||||
std::stringstream sstr;
|
||||
for (auto kv : caps) {
|
||||
for (auto const kv : caps) {
|
||||
if (capabilities & kv.first) {
|
||||
capabilities &= ~kv.first;
|
||||
sstr << kv.second;
|
||||
|
||||
+7
-7
@@ -45,12 +45,12 @@ std::list<std::function<void()>> obsffmpeg::finalizers;
|
||||
static std::map<std::string, std::shared_ptr<obsffmpeg::ui::handler>> codec_to_handler_map;
|
||||
static std::shared_ptr<obsffmpeg::ui::handler> debug_handler = std::make_shared<obsffmpeg::ui::debug_handler>();
|
||||
|
||||
void obsffmpeg::register_codec_handler(std::string codec, std::shared_ptr<obsffmpeg::ui::handler> handler)
|
||||
void obsffmpeg::register_codec_handler(std::string const codec, std::shared_ptr<obsffmpeg::ui::handler> const handler)
|
||||
{
|
||||
codec_to_handler_map.emplace(codec, handler);
|
||||
}
|
||||
|
||||
std::shared_ptr<obsffmpeg::ui::handler> obsffmpeg::find_codec_handler(std::string codec)
|
||||
std::shared_ptr<obsffmpeg::ui::handler> obsffmpeg::find_codec_handler(std::string const codec)
|
||||
{
|
||||
auto found = codec_to_handler_map.find(codec);
|
||||
if (found == codec_to_handler_map.end())
|
||||
@@ -58,7 +58,7 @@ std::shared_ptr<obsffmpeg::ui::handler> obsffmpeg::find_codec_handler(std::strin
|
||||
return found->second;
|
||||
}
|
||||
|
||||
bool obsffmpeg::has_codec_handler(std::string codec)
|
||||
bool obsffmpeg::has_codec_handler(std::string const codec)
|
||||
{
|
||||
auto found = codec_to_handler_map.find(codec);
|
||||
return (found != codec_to_handler_map.end());
|
||||
@@ -72,7 +72,7 @@ try {
|
||||
avcodec_register_all();
|
||||
|
||||
// Run all initializers.
|
||||
for (auto func : obsffmpeg::initializers) {
|
||||
for (auto const func : obsffmpeg::initializers) {
|
||||
func();
|
||||
}
|
||||
|
||||
@@ -91,7 +91,7 @@ try {
|
||||
|
||||
obsffmpeg::encoder::prores_aw::initialize();
|
||||
return true;
|
||||
} catch (std::exception ex) {
|
||||
} catch (std::exception const& ex) {
|
||||
PLOG_ERROR("Exception during initalization: %s.", ex.what());
|
||||
return false;
|
||||
} catch (...) {
|
||||
@@ -104,10 +104,10 @@ try {
|
||||
obsffmpeg::encoder::prores_aw::finalize();
|
||||
|
||||
// Run all finalizers.
|
||||
for (auto func : obsffmpeg::finalizers) {
|
||||
for (auto const func : obsffmpeg::finalizers) {
|
||||
func();
|
||||
}
|
||||
} catch (std::exception ex) {
|
||||
} catch (std::exception const& ex) {
|
||||
PLOG_ERROR("Exception during finalizing: %s.", ex.what());
|
||||
} catch (...) {
|
||||
PLOG_ERROR("Unrecognized exception during finalizing.");
|
||||
|
||||
Reference in New Issue
Block a user