[xiph-commits] r3179 - in libannodex/trunk/src: importers
libannodex tools
shans at svn.annodex.net
shans at svn.annodex.net
Tue Aug 7 22:22:00 PDT 2007
Author: shans
Date: 2007-08-07 22:22:00 -0700 (Tue, 07 Aug 2007)
New Revision: 3179
Modified:
libannodex/trunk/src/importers/anx_import_ogg.c
libannodex/trunk/src/libannodex/anx_write.c
libannodex/trunk/src/tools/anxenc.c
Log:
(1) use liboggz facility to reconstruct granulepos values for packets, so that output annodex files aren't full of pages without granulepos values
(2) stop flushing when a packet with a proper granulepos arrives
(3) an interim fix to anxenc.c so that it doesn't terminate early when
OGGZ_STOP_ERR is returned. Probably need to look at this more closely.
Modified: libannodex/trunk/src/importers/anx_import_ogg.c
===================================================================
--- libannodex/trunk/src/importers/anx_import_ogg.c 2007-08-04 14:22:12 UTC (rev 3178)
+++ libannodex/trunk/src/importers/anx_import_ogg.c 2007-08-08 05:22:00 UTC (rev 3179)
@@ -605,6 +605,8 @@
AnxSource * m = aod->anx_source;
AnxSourceTrack * track = NULL;
anx_int64_t gp = oggz_tell_granulepos(oggz);
+
+ op->granulepos = gp;
#ifdef DEBUG
fprintf (aod->df, "anxogg::read_packet_data IN: %010ld, granulepos %llx\n",
Modified: libannodex/trunk/src/libannodex/anx_write.c
===================================================================
--- libannodex/trunk/src/libannodex/anx_write.c 2007-08-04 14:22:12 UTC (rev 3178)
+++ libannodex/trunk/src/libannodex/anx_write.c 2007-08-08 05:22:00 UTC (rev 3179)
@@ -1029,7 +1029,8 @@
wsub->last_granulepos = granulepos;
}
- if (granulepos >= 0) flush |= OGGZ_FLUSH_AFTER;
+ /* SGS */
+ //if (granulepos >= 0) flush |= OGGZ_FLUSH_AFTER;
return anx_packet_init (annodex, writer->media_buf, input_n,
writer->media_serialno,
Modified: libannodex/trunk/src/tools/anxenc.c
===================================================================
--- libannodex/trunk/src/tools/anxenc.c 2007-08-04 14:22:12 UTC (rev 3178)
+++ libannodex/trunk/src/tools/anxenc.c 2007-08-08 05:22:00 UTC (rev 3179)
@@ -43,6 +43,8 @@
#include <annodex/annodex.h>
+#include <oggz/oggz_constants.h>
+
#include "common.h"
/* #define DEBUG */
@@ -167,28 +169,29 @@
while (n > 0) {
n = anx_write_output (anx, buf, 1024);
if (n == -1) {
+ printf("omg like totally -1\n");
anx_exit_err (anx, "Failed anx_writer_output");
}
- if (n < 0) {
- break;
- }
-
- if ((n_written = fwrite (buf, 1, (size_t)n, outfile)) < n) {
+ n_written = 0;
+ if (n > 0 && (n_written = fwrite (buf, 1, (size_t)n, outfile)) < n) {
if (ferror(outfile) != 0)
print_debug (2, "Error writing output file\n");
else
print_debug (2, "Error: short write; wrote %ld bytes\n", n_written);
}
+
#ifdef DEBUG
static int position = 0;
printf ("anxenc: writing %d(%d) bytes at %x\n", n, n_written, position);
position += n_written;
#endif
+ if (n == OGGZ_ERR_STOP_ERR) n = 1;
}
+
if (anx_close (anx) != NULL) {
exit_err ("Failed close of annodex %s\n", infilename);
}
More information about the commits
mailing list