~phablet-team/aethercast/fix-for-microsoft-dongle

« back to all changes in this revision

Viewing changes to src/mcs/logger.cpp

Add hardware encoding and video streaming support.

The hardware encoding is currently only for Android 5.x based devices. On all others encoding will simply not work. The streaming part of aethercast (MPEGTS packetizing, RTP sending) as based on some code from Android.

Approved by PS Jenkins bot, Thomas Voß, Jim Hodapp.

Show diffs side-by-side

added added

removed removed

Lines of Context:
15
15
 *
16
16
 */
17
17
 
 
18
#include <thread>
 
19
 
18
20
#include "logger.h"
19
21
 
20
22
#define BOOST_LOG_DYN_LINK
34
36
}
35
37
 
36
38
struct BoostLogLogger : public mcs::Logger {
37
 
    BoostLogLogger() {
 
39
    BoostLogLogger() :
 
40
        initialized_(false) {
 
41
    }
 
42
 
 
43
    void Init(const mcs::Logger::Severity &severity = mcs::Logger::Severity::kWarning) override {
 
44
        if (initialized_)
 
45
            return;
 
46
 
38
47
        boost::log::formatter formatter = boost::log::expressions::stream
39
48
            << "[" << attrs::Severity << " "
40
49
            << boost::log::expressions::format_date_time< boost::posix_time::ptime >("Timestamp", "%Y-%m-%d %H:%M:%S")
48
57
        boost::log::core::get()->remove_all_sinks();
49
58
        auto logger = boost::log::add_console_log(std::cout);
50
59
        logger->set_formatter(formatter);
51
 
        // logger->set_filter(attrs::Severity < mcs::Logger::Severity::kInfo);
 
60
 
 
61
        // logger->set_filter(attrs::Severity < severity);
 
62
 
 
63
        initialized_ = true;
52
64
    }
53
65
 
54
66
    void Log(Severity severity, const std::string& message, const boost::optional<Location> &loc) {
 
67
        if (!initialized_)
 
68
            Init();
 
69
 
55
70
        if (auto rec = boost::log::trivial::logger::get().open_record()) {
56
71
            boost::log::record_ostream out{rec};
57
72
            out << boost::log::add_value(attrs::Severity, severity)
68
83
            boost::log::trivial::logger::get().push_record(std::move(rec));
69
84
        }
70
85
    }
 
86
 
 
87
private:
 
88
    bool initialized_;
71
89
};
72
90
 
73
91
std::shared_ptr<mcs::Logger>& MutableInstance() {