blob: 00b757feb078d89619164ca6019c2062feaa4d44 [file] [log] [blame]
Kristian Høgsberg894e0b52012-05-25 17:55:20 -04001/*
2 * Copyright © 2012 Intel Corporation
3 *
Bryce Harrington212018e2015-06-11 16:05:41 -07004 * 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øgsberg894e0b52012-05-25 17:55:20 -040011 *
Bryce Harrington212018e2015-06-11 16:05:41 -070012 * 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øgsberg894e0b52012-05-25 17:55:20 -040024 */
25
26#ifndef _WCAP_DECODE_
27#define _WCAP_DECODE_
28
Jussi Kukkonen649bbce2016-07-19 14:16:27 +030029#include <stdint.h>
30
Kristian Høgsberg894e0b52012-05-25 17:55:20 -040031#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
38struct wcap_header {
39 uint32_t magic;
40 uint32_t format;
41 uint32_t width, height;
42};
43
44struct wcap_frame_header {
45 uint32_t msecs;
46 uint32_t nrects;
47};
48
49struct wcap_rectangle {
50 int32_t x1, y1, x2, y2;
51};
52
53struct wcap_decoder {
54 int fd;
55 size_t size;
56 void *map, *p, *end;
57 uint32_t *frame;
Kristian Høgsberg2255eb02012-05-25 21:51:25 -040058 uint32_t format;
Kristian Høgsberg11374d22012-05-25 22:33:35 -040059 uint32_t msecs;
60 uint32_t count;
Kristian Høgsberg894e0b52012-05-25 17:55:20 -040061 int width, height;
62};
63
64int wcap_decoder_get_frame(struct wcap_decoder *decoder);
65struct wcap_decoder *wcap_decoder_create(const char *filename);
66void wcap_decoder_destroy(struct wcap_decoder *decoder);
67
68#endif