GFXprim
2D bitmap graphics library with emphasis on speed and correctness
Loading...
Searching...
No Matches
gp_grabber.h
Go to the documentation of this file.
1// SPDX-License-Identifier: LGPL-2.1-or-later
2/*
3 * Copyright (C) 2009-2024 Cyril Hrubis <metan@ucw.cz>
4 */
5
10#ifndef GP_GRABBERS_GRABBER_H
11#define GP_GRABBERS_GRABBER_H
12
13#include <core/gp_types.h>
14
15typedef struct gp_grabber gp_grabber;
16
18struct gp_grabber {
21
30 int (*poll)(gp_grabber *self);
31
33 int fd;
34
42 int (*start)(gp_grabber *self);
43
51 int (*stop)(gp_grabber *self);
52
60 void (*exit)(gp_grabber *self);
61
62 char priv[];
63};
64
65#define GP_GRABBER_PRIV(grabber) ((void*)(grabber)->priv)
66
67static inline void gp_grabber_exit(gp_grabber *self)
68{
69 self->exit(self);
70}
71
72static inline int gp_grabber_poll(gp_grabber *self)
73{
74 return self->poll(self);
75}
76
77static inline int gp_grabber_start(gp_grabber *self)
78{
79 if (self->start)
80 return self->start(self);
81
82 return 0;
83}
84
85static inline int gp_grabber_stop(gp_grabber *self)
86{
87 if (self->stop)
88 return self->stop(self);
89
90 return 0;
91}
92
93#endif /* GP_GRABBERS_GRABBER_H */
A common types.
A grabber.
Definition gp_grabber.h:18
int(* poll)(gp_grabber *self)
A grabber polling function.
Definition gp_grabber.h:30
int fd
Grabber fd suitable for polling.
Definition gp_grabber.h:33
int(* stop)(gp_grabber *self)
Stops the grabbing.
Definition gp_grabber.h:51
struct gp_pixmap * frame
Pixmap with current frame.
Definition gp_grabber.h:20
int(* start)(gp_grabber *self)
Starts the actuall grabbing.
Definition gp_grabber.h:42
void(* exit)(gp_grabber *self)
Destroys grabber.
Definition gp_grabber.h:60
A pixmap buffer.
Definition gp_pixmap.h:33