annotate vidix/drivers.c @ 28092:77c7b422a49d

Add support for writing PNG files with alpha channel in -vo png
author reimar
date Wed, 10 Dec 2008 16:44:12 +0000
parents 917c93c652b0
children 0f1b5b68af32
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;
27420
917c93c652b0 Add VIDIX driver for SuperH Mobile VEU hardware block.
ben
parents: 27079
diff changeset
46 extern VDXDriver sh_veu_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
47 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
48 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
49
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 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
51 {
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 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
53
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 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
55 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
56 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
57 *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
58 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
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
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 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
62 {
22973
46597c69d843 added conditional vidix drivers compilation
ben
parents: 22905
diff changeset
63 #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
64 vidix_register_driver (&cyberblade_drv);
22973
46597c69d843 added conditional vidix drivers compilation
ben
parents: 22905
diff changeset
65 #endif
23275
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents: 23046
diff changeset
66 #ifdef CONFIG_VIDIX_DRV_IVTV
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents: 23046
diff changeset
67 vidix_register_driver (&ivtv_drv);
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents: 23046
diff changeset
68 #endif
22973
46597c69d843 added conditional vidix drivers compilation
ben
parents: 22905
diff changeset
69 #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
70 vidix_register_driver (&mach64_drv);
22973
46597c69d843 added conditional vidix drivers compilation
ben
parents: 22905
diff changeset
71 #endif
46597c69d843 added conditional vidix drivers compilation
ben
parents: 22905
diff changeset
72 #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
73 vidix_register_driver (&mga_drv);
22973
46597c69d843 added conditional vidix drivers compilation
ben
parents: 22905
diff changeset
74 #endif
46597c69d843 added conditional vidix drivers compilation
ben
parents: 22905
diff changeset
75 #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
76 vidix_register_driver (&mga_crtc2_drv);
22973
46597c69d843 added conditional vidix drivers compilation
ben
parents: 22905
diff changeset
77 #endif
46597c69d843 added conditional vidix drivers compilation
ben
parents: 22905
diff changeset
78 #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
79 vidix_register_driver (&nvidia_drv);
22973
46597c69d843 added conditional vidix drivers compilation
ben
parents: 22905
diff changeset
80 #endif
22974
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents: 22973
diff changeset
81 #ifdef CONFIG_VIDIX_DRV_PM2
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents: 22973
diff changeset
82 vidix_register_driver (&pm2_drv);
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents: 22973
diff changeset
83 #endif
22973
46597c69d843 added conditional vidix drivers compilation
ben
parents: 22905
diff changeset
84 #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
85 vidix_register_driver (&pm3_drv);
22973
46597c69d843 added conditional vidix drivers compilation
ben
parents: 22905
diff changeset
86 #endif
46597c69d843 added conditional vidix drivers compilation
ben
parents: 22905
diff changeset
87 #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
88 vidix_register_driver (&radeon_drv);
22973
46597c69d843 added conditional vidix drivers compilation
ben
parents: 22905
diff changeset
89 #endif
46597c69d843 added conditional vidix drivers compilation
ben
parents: 22905
diff changeset
90 #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
91 vidix_register_driver (&rage128_drv);
22973
46597c69d843 added conditional vidix drivers compilation
ben
parents: 22905
diff changeset
92 #endif
26096
e6a565ec1a3b New S3 VIDIX driver.
ben
parents: 23275
diff changeset
93 #ifdef CONFIG_VIDIX_DRV_S3
e6a565ec1a3b New S3 VIDIX driver.
ben
parents: 23275
diff changeset
94 vidix_register_driver (&s3_drv);
22973
46597c69d843 added conditional vidix drivers compilation
ben
parents: 22905
diff changeset
95 #endif
27420
917c93c652b0 Add VIDIX driver for SuperH Mobile VEU hardware block.
ben
parents: 27079
diff changeset
96 #ifdef CONFIG_VIDIX_DRV_SH_VEU
917c93c652b0 Add VIDIX driver for SuperH Mobile VEU hardware block.
ben
parents: 27079
diff changeset
97 vidix_register_driver (&sh_veu_drv);
917c93c652b0 Add VIDIX driver for SuperH Mobile VEU hardware block.
ben
parents: 27079
diff changeset
98 #endif
22973
46597c69d843 added conditional vidix drivers compilation
ben
parents: 22905
diff changeset
99 #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
100 vidix_register_driver (&sis_drv);
22973
46597c69d843 added conditional vidix drivers compilation
ben
parents: 22905
diff changeset
101 #endif
46597c69d843 added conditional vidix drivers compilation
ben
parents: 22905
diff changeset
102 #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
103 vidix_register_driver (&unichrome_drv);
22973
46597c69d843 added conditional vidix drivers compilation
ben
parents: 22905
diff changeset
104 #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
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
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 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
108 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
109 {
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 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
111
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 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
113 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
114
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 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
116 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
117
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 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
119 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
120
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 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
122 {
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 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
124 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
125 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
126 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
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
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 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
130 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
131
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
132 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
133 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
134 }
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
135
22873
030428ba5bb3 allow passing :help to -vo [cx]vidix to get list of all compiled in vidix drivers
ben
parents: 22858
diff changeset
136 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
137 {
030428ba5bb3 allow passing :help to -vo [cx]vidix to get list of all compiled in vidix drivers
ben
parents: 22858
diff changeset
138 VDXDriver *drv;
030428ba5bb3 allow passing :help to -vo [cx]vidix to get list of all compiled in vidix drivers
ben
parents: 22858
diff changeset
139
030428ba5bb3 allow passing :help to -vo [cx]vidix to get list of all compiled in vidix drivers
ben
parents: 22858
diff changeset
140 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
141
030428ba5bb3 allow passing :help to -vo [cx]vidix to get list of all compiled in vidix drivers
ben
parents: 22858
diff changeset
142 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
143 while (drv)
030428ba5bb3 allow passing :help to -vo [cx]vidix to get list of all compiled in vidix drivers
ben
parents: 22858
diff changeset
144 {
030428ba5bb3 allow passing :help to -vo [cx]vidix to get list of all compiled in vidix drivers
ben
parents: 22858
diff changeset
145 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
146 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
147 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
148 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
149 }
030428ba5bb3 allow passing :help to -vo [cx]vidix to get list of all compiled in vidix drivers
ben
parents: 22858
diff changeset
150 }
030428ba5bb3 allow passing :help to -vo [cx]vidix to get list of all compiled in vidix drivers
ben
parents: 22858
diff changeset
151
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
152 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
153 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
154 {
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
155 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
156
22878
e0749444591f segfaults if name is NULL
ben
parents: 22873
diff changeset
157 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
158 {
030428ba5bb3 allow passing :help to -vo [cx]vidix to get list of all compiled in vidix drivers
ben
parents: 22858
diff changeset
159 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
160 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
161 return 0;
030428ba5bb3 allow passing :help to -vo [cx]vidix to get list of all compiled in vidix drivers
ben
parents: 22858
diff changeset
162 }
030428ba5bb3 allow passing :help to -vo [cx]vidix to get list of all compiled in vidix drivers
ben
parents: 22858
diff changeset
163
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
164 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
165 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
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 (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
168 {
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 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
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 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
172 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
173 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
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 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
176 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
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 }
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 }
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 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
181 {
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 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
183 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
184 }
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 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
186 }
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
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 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
189 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
190 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
191 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
192 }