Updated Logger to use enum class

This commit is contained in:
epoupon
2015-09-11 17:58:10 +02:00
parent c94c859f68
commit 9ebedd5bfc
26 changed files with 139 additions and 141 deletions
+7 -7
View File
@@ -53,7 +53,7 @@ void AvInit()
/* register all the codecs */
avcodec_register_all();
av_register_all();
LMS_LOG(MOD_AV, SEV_INFO) << "avcodec version = " << avcodec_version();
LMS_LOG(AV, INFO) << "avcodec version = " << avcodec_version();
}
@@ -79,7 +79,7 @@ MediaFile::open(void)
int error = avformat_open_input(&_context, _p.string().c_str(), nullptr, nullptr);
if (error < 0)
{
LMS_LOG(MOD_AV, SEV_ERROR) << "Cannot open '" << _p.string() << "', avformat_open_input returned " << averror_to_string(error);
LMS_LOG(AV, ERROR) << "Cannot open '" << _p.string() << "', avformat_open_input returned " << averror_to_string(error);
return false;
}
@@ -95,7 +95,7 @@ MediaFile::scan(void)
int error = avformat_find_stream_info(_context, nullptr);
if (error < 0)
{
LMS_LOG(MOD_AV, SEV_ERROR) << "Cannot find stream information: '" << averror_to_string(error);
LMS_LOG(AV, ERROR) << "Cannot find stream information: '" << averror_to_string(error);
return false;
}
@@ -171,7 +171,7 @@ MediaFile::getStreams(Stream::Type type) const
if (avstream->codec == nullptr)
{
LMS_LOG(MOD_AV, SEV_ERROR) << "Skipping stream " << i << " since no codec is set";
LMS_LOG(AV, ERROR) << "Skipping stream " << i << " since no codec is set";
continue;
}
@@ -226,7 +226,7 @@ MediaFile::getBestStreamId(Stream::Type type) const
0);
if (res < 0)
{
LMS_LOG(MOD_AV, SEV_ERROR) << "Cannot find best stream for type " << streamType_to_string(type);
LMS_LOG(AV, ERROR) << "Cannot find best stream for type " << streamType_to_string(type);
return -1;
}
@@ -273,7 +273,7 @@ MediaFile::getAttachedPictures(std::size_t nbMaxPictures) const
if (avstream->codec == nullptr)
{
LMS_LOG(MOD_AV, SEV_ERROR) << "Skipping stream " << i << " since no codec is set";
LMS_LOG(AV, ERROR) << "Skipping stream " << i << " since no codec is set";
continue;
}
@@ -287,7 +287,7 @@ MediaFile::getAttachedPictures(std::size_t nbMaxPictures) const
else
{
picture.mimeType = "application/octet-stream";
LMS_LOG(MOD_AV, SEV_ERROR) << "CODEC ID " << avstream->codec->codec_id << " not handled in mime type conversion";
LMS_LOG(AV, ERROR) << "CODEC ID " << avstream->codec->codec_id << " not handled in mime type conversion";
}
AVPacket pkt = avstream->attached_pic;
+11 -11
View File
@@ -66,7 +66,7 @@ Transcoder::init()
}
if (!_avConvPath.empty())
LMS_LOG(MOD_TRANSCODE, SEV_INFO) << "Using transcoder " << _avConvPath;
LMS_LOG(TRANSCODE, INFO) << "Using transcoder " << _avConvPath;
else
throw std::runtime_error("Cannot find any transcoder binary!");
}
@@ -94,7 +94,7 @@ Transcoder::start()
else if (!boost::filesystem::is_regular( _filePath) )
return false;
LMS_LOG(MOD_TRANSCODE, SEV_INFO) << "Transcoding file '" << _filePath << "'";
LMS_LOG(TRANSCODE, INFO) << "Transcoding file '" << _filePath << "'";
// Launch a process to handle the conversion
boost::iostreams::file_descriptor_sink sink(_outputPipe.sink, boost::iostreams::close_handle);
@@ -157,7 +157,7 @@ Transcoder::start()
}
oss << " -"; // output to stdout
LMS_LOG(MOD_TRANSCODE, SEV_DEBUG) << "Executing '" << oss.str() << "'";
LMS_LOG(TRANSCODE, DEBUG) << "Executing '" << oss.str() << "'";
// make sure only one thread is executing this part of code
// See boost process FAQ
@@ -191,7 +191,7 @@ Transcoder::process(std::vector<unsigned char>& output, std::size_t maxSize)
}
if (!_in || _in.fail() || _in.eof()) {
LMS_LOG(MOD_TRANSCODE, SEV_DEBUG) << "Transcode complete!";
LMS_LOG(TRANSCODE, DEBUG) << "Transcode complete!";
waitChild();
_isComplete = true;
@@ -201,7 +201,7 @@ Transcoder::process(std::vector<unsigned char>& output, std::size_t maxSize)
Transcoder::~Transcoder()
{
LMS_LOG(MOD_TRANSCODE, SEV_DEBUG) << "~Transcoder called!";
LMS_LOG(TRANSCODE, DEBUG) << "~Transcoder called!";
if (_in.eof())
waitChild();
@@ -216,12 +216,12 @@ Transcoder::waitChild()
{
boost::system::error_code ec;
LMS_LOG(MOD_TRANSCODE, SEV_DEBUG) << "Waiting for child...";
LMS_LOG(TRANSCODE, DEBUG) << "Waiting for child...";
boost::process::wait_for_exit(*_child, ec);
LMS_LOG(MOD_TRANSCODE, SEV_DEBUG) << "Waiting for child: OK";
LMS_LOG(TRANSCODE, DEBUG) << "Waiting for child: OK";
if (ec)
LMS_LOG(MOD_TRANSCODE, SEV_ERROR) << "Transcoder::waitChild: error: " << ec.message();
LMS_LOG(TRANSCODE, ERROR) << "Transcoder::waitChild: error: " << ec.message();
_child.reset();
}
@@ -234,13 +234,13 @@ Transcoder::killChild()
{
boost::system::error_code ec;
LMS_LOG(MOD_TRANSCODE, SEV_DEBUG) << "Killing child! pid = " << _child->pid;
LMS_LOG(TRANSCODE, DEBUG) << "Killing child! pid = " << _child->pid;
boost::process::terminate(*_child, ec);
LMS_LOG(MOD_TRANSCODE, SEV_DEBUG) << "Killing child DONE";
LMS_LOG(TRANSCODE, DEBUG) << "Killing child DONE";
// If an error occured, force kill the child
if (ec)
LMS_LOG(MOD_TRANSCODE, SEV_ERROR) << "Transcoder::killChild: error: " << ec.message();
LMS_LOG(TRANSCODE, ERROR) << "Transcoder::killChild: error: " << ec.message();
_child.reset();
}