Commit 874cbc3d authored by msmith's avatar msmith

Make oggz-validate do some page-level validation: currently, it just ensures

that a page that ends zero packets (ogg_page_packets() == 0) has the correct
granulepos, -1.



git-svn-id: http://svn.annodex.net/liboggz/trunk@1405 8158c8cd-e7e1-0310-9fa4-c5954c97daef
parent b5d1f042
......@@ -133,6 +133,20 @@ gp_to_time (OGGZ * oggz, long serialno, ogg_int64_t granulepos)
return (timestamp_t)((double)(granule * gr_d) / (double)gr_n);
}
static int
read_page (OGGZ * oggz, const ogg_page * og, long serialno, void * user_data)
{
ogg_int64_t gpos = ogg_page_granulepos((ogg_page *)og);
int ret = 0;
if(gpos != -1 && ogg_page_packets((ogg_page *)og) == 0) {
ret = log_error ();
fprintf (stderr, "serialno %010ld: granulepos %lld on page with no completed packets, must be -1\n", serialno, gpos);
}
return ret;
}
static int
read_packet (OGGZ * oggz, ogg_packet * op, long serialno, void * user_data)
{
......@@ -229,6 +243,7 @@ validate (char * filename)
}
oggz_set_read_callback (reader, -1, read_packet, &ovdata);
oggz_set_read_page (reader, -1, read_page, NULL);
while (active && (n = oggz_read (reader, 1024)) != 0) {
if (nr_errors > MAX_ERRORS) {
......
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