23 #include <asm/string.h>
24 #include <linux/slab.h>
53 (V4L2_STD_ATSC_8_VSB| \
66 #define TSTD_B (V4L2_STD_PAL_B|V4L2_STD_SECAM_B)
67 #define TSTD_B1 (V4L2_STD_PAL_B1)
68 #define TSTD_D (V4L2_STD_PAL_D|V4L2_STD_SECAM_D)
69 #define TSTD_D1 (V4L2_STD_PAL_D1)
70 #define TSTD_G (V4L2_STD_PAL_G|V4L2_STD_SECAM_G)
71 #define TSTD_H (V4L2_STD_PAL_H|V4L2_STD_SECAM_H)
72 #define TSTD_I (V4L2_STD_PAL_I)
73 #define TSTD_K (V4L2_STD_PAL_K|V4L2_STD_SECAM_K)
74 #define TSTD_K1 (V4L2_STD_SECAM_K1)
75 #define TSTD_L (V4L2_STD_SECAM_L)
76 #define TSTD_M (V4L2_STD_PAL_M|V4L2_STD_NTSC_M)
77 #define TSTD_N (V4L2_STD_PAL_N)
78 #define TSTD_Nc (V4L2_STD_PAL_Nc)
79 #define TSTD_60 (V4L2_STD_PAL_60)
81 #define CSTD_ALL (CSTD_PAL|CSTD_NTSC|CSTD_ATSC|CSTD_SECAM)
84 static const struct std_name std_groups[] = {
92 static const struct std_name std_items[] = {
119 unsigned int arrSize,
121 unsigned int bufSize)
125 for (idx = 0; idx < arrSize; idx++) {
135 unsigned int bufSize)
148 while ((cnt < bufSize) && (bufPtr[cnt] !=
'-')) cnt++;
149 if (cnt >= bufSize)
return 0;
150 sp = find_std_name(std_groups,
ARRAY_SIZE(std_groups),
161 while (cnt < bufSize) {
167 if (ch ==
'/')
break;
170 sp = find_std_name(std_items,
ARRAY_SIZE(std_items),
176 if (cnt < bufSize) cnt++;
181 if (idPtr) *idPtr =
id;
189 unsigned int idx1,idx2;
195 for (idx1 = 0; idx1 <
ARRAY_SIZE(std_groups); idx1++) {
196 gp = std_groups + idx1;
198 for (idx2 = 0; idx2 <
ARRAY_SIZE(std_items); idx2++) {
199 ip = std_items + idx2;
200 if (!(gp->
id & ip->
id &
id))
continue;
248 .reserved = {0,0,0,0}
259 .reserved = {0,0,0,0}
268 .reserved = {0,0,0,0}
277 .reserved = {0,0,0,0}
284 for (idx = 0; idx <
ARRAY_SIZE(generic_standards); idx++) {
285 if (generic_standards[idx].
id &
id) {
286 return generic_standards +
idx;
297 template = match_std(
id);
298 if (!
template)
return 0;
300 memcpy(std,
template,
sizeof(*
template));
322 unsigned int std_cnt = 0;
323 unsigned int idx,bcnt,idx2;
331 PVR2_TRACE_STD,
"Mapping standards mask=0x%x (%.*s)",
338 for (idmsk = 1, cmsk =
id; cmsk; idmsk <<= 1) {
339 if (!(idmsk & cmsk))
continue;
341 if (match_std(idmsk)) {
348 for (idx2 = 0; idx2 <
ARRAY_SIZE(std_mixes); idx2++) {
349 if ((
id & std_mixes[idx2]) == std_mixes[idx2]) std_cnt++;
361 " Failed to classify the following standard(s): %.*s",
365 pvr2_trace(PVR2_TRACE_STD,
"Setting up %u unique standard(s)",
367 if (!std_cnt)
return NULL;
374 for (idx = 0; idx < std_cnt; idx++)
375 stddefs[idx].
index = idx;
380 for (idx2 = 0; (idx2 <
ARRAY_SIZE(std_mixes)) && (idx < std_cnt);
382 if (!(
id & std_mixes[idx2]))
continue;
383 if (pvr2_std_fill(stddefs+idx,std_mixes[idx2])) idx++;
386 for (idmsk = 1, cmsk =
id; cmsk && (idx < std_cnt); idmsk <<= 1) {
387 if (!(idmsk & cmsk))
continue;
389 if (!pvr2_std_fill(stddefs+idx,idmsk))
continue;