1 /*
2  * Copyright (c) 2021-2021 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #include "pipeline/core/event.h"
17 
18 namespace OHOS {
19 namespace Media {
20 static const std::map<EventType, const char*> g_EventTypeMap = {
21     {EventType::EVENT_READY, "EVENT_READY"},
22     {EventType::EVENT_AUDIO_PROGRESS, "EVENT_AUDIO_PROGRESS"},
23     {EventType::EVENT_VIDEO_PROGRESS, "EVENT_VIDEO_PROGRESS"},
24     {EventType::EVENT_COMPLETE, "EVENT_COMPLETE"},
25     {EventType::EVENT_ERROR, "EVENT_ERROR"},
26     {EventType::EVENT_PLUGIN_ERROR, "EVENT_PLUGIN_ERROR"},
27     {EventType::EVENT_PLUGIN_EVENT, "EVENT_PLUGIN_EVENT"},
28     {EventType::EVENT_BUFFERING, "EVENT_BUFFERING"},
29     {EventType::EVENT_BUFFER_PROGRESS, "EVENT_BUFFER_PROGRESS"},
30     {EventType::EVENT_DECODER_ERROR, "EVENT_DECODER_ERROR"},
31     {EventType::EVENT_RESOLUTION_CHANGE, "EVENT_RESOLUTION_CHANGE"},
32     {EventType::EVENT_VIDEO_RENDERING_START, "EVENT_VIDEO_RENDERING_START"},
33     {EventType::EVENT_IS_LIVE_STREAM, "EVENT_IS_LIVE_STREAM"},
34 };
35 
GetEventName(EventType type)36 const char* GetEventName(EventType type)
37 {
38     auto it = g_EventTypeMap.find(type);
39     if (it != g_EventTypeMap.end()) {
40         return it->second;
41     }
42     return "Unknow event";
43 }
44 }
45 }