OLD | NEW |
(Empty) | |
| 1 /* |
| 2 * Copyright (c) 2007-2008 Intel Corporation. All Rights Reserved. |
| 3 * |
| 4 * Permission is hereby granted, free of charge, to any person obtaining a |
| 5 * copy of this software and associated documentation files (the |
| 6 * "Software"), to deal in the Software without restriction, including |
| 7 * without limitation the rights to use, copy, modify, merge, publish, |
| 8 * distribute, sub license, and/or sell copies of the Software, and to |
| 9 * permit persons to whom the Software is furnished to do so, subject to |
| 10 * the following conditions: |
| 11 * |
| 12 * The above copyright notice and this permission notice (including the |
| 13 * next paragraph) shall be included in all copies or substantial portions |
| 14 * of the Software. |
| 15 * |
| 16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
| 17 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
| 18 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. |
| 19 * IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR |
| 20 * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, |
| 21 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE |
| 22 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
| 23 */ |
| 24 |
| 25 /* |
| 26 * it is a real program to show how VAAPI encoding work, |
| 27 * It does H264 element stream level encoding on auto-generated YUV data |
| 28 * |
| 29 * gcc -o h264encode h264encode -lva -lva-x11 |
| 30 * ./h264encode -w <width> -h <height> -n <frame_num> |
| 31 * |
| 32 */ |
| 33 #include <binder/IPCThreadState.h> |
| 34 #include <binder/ProcessState.h> |
| 35 #include <binder/IServiceManager.h> |
| 36 #include <utils/Log.h> |
| 37 #include <surfaceflinger/ISurfaceComposer.h> |
| 38 #include <surfaceflinger/Surface.h> |
| 39 #include <surfaceflinger/ISurface.h> |
| 40 #include <surfaceflinger/SurfaceComposerClient.h> |
| 41 #include <binder/MemoryHeapBase.h> |
| 42 #define Display unsigned int |
| 43 |
| 44 using namespace android; |
| 45 #include "../android_winsys.cpp" |
| 46 #include "h264encode_common.c" |
| 47 |
| 48 sp<SurfaceComposerClient> client; |
| 49 sp<Surface> android_surface; |
| 50 sp<ISurface> android_isurface; |
| 51 sp<SurfaceControl> surface_ctrl; |
| 52 |
| 53 static int display_surface(int frame_id, int *exit_encode) |
| 54 { |
| 55 VAStatus va_status; |
| 56 |
| 57 sp<ProcessState> proc(ProcessState::self()); |
| 58 ProcessState::self()->startThreadPool(); |
| 59 |
| 60 printf("Create window0 for thread0\n"); |
| 61 SURFACE_CREATE(client,surface_ctrl,android_surface, android_isurface, 0, 0,
win_width, win_height); |
| 62 va_status = vaPutSurface(va_dpy, surface_id[frame_id], android_isurface, |
| 63 0,0, frame_width, frame_height, |
| 64 0,0, win_width, win_height, |
| 65 NULL,0,0); |
| 66 |
| 67 *exit_encode = 0; |
| 68 return 0; |
| 69 } |
| 70 |
OLD | NEW |