blob: 3c374419d507123b8b50d743dc3489d810c8950e [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
29#define WCAP_HEADER_MAGIC 0x57434150
30
31#define WCAP_FORMAT_XRGB8888 0x34325258
32#define WCAP_FORMAT_XBGR8888 0x34324258
33#define WCAP_FORMAT_RGBX8888 0x34325852
34#define WCAP_FORMAT_BGRX8888 0x34325842
35
36struct wcap_header {
37 uint32_t magic;
38 uint32_t format;
39 uint32_t width, height;
40};
41
42struct wcap_frame_header {
43 uint32_t msecs;
44 uint32_t nrects;
45};
46
47struct wcap_rectangle {
48 int32_t x1, y1, x2, y2;
49};
50
51struct wcap_decoder {
52 int fd;
53 size_t size;
54 void *map, *p, *end;
55 uint32_t *frame;
Kristian Høgsberg2255eb02012-05-25 21:51:25 -040056 uint32_t format;
Kristian Høgsberg11374d22012-05-25 22:33:35 -040057 uint32_t msecs;
58 uint32_t count;
Kristian Høgsberg894e0b52012-05-25 17:55:20 -040059 int width, height;
60};
61
62int wcap_decoder_get_frame(struct wcap_decoder *decoder);
63struct wcap_decoder *wcap_decoder_create(const char *filename);
64void wcap_decoder_destroy(struct wcap_decoder *decoder);
65
66#endif