Commit 9c6c141f authored by shans's avatar shans

Always calculate granulepos value, even if one is available in bitstream. ...

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.



git-svn-id: http://svn.annodex.net/liboggz/trunk@3236 8158c8cd-e7e1-0310-9fa4-c5954c97daef
parent cf56bdb2
......@@ -693,15 +693,16 @@ auto_calc_vorbis(ogg_int64_t now, oggz_stream_t *stream, ogg_packet *op) {
*/
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;
......
......@@ -237,6 +237,7 @@ read_packet (OGGZ * oggz, ogg_packet * op, long serialno, void * user_data)
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 @@ read_packet (OGGZ * oggz, ogg_packet * op, long serialno, void * user_data)
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,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment