Commit 1676a32f authored by conrad's avatar conrad

use error descriptions in error output rather than just printing codes.

These descriptions paraphrase OGGZ_ERR_* descriptions, in terms of validating
the input file, not in terms of feeding the in-memory writer used for
validation.


git-svn-id: http://svn.annodex.net/liboggz/trunk@1208 8158c8cd-e7e1-0310-9fa4-c5954c97daef
parent 124067d1
...@@ -51,10 +51,10 @@ typedef struct { ...@@ -51,10 +51,10 @@ typedef struct {
} error_text; } error_text;
static error_text errors[] = { static error_text errors[] = {
{5, "Multiple bos packets"}, {-5, "Multiple bos packets"},
{6, "Multiple eos packets"}, {-6, "Multiple eos packets"},
{20, "Packet belongs to unknown serialno"}, {-20, "Packet belongs to unknown serialno"},
{24, "Granulepos out of order within logical bitstream"}, {-24, "Granulepos decreasing within track"},
{0, NULL} {0, NULL}
}; };
...@@ -134,7 +134,7 @@ read_packet (OGGZ * oggz, ogg_packet * op, long serialno, void * user_data) ...@@ -134,7 +134,7 @@ read_packet (OGGZ * oggz, ogg_packet * op, long serialno, void * user_data)
OGGZ * writer = (OGGZ *)user_data; OGGZ * writer = (OGGZ *)user_data;
timestamp_t timestamp; timestamp_t timestamp;
int flush; int flush;
int ret = 0, feed_err = 0; int ret = 0, feed_err = 0, i;
timestamp = gp_to_time (oggz, serialno, op->granulepos); timestamp = gp_to_time (oggz, serialno, op->granulepos);
if (timestamp != -1.0) { if (timestamp != -1.0) {
...@@ -162,9 +162,18 @@ read_packet (OGGZ * oggz, ogg_packet * op, long serialno, void * user_data) ...@@ -162,9 +162,18 @@ read_packet (OGGZ * oggz, ogg_packet * op, long serialno, void * user_data)
} else { } else {
ot_fprint_time (stderr, (double)timestamp/SUBSECONDS); ot_fprint_time (stderr, (double)timestamp/SUBSECONDS);
} }
fprintf (stderr, fprintf (stderr, ": serialno %010ld: ", serialno);
": serialno %010ld: Packet violates Ogg framing constraints: %d\n", for (i = 0; errors[i].error; i++) {
serialno, feed_err); if (errors[i].error == feed_err) {
fprintf (stderr, "%s\n", errors[i].description);
break;
}
}
if (errors[i].error == 0) {
fprintf (stderr,
"Packet violates Ogg framing constraints: %d\n",
feed_err);
}
} }
return ret; return ret;
......
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