[mythtv-users] Re: Commercial Flagging, what are the best

Boleslaw Ciesielski bolek-mythtv at curl.com
Wed Dec 21 15:52:55 EST 2005


Kevin Kuphal wrote:
> In looking further, recent SVN changes have the skeleton for XDS parsing 
> but nothing is done with the data.  My PVR-150 is putting data into 
> /dev/vbi so I think my backend is set up for capturing.  This may be my 
> Christmas project to see if I can properly decode the XDS V-chip 
> information at least in debugging output to see what it says.

The following patch against the vbi utility (from ivtv) will let you do 
some quick testing outside of myth.

Bolek

Index: test/vbi.c
===================================================================
--- test/vbi.c  (revision 2757)
+++ test/vbi.c  (working copy)
@@ -112,16 +112,52 @@

  static void decode_xds(struct v4l2_sliced_vbi_data *s)
  {
-       char c;
+       char c, c1, c2;
+        static int vchip = 0;

         //printf("XDS: %02x %02x: ", s->data[0], s->data[1]);
-       c = odd_parity(s->data[0]) ? s->data[0] & 0x7F : '?';
-       c = printable(c);
+       c1 = odd_parity(s->data[0]) ? s->data[0] & 0x7F : '?';
+       c = printable(c1);
         //putchar(c);
-       c = odd_parity(s->data[1]) ? s->data[1] & 0x7F : '?';
-       c = printable(c);
+       c2 = odd_parity(s->data[1]) ? s->data[1] & 0x7F : '?';
+       c = printable(c2);
         //putchar(c);
         //putchar('\n');
+
+        if (c1 == 0x01 && c2 == 0x05) {
+          vchip = 1;
+        } else if (vchip) {
+          char rating[32] = "";
+          if ((c1 & 0x5F) == 0x48) {
+            switch (c2 & 0x07) {
+            case 0x01:
+              strcat(rating, "TV-Y");
+              break;
+            case 0x02:
+              strcat(rating, "TV-Y7");
+              break;
+            case 0x03:
+              strcat(rating, "TV-G");
+              break;
+            case 0x04:
+              strcat(rating, "TV-PG");
+              break;
+            case 0x05:
+              strcat(rating, "TV-14");
+              break;
+            case 0x06:
+              strcat(rating, "TV-MA");
+              break;
+            }
+            if ((c1 & 0x20) || (c2 & 0x38)) strcat(rating, "-");
+            if (c1 & 0x20) strcat(rating, "D");
+            if (c2 & 0x08) strcat(rating, "L");
+            if (c2 & 0x10) strcat(rating, "S");
+            if (c2 & 0x20) strcat(rating, "V");
+          }
+          printf("\nVCHIP: %02x %02x %s\n", c1, c2, rating);
+          vchip = 0;
+        }
  }

  #define CC_SIZE 64


More information about the mythtv-users mailing list