/* Mapping of standard bits to color system */ staticconststruct std_name std_groups[] = {
{"PAL",CSTD_PAL},
{"NTSC",CSTD_NTSC},
{"SECAM",CSTD_SECAM},
{"ATSC",CSTD_ATSC},
};
/* Mapping of standard bits to modulation system */ staticconststruct std_name std_items[] = {
{"B",TSTD_B},
{"B1",TSTD_B1},
{"D",TSTD_D},
{"D1",TSTD_D1},
{"G",TSTD_G},
{"H",TSTD_H},
{"I",TSTD_I},
{"K",TSTD_K},
{"K1",TSTD_K1},
{"L",TSTD_L},
{"LC",V4L2_STD_SECAM_LC},
{"M",TSTD_M},
{"Mj",V4L2_STD_NTSC_M_JP},
{"443",V4L2_STD_NTSC_443},
{"Mk",V4L2_STD_NTSC_M_KR},
{"N",TSTD_N},
{"Nc",TSTD_Nc},
{"60",TSTD_60},
{"8VSB",V4L2_STD_ATSC_8_VSB},
{"16VSB",V4L2_STD_ATSC_16_VSB},
};
// Search an array of std_name structures and return a pointer to the // element with the matching name. staticconststruct std_name *find_std_name(conststruct std_name *arrPtr, unsignedint arrSize, constchar *bufPtr, unsignedint bufSize)
{ unsignedint idx; conststruct std_name *p; for (idx = 0; idx < arrSize; idx++) {
p = arrPtr + idx; if (strlen(p->name) != bufSize) continue; if (!memcmp(bufPtr,p->name,bufSize)) return p;
} return NULL;
}
int pvr2_std_str_to_id(v4l2_std_id *idPtr,constchar *bufPtr, unsignedint bufSize)
{
v4l2_std_id id = 0;
v4l2_std_id cmsk = 0;
v4l2_std_id t; int mMode = 0; unsignedint cnt; char ch; conststruct std_name *sp;
while (bufSize) { if (!mMode) {
cnt = 0; while ((cnt < bufSize) && (bufPtr[cnt] != '-')) cnt++; if (cnt >= bufSize) return 0; // No more characters
sp = find_std_name(std_groups, ARRAY_SIZE(std_groups),
bufPtr,cnt); if (!sp) return 0; // Illegal color system name
cnt++;
bufPtr += cnt;
bufSize -= cnt;
mMode = !0;
cmsk = sp->id; continue;
}
cnt = 0; while (cnt < bufSize) {
ch = bufPtr[cnt]; if (ch == ';') {
mMode = 0; break;
} if (ch == '/') break;
cnt++;
}
sp = find_std_name(std_items, ARRAY_SIZE(std_items),
bufPtr,cnt); if (!sp) return 0; // Illegal modulation system ID
t = sp->id & cmsk; if (!t) return 0; // Specific color + modulation system illegal
id |= t; if (cnt < bufSize) cnt++;
bufPtr += cnt;
bufSize -= cnt;
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.