• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* ------------------------------------------------------------------
2  * Copyright (C) 2009 Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
13  * express or implied.
14  * See the License for the specific language governing permissions
15  * and limitations under the License.
16  * -------------------------------------------------------------------
17  */
18 
19 #ifndef ANDROID_SURFACE_OUTPUT_FB_H_INCLUDED
20 #define ANDROID_SURFACE_OUTPUT_FB_H_INCLUDED
21 
22 #include "android_surface_output.h"
23 
24 // support for shared contiguous physical memory
25 #include <binder/MemoryHeapPmem.h>
26 
27 // data structures for tunneling buffers
28 typedef struct PLATFORM_PRIVATE_PMEM_INFO
29 {
30     /* pmem file descriptor */
31     uint32 pmem_fd;
32     uint32 offset;
33 } PLATFORM_PRIVATE_PMEM_INFO;
34 
35 typedef struct PLATFORM_PRIVATE_ENTRY
36 {
37     /* Entry type */
38     uint32 type;
39 
40     /* Pointer to platform specific entry */
41     OsclAny* entry;
42 } PLATFORM_PRIVATE_ENTRY;
43 
44 typedef struct PLATFORM_PRIVATE_LIST
45 {
46     /* Number of entries */
47     uint32 nEntries;
48 
49     /* Pointer to array of platform specific entries *
50      * Contiguous block of PLATFORM_PRIVATE_ENTRY elements */
51     PLATFORM_PRIVATE_ENTRY* entryList;
52 } PLATFORM_PRIVATE_LIST;
53 
54 
55 class AndroidSurfaceOutputFB : public AndroidSurfaceOutput
56 {
57 public:
58     AndroidSurfaceOutputFB();
59 
60     // frame buffer interface
61     virtual bool initCheck();
62     virtual PVMFStatus writeFrameBuf(uint8* aData, uint32 aDataLen, const PvmiMediaXferHeader& data_header_info);
63     virtual void postLastFrame();
64     virtual void closeFrameBuf();
65 
66     OSCL_IMPORT_REF ~AndroidSurfaceOutputFB();
67 
68 private:
69     bool getPmemFd(OsclAny *private_data_ptr, uint32 *pmemFD);
70     bool getOffset(OsclAny *private_data_ptr, uint32 *offset);
71     void convertFrame(void* src, void* dst, size_t len);
72 
73     // hardware frame buffer support
74     sp<MemoryHeapPmem>          mHeapPmem;
75     bool                        mHardwareCodec;
76     uint32                      mOffset;
77 };
78 
79 #endif // ANDROID_SURFACE_OUTPUT_FB_H_INCLUDED
80