libxcoder  5.2.0
ISharedBuffer.h
Go to the documentation of this file.
1 /*******************************************************************************
2  *
3  * Copyright (C) 2022 NETINT Technologies
4  *
5  * Permission is hereby granted, free of charge, to any person obtaining a copy
6  * of this software and associated documentation files (the "Software"), to deal
7  * in the Software without restriction, including without limitation the rights
8  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9  * copies of the Software, and to permit persons to whom the Software is
10  * furnished to do so, subject to the following conditions:
11  *
12  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
13  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
14  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
15  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
16  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
17  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
18  * SOFTWARE.
19  *
20  ******************************************************************************/
21 
22 /*!*****************************************************************************
23  * \file ISharedBuffer.h
24  *
25  * \brief Public definitions related to resource management of NETINT video
26  * processing devices on Android
27  *******************************************************************************/
28 
29 #ifndef ISHAREDBUFFER_H_
30 #define ISHAREDBUFFER_H_
31 
32 #include <utils/RefBase.h>
33 #include <binder/IInterface.h>
34 #include <binder/Parcel.h>
35 #include <utils/String8.h>
36 
37 #define SHARED_BUFFER_SERVICE "net.int.SharedBuffer"
38 #define STR_BUFFER_LEN 32
39 
40 using namespace android;
41 using namespace std;
42 
43 class ISharedBuffer : public IInterface {
44  public:
45  DECLARE_META_INTERFACE(SharedBuffer);
46  /*!*****************************************************************************
47  * \brief Get file descripter by using android net.int.SharedBuffer service.
48  *
49  * \param[in] name The name of the share mem
50  *
51  * \return Get fd (> 0) , < 0 otherwise
52  *
53  ******************************************************************************/
54  virtual int getFd(String8 &name) = 0;
55  /*!*****************************************************************************
56  * \brief Set file descripter with the name of the share mem by using android net.int.SharedBuffer service.
57  *
58  * \param[in] name The name of the share mem
59  *
60  * \return Get fd (> 0) , < 0 otherwise
61  *
62  ******************************************************************************/
63  virtual int setFd(String8 &param, int32_t fd) = 0;
64 };
65 
66 class BnSharedBuffer : public BnInterface<ISharedBuffer> {
67  public:
68  /*!*****************************************************************************
69  * \brief transmit the data between binder clint and server.
70  *
71  * \param[in] code The funtion identify
72  * \param[in] data The parcel take the data of the shm
73  * \param[in] reply The parcel take the return data of the shm
74  * \param[in] flags always 0
75  *
76  * \return success status_t (> 0) , < 0 otherwise
77  *
78  ******************************************************************************/
79  virtual status_t onTransact(uint32_t code, const Parcel &data,
80  Parcel *reply, uint32_t flags = 0);
81 };
82 
83 #endif // ISHAREDBUFFER_H_
ISharedBuffer
Definition: ISharedBuffer.h:43
BnSharedBuffer
Definition: ISharedBuffer.h:66