annotate vidix/drivers.c @ 37091:ec312b34e302

Fix segmentation fault. This would occur when there is no audio. (This should have been part of r37186 but is missing there.)
author ib
date Wed, 07 May 2014 14:03:40 +0000
parents ddab7b946042
children 3c5c93a30fb7
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"
30550
ddab7b946042 VIDIX: #include drivers.h in drivers.c.
diego
parents: 29263
diff changeset
29 #include "drivers.h"
22905
f34e5d778267 consistent include paths for config.h et al.
diego
parents: 22902
diff changeset
30 #include "libavutil/common.h"
f34e5d778267 consistent include paths for config.h et al.
diego
parents: 22902
diff changeset
31 #include "mpbswap.h"
22973
46597c69d843 added conditional vidix drivers compilation
ben
parents: 22905
diff changeset
32 #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
33
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 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
35
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
36 extern VDXDriver cyberblade_drv;
23275
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents: 23046
diff changeset
37 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
38 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
39 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
40 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
41 extern VDXDriver nvidia_drv;
22974
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents: 22973
diff changeset
42 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
43 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
44 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
45 extern VDXDriver rage128_drv;
26096
e6a565ec1a3b New S3 VIDIX driver.
ben
parents: 23275
diff changeset
46 extern VDXDriver s3_drv;
27420
917c93c652b0 Add VIDIX driver for SuperH Mobile VEU hardware block.
ben
parents: 27079
diff changeset
47 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
48 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
49 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
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 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
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 VDXDriver **d;
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 27420
diff changeset
54
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
55 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
56 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
57 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
58 *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
59 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
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
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 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
63 {
22973
46597c69d843 added conditional vidix drivers compilation
ben
parents: 22905
diff changeset
64 #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
65 vidix_register_driver (&cyberblade_drv);
22973
46597c69d843 added conditional vidix drivers compilation
ben
parents: 22905
diff changeset
66 #endif
23275
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents: 23046
diff changeset
67 #ifdef CONFIG_VIDIX_DRV_IVTV
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents: 23046
diff changeset
68 vidix_register_driver (&ivtv_drv);
17fcd644f32e new VIDIX driver for IVTV cards, original patch by Lutz Koschorreck
ben
parents: 23046
diff changeset
69 #endif
22973
46597c69d843 added conditional vidix drivers compilation
ben
parents: 22905
diff changeset
70 #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
71 vidix_register_driver (&mach64_drv);
22973
46597c69d843 added conditional vidix drivers compilation
ben
parents: 22905
diff changeset
72 #endif
46597c69d843 added conditional vidix drivers compilation
ben
parents: 22905
diff changeset
73 #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
74 vidix_register_driver (&mga_drv);
22973
46597c69d843 added conditional vidix drivers compilation
ben
parents: 22905
diff changeset
75 #endif
46597c69d843 added conditional vidix drivers compilation
ben
parents: 22905
diff changeset
76 #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
77 vidix_register_driver (&mga_crtc2_drv);
22973
46597c69d843 added conditional vidix drivers compilation
ben
parents: 22905
diff changeset
78 #endif
46597c69d843 added conditional vidix drivers compilation
ben
parents: 22905
diff changeset
79 #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
80 vidix_register_driver (&nvidia_drv);
22973
46597c69d843 added conditional vidix drivers compilation
ben
parents: 22905
diff changeset
81 #endif
22974
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents: 22973
diff changeset
82 #ifdef CONFIG_VIDIX_DRV_PM2
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents: 22973
diff changeset
83 vidix_register_driver (&pm2_drv);
30341a2c2179 added vidix driver for Permedia2 cards from upstream vidix
ben
parents: 22973
diff changeset
84 #endif
22973
46597c69d843 added conditional vidix drivers compilation
ben
parents: 22905
diff changeset
85 #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
86 vidix_register_driver (&pm3_drv);
22973
46597c69d843 added conditional vidix drivers compilation
ben
parents: 22905
diff changeset
87 #endif
46597c69d843 added conditional vidix drivers compilation
ben
parents: 22905
diff changeset
88 #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
89 vidix_register_driver (&radeon_drv);
22973
46597c69d843 added conditional vidix drivers compilation
ben
parents: 22905
diff changeset
90 #endif
46597c69d843 added conditional vidix drivers compilation
ben
parents: 22905
diff changeset
91 #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
92 vidix_register_driver (&rage128_drv);
22973
46597c69d843 added conditional vidix drivers compilation
ben
parents: 22905
diff changeset
93 #endif
26096
e6a565ec1a3b New S3 VIDIX driver.
ben
parents: 23275
diff changeset
94 #ifdef CONFIG_VIDIX_DRV_S3
e6a565ec1a3b New S3 VIDIX driver.
ben
parents: 23275
diff changeset
95 vidix_register_driver (&s3_drv);
22973
46597c69d843 added conditional vidix drivers compilation
ben
parents: 22905
diff changeset
96 #endif
27420
917c93c652b0 Add VIDIX driver for SuperH Mobile VEU hardware block.
ben
parents: 27079
diff changeset
97 #ifdef CONFIG_VIDIX_DRV_SH_VEU
917c93c652b0 Add VIDIX driver for SuperH Mobile VEU hardware block.
ben
parents: 27079
diff changeset
98 vidix_register_driver (&sh_veu_drv);
917c93c652b0 Add VIDIX driver for SuperH Mobile VEU hardware block.
ben
parents: 27079
diff changeset
99 #endif
22973
46597c69d843 added conditional vidix drivers compilation
ben
parents: 22905
diff changeset
100 #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
101 vidix_register_driver (&sis_drv);
22973
46597c69d843 added conditional vidix drivers compilation
ben
parents: 22905
diff changeset
102 #endif
46597c69d843 added conditional vidix drivers compilation
ben
parents: 22905
diff changeset
103 #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
104 vidix_register_driver (&unichrome_drv);
22973
46597c69d843 added conditional vidix drivers compilation
ben
parents: 22905
diff changeset
105 #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
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
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 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
109 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
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 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
112
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 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
114 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
115
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 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
117 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
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 (!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
120 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
121
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 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
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 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
125 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
126 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 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
128 }
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 27420
diff changeset
129
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
130 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
131 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
132
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 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
134 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
135 }
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
136
22873
030428ba5bb3 allow passing :help to -vo [cx]vidix to get list of all compiled in vidix drivers
ben
parents: 22858
diff changeset
137 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
138 {
030428ba5bb3 allow passing :help to -vo [cx]vidix to get list of all compiled in vidix drivers
ben
parents: 22858
diff changeset
139 VDXDriver *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 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
142
030428ba5bb3 allow passing :help to -vo [cx]vidix to get list of all compiled in vidix drivers
ben
parents: 22858
diff changeset
143 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
144 while (drv)
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 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
147 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
148 printf (" * %s - %s\n", drv->name, cap.name);
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 27420
diff changeset
149 drv = drv->next;
22873
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 }
030428ba5bb3 allow passing :help to -vo [cx]vidix to get list of all compiled in vidix drivers
ben
parents: 22858
diff changeset
152
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
153 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
154 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
155 {
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 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
157
22878
e0749444591f segfaults if name is NULL
ben
parents: 22873
diff changeset
158 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
159 {
030428ba5bb3 allow passing :help to -vo [cx]vidix to get list of all compiled in vidix drivers
ben
parents: 22858
diff changeset
160 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
161 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
162 return 0;
030428ba5bb3 allow passing :help to -vo [cx]vidix to get list of all compiled in vidix drivers
ben
parents: 22858
diff changeset
163 }
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 27420
diff changeset
164
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
165 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
166 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
167 {
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 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
169 {
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 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
171 {
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 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
173 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
174 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
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 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
177 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
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 }
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 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
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 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
184 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
185 }
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 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
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
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 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
190 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
191 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
192 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
193 }