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 
17 #ifndef MEDIACTSNATIVE_NATIVE_MEDIA_COMMON_H
18 #define MEDIACTSNATIVE_NATIVE_MEDIA_COMMON_H
19 
20 #include <NdkMediaFormat.h>
21 
22 extern const char* AMEDIA_MIMETYPE_VIDEO_VP8;
23 extern const char* AMEDIA_MIMETYPE_VIDEO_VP9;
24 extern const char* AMEDIA_MIMETYPE_VIDEO_AV1;
25 extern const char* AMEDIA_MIMETYPE_VIDEO_AVC;
26 extern const char* AMEDIA_MIMETYPE_VIDEO_HEVC;
27 extern const char* AMEDIA_MIMETYPE_VIDEO_MPEG4;
28 extern const char* AMEDIA_MIMETYPE_VIDEO_H263;
29 
30 extern const char* AMEDIA_MIMETYPE_AUDIO_AMR_NB;
31 extern const char* AMEDIA_MIMETYPE_AUDIO_AMR_WB;
32 extern const char* AMEDIA_MIMETYPE_AUDIO_AAC;
33 extern const char* AMEDIA_MIMETYPE_AUDIO_VORBIS;
34 extern const char* AMEDIA_MIMETYPE_AUDIO_OPUS;
35 
36 // TODO(b/146420990)
37 typedef enum {
38     OUTPUT_FORMAT_START = 0,
39     OUTPUT_FORMAT_MPEG_4 = OUTPUT_FORMAT_START,
40     OUTPUT_FORMAT_WEBM = OUTPUT_FORMAT_START + 1,
41     OUTPUT_FORMAT_THREE_GPP = OUTPUT_FORMAT_START + 2,
42     OUTPUT_FORMAT_HEIF = OUTPUT_FORMAT_START + 3,
43     OUTPUT_FORMAT_OGG = OUTPUT_FORMAT_START + 4,
44     OUTPUT_FORMAT_LIST_END = OUTPUT_FORMAT_START + 4,
45 } MuxerFormat;
46 
47 // Color formats supported by encoder - should mirror supportedColorList
48 // from MediaCodecConstants.h (are these going to be deprecated)
49 constexpr int COLOR_FormatYUV420SemiPlanar = 21;
50 constexpr int COLOR_FormatYUV420Flexible = 0x7F420888;
51 constexpr int COLOR_FormatSurface = 0x7f000789;
52 
53 // constants not defined in NDK
54 extern const char* TBD_AMEDIACODEC_PARAMETER_KEY_REQUEST_SYNC_FRAME;
55 extern const char* TBD_AMEDIACODEC_PARAMETER_KEY_VIDEO_BITRATE;
56 extern const char* TBD_AMEDIACODEC_PARAMETER_KEY_MAX_B_FRAMES;
57 extern const char* TBD_AMEDIAFORMAT_KEY_BIT_RATE_MODE;
58 static const int TBD_AMEDIACODEC_BUFFER_FLAG_KEY_FRAME = 0x1;
59 
60 static const int kBitrateModeConstant = 2;
61 
62 // common utility functions
63 bool isCSDIdentical(AMediaFormat* refFormat, AMediaFormat* testFormat);
64 
65 #endif  // MEDIACTSNATIVE_NATIVE_MEDIA_COMMON_H
66