• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2025 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 AVTRANSCODER_FFI_H
17 #define AVTRANSCODER_FFI_H
18 #include "ffi_remote_data.h"
19 #include "cj_common_ffi.h"
20 #include "cj_avplayer_utils.h"
21 
22 namespace OHOS {
23 namespace Media {
24 extern "C" {
25 
26 struct CAVTransCoderConfig {
27     int32_t audioBitrate;
28     char* audioCodecFormat;
29     char* fileFormat;
30     int32_t videoBitrate;
31     char* videoCodecFormat;
32     int32_t videoFrameWidth;
33     int32_t videoFrameHeight;
34 };
35 
36 FFI_EXPORT int64_t FfiAVTranscoderCreateAVTranscoder(int32_t* errCode);
37 
38 FFI_EXPORT int32_t FfiAVTranscoderPrepare(int64_t id, CAVTransCoderConfig config);
39 FFI_EXPORT int32_t FfiAVTranscoderStart(int64_t id);
40 FFI_EXPORT int32_t FfiAVTranscoderPause(int64_t id);
41 FFI_EXPORT int32_t FfiAVTranscoderResume(int64_t id);
42 FFI_EXPORT int32_t FfiAVTranscoderCancel(int64_t id);
43 FFI_EXPORT int32_t FfiAVTranscoderRelease(int64_t id);
44 
45 FFI_EXPORT CAVFileDescriptor FfiAVTranscoderGetFdSrc(int64_t id, int32_t* errCode);
46 FFI_EXPORT int32_t FfiAVTranscoderSetFdSrc(int64_t id, CAVFileDescriptor fdSrc);
47 
48 FFI_EXPORT int32_t FfiAVTranscoderGetFdDst(int64_t id, int32_t* errCode);
49 FFI_EXPORT int32_t FfiAVTranscoderSetFdDst(int64_t id, int32_t fdDst);
50 
51 FFI_EXPORT int32_t FfiAVTranscoderOnProgressUpdate(int64_t id, int64_t callbackId);
52 FFI_EXPORT int32_t FfiAVTranscoderOffProgressUpdate(int64_t id);
53 FFI_EXPORT int32_t FfiAVTranscoderOnComplete(int64_t id, int64_t callbackId);
54 FFI_EXPORT int32_t FfiAVTranscoderOffComplete(int64_t id);
55 FFI_EXPORT int32_t FfiAVTranscoderOnError(int64_t id, int64_t callbackId);
56 FFI_EXPORT int32_t FfiAVTranscoderOffError(int64_t id);
57 }
58 }
59 }
60 #endif // AVTRANSCODER_FFI_H