1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/media/omx-plugin/include/froyo/cutils/native_handle.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,73 @@ 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 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 +/* keep the old definition for backward source-compatibility */ 1.37 +typedef native_handle_t native_handle; 1.38 + 1.39 +/* 1.40 + * native_handle_close 1.41 + * 1.42 + * closes the file descriptors contained in this native_handle_t 1.43 + * 1.44 + * return 0 on success, or a negative error code on failure 1.45 + * 1.46 + */ 1.47 +int native_handle_close(const native_handle_t* h); 1.48 + 1.49 + 1.50 +/* 1.51 + * native_handle_create 1.52 + * 1.53 + * creates a native_handle_t and initializes it. must be destroyed with 1.54 + * native_handle_delete(). 1.55 + * 1.56 + */ 1.57 +native_handle_t* native_handle_create(int numFds, int numInts); 1.58 + 1.59 +/* 1.60 + * native_handle_delete 1.61 + * 1.62 + * frees a native_handle_t allocated with native_handle_create(). 1.63 + * This ONLY frees the memory allocated for the native_handle_t, but doesn't 1.64 + * close the file descriptors; which can be achieved with native_handle_close(). 1.65 + * 1.66 + * return 0 on success, or a negative error code on failure 1.67 + * 1.68 + */ 1.69 +int native_handle_delete(native_handle_t* h); 1.70 + 1.71 + 1.72 +#ifdef __cplusplus 1.73 +} 1.74 +#endif 1.75 + 1.76 +#endif /* NATIVE_HANDLE_H_ */