From 26bb50640c1b33f1cd3fc2cefef10a2734825308 Mon Sep 17 00:00:00 2001 From: Aaron Vaage Date: Tue, 19 Jun 2018 09:52:54 -0700 Subject: [PATCH] Added StreamTypeToString Added a StreamTypeToString function in StreamInfo (where stream type is defined) so that we can print the type in a more readable way. Change-Id: Icb1d10f5a72dca314d9bdf07e9cd0c0a185bd791 --- packager/media/base/stream_info.cc | 16 ++++++++++++++++ packager/media/base/stream_info.h | 2 ++ 2 files changed, 18 insertions(+) diff --git a/packager/media/base/stream_info.cc b/packager/media/base/stream_info.cc index bbe8c75ca1..c9bce919bb 100644 --- a/packager/media/base/stream_info.cc +++ b/packager/media/base/stream_info.cc @@ -14,6 +14,22 @@ namespace shaka { namespace media { +std::string StreamTypeToString(StreamType type) { + switch (type) { + case kStreamUnknown: + return "Unknown"; + case kStreamVideo: + return "Video"; + case kStreamAudio: + return "Audio"; + case kStreamText: + return "Text"; + } + + NOTREACHED() << "Unhandled StreamType with value " << static_cast(type); + return ""; +} + StreamInfo::StreamInfo(StreamType stream_type, int track_id, uint32_t time_scale, diff --git a/packager/media/base/stream_info.h b/packager/media/base/stream_info.h index bbd98e926d..d6ce354476 100644 --- a/packager/media/base/stream_info.h +++ b/packager/media/base/stream_info.h @@ -23,6 +23,8 @@ enum StreamType { kStreamText, }; +std::string StreamTypeToString(StreamType type); + enum Codec { kUnknownCodec = 0,