[xiph-commits] r3236 - in liboggz/trunk/src: liboggz tools
shans at svn.annodex.net
shans at svn.annodex.net
Tue Sep 11 18:00:43 PDT 2007
Author: shans
Date: 2007-09-11 18:00:42 -0700 (Tue, 11 Sep 2007)
New Revision: 3236
Modified:
liboggz/trunk/src/liboggz/oggz_auto.c
liboggz/trunk/src/tools/oggzdump.c
Log:
Always calculate granulepos value, even if one is available in bitstream. These get reported via different mechanisms so the library user can decide which to trust.
Modifications to oggzdump to indicate which granulepos values are virtual (i.e. calculated) and which granulepos values are different to those stored in the bitstream.
Modified: liboggz/trunk/src/liboggz/oggz_auto.c
===================================================================
--- liboggz/trunk/src/liboggz/oggz_auto.c 2007-09-12 00:54:27 UTC (rev 3235)
+++ liboggz/trunk/src/liboggz/oggz_auto.c 2007-09-12 01:00:42 UTC (rev 3236)
@@ -693,15 +693,16 @@
*/
int mode;
int size;
- int result;
+ ogg_int64_t result;
mode = (op->packet[0] >> 1) & ((1 << info->log2_num_modes) - 1);
size = info->mode_sizes[mode];
/*
- * if we have a working granulepos, we use it.
+ * if we have a working granulepos, we use it, but only if we can't
+ * calculate a valid gp value.
*/
- if (now > -1) {
+ if (now > -1 && stream->last_granulepos == -1) {
info->encountered_first_data_packet = 1;
info->last_was_long = size;
return now;
Modified: liboggz/trunk/src/tools/oggzdump.c
===================================================================
--- liboggz/trunk/src/tools/oggzdump.c 2007-09-12 00:54:27 UTC (rev 3235)
+++ liboggz/trunk/src/tools/oggzdump.c 2007-09-12 01:00:42 UTC (rev 3236)
@@ -237,6 +237,7 @@
ODData * oddata = (ODData *) user_data;
ogg_int64_t units;
double time_offset;
+ ogg_int64_t calced_gp = oggz_tell_granulepos (oggz);
if (oddata->hide_offset) {
fprintf (outfile, "oOo");
@@ -257,7 +258,13 @@
if (oddata->hide_granulepos) {
fprintf (outfile, "gGg");
} else {
- ot_fprint_granulepos (outfile, oggz, serialno, op->granulepos);
+ ot_fprint_granulepos (outfile, oggz, serialno, calced_gp);
+ if (op->granulepos == -1) {
+ fprintf (outfile, " (VIRT)");
+ } else if (op->granulepos != calced_gp) {
+ fprintf (outfile, " ERR: file gp ");
+ ot_fprint_granulepos (outfile, oggz, serialno, op->granulepos);
+ }
}
fprintf (outfile, ", packetno %" PRId64,
More information about the commits
mailing list