Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 18 additions & 16 deletions src/lib/image/MovieFFMpeg/MovieFFMpeg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
#include <set>
#include <limits>
#include <cmath>
#include <mutex>
#include <boost/filesystem.hpp>
#include <boost/filesystem/operations.hpp>
#include <boost/thread/mutex.hpp>
Expand Down Expand Up @@ -1420,14 +1421,14 @@ namespace TwkMovie
{
if (!videoToolboxInit(avCodec, avCodecContext, hardwareContext))
{
static bool hasDisplayedError = false;
if (!hasDisplayedError)
{
std::cout << "WARNING: Hardware decoder is not available "
"or failed to intialize."
<< std::endl;
hasDisplayedError = true;
}
static std::once_flag warnOnce;
std::call_once(warnOnce,
[]()
{
std::cout << "WARNING: Hardware decoder is not available "
"or failed to intialize."
<< std::endl;
});
}
}
#endif
Expand Down Expand Up @@ -3785,14 +3786,15 @@ namespace TwkMovie
const AVPixFmtDescriptor* desc = av_pix_fmt_desc_get(nativeFormat);
if (!desc && nativeFormat == AV_PIX_FMT_NONE)
{
static bool warned = false;
if (!warned)
{
std::cout << "WARNING: FFmpeg detected pixel format "
"AV_PIX_FMT_NONE for frames in "
<< m_filename << ". Using fallback pixel format: " << av_get_pix_fmt_name(m_pxlFormatOnOpen) << std::endl;
warned = true;
}
static std::once_flag warnOnce;
std::call_once(warnOnce,
[this]()
{
std::cout << "WARNING: FFmpeg detected pixel format "
"AV_PIX_FMT_NONE for frames in "
<< m_filename << ". Using fallback pixel format: " << av_get_pix_fmt_name(m_pxlFormatOnOpen)
<< std::endl;
});
// Use the pixel format detected when the file was opened as a
// fallback. Assumes that m_pxlFormatOnOpen is set because the file
// was opened.
Expand Down
Loading