From ece9d2b9800f6a68d81b0d52b1ceaa5284d64ff9 Mon Sep 17 00:00:00 2001 From: Ramoe Date: Fri, 17 Nov 2017 11:31:49 +0100 Subject: [PATCH 1/3] Added Util::stringToLower --- lib/util.cpp | 8 ++++++++ lib/util.h | 2 ++ 2 files changed, 10 insertions(+) diff --git a/lib/util.cpp b/lib/util.cpp index f6ea07be..f52f2ee5 100644 --- a/lib/util.cpp +++ b/lib/util.cpp @@ -137,6 +137,14 @@ namespace Util{ return result.size() == positions.size(); } + void stringToLower(std::string & val){ + int i = 0; + while(val[i]){ + val.at(i) = tolower(val.at(i)); + i++; + } + } + /// 64-bits version of ftell uint64_t ftell(FILE *stream){ /// \TODO Windows implementation (e.g. _ftelli64 ?) diff --git a/lib/util.h b/lib/util.h index b62e7d18..841b2901 100644 --- a/lib/util.h +++ b/lib/util.h @@ -9,6 +9,8 @@ namespace Util{ bool createPath(const std::string &path); bool stringScan(const std::string &src, const std::string &pattern, std::deque &result); + void stringToLower(std::string &val); + uint64_t ftell(FILE *stream); uint64_t fseek(FILE *stream, uint64_t offset, int whence); From c47162bf039c4007d96553bf25a04f34b221f6fe Mon Sep 17 00:00:00 2001 From: Thulinma Date: Thu, 23 Nov 2017 10:19:44 +0100 Subject: [PATCH 2/3] Changed page delete failure message into error message --- src/io.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/io.cpp b/src/io.cpp index d382532e..54d826e3 100644 --- a/src/io.cpp +++ b/src/io.cpp @@ -187,7 +187,7 @@ namespace Mist { } } if (i == 1024){ - FAIL_MSG("Could not erase page %lu for track %lu->%lu stream %s from track index!", pageNumber, tid, mapTid, streamName.c_str()); + ERROR_MSG("Could not erase page %lu for track %lu->%lu stream %s from track index!", pageNumber, tid, mapTid, streamName.c_str()); } if (!nProxy.pagesByTrack.count(tid)){ From ae8760ee08832e95db440ee348e9b5dfa66caf1d Mon Sep 17 00:00:00 2001 From: Thulinma Date: Thu, 23 Nov 2017 14:07:46 +0100 Subject: [PATCH 3/3] Changed default track selection ordering for VoD files back to previous ordering, live is still reversed. --- src/output/output.cpp | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/src/output/output.cpp b/src/output/output.cpp index d9869b21..5f4290da 100644 --- a/src/output/output.cpp +++ b/src/output/output.cpp @@ -322,11 +322,21 @@ namespace Mist{ if (!found){ jsonForEach((*itb), itc){ if (found){break;} - for (std::map::iterator trit = myMeta.tracks.begin(); trit != myMeta.tracks.end(); trit++){ - if (trit->second.codec == (*itc).asStringRef() || (*itc).asStringRef() == "*"){ - selectedTracks.insert(trit->first); - found = true; - if ((*itc).asStringRef() != "*"){break;} + if (myMeta.live){ + for (std::map::reverse_iterator trit = myMeta.tracks.rbegin(); trit != myMeta.tracks.rend(); trit++){ + if (trit->second.codec == (*itc).asStringRef() || (*itc).asStringRef() == "*"){ + selectedTracks.insert(trit->first); + found = true; + if ((*itc).asStringRef() != "*"){break;} + } + } + }else{ + for (std::map::iterator trit = myMeta.tracks.begin(); trit != myMeta.tracks.end(); trit++){ + if (trit->second.codec == (*itc).asStringRef() || (*itc).asStringRef() == "*"){ + selectedTracks.insert(trit->first); + found = true; + if ((*itc).asStringRef() != "*"){break;} + } } } }