Kristian Høgsberg | 894e0b5 | 2012-05-25 17:55:20 -0400 | [diff] [blame] | 1 | /* |
| 2 | * Copyright © 2012 Intel Corporation |
| 3 | * |
Bryce Harrington | 212018e | 2015-06-11 16:05:41 -0700 | [diff] [blame] | 4 | * Permission is hereby granted, free of charge, to any person obtaining |
| 5 | * a 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, sublicense, 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: |
Kristian Høgsberg | 894e0b5 | 2012-05-25 17:55:20 -0400 | [diff] [blame] | 11 | * |
Bryce Harrington | 212018e | 2015-06-11 16:05:41 -0700 | [diff] [blame] | 12 | * The above copyright notice and this permission notice (including the |
| 13 | * next paragraph) shall be included in all copies or substantial |
| 14 | * portions of the Software. |
| 15 | * |
| 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, |
| 17 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
| 18 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
| 19 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS |
| 20 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN |
| 21 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
| 22 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
| 23 | * SOFTWARE. |
Kristian Høgsberg | 894e0b5 | 2012-05-25 17:55:20 -0400 | [diff] [blame] | 24 | */ |
| 25 | |
| 26 | #ifndef _WCAP_DECODE_ |
| 27 | #define _WCAP_DECODE_ |
| 28 | |
Jussi Kukkonen | 649bbce | 2016-07-19 14:16:27 +0300 | [diff] [blame^] | 29 | #include <stdint.h> |
| 30 | |
Kristian Høgsberg | 894e0b5 | 2012-05-25 17:55:20 -0400 | [diff] [blame] | 31 | #define WCAP_HEADER_MAGIC 0x57434150 |
| 32 | |
| 33 | #define WCAP_FORMAT_XRGB8888 0x34325258 |
| 34 | #define WCAP_FORMAT_XBGR8888 0x34324258 |
| 35 | #define WCAP_FORMAT_RGBX8888 0x34325852 |
| 36 | #define WCAP_FORMAT_BGRX8888 0x34325842 |
| 37 | |
| 38 | struct wcap_header { |
| 39 | uint32_t magic; |
| 40 | uint32_t format; |
| 41 | uint32_t width, height; |
| 42 | }; |
| 43 | |
| 44 | struct wcap_frame_header { |
| 45 | uint32_t msecs; |
| 46 | uint32_t nrects; |
| 47 | }; |
| 48 | |
| 49 | struct wcap_rectangle { |
| 50 | int32_t x1, y1, x2, y2; |
| 51 | }; |
| 52 | |
| 53 | struct wcap_decoder { |
| 54 | int fd; |
| 55 | size_t size; |
| 56 | void *map, *p, *end; |
| 57 | uint32_t *frame; |
Kristian Høgsberg | 2255eb0 | 2012-05-25 21:51:25 -0400 | [diff] [blame] | 58 | uint32_t format; |
Kristian Høgsberg | 11374d2 | 2012-05-25 22:33:35 -0400 | [diff] [blame] | 59 | uint32_t msecs; |
| 60 | uint32_t count; |
Kristian Høgsberg | 894e0b5 | 2012-05-25 17:55:20 -0400 | [diff] [blame] | 61 | int width, height; |
| 62 | }; |
| 63 | |
| 64 | int wcap_decoder_get_frame(struct wcap_decoder *decoder); |
| 65 | struct wcap_decoder *wcap_decoder_create(const char *filename); |
| 66 | void wcap_decoder_destroy(struct wcap_decoder *decoder); |
| 67 | |
| 68 | #endif |