Upgrade from Wt3 to Wt4

This commit is contained in:
emeric
2018-04-16 16:56:51 +02:00
parent b743127076
commit 9cb4918f44
87 changed files with 954 additions and 2057 deletions
+7 -7
View File
@@ -57,14 +57,14 @@ MediaFile::MediaFile(const boost::filesystem::path& p)
int error = avformat_open_input(&_context, _p.string().c_str(), nullptr, nullptr);
if (error < 0)
{
LMS_LOG(AV, ERROR) << "Cannot open " << _p << ": " << averror_to_string(error);
LMS_LOG(AV, ERROR) << "Cannot open " << _p.string() << ": " << averror_to_string(error);
throw MediaFileException(error);
}
error = avformat_find_stream_info(_context, nullptr);
if (error < 0)
{
LMS_LOG(AV, ERROR) << "Cannot find stream information on " << _p << ": " << averror_to_string(error);
LMS_LOG(AV, ERROR) << "Cannot find stream information on " << _p.string() << ": " << averror_to_string(error);
avformat_close_input(&_context);
throw MediaFileException(error);
}
@@ -75,13 +75,13 @@ MediaFile::~MediaFile()
avformat_close_input(&_context);
}
boost::posix_time::time_duration
std::chrono::milliseconds
MediaFile::getDuration() const
{
if (static_cast<int>(_context->duration) != AV_NOPTS_VALUE )
return boost::posix_time::seconds(_context->duration / AV_TIME_BASE);
else
return boost::posix_time::seconds(0); // TODO, do something better?
if (_context->duration == AV_NOPTS_VALUE)
return std::chrono::milliseconds(0); // TODO estimate
return std::chrono::milliseconds(_context->duration / AV_TIME_BASE * 1000);
}
void
+2 -2
View File
@@ -33,10 +33,10 @@ extern "C"
#include <string>
#include <cstdint>
#include <map>
#include <chrono>
#include <boost/optional.hpp>
#include <boost/filesystem/path.hpp>
#include <boost/date_time/posix_time/posix_time_types.hpp> //no i/o just types
#include "utils/Exception.hpp"
@@ -75,7 +75,7 @@ class MediaFile
const boost::filesystem::path& getPath() const {return _p;};
boost::posix_time::time_duration getDuration() const;
std::chrono::milliseconds getDuration() const;
std::map<std::string, std::string> getMetaData(void);
std::vector<StreamInfo> getStreamInfo() const;
+2 -2
View File
@@ -101,7 +101,7 @@ Transcoder::init()
}
if (!avConvPath.empty())
LMS_LOG(TRANSCODE, INFO) << "Using transcoder " << avConvPath;
LMS_LOG(TRANSCODE, INFO) << "Using transcoder " << avConvPath.string();
else
throw std::runtime_error("Cannot find any transcoder binary!");
}
@@ -123,7 +123,7 @@ Transcoder::start()
else if (!boost::filesystem::is_regular( _filePath) )
return false;
LMS_LOG_TRANSCODE(INFO) << "Transcoding file '" << _filePath << "'";
LMS_LOG_TRANSCODE(INFO) << "Transcoding file '" << _filePath.string() << "'";
std::vector<std::string> args;