From 6bd993f136b5fa0e6c8f788ccb8746bf2a55b791 Mon Sep 17 00:00:00 2001
From: Elian Dib <elian.di@laposte.net>
Date: Mon, 8 Jan 2018 09:19:46 +0100
Subject: [PATCH] Added platform check to select corresponding binaries

---
 decode.m       | 10 +++++++++-
 encode.m       | 10 +++++++++-
 encodedecode.m | 10 +++++++++-
 3 files changed, 27 insertions(+), 3 deletions(-)

diff --git a/decode.m b/decode.m
index b58e8ff..1093ea8 100644
--- a/decode.m
+++ b/decode.m
@@ -3,7 +3,15 @@ function [nbBits,peaksnr] = decode(varargin)
 %   Detailed explanation goes here
 
 [HEVCDir,~,~] = fileparts(mfilename('fullpath'));
-TAppDecoder = fullfile(HEVCDir,'bin','TAppDecoder.exe');
+if ispc
+    TAppDecoder = fullfile(HEVCDir,'bin','TAppDecoder.exe');
+elseif isunix
+    TAppDecoder = fullfile(HEVCDir,'bin','TAppDecoderStatic');
+elseif ismac
+    error('custom HEVC not compiled for macOS');
+else
+    disp('Platform not supported')
+end
 
 p = inputParser; p.KeepUnmatched = true; p.StructExpand = true;
 
diff --git a/encode.m b/encode.m
index 8094a49..dfb0d44 100644
--- a/encode.m
+++ b/encode.m
@@ -3,7 +3,15 @@ function [nbBits,peaksnr] = encode(varargin)
 %   Detailed explanation goes here
 
 [HEVCDir,~,~] = fileparts(mfilename('fullpath'));
-TAppEncoder = fullfile(HEVCDir,'bin','TAppEncoder.exe');
+if ispc
+    TAppEncoder = fullfile(HEVCDir,'bin','TAppEncoder.exe');
+elseif isunix
+    TAppEncoder = fullfile(HEVCDir,'bin','TAppEncoderStatic');
+elseif ismac
+    error('custom HEVC not compiled for macOS');
+else
+    disp('Platform not supported')
+end
 defaultCfg  = fullfile(HEVCDir,'cfg','intra.cfg');
 
 p = inputParser; p.KeepUnmatched = true; p.StructExpand = true;
diff --git a/encodedecode.m b/encodedecode.m
index 1838ee9..78793f7 100644
--- a/encodedecode.m
+++ b/encodedecode.m
@@ -3,7 +3,15 @@ function [nbBits,peaksnr] = encodedecode(varargin)
 %   Detailed explanation goes here
 
 [HEVCDir,~,~] = fileparts(mfilename('fullpath'));
-TAppEncoder = fullfile(HEVCDir,'bin','TAppEncoder.exe');
+if ispc
+    TAppEncoder = fullfile(HEVCDir,'bin','TAppEncoder.exe');
+elseif isunix
+    TAppEncoder = fullfile(HEVCDir,'bin','TAppEncoderStatic');
+elseif ismac
+    error('custom HEVC not compiled for macOS');
+else
+    disp('Platform not supported')
+end
 defaultCfg  = fullfile(HEVCDir,'cfg','intra.cfg');
 
 p = inputParser; p.KeepUnmatched = true; p.StructExpand = true;
-- 
GitLab