annotate vidix/drivers.c @ 27404:778fac8c186f

Add separate variables for CFLAGS that are specific to internal libraries and only add them to CFLAGS when compiling objects from those libraries.
author diego
date Thu, 07 Aug 2008 21:46:06 +0000
parents df448e1248b2
children 917c93c652b0
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
22902
d74001dbe2a6 missing headers in vidix drivers registry files
ben
parents: 22878
diff changeset
1 /*
23046
82216ef041e0 updated vidix files headers whenever it's possible to have a clear GPL statement
ben
parents: 22974
diff changeset
2 * VIDIX Drivers Registry Handler.
82216ef041e0 updated vidix files headers whenever it's possible to have a clear GPL statement
ben
parents: 22974
diff changeset
3 * Copyright (C) 2007 Benjamin Zores <ben@geexbox.org>
22902
d74001dbe2a6 missing headers in vidix drivers registry files
ben
parents: 22878
diff changeset
4 *
23046
82216ef041e0 updated vidix files headers whenever it's possible to have a clear GPL statement
ben
parents: 22974
diff changeset
5 * This file is part of MPlayer.
22902
d74001dbe2a6 missing headers in vidix drivers registry files
ben
parents: 22878
diff changeset
6 *
23046
82216ef041e0 updated vidix files headers whenever it's possible to have a clear GPL statement
ben
parents: 22974
diff changeset
7 * MPlayer is free software; you can redistribute it and/or modify
82216ef041e0 updated vidix files headers whenever it's possible to have a clear GPL statement
ben
parents: 22974
diff changeset
8 * it under the terms of the GNU General Public License as published by
82216ef041e0 updated vidix files headers whenever it's possible to have a clear GPL statement
ben
parents: 22974
diff changeset
9 * the Free Software Foundation; either version 2 of the License, or
82216ef041e0 updated vidix files headers whenever it's possible to have a clear GPL statement
ben
parents: 22974
diff changeset
10 * (at your option) any later version.
22902
d74001dbe2a6 missing headers in vidix drivers registry files
ben
parents: 22878
diff changeset
11 *
23046
82216ef041e0 updated vidix files headers whenever it's possible to have a clear GPL statement
ben
parents: 22974
diff changeset
12 * MPlayer is distributed in the hope that it will be useful,
82216ef041e0 updated vidix files headers whenever it's possible to have a clear GPL statement
ben
parents: 22974
diff changeset
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
82216ef041e0 updated vidix files headers whenever it's possible to have a clear GPL statement
ben
parents: 22974
diff changeset
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
82216ef041e0 updated vidix files headers whenever it's possible to have a clear GPL statement
ben
parents: 22974
diff changeset
15 * GNU General Public License for more details.
82216ef041e0 updated vidix files headers whenever it's possible to have a clear GPL statement
ben
parents: 22974
diff changeset
16 *
26719
3abd1629658b Use standard license headers.
diego
parents: 26203
diff changeset
17 * You should have received a copy of the GNU General Public License along
3abd1629658b Use standard license headers.
diego
parents: 26203
diff changeset
18 * with MPlayer; if not, write to the Free Software Foundation, Inc.,
3abd1629658b Use standard license headers.
diego
parents: 26203
diff changeset
19 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
22902
d74001dbe2a6 missing headers in vidix drivers registry files
ben
parents: 22878
diff changeset
20 */
d74001dbe2a6 missing headers in vidix drivers registry files
ben
parents: 22878
diff changeset
21
22857
77def5093daf switch to new internal vidix API, no more dlopen/dlsym, libvidix is now a fully static library with all drivers built-in
ben
parents:
diff changeset
22 #include <stdlib.h>
77def5093daf switch to new internal vidix API, no more dlopen/dlsym, libvidix is now a fully static library with all drivers built-in
ben
parents:
diff changeset
23 #include <stdio.h>
77def5093daf switch to new internal vidix API, no more dlopen/dlsym, libvidix is now a fully static library with all drivers built-in
ben
parents:
diff changeset
24 #include <errno.h>
77def5093daf switch to new internal vidix API, no more dlopen/dlsym, libvidix is now a fully static library with all drivers built-in
ben
parents:
diff changeset
25 #include <string.h>
77def5093daf switch to new internal vidix API, no more dlopen/dlsym, libvidix is now a fully static library with all drivers built-in
ben
parents:
diff changeset
26
26203
0d255d03016f #include config.h before all other headers.
diego
parents: 26096
diff changeset
27 #include "config.h"
27079
df448e1248b2 remove now useless vidixlib.h file
ben
parents: 26719
diff changeset
28 #include "vidix.h"
22905
f34e5d778267 consistent include paths for config.h et al.
diego
parents: 22902
diff changeset
29 #include "libavutil/common.h"
f34e5d778267 consistent include paths for config.h et al.
diego
parents: 22902
diff changeset
30 #include "mpbswap.h"
22973
46597c69d843 added conditional vidix drivers compilation
ben
parents: 22905
diff changeset
31 #include "config.h"
22857
77def5093daf switch to new internal vidix API, no more dlopen/dlsym, libvidix is now a fully static library with all drivers built-in
ben
parents:
diff changeset
32
77def5093daf switch to new internal vidix API, no more dlopen/dlsym, libvidix is now a fully static library with all drivers built-in
ben
parents:
diff changeset
33 VDXDriver *first_driver = NULL;
77def5093daf switch to new internal vidix API, no more dlopen/dlsym, libvidix is now a fully static library with all drivers built-in
ben
parents:
diff changeset
34
77def5093daf switch to new internal vidix API, no more dlopen/dlsym, libvidix is now a fully static library with all drivers built-in
ben
parents:
diff changeset
35 extern VDXDriver cyberblade_drv;
23275
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents: 23046
diff changeset
36 extern VDXDriver ivtv_drv;
22857
77def5093daf switch to new internal vidix API, no more dlopen/dlsym, libvidix is now a fully static library with all drivers built-in
ben
parents:
diff changeset
37 extern VDXDriver mach64_drv;
77def5093daf switch to new internal vidix API, no more dlopen/dlsym, libvidix is now a fully static library with all drivers built-in
ben
parents:
diff changeset
38 extern VDXDriver mga_drv;
77def5093daf switch to new internal vidix API, no more dlopen/dlsym, libvidix is now a fully static library with all drivers built-in
ben
parents:
diff changeset
39 extern VDXDriver mga_crtc2_drv;
77def5093daf switch to new internal vidix API, no more dlopen/dlsym, libvidix is now a fully static library with all drivers built-in
ben
parents:
diff changeset
40 extern VDXDriver nvidia_drv;
22974
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents: 22973
diff changeset
41 extern VDXDriver pm2_drv;
22857
77def5093daf switch to new internal vidix API, no more dlopen/dlsym, libvidix is now a fully static library with all drivers built-in
ben
parents:
diff changeset
42 extern VDXDriver pm3_drv;
77def5093daf switch to new internal vidix API, no more dlopen/dlsym, libvidix is now a fully static library with all drivers built-in
ben
parents:
diff changeset
43 extern VDXDriver radeon_drv;
77def5093daf switch to new internal vidix API, no more dlopen/dlsym, libvidix is now a fully static library with all drivers built-in
ben
parents:
diff changeset
44 extern VDXDriver rage128_drv;
26096
e6a565ec1a3b New S3 VIDIX driver.
ben
parents: 23275
diff changeset
45 extern VDXDriver s3_drv;
22857
77def5093daf switch to new internal vidix API, no more dlopen/dlsym, libvidix is now a fully static library with all drivers built-in
ben
parents:
diff changeset
46 extern VDXDriver sis_drv;
77def5093daf switch to new internal vidix API, no more dlopen/dlsym, libvidix is now a fully static library with all drivers built-in
ben
parents:
diff changeset
47 extern VDXDriver unichrome_drv;
77def5093daf switch to new internal vidix API, no more dlopen/dlsym, libvidix is now a fully static library with all drivers built-in
ben
parents:
diff changeset
48
77def5093daf switch to new internal vidix API, no more dlopen/dlsym, libvidix is now a fully static library with all drivers built-in
ben
parents:
diff changeset
49 static void vidix_register_driver (VDXDriver *drv)
77def5093daf switch to new internal vidix API, no more dlopen/dlsym, libvidix is now a fully static library with all drivers built-in
ben
parents:
diff changeset
50 {
77def5093daf switch to new internal vidix API, no more dlopen/dlsym, libvidix is now a fully static library with all drivers built-in
ben
parents:
diff changeset
51 VDXDriver **d;
77def5093daf switch to new internal vidix API, no more dlopen/dlsym, libvidix is now a fully static library with all drivers built-in
ben
parents:
diff changeset
52
77def5093daf switch to new internal vidix API, no more dlopen/dlsym, libvidix is now a fully static library with all drivers built-in
ben
parents:
diff changeset
53 d = &first_driver;
77def5093daf switch to new internal vidix API, no more dlopen/dlsym, libvidix is now a fully static library with all drivers built-in
ben
parents:
diff changeset
54 while (*d != NULL)
77def5093daf switch to new internal vidix API, no more dlopen/dlsym, libvidix is now a fully static library with all drivers built-in
ben
parents:
diff changeset
55 d = &(*d)->next;
77def5093daf switch to new internal vidix API, no more dlopen/dlsym, libvidix is now a fully static library with all drivers built-in
ben
parents:
diff changeset
56 *d = drv;
77def5093daf switch to new internal vidix API, no more dlopen/dlsym, libvidix is now a fully static library with all drivers built-in
ben
parents:
diff changeset
57 drv->next = NULL;
77def5093daf switch to new internal vidix API, no more dlopen/dlsym, libvidix is now a fully static library with all drivers built-in
ben
parents:
diff changeset
58 }
77def5093daf switch to new internal vidix API, no more dlopen/dlsym, libvidix is now a fully static library with all drivers built-in
ben
parents:
diff changeset
59
77def5093daf switch to new internal vidix API, no more dlopen/dlsym, libvidix is now a fully static library with all drivers built-in
ben
parents:
diff changeset
60 void vidix_register_all_drivers (void)
77def5093daf switch to new internal vidix API, no more dlopen/dlsym, libvidix is now a fully static library with all drivers built-in
ben
parents:
diff changeset
61 {
22973
46597c69d843 added conditional vidix drivers compilation
ben
parents: 22905
diff changeset
62 #ifdef CONFIG_VIDIX_DRV_CYBERBLADE
22857
77def5093daf switch to new internal vidix API, no more dlopen/dlsym, libvidix is now a fully static library with all drivers built-in
ben
parents:
diff changeset
63 vidix_register_driver (&cyberblade_drv);
22973
46597c69d843 added conditional vidix drivers compilation
ben
parents: 22905
diff changeset
64 #endif
23275
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents: 23046
diff changeset
65 #ifdef CONFIG_VIDIX_DRV_IVTV
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents: 23046
diff changeset
66 vidix_register_driver (&ivtv_drv);
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents: 23046
diff changeset
67 #endif
22973
46597c69d843 added conditional vidix drivers compilation
ben
parents: 22905
diff changeset
68 #ifdef CONFIG_VIDIX_DRV_MACH64
22857
77def5093daf switch to new internal vidix API, no more dlopen/dlsym, libvidix is now a fully static library with all drivers built-in
ben
parents:
diff changeset
69 vidix_register_driver (&mach64_drv);
22973
46597c69d843 added conditional vidix drivers compilation
ben
parents: 22905
diff changeset
70 #endif
46597c69d843 added conditional vidix drivers compilation
ben
parents: 22905
diff changeset
71 #ifdef CONFIG_VIDIX_DRV_MGA
22857
77def5093daf switch to new internal vidix API, no more dlopen/dlsym, libvidix is now a fully static library with all drivers built-in
ben
parents:
diff changeset
72 vidix_register_driver (&mga_drv);
22973
46597c69d843 added conditional vidix drivers compilation
ben
parents: 22905
diff changeset
73 #endif
46597c69d843 added conditional vidix drivers compilation
ben
parents: 22905
diff changeset
74 #ifdef CONFIG_VIDIX_DRV_MGA_CRTC2
22857
77def5093daf switch to new internal vidix API, no more dlopen/dlsym, libvidix is now a fully static library with all drivers built-in
ben
parents:
diff changeset
75 vidix_register_driver (&mga_crtc2_drv);
22973
46597c69d843 added conditional vidix drivers compilation
ben
parents: 22905
diff changeset
76 #endif
46597c69d843 added conditional vidix drivers compilation
ben
parents: 22905
diff changeset
77 #ifdef CONFIG_VIDIX_DRV_NVIDIA
22857
77def5093daf switch to new internal vidix API, no more dlopen/dlsym, libvidix is now a fully static library with all drivers built-in
ben
parents:
diff changeset
78 vidix_register_driver (&nvidia_drv);
22973
46597c69d843 added conditional vidix drivers compilation
ben
parents: 22905
diff changeset
79 #endif
22974
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents: 22973
diff changeset
80 #ifdef CONFIG_VIDIX_DRV_PM2
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents: 22973
diff changeset
81 vidix_register_driver (&pm2_drv);
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents: 22973
diff changeset
82 #endif
22973
46597c69d843 added conditional vidix drivers compilation
ben
parents: 22905
diff changeset
83 #ifdef CONFIG_VIDIX_DRV_PM3
22857
77def5093daf switch to new internal vidix API, no more dlopen/dlsym, libvidix is now a fully static library with all drivers built-in
ben
parents:
diff changeset
84 vidix_register_driver (&pm3_drv);
22973
46597c69d843 added conditional vidix drivers compilation
ben
parents: 22905
diff changeset
85 #endif
46597c69d843 added conditional vidix drivers compilation
ben
parents: 22905
diff changeset
86 #ifdef CONFIG_VIDIX_DRV_RADEON
22857
77def5093daf switch to new internal vidix API, no more dlopen/dlsym, libvidix is now a fully static library with all drivers built-in
ben
parents:
diff changeset
87 vidix_register_driver (&radeon_drv);
22973
46597c69d843 added conditional vidix drivers compilation
ben
parents: 22905
diff changeset
88 #endif
46597c69d843 added conditional vidix drivers compilation
ben
parents: 22905
diff changeset
89 #ifdef CONFIG_VIDIX_DRV_RAGE128
22857
77def5093daf switch to new internal vidix API, no more dlopen/dlsym, libvidix is now a fully static library with all drivers built-in
ben
parents:
diff changeset
90 vidix_register_driver (&rage128_drv);
22973
46597c69d843 added conditional vidix drivers compilation
ben
parents: 22905
diff changeset
91 #endif
26096
e6a565ec1a3b New S3 VIDIX driver.
ben
parents: 23275
diff changeset
92 #ifdef CONFIG_VIDIX_DRV_S3
e6a565ec1a3b New S3 VIDIX driver.
ben
parents: 23275
diff changeset
93 vidix_register_driver (&s3_drv);
22973
46597c69d843 added conditional vidix drivers compilation
ben
parents: 22905
diff changeset
94 #endif
46597c69d843 added conditional vidix drivers compilation
ben
parents: 22905
diff changeset
95 #ifdef CONFIG_VIDIX_DRV_SIS
22857
77def5093daf switch to new internal vidix API, no more dlopen/dlsym, libvidix is now a fully static library with all drivers built-in
ben
parents:
diff changeset
96 vidix_register_driver (&sis_drv);
22973
46597c69d843 added conditional vidix drivers compilation
ben
parents: 22905
diff changeset
97 #endif
46597c69d843 added conditional vidix drivers compilation
ben
parents: 22905
diff changeset
98 #ifdef CONFIG_VIDIX_DRV_UNICHROME
22857
77def5093daf switch to new internal vidix API, no more dlopen/dlsym, libvidix is now a fully static library with all drivers built-in
ben
parents:
diff changeset
99 vidix_register_driver (&unichrome_drv);
22973
46597c69d843 added conditional vidix drivers compilation
ben
parents: 22905
diff changeset
100 #endif
22857
77def5093daf switch to new internal vidix API, no more dlopen/dlsym, libvidix is now a fully static library with all drivers built-in
ben
parents:
diff changeset
101 }
77def5093daf switch to new internal vidix API, no more dlopen/dlsym, libvidix is now a fully static library with all drivers built-in
ben
parents:
diff changeset
102
77def5093daf switch to new internal vidix API, no more dlopen/dlsym, libvidix is now a fully static library with all drivers built-in
ben
parents:
diff changeset
103 static int vidix_probe_driver (VDXContext *ctx, VDXDriver *drv,
77def5093daf switch to new internal vidix API, no more dlopen/dlsym, libvidix is now a fully static library with all drivers built-in
ben
parents:
diff changeset
104 unsigned int cap, int verbose)
77def5093daf switch to new internal vidix API, no more dlopen/dlsym, libvidix is now a fully static library with all drivers built-in
ben
parents:
diff changeset
105 {
77def5093daf switch to new internal vidix API, no more dlopen/dlsym, libvidix is now a fully static library with all drivers built-in
ben
parents:
diff changeset
106 vidix_capability_t vid_cap;
77def5093daf switch to new internal vidix API, no more dlopen/dlsym, libvidix is now a fully static library with all drivers built-in
ben
parents:
diff changeset
107
77def5093daf switch to new internal vidix API, no more dlopen/dlsym, libvidix is now a fully static library with all drivers built-in
ben
parents:
diff changeset
108 if (verbose)
77def5093daf switch to new internal vidix API, no more dlopen/dlsym, libvidix is now a fully static library with all drivers built-in
ben
parents:
diff changeset
109 printf ("vidixlib: PROBING: %s\n", drv->name);
77def5093daf switch to new internal vidix API, no more dlopen/dlsym, libvidix is now a fully static library with all drivers built-in
ben
parents:
diff changeset
110
77def5093daf switch to new internal vidix API, no more dlopen/dlsym, libvidix is now a fully static library with all drivers built-in
ben
parents:
diff changeset
111 if (!drv->probe || drv->probe (verbose, PROBE_NORMAL) != 0)
77def5093daf switch to new internal vidix API, no more dlopen/dlsym, libvidix is now a fully static library with all drivers built-in
ben
parents:
diff changeset
112 return 0;
77def5093daf switch to new internal vidix API, no more dlopen/dlsym, libvidix is now a fully static library with all drivers built-in
ben
parents:
diff changeset
113
77def5093daf switch to new internal vidix API, no more dlopen/dlsym, libvidix is now a fully static library with all drivers built-in
ben
parents:
diff changeset
114 if (!drv->get_caps || drv->get_caps (&vid_cap) != 0)
77def5093daf switch to new internal vidix API, no more dlopen/dlsym, libvidix is now a fully static library with all drivers built-in
ben
parents:
diff changeset
115 return 0;
77def5093daf switch to new internal vidix API, no more dlopen/dlsym, libvidix is now a fully static library with all drivers built-in
ben
parents:
diff changeset
116
77def5093daf switch to new internal vidix API, no more dlopen/dlsym, libvidix is now a fully static library with all drivers built-in
ben
parents:
diff changeset
117 if ((vid_cap.type & cap) != cap)
77def5093daf switch to new internal vidix API, no more dlopen/dlsym, libvidix is now a fully static library with all drivers built-in
ben
parents:
diff changeset
118 {
77def5093daf switch to new internal vidix API, no more dlopen/dlsym, libvidix is now a fully static library with all drivers built-in
ben
parents:
diff changeset
119 if (verbose)
77def5093daf switch to new internal vidix API, no more dlopen/dlsym, libvidix is now a fully static library with all drivers built-in
ben
parents:
diff changeset
120 printf ("vidixlib: Found %s but has no required capability\n",
77def5093daf switch to new internal vidix API, no more dlopen/dlsym, libvidix is now a fully static library with all drivers built-in
ben
parents:
diff changeset
121 drv->name);
77def5093daf switch to new internal vidix API, no more dlopen/dlsym, libvidix is now a fully static library with all drivers built-in
ben
parents:
diff changeset
122 return 0;
77def5093daf switch to new internal vidix API, no more dlopen/dlsym, libvidix is now a fully static library with all drivers built-in
ben
parents:
diff changeset
123 }
77def5093daf switch to new internal vidix API, no more dlopen/dlsym, libvidix is now a fully static library with all drivers built-in
ben
parents:
diff changeset
124
77def5093daf switch to new internal vidix API, no more dlopen/dlsym, libvidix is now a fully static library with all drivers built-in
ben
parents:
diff changeset
125 if (verbose)
77def5093daf switch to new internal vidix API, no more dlopen/dlsym, libvidix is now a fully static library with all drivers built-in
ben
parents:
diff changeset
126 printf ("vidixlib: %s probed o'k\n", drv->name);
77def5093daf switch to new internal vidix API, no more dlopen/dlsym, libvidix is now a fully static library with all drivers built-in
ben
parents:
diff changeset
127
77def5093daf switch to new internal vidix API, no more dlopen/dlsym, libvidix is now a fully static library with all drivers built-in
ben
parents:
diff changeset
128 ctx->drv = drv;
77def5093daf switch to new internal vidix API, no more dlopen/dlsym, libvidix is now a fully static library with all drivers built-in
ben
parents:
diff changeset
129 return 1;
77def5093daf switch to new internal vidix API, no more dlopen/dlsym, libvidix is now a fully static library with all drivers built-in
ben
parents:
diff changeset
130 }
77def5093daf switch to new internal vidix API, no more dlopen/dlsym, libvidix is now a fully static library with all drivers built-in
ben
parents:
diff changeset
131
22873
030428ba5bb3 allow passing :help to -vo [cx]vidix to get list of all compiled in vidix drivers
ben
parents: 22858
diff changeset
132 static void vidix_list_drivers (void)
030428ba5bb3 allow passing :help to -vo [cx]vidix to get list of all compiled in vidix drivers
ben
parents: 22858
diff changeset
133 {
030428ba5bb3 allow passing :help to -vo [cx]vidix to get list of all compiled in vidix drivers
ben
parents: 22858
diff changeset
134 VDXDriver *drv;
030428ba5bb3 allow passing :help to -vo [cx]vidix to get list of all compiled in vidix drivers
ben
parents: 22858
diff changeset
135
030428ba5bb3 allow passing :help to -vo [cx]vidix to get list of all compiled in vidix drivers
ben
parents: 22858
diff changeset
136 printf ("Available VIDIX drivers:\n");
030428ba5bb3 allow passing :help to -vo [cx]vidix to get list of all compiled in vidix drivers
ben
parents: 22858
diff changeset
137
030428ba5bb3 allow passing :help to -vo [cx]vidix to get list of all compiled in vidix drivers
ben
parents: 22858
diff changeset
138 drv = first_driver;
030428ba5bb3 allow passing :help to -vo [cx]vidix to get list of all compiled in vidix drivers
ben
parents: 22858
diff changeset
139 while (drv)
030428ba5bb3 allow passing :help to -vo [cx]vidix to get list of all compiled in vidix drivers
ben
parents: 22858
diff changeset
140 {
030428ba5bb3 allow passing :help to -vo [cx]vidix to get list of all compiled in vidix drivers
ben
parents: 22858
diff changeset
141 vidix_capability_t cap;
030428ba5bb3 allow passing :help to -vo [cx]vidix to get list of all compiled in vidix drivers
ben
parents: 22858
diff changeset
142 drv->get_caps (&cap);
030428ba5bb3 allow passing :help to -vo [cx]vidix to get list of all compiled in vidix drivers
ben
parents: 22858
diff changeset
143 printf (" * %s - %s\n", drv->name, cap.name);
030428ba5bb3 allow passing :help to -vo [cx]vidix to get list of all compiled in vidix drivers
ben
parents: 22858
diff changeset
144 drv = drv->next;
030428ba5bb3 allow passing :help to -vo [cx]vidix to get list of all compiled in vidix drivers
ben
parents: 22858
diff changeset
145 }
030428ba5bb3 allow passing :help to -vo [cx]vidix to get list of all compiled in vidix drivers
ben
parents: 22858
diff changeset
146 }
030428ba5bb3 allow passing :help to -vo [cx]vidix to get list of all compiled in vidix drivers
ben
parents: 22858
diff changeset
147
22857
77def5093daf switch to new internal vidix API, no more dlopen/dlsym, libvidix is now a fully static library with all drivers built-in
ben
parents:
diff changeset
148 int vidix_find_driver (VDXContext *ctx, const char *name,
77def5093daf switch to new internal vidix API, no more dlopen/dlsym, libvidix is now a fully static library with all drivers built-in
ben
parents:
diff changeset
149 unsigned int cap, int verbose)
77def5093daf switch to new internal vidix API, no more dlopen/dlsym, libvidix is now a fully static library with all drivers built-in
ben
parents:
diff changeset
150 {
77def5093daf switch to new internal vidix API, no more dlopen/dlsym, libvidix is now a fully static library with all drivers built-in
ben
parents:
diff changeset
151 VDXDriver *drv;
77def5093daf switch to new internal vidix API, no more dlopen/dlsym, libvidix is now a fully static library with all drivers built-in
ben
parents:
diff changeset
152
22878
e0749444591f segfaults if name is NULL
ben
parents: 22873
diff changeset
153 if (name && !strcmp (name, "help"))
22873
030428ba5bb3 allow passing :help to -vo [cx]vidix to get list of all compiled in vidix drivers
ben
parents: 22858
diff changeset
154 {
030428ba5bb3 allow passing :help to -vo [cx]vidix to get list of all compiled in vidix drivers
ben
parents: 22858
diff changeset
155 vidix_list_drivers ();
030428ba5bb3 allow passing :help to -vo [cx]vidix to get list of all compiled in vidix drivers
ben
parents: 22858
diff changeset
156 ctx->drv = NULL;
030428ba5bb3 allow passing :help to -vo [cx]vidix to get list of all compiled in vidix drivers
ben
parents: 22858
diff changeset
157 return 0;
030428ba5bb3 allow passing :help to -vo [cx]vidix to get list of all compiled in vidix drivers
ben
parents: 22858
diff changeset
158 }
030428ba5bb3 allow passing :help to -vo [cx]vidix to get list of all compiled in vidix drivers
ben
parents: 22858
diff changeset
159
22857
77def5093daf switch to new internal vidix API, no more dlopen/dlsym, libvidix is now a fully static library with all drivers built-in
ben
parents:
diff changeset
160 drv = first_driver;
77def5093daf switch to new internal vidix API, no more dlopen/dlsym, libvidix is now a fully static library with all drivers built-in
ben
parents:
diff changeset
161 while (drv)
77def5093daf switch to new internal vidix API, no more dlopen/dlsym, libvidix is now a fully static library with all drivers built-in
ben
parents:
diff changeset
162 {
77def5093daf switch to new internal vidix API, no more dlopen/dlsym, libvidix is now a fully static library with all drivers built-in
ben
parents:
diff changeset
163 if (name) /* forced driver */
77def5093daf switch to new internal vidix API, no more dlopen/dlsym, libvidix is now a fully static library with all drivers built-in
ben
parents:
diff changeset
164 {
77def5093daf switch to new internal vidix API, no more dlopen/dlsym, libvidix is now a fully static library with all drivers built-in
ben
parents:
diff changeset
165 if (!strcmp (drv->name, name))
77def5093daf switch to new internal vidix API, no more dlopen/dlsym, libvidix is now a fully static library with all drivers built-in
ben
parents:
diff changeset
166 {
77def5093daf switch to new internal vidix API, no more dlopen/dlsym, libvidix is now a fully static library with all drivers built-in
ben
parents:
diff changeset
167 if (vidix_probe_driver (ctx, drv, cap, verbose))
77def5093daf switch to new internal vidix API, no more dlopen/dlsym, libvidix is now a fully static library with all drivers built-in
ben
parents:
diff changeset
168 return 1;
77def5093daf switch to new internal vidix API, no more dlopen/dlsym, libvidix is now a fully static library with all drivers built-in
ben
parents:
diff changeset
169 else
77def5093daf switch to new internal vidix API, no more dlopen/dlsym, libvidix is now a fully static library with all drivers built-in
ben
parents:
diff changeset
170 {
77def5093daf switch to new internal vidix API, no more dlopen/dlsym, libvidix is now a fully static library with all drivers built-in
ben
parents:
diff changeset
171 ctx->drv = NULL;
77def5093daf switch to new internal vidix API, no more dlopen/dlsym, libvidix is now a fully static library with all drivers built-in
ben
parents:
diff changeset
172 return 0;
77def5093daf switch to new internal vidix API, no more dlopen/dlsym, libvidix is now a fully static library with all drivers built-in
ben
parents:
diff changeset
173 }
77def5093daf switch to new internal vidix API, no more dlopen/dlsym, libvidix is now a fully static library with all drivers built-in
ben
parents:
diff changeset
174 }
77def5093daf switch to new internal vidix API, no more dlopen/dlsym, libvidix is now a fully static library with all drivers built-in
ben
parents:
diff changeset
175 }
77def5093daf switch to new internal vidix API, no more dlopen/dlsym, libvidix is now a fully static library with all drivers built-in
ben
parents:
diff changeset
176 else /* auto-probe */
77def5093daf switch to new internal vidix API, no more dlopen/dlsym, libvidix is now a fully static library with all drivers built-in
ben
parents:
diff changeset
177 {
77def5093daf switch to new internal vidix API, no more dlopen/dlsym, libvidix is now a fully static library with all drivers built-in
ben
parents:
diff changeset
178 if (vidix_probe_driver (ctx, drv, cap, verbose))
77def5093daf switch to new internal vidix API, no more dlopen/dlsym, libvidix is now a fully static library with all drivers built-in
ben
parents:
diff changeset
179 return 1;
77def5093daf switch to new internal vidix API, no more dlopen/dlsym, libvidix is now a fully static library with all drivers built-in
ben
parents:
diff changeset
180 }
77def5093daf switch to new internal vidix API, no more dlopen/dlsym, libvidix is now a fully static library with all drivers built-in
ben
parents:
diff changeset
181 drv = drv->next;
77def5093daf switch to new internal vidix API, no more dlopen/dlsym, libvidix is now a fully static library with all drivers built-in
ben
parents:
diff changeset
182 }
77def5093daf switch to new internal vidix API, no more dlopen/dlsym, libvidix is now a fully static library with all drivers built-in
ben
parents:
diff changeset
183
77def5093daf switch to new internal vidix API, no more dlopen/dlsym, libvidix is now a fully static library with all drivers built-in
ben
parents:
diff changeset
184 if (verbose)
77def5093daf switch to new internal vidix API, no more dlopen/dlsym, libvidix is now a fully static library with all drivers built-in
ben
parents:
diff changeset
185 printf ("vidixlib: No suitable driver can be found.\n");
77def5093daf switch to new internal vidix API, no more dlopen/dlsym, libvidix is now a fully static library with all drivers built-in
ben
parents:
diff changeset
186 ctx->drv = NULL;
77def5093daf switch to new internal vidix API, no more dlopen/dlsym, libvidix is now a fully static library with all drivers built-in
ben
parents:
diff changeset
187 return 0;
77def5093daf switch to new internal vidix API, no more dlopen/dlsym, libvidix is now a fully static library with all drivers built-in
ben
parents:
diff changeset
188 }