Commit 6a617402 authored by conrad's avatar conrad

improved debugging for oggz_read_input (EMPTY) and EMPTY packet queue in oggz_write

git-svn-id: http://svn.annodex.net/liboggz/trunk@541 8158c8cd-e7e1-0310-9fa4-c5954c97daef
parent aeda948e
......@@ -454,7 +454,13 @@ oggz_read_input (OGGZ * oggz, unsigned char * buf, long n)
/* Don't return 0 unless it's actually an EOF condition */
if (nread == 0) {
switch (cb_ret) {
case OGGZ_CONTINUE: /*case OGGZ_READ_EMPTY:*/ return 0; break;
case OGGZ_CONTINUE: return 0; break;
case OGGZ_READ_EMPTY:
#ifdef DEBUG
printf ("oggz_read_input: OUT EMPTY\n");
#endif
return OGGZ_ERR_READ_STOP_OK;
break;
case OGGZ_STOP_ERR: return OGGZ_ERR_READ_STOP_ERR; break;
case OGGZ_STOP_OK: default: return OGGZ_ERR_READ_STOP_OK; break;
}
......
......@@ -502,6 +502,14 @@ oggz_page_writeout (OGGZ * oggz, long n)
b = MIN (n, og->header_len + og->body_len - writer->page_offset);
if (b > 0) {
#ifdef DEBUG
{
unsigned char * c = &og->body[writer->page_offset - og->header_len];
printf ("oggz_page_writeout [%d] (@%ld): %c%c%c%c ...\n",
ogg_page_serialno (og), (long) ogg_page_granulepos (og),
c[0], c[1], c[2], c[3]);
}
#endif
#ifdef OGGZ_WRITE_DIRECT
nwritten = write (fd,
og->body + (writer->page_offset - og->header_len), b);
......@@ -529,11 +537,19 @@ oggz_dequeue_packet (OGGZ * oggz)
oggz_writer_packet_t * next_zpacket;
if (writer->next_zpacket != NULL) {
#ifdef DEBUG
printf ("oggz_dequeue_packet: queue EMPTY\n");
#endif
next_zpacket = writer->next_zpacket;
writer->next_zpacket = NULL;
} else {
next_zpacket = oggz_vector_pop (writer->packet_queue);
#ifdef DEBUG
printf ("oggz_dequeue_packet: dequeued packet, queue size %d\n",
oggz_vector_size (writer->packet_queue));
#endif
if (next_zpacket == NULL) {
if (writer->hungry) {
writer->hungry (oggz, 1, writer->hungry_user_data);
......
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