]> mj.ucw.cz Git - vcut.git/commitdiff
Fixed a cupola bugs.
authormj <mj>
Mon, 19 Dec 2005 00:42:54 +0000 (00:42 +0000)
committermj <mj>
Mon, 19 Dec 2005 00:42:54 +0000 (00:42 +0000)
vorbiscut.c

index f4ad4b5f72dfd58a639ce3f1c728fd50353b4c6f..9fa51e53f45c19060dc0a2d925f34d5fc02c82fc 100644 (file)
@@ -151,6 +151,8 @@ static void scan_streams(void)
 
       total_samples += samples;
     }
+  if (ov_pcm_total(&vf, -1) != total_samples)
+    die("ov_pcm_total mismatch");
 
   if (start_pos < 0)
     {
@@ -233,7 +235,12 @@ static int in_read(s16 *buf, s64 pos, int nsamp)
   if (inmode == IN_OGG)
     {
       if (ov_pcm_tell(&vf) != pos)
-       printf("!!! CONFUSED POSITION\n");
+       {
+         printf("!!! CONFUSED POSITION\n");
+         ov_pcm_seek(&vf, pos);
+         if (ov_pcm_tell(&vf) != pos)
+           printf(">>> unable to correct :(\n");
+       }
       for (;;)
        {
          int bp;
@@ -244,6 +251,8 @@ static int in_read(s16 *buf, s64 pos, int nsamp)
            printf("!!! BAD LINK\n");
          else if (e % 4)
            die("ov_read returned %d bytes, which means non-integer number of samples. Huh.", e);
+         else if (e < 0)
+           die("ov_read returned %d. Huh!", e);
          else if (e/4 <= nsamp)
            return e/4;
          else
@@ -391,8 +400,8 @@ static void editor(void)
     M_POST,
   } mode = M_START;
   int silence = 0;
-  int step = rate;
-  double fst = 1;
+  int step = rate*4;
+  double fst = 4;
   double fsil = 1;
   int lback = 3*rate;
   for(;;)
@@ -504,6 +513,7 @@ static void editor(void)
          break;
        case 0x3027e:   // Delete
          mode = M_END;
+         go = end_pos - lback;
          break;
        case '[':
          mode = M_PRE;
@@ -575,8 +585,8 @@ static void editor(void)
       else
        {
          nsamp = sizeof(buf)/4;
-         if (pos + nsamp > end_pos)
-           nsamp = end_pos - pos;
+         if (pos + nsamp > pos)
+           nsamp = end - pos;
          nsamp = cooked_read(buf, pos, nsamp, (mode == M_PRE), (mode == M_POST));
          nread = nsamp;
        }