/* Work around a MythTV oddity: if you're in the UK, you need to be able to set * the TV standard to PAL-I in order to get audio to work, but MythTV only lets * you pick plain PAL. This is a preloadable library that'll rewrite PAL to * PAL-I in the appropriate ioctl. * * Compile this with: * gcc -shared -o palifier.so palifier.c -ldl * And add this to the top of /etc/init.d/mythtv-backend (or equivalent): * export LD_PRELOAD=/wherever/palifier.so * * Adam Sampson */ #include #define __USE_GNU #include #include #include int ioctl(int d, unsigned long int request, void *arg) { static int (*real)(int d, unsigned long int request, void *arg) = NULL; if (real == NULL) real = dlsym(RTLD_NEXT, "ioctl"); if (request == VIDIOC_S_STD) { unsigned long long int *std = arg; /* This matches any of the PAL standards. */ if (*std & 0xFFF) { *std = V4L2_STD_PAL_I; fprintf(stderr, "palifier: rewrote PAL* to PAL_I\n"); } } return real(d, request, arg); }