1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/media/omx-plugin/include/ics/cutils/native_handle.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,69 @@ 1.4 +/* 1.5 + * Copyright (C) 2009 The Android Open Source Project 1.6 + * 1.7 + * Licensed under the Apache License, Version 2.0 (the "License"); 1.8 + * you may not use this file except in compliance with the License. 1.9 + * You may obtain a copy of the License at 1.10 + * 1.11 + * http://www.apache.org/licenses/LICENSE-2.0 1.12 + * 1.13 + * Unless required by applicable law or agreed to in writing, software 1.14 + * distributed under the License is distributed on an "AS IS" BASIS, 1.15 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1.16 + * See the License for the specific language governing permissions and 1.17 + * limitations under the License. 1.18 + */ 1.19 + 1.20 +#ifndef NATIVE_HANDLE_H_ 1.21 +#define NATIVE_HANDLE_H_ 1.22 + 1.23 +#ifdef __cplusplus 1.24 +extern "C" { 1.25 +#endif 1.26 + 1.27 +typedef struct native_handle 1.28 +{ 1.29 + int version; /* sizeof(native_handle_t) */ 1.30 + int numFds; /* number of file-descriptors at &data[0] */ 1.31 + int numInts; /* number of ints at &data[numFds] */ 1.32 + int data[0]; /* numFds + numInts ints */ 1.33 +} native_handle_t; 1.34 + 1.35 +/* 1.36 + * native_handle_close 1.37 + * 1.38 + * closes the file descriptors contained in this native_handle_t 1.39 + * 1.40 + * return 0 on success, or a negative error code on failure 1.41 + * 1.42 + */ 1.43 +int native_handle_close(const native_handle_t* h); 1.44 + 1.45 + 1.46 +/* 1.47 + * native_handle_create 1.48 + * 1.49 + * creates a native_handle_t and initializes it. must be destroyed with 1.50 + * native_handle_delete(). 1.51 + * 1.52 + */ 1.53 +native_handle_t* native_handle_create(int numFds, int numInts); 1.54 + 1.55 +/* 1.56 + * native_handle_delete 1.57 + * 1.58 + * frees a native_handle_t allocated with native_handle_create(). 1.59 + * This ONLY frees the memory allocated for the native_handle_t, but doesn't 1.60 + * close the file descriptors; which can be achieved with native_handle_close(). 1.61 + * 1.62 + * return 0 on success, or a negative error code on failure 1.63 + * 1.64 + */ 1.65 +int native_handle_delete(native_handle_t* h); 1.66 + 1.67 + 1.68 +#ifdef __cplusplus 1.69 +} 1.70 +#endif 1.71 + 1.72 +#endif /* NATIVE_HANDLE_H_ */