• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2024 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 #ifndef OH_VEF_CODEC_COMMON_H
17 #define OH_VEF_CODEC_COMMON_H
18 
19 #include <memory>
20 #include <functional>
21 #include <native_avcodec_base.h>
22 #include "video_editor.h"
23 
24 namespace OHOS {
25 namespace Media {
26 
27 enum class CodecType : uint32_t { VIDEO = 0, AUDIO };
28 enum class CodecResult : uint32_t { SUCCESS = 0, FAILED, CANCELED };
29 enum class CodecState : uint32_t { INIT = 0, RUNNING, FINISH_SUCCESS, FINISH_FAILED, CANCEL };
30 
31 using CodecOnInData = std::function<VEFError(OH_AVCodec* codec, OH_AVMemory* data, OH_AVCodecBufferAttr* attr)>;
32 using CodecOnOutData = std::function<VEFError(OH_AVCodec* codec, uint32_t index, OH_AVMemory* data,
33     OH_AVCodecBufferAttr* attr)>;
34 using CodecOnDecodeFrame = std::function<void(uint64_t pts)>;
35 using CodecOnDecodeResult = std::function<void(CodecResult result)>;
36 
37 struct PcmData {
38     std::shared_ptr<uint8_t> data = nullptr;
39     int32_t dataSize = 0;
40     int64_t pts = 0;
41     uint32_t flags = 0;
42 };
43 } // namespace Media
44 } // namespace OHOS
45 
46 #endif // OH_VEF_CODEC_COMMON_H