Index: media/base/media_log.cc |
diff --git a/media/base/media_log.cc b/media/base/media_log.cc |
index b172bfbce912f828f4896769a215f1d7658a6877..2ae446f5389d4303ae3d6612a2392a9dbbd62ebd 100644 |
--- a/media/base/media_log.cc |
+++ b/media/base/media_log.cc |
@@ -98,6 +98,37 @@ const char* MediaLog::PipelineStatusToString(PipelineStatus status) { |
return NULL; |
} |
+bool MediaLog::StringToPipelineStatus(const std::string status, |
DaleCurtis
2014/11/11 20:48:58
Instead of having this wacky string conversion, ha
prabhur1
2014/11/12 21:32:37
Done.
|
+ PipelineStatus& out_status) { |
+ static const char* player_status[] = { |
DaleCurtis
2014/11/11 20:48:58
Move this and compile_assert outside of the functi
prabhur1
2014/11/12 21:32:37
Done.
|
+ "pipeline: ok", // == PIPELINE_OK |
+ "pipeline: url not found", // == PIPELINE_ERROR_URL_NOT_FOUND |
+ "pipeline: network error", // == PIPELINE_ERROR_NETWORK |
+ "pipeline: decode error", // == PIPELINE_ERROR_DECODE |
+ "pipeline: decrypt error", // == PIPELINE_ERROR_DECRYPT |
+ "pipeline: abort", // == PIPELINE_ERROR_ABORT |
+ "pipeline: initialization failed", // PIPELINE_ERROR_INITIALIZATION_FAILED |
+ "", // == undefined |
+ "pipeline: could not render", // == PIPELINE_ERROR_COULD_NOT_RENDER |
+ "pipeline: read error", // == PIPELINE_ERROR_READ |
+ "pipeline: operation pending", // == PIPELINE_ERROR_OPERATION_PENDING |
+ "pipeline: invalid state", // == PIPELINE_ERROR_INVALID_STATE |
+ "demuxer: could not open", // == DEMUXER_ERROR_COULD_NOT_OPEN |
+ "dumuxer: could not parse", // == DEMUXER_ERROR_COULD_NOT_PARSE |
DaleCurtis
2014/11/11 20:48:58
demuxer instead of dumuxer :)
prabhur1
2014/11/12 21:32:37
Done.
|
+ "demuxer: no supported streams", // == DEMUXER_ERROR_NO_SUPPORTED_STREAMS |
+ "decoder: not supported" // == DECODER_ERROR_NOT_SUPPORTED |
+ }; |
+ COMPILE_ASSERT(arraysize(player_status) == PIPELINE_STATUS_MAX + 1, |
+ "player_status out of sync with PipelineStatus"); |
+ for (uint32 i = 0; i < arraysize(player_status); i++) { |
DaleCurtis
2014/11/11 20:48:58
size_t
prabhur1
2014/11/12 21:32:37
Done.
|
+ if (player_status[i] == status) { |
+ out_status = (PipelineStatus)i; |
DaleCurtis
2014/11/11 20:48:58
static_cast<PipelineStatus>(i)
prabhur1
2014/11/12 21:32:37
Done.
|
+ return true; |
+ } |
+ } |
+ return false; |
+} |
+ |
LogHelper::LogHelper(const LogCB& log_cb) : log_cb_(log_cb) {} |
LogHelper::~LogHelper() { |