Supporting multiple transcode binaries (ffmpeg, avconv)
This commit is contained in:
@@ -11,15 +11,35 @@
|
|||||||
namespace Transcode
|
namespace Transcode
|
||||||
{
|
{
|
||||||
|
|
||||||
|
// TODO, parametrize?
|
||||||
|
const std::vector<std::string> execNames =
|
||||||
|
{
|
||||||
|
"avconv",
|
||||||
|
"ffmpeg",
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
boost::mutex AvConvTranscoder::_mutex;
|
boost::mutex AvConvTranscoder::_mutex;
|
||||||
|
|
||||||
boost::filesystem::path AvConvTranscoder::_avConvPath = "";
|
boost::filesystem::path AvConvTranscoder::_avConvPath = boost::filesystem::path();
|
||||||
|
|
||||||
void
|
void
|
||||||
AvConvTranscoder::init()
|
AvConvTranscoder::init()
|
||||||
{
|
{
|
||||||
_avConvPath = boost::process::search_path("avconv");
|
BOOST_FOREACH(std::string execName, execNames)
|
||||||
LMS_LOG(MOD_TRANSCODE, SEV_INFO) << "Using execPath " << _avConvPath;
|
{
|
||||||
|
const boost::filesystem::path p = boost::process::search_path(execName);
|
||||||
|
if (!p.empty())
|
||||||
|
{
|
||||||
|
_avConvPath = p;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!_avConvPath.empty())
|
||||||
|
LMS_LOG(MOD_TRANSCODE, SEV_INFO) << "Using transcoder " << _avConvPath;
|
||||||
|
else
|
||||||
|
LMS_LOG(MOD_TRANSCODE, SEV_ERROR) << "Cannot find any transcoder binary!";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -48,7 +68,7 @@ AvConvTranscoder::AvConvTranscoder(const Parameters& parameters)
|
|||||||
|
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
|
|
||||||
oss << "avconv";
|
oss << _avConvPath;
|
||||||
|
|
||||||
// input Offset
|
// input Offset
|
||||||
if (_parameters.getOffset().total_seconds() > 0)
|
if (_parameters.getOffset().total_seconds() > 0)
|
||||||
|
|||||||
Reference in New Issue
Block a user