changeset 7:26ee741f8c08

Add some primitive debugging in the liboggplayer.
author Matti Hamalainen <ccr@tnsp.org>
date Mon, 05 Aug 2013 14:33:35 +0300
parents 2741d9fe1c71
children 3b6cea0d1980
files liboggplayer-src/src/open_close.cpp
diffstat 1 files changed, 11 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/liboggplayer-src/src/open_close.cpp	Mon Aug 05 14:33:08 2013 +0300
+++ b/liboggplayer-src/src/open_close.cpp	Mon Aug 05 14:33:35 2013 +0300
@@ -72,9 +72,11 @@
 			while (theora_p && (theora_p < 3) && (ret = ogg_stream_packetout(
 					&o_tsstate, &o_packet))) {
 				if (ret < 0) {
+					fprintf(stderr, "X: 0\n");
 					return false;
 				}
 				if (theora_decode_header(&t_info, &t_comment, &o_packet)) {
+					fprintf(stderr, "X: 1\n");
 					return false;
 				}
 				theora_p++;
@@ -84,9 +86,11 @@
 			while (vorbis_p && (vorbis_p < 3) && (ret = ogg_stream_packetout(
 					&o_vsstate, &o_packet))) {
 				if (ret < 0) {
+					fprintf(stderr, "X: 2\n");
 					return false;
 				}
 				if (vorbis_synthesis_headerin(&v_info, &v_comment, &o_packet)) {
+					fprintf(stderr, "X: 3\n");
 					return false;
 				}
 				vorbis_p++;
@@ -101,6 +105,7 @@
 				queue_page(&o_page); /* demux into the appropriate stream */
 			} else {
 				if (!buffer_data()) /* someone needs more data */{
+					fprintf(stderr, "X: 4\n");
 					return false;
 				}
 			}
@@ -119,12 +124,14 @@
 					sizeof(pp_level));
 			pp_inc = 0;
 		} else {
+			fprintf(stderr, "DDD: 0\n");
 			return false;
 		}
 		if (vorbis_p) {
 			vorbis_synthesis_init(&v_state, &v_info);
 			vorbis_block_init(&v_state, &v_block);
 		} else {
+			fprintf(stderr, "DDD: 1\n");
 			return false;
 		}
 		return true;
@@ -142,6 +149,7 @@
 		// 1) open the input file
 		file_in.open(path.c_str(), std::ios::binary);
 		if (file_in.fail()) {
+			fprintf(stderr, "XXX: 0\n");
 			failbit = true;
 			return;
 		}
@@ -155,11 +163,13 @@
 
 		// 3) parse headers
 		if (!failbit && !parse_headers()) {
+			fprintf(stderr, "XXX: 1\n");
 			failbit = true;
 		}
 
 		// 3) init decoders
 		if (!failbit && !init_decoders()) {
+			fprintf(stderr, "XXX: 2\n");
 			failbit = true;
 		}
 
@@ -171,6 +181,7 @@
 			vorbis_comment_clear(&v_comment);
 			ogg_sync_clear(&o_sync);
 			file_in.close();
+			fprintf(stderr, "XXX: done\n");
 			return;
 		}