1 /*
2  * Copyright (C) 2019 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 #ifndef ANDROID_MEDIA_ECO_DATA_KEY_H_
17 #define ANDROID_MEDIA_ECO_DATA_KEY_H_
18 
19 #include <android-base/unique_fd.h>
20 #include <binder/Parcel.h>
21 #include <binder/Parcelable.h>
22 #include <stdint.h>
23 #include <sys/mman.h>
24 
25 namespace android {
26 namespace media {
27 namespace eco {
28 
29 // ================================================================================================
30 // Standard ECOData keys.
31 // ================================================================================================
32 constexpr char KEY_ECO_DATA_TYPE[] = "eco-data-type";
33 constexpr char KEY_ECO_DATA_TIME_US[] = "eco-data-time-us";
34 
35 // ================================================================================================
36 // Standard ECOServiceStatsProvider config keys. These keys are used in the ECOData as an config
37 // when StatsProvider connects with ECOService.
38 // ================================================================================================
39 constexpr char KEY_PROVIDER_NAME[] = "provider-name";
40 constexpr char KEY_PROVIDER_TYPE[] = "provider-type";
41 
42 // ================================================================================================
43 // Standard ECOServiceInfoListener config keys. These keys are used in the ECOData as config
44 // when ECOServiceInfoListener connects with ECOService to specify the informations that the
45 // listener wants to listen to.
46 // ================================================================================================
47 constexpr char KEY_LISTENER_NAME[] = "listener-name";
48 constexpr char KEY_LISTENER_TYPE[] = "listener-type";
49 
50 // Following two keys are used together for the listener to specify the condition when it wants to
51 // receive notification. When a frame's avg-qp crosses KEY_LISTENER_QP_BLOCKINESS_THRESHOLD or
52 // the detla of qp between current frame and previous frame also goes beyond
53 // KEY_LISTENER_QP_CHANGE_THRESHOLD, ECOService will notify the listener.
54 constexpr char KEY_LISTENER_QP_BLOCKINESS_THRESHOLD[] = "listener-qp-blockness-threshold";
55 constexpr char KEY_LISTENER_QP_CHANGE_THRESHOLD[] = "listener-qp-change-threshold";
56 
57 // ================================================================================================
58 // ECOService Stats keys. These key MUST BE specified when provider pushes the stats to ECOService
59 // to indicate the stats is session stats or frame stats.
60 // ================================================================================================
61 constexpr char KEY_STATS_TYPE[] = "stats-type";
62 constexpr char VALUE_STATS_TYPE_SESSION[] = "stats-type-session";  // value for KEY_STATS_TYPE.
63 constexpr char VALUE_STATS_TYPE_FRAME[] = "stats-type-frame";      // value for KEY_STATS_TYPE.
64 
65 // ================================================================================================
66 // Standard ECOService Info keys. These key will be in the info provided by ECOService to indicate
67 // the info is session info or frame info.
68 // ================================================================================================
69 constexpr char KEY_INFO_TYPE[] = "info-type";
70 constexpr char VALUE_INFO_TYPE_SESSION[] = "info-type-session";  // value for KEY_INFO_TYPE.
71 constexpr char VALUE_INFO_TYPE_FRAME[] = "info-type-frame";      // value for KEY_INFO_TYPE.
72 
73 // ================================================================================================
74 // General keys to be used by both stats and info in the ECOData.
75 // ================================================================================================
76 constexpr char ENCODER_NAME[] = "encoder-name";
77 constexpr char ENCODER_TYPE[] = "encoder-type";
78 constexpr char ENCODER_PROFILE[] = "encoder-profile";
79 constexpr char ENCODER_LEVEL[] = "encoder-level";
80 constexpr char ENCODER_INPUT_WIDTH[] = "encoder-input-width";
81 constexpr char ENCODER_INPUT_HEIGHT[] = "encoder-input-height";
82 constexpr char ENCODER_OUTPUT_WIDTH[] = "encoder-output-width";
83 constexpr char ENCODER_OUTPUT_HEIGHT[] = "encoder-output-height";
84 constexpr char ENCODER_TARGET_BITRATE_BPS[] = "encoder-target-bitrate-bps";  // Session info
85 constexpr char ENCODER_ACTUAL_BITRATE_BPS[] = "encoder-actual-bitrate-bps";  // Frame info
86 constexpr char ENCODER_KFI_FRAMES[] = "encoder-kfi-frames";
87 constexpr char ENCODER_FRAMERATE_FPS[] = "encoder-framerate-fps";
88 
89 constexpr char FRAME_NUM[] = "frame-num";
90 constexpr char FRAME_PTS_US[] = "frame-pts-us";
91 constexpr char FRAME_AVG_QP[] = "frame-avg-qp";
92 constexpr char FRAME_TYPE[] = "frame-type";
93 constexpr char FRAME_SIZE_BYTES[] = "frame-size-bytes";
94 
95 }  // namespace eco
96 }  // namespace media
97 }  // namespace android
98 
99 #endif  // ANDROID_MEDIA_ECO_DATA_KEY_H_
100