• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 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 #ifndef HDI_CODEC_CLIENT_INF_H
17 #define HDI_CODEC_CLIENT_INF_H
18 
19 #include "codec_callback.h"
20 
21 #ifdef __cplusplus
22 extern "C" {
23 #endif /* __cplusplus */
24 
25 struct HdfRemoteService;
26 
27 enum {
28     CMD_CODEC_INIT,
29     CMD_CODEC_DEINIT,
30     CMD_CODEC_ENUM_CAP,
31     CMD_CODEC_GET_CAP,
32     CMD_CODEC_CREATE,
33     CMD_CODEC_DESTROY,
34     CMD_CODEC_SET_MODE,
35     CMD_CODEC_SET_PARAMS,
36     CMD_CODEC_GET_PARAMS,
37     CMD_CODEC_START,
38     CMD_CODEC_STOP,
39     CMD_CODEC_FLUSH,
40     CMD_CODEC_QUEQUE_INPUT,
41     CMD_CODEC_DEQUEQUE_INPUT,
42     CMD_CODEC_QUEQUE_OUTPUT,
43     CMD_CODEC_DEQUEQUE_OUTPUT,
44     CMD_CODEC_SET_CBK,
45 };
46 
47 struct ICodec {
48     struct HdfRemoteService *remote;
49     int32_t (*CodecInit)(struct ICodec *self);
50     int32_t (*CodecDeinit)(struct ICodec *self);
51     int32_t (*CodecEnumerateCapbility)(struct ICodec *self, uint32_t index, CodecCapbility *cap);
52     int32_t (*CodecGetCapbility)(struct ICodec *self, AvCodecMime mime, CodecType type,
53                                  uint32_t flags, CodecCapbility *cap);
54     int32_t (*CodecCreate)(struct ICodec *self, const char* name, const Param *attr,
55                            int len, CODEC_HANDLETYPE *handle);
56     int32_t (*CodecDestroy)(struct ICodec *self, CODEC_HANDLETYPE handle);
57     int32_t (*CodecSetPortMode)(struct ICodec *self, CODEC_HANDLETYPE handle, DirectionType type, BufferMode mode);
58     int32_t (*CodecSetParameter)(struct ICodec *self, CODEC_HANDLETYPE handle, const Param *params, int paramCnt);
59     int32_t (*CodecGetParameter)(struct ICodec *self, CODEC_HANDLETYPE handle, Param *params, int paramCnt);
60     int32_t (*CodecStart)(struct ICodec *self, CODEC_HANDLETYPE handle);
61     int32_t (*CodecStop)(struct ICodec *self, CODEC_HANDLETYPE handle);
62     int32_t (*CodecFlush)(struct ICodec *self, CODEC_HANDLETYPE handle, DirectionType directType);
63     int32_t (*CodecQueueInput)(struct ICodec *self, CODEC_HANDLETYPE handle,
64                                const InputInfo *inputData, uint32_t timeoutMs);
65     int32_t (*CodecDequeInput)(struct ICodec *self, CODEC_HANDLETYPE handle,
66                                uint32_t timeoutMs, InputInfo *inputData);
67     int32_t (*CodecQueueOutput)(struct ICodec *self, CODEC_HANDLETYPE handle, OutputInfo *outInfo,
68                                 uint32_t timeoutMs, int releaseFenceFd);
69     int32_t (*CodecDequeueOutput)(struct ICodec *self, CODEC_HANDLETYPE handle, uint32_t timeoutMs,
70                                   int *acquireFd, OutputInfo *outInfo);
71     int32_t (*CodecSetCallback)(struct ICodec *self, CODEC_HANDLETYPE handle,
72                                 struct ICodecCallback *cb, UINTPTR instance);
73 };
74 
75 struct ICodec *HdiCodecGet(const char *serviceName);
76 void HdiCodecRelease(struct ICodec *instance);
77 
78 #ifdef __cplusplus
79 }
80 #endif /* __cplusplus */
81 
82 #endif // HDI_SAMPLE_CLIENT_C_INF_H