]> err.no Git - linux-2.6/blobdiff - drivers/media/dvb/ttpci/av7110_av.c
Merge branch 'linus' into core/softlockup
[linux-2.6] / drivers / media / dvb / ttpci / av7110_av.c
index aef6e36d7c5c5e4467182b2660413e4607827554..ec55a968f204cf1195dbb219883055a149b46267 100644 (file)
@@ -965,7 +965,9 @@ static u8 iframe_header[] = { 0x00, 0x00, 0x01, 0xe0, 0x00, 0x00, 0x80, 0x00, 0x
 
 static int play_iframe(struct av7110 *av7110, char __user *buf, unsigned int len, int nonblock)
 {
-       int i, n;
+       unsigned i, n;
+       int progressive = 0;
+       int match = 0;
 
        dprintk(2, "av7110:%p, \n", av7110);
 
@@ -974,6 +976,33 @@ static int play_iframe(struct av7110 *av7110, char __user *buf, unsigned int len
                        return -EBUSY;
        }
 
+       /* search in buf for instances of 00 00 01 b5 1? */
+       for (i = 0; i < len; i++) {
+               unsigned char c;
+               if (get_user(c, buf + i))
+                       return -EFAULT;
+               if (match == 5) {
+                       progressive = c & 0x08;
+                       match = 0;
+               }
+               if (c == 0x00) {
+                       match = (match == 1 || match == 2) ? 2 : 1;
+                       continue;
+               }
+               switch (match++) {
+               case 2: if (c == 0x01)
+                               continue;
+                       break;
+               case 3: if (c == 0xb5)
+                               continue;
+                       break;
+               case 4: if ((c & 0xf0) == 0x10)
+                               continue;
+                       break;
+               }
+               match = 0;
+       }
+
        /* setting n always > 1, fixes problems when playing stillframes
           consisting of I- and P-Frames */
        n = MIN_IFRAME / len + 1;
@@ -985,7 +1014,11 @@ static int play_iframe(struct av7110 *av7110, char __user *buf, unsigned int len
                dvb_play(av7110, buf, len, 0, 1);
 
        av7110_ipack_flush(&av7110->ipack[1]);
-       return 0;
+
+       if (progressive)
+               return vidcom(av7110, AV_VIDEO_CMD_FREEZE, 1);
+       else
+               return 0;
 }