7dbcc1c2e2c86c31c609a8f194d10f4daebd1b3f
[media-ctl.git] / media.h
1 /*
2  * Media controller test application
3  *
4  * Copyright (C) 2010 Ideas on board SPRL <laurent.pinchart@ideasonboard.com>
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License along
17  * with this program; if not, write to the Free Software Foundation, Inc.,
18  */
19
20 #ifndef __MEDIA_H__
21 #define __MEDIA_H__
22
23 #include <linux/media.h>
24
25 struct media_entity_link {
26         struct media_entity_pad *source;
27         struct media_entity_pad *sink;
28         __u32 flags;
29 };
30
31 struct media_entity_pad {
32         struct media_entity *entity;
33         __u32 type;
34         __u32 index;
35 };
36
37 struct media_entity {
38         struct media_user_entity info;
39         struct media_entity_pad *pads;
40         struct media_entity_link *links;
41
42         char devname[32];
43         int fd;
44 };
45
46 struct media_device {
47         int fd;
48         struct media_entity *entities;
49         unsigned int entities_count;
50 };
51
52 struct media_device *media_open(const char *name, int verbose);
53 void media_close(struct media_device *media);
54
55 struct media_entity_pad *media_entity_remote_pad(struct media_entity_pad *pad);
56
57 struct media_entity *media_get_entity_by_name(struct media_device *media,
58         const char *name, size_t length);
59 void media_print_topology(struct media_device *media, int dot);
60 int media_setup_link(struct media_device *media,
61         struct media_entity_pad *source, struct media_entity_pad *sink,
62         __u32 flags);
63 int media_reset_links(struct media_device *media);
64
65 #endif
66