[xiph-commits] r3619 - liboggz/trunk/src/tools/oggz-chop

conrad at svn.annodex.net conrad at svn.annodex.net
Sun Jun 29 07:08:30 PDT 2008


Author: conrad
Date: 2008-06-29 07:08:30 -0700 (Sun, 29 Jun 2008)
New Revision: 3619

Modified:
   liboggz/trunk/src/tools/oggz-chop/oggz-chop.c
   liboggz/trunk/src/tools/oggz-chop/oggz-chop.h
Log:
oggz-chop: simplify states, cleanup


Modified: liboggz/trunk/src/tools/oggz-chop/oggz-chop.c
===================================================================
--- liboggz/trunk/src/tools/oggz-chop/oggz-chop.c	2008-06-29 13:51:55 UTC (rev 3618)
+++ liboggz/trunk/src/tools/oggz-chop/oggz-chop.c	2008-06-29 14:08:30 UTC (rev 3619)
@@ -65,8 +65,6 @@
 
   int headers_remaining;
 
-  int rec_skeleton;
-
   /* Greatest previously inferred keyframe value */
   ogg_int64_t prev_keyframe;
 
@@ -432,7 +430,7 @@
   ogg_page * og, * min_og;
   double min_time;
 
-  if (state->status >= OC_WRITTEN_ACCUM) return -1;
+  if (state->status >= OC_GLUE_DONE) return -1;
 
   /*
    * We create a table of candidate tracks, which are all those which
@@ -501,7 +499,7 @@
 
   oggz_table_delete (candidates);
 
-  state->status = OC_WRITTEN_ACCUM;
+  state->status = OC_GLUE_DONE;
  
   return 0;
 }
@@ -517,7 +515,7 @@
   long serialno;
   OCTrackState * ts;
 
-  if (state->status < OC_WRITTEN_ACCUM) {
+  if (state->status < OC_GLUE_DONE) {
     /* Write in fisbones */
     fisbones_write (state);
 
@@ -532,7 +530,7 @@
     }
   }
 
-  state->status = OC_WRITTEN_ACCUM;
+  state->status = OC_GLUE_DONE;
 
   return 0;
 }
@@ -566,17 +564,10 @@
   } else if (page_time >= state->start &&
       (state->end == -1 || page_time <= state->end)) {
 
-    if (state->status < OC_WRITTEN_ACCUM) {
+    if (state->status < OC_GLUE_DONE) {
       chop_glue (state, oggz);
     }
 
-    if (!ts->rec_skeleton) {
-#ifdef DEBUG
-      printf ("read_plain: start granule for serialno %010ld: %ld\n",
-              serialno, ts->fisbone.start_granule);
-#endif
-      ts->rec_skeleton = 1;
-    }
     fwrite_ogg_page (state->outfile, og);
   } else if (state->end != -1.0 && page_time > state->end) {
     /* This is the first page past the end time; set EOS */
@@ -615,14 +606,6 @@
     /* Glue in fisbones, write out accumulated pages */
     chop_glue (state, oggz);
 
-    if (!ts->rec_skeleton) {
-#ifdef DEBUG
-      printf ("read_gs: start granule for serialno %010ld: %ld\n",
-              serialno, ts->fisbone.start_granule);
-#endif
-      ts->rec_skeleton = 1;
-    }
-
     /* Switch to the plain page reader */
     oggz_set_read_page (oggz, serialno, read_plain, state);
     return read_plain (oggz, og, serialno, user_data);
@@ -721,7 +704,7 @@
     /* Write the Skeleton BOS page out */
     if (state->status == OC_INIT) {
       fishead_write (state);
-      state->status = OC_HEADERS;
+      state->status = OC_GLUING;
     }
 
     oggz_set_read_page (oggz, serialno, read_headers, state);

Modified: liboggz/trunk/src/tools/oggz-chop/oggz-chop.h
===================================================================
--- liboggz/trunk/src/tools/oggz-chop/oggz-chop.h	2008-06-29 13:51:55 UTC (rev 3618)
+++ liboggz/trunk/src/tools/oggz-chop/oggz-chop.h	2008-06-29 14:08:30 UTC (rev 3619)
@@ -42,10 +42,8 @@
 
 typedef enum {
   OC_INIT = 0, /* Done nothing yet */
-  OC_HEADERS,  /* Done Skeleton BOS, copying media headers */
-  OC_SKIP,     /* Skipping pages before start */
-  OC_WRITTEN_ACCUM, /* Written accum pages */
-  OC_BLAT      /* Copying pages after start */
+  OC_GLUING,  /* Done Skeleton BOS, copying media headers */
+  OC_GLUE_DONE /* Written accum pages, copy remaining data to end */
 } OCStatus;
 
 typedef struct _OCState {



More information about the commits mailing list