changeset 14:083c73ceb716

Get rid of the vorbis related code.
author Matti Hamalainen <ccr@tnsp.org>
date Mon, 05 Aug 2013 16:54:46 +0300
parents c859c22c1af5
children a354578a41c6
files liboggplayer-src/src/imp.hpp liboggplayer-src/src/open_close.cpp liboggplayer-src/src/play.cpp
diffstat 3 files changed, 28 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/liboggplayer-src/src/imp.hpp	Mon Aug 05 16:47:07 2013 +0300
+++ b/liboggplayer-src/src/imp.hpp	Mon Aug 05 16:54:46 2013 +0300
@@ -1,5 +1,7 @@
 #include <oggplayer.h>
+#ifdef VORBIS_SUPPORT
 #include "SDL_audiocvt.hpp"
+#endif
 #include <fstream>
 #include <vector>
 #include <theora/theora.h>
@@ -72,7 +74,9 @@
 	char* audio_buffer;
 	boost::circular_buffer<char> cirbuf;
 	unsigned int audio_buffer_size;
+#ifdef VORBIS_SUPPORT
 	SDL_AudioCVT cvt;
+#endif
 
 	bool playing;
 
--- a/liboggplayer-src/src/open_close.cpp	Mon Aug 05 16:47:07 2013 +0300
+++ b/liboggplayer-src/src/open_close.cpp	Mon Aug 05 16:54:46 2013 +0300
@@ -3,6 +3,7 @@
 	void OggPlayer::Imp::close() {
 		if(!need_close) return;
 
+#ifdef VORBIS_SUPPORT
 		if (vorbis_p) {
 			ogg_stream_clear(&o_vsstate);
 			vorbis_block_clear(&v_block);
@@ -10,6 +11,7 @@
 		}
 		vorbis_comment_clear(&v_comment);
 		vorbis_info_clear(&v_info);
+#endif
 
 		if (theora_p) {
 			ogg_stream_clear(&o_tsstate);
@@ -52,12 +54,16 @@
 					/* it is theora */
 					memcpy(&o_tsstate, &test, sizeof(test));
 					theora_p = 1;
-				} else if (!vorbis_p && vorbis_synthesis_headerin(&v_info,
+				} else
+#ifdef VORBIS_SUPPORT
+				if (!vorbis_p && vorbis_synthesis_headerin(&v_info,
 						&v_comment, &o_packet) >= 0) {
 					/* it is vorbis */
 					memcpy(&o_vsstate, &test, sizeof(test));
 					vorbis_p = 1;
-				} else {
+				} else 
+#endif
+				{
 					/* whatever it is, we don't care about it */
 					ogg_stream_clear(&test);
 				}
@@ -65,7 +71,11 @@
 		}
 
 		// we're expecting more header packets.
-		while ((theora_p && theora_p < 3) || (vorbis_p && vorbis_p < 3)) {
+		while ((theora_p && theora_p < 3)
+#ifdef VORBIS_SUPPORT
+			|| (vorbis_p && vorbis_p < 3)
+#endif
+			) {
 			int ret;
 
 			// look for further theora headers
@@ -82,6 +92,7 @@
 				theora_p++;
 			}
 
+#ifdef VORBIS_SUPPORT
 			// look for more vorbis header packets
 			while (vorbis_p && (vorbis_p < 3) && (ret = ogg_stream_packetout(
 					&o_vsstate, &o_packet))) {
@@ -97,6 +108,7 @@
 				if (vorbis_p == 3)
 					break;
 			}
+#endif
 
 			// The header pages/packets will arrive before anything else we
 			//   care about, or the stream is not obeying spec
@@ -127,7 +139,7 @@
 			fprintf(stderr, "DDD: 0\n");
 			return false;
 		}
-#if 0
+#ifdef VORBIS_SUPPORT
 		if (vorbis_p) {
 			vorbis_synthesis_init(&v_state, &v_info);
 			vorbis_block_init(&v_state, &v_block);
@@ -158,8 +170,10 @@
 
 		// 2) init some structs
 		ogg_sync_init(&o_sync);
+#ifdef VORBIS_SUPPORT
 		vorbis_info_init(&v_info);
 		vorbis_comment_init(&v_comment);
+#endif
 		theora_info_init(&t_info);
 		theora_comment_init(&t_comment);
 
@@ -179,15 +193,17 @@
 		if (failbit) {
 			theora_info_clear(&t_info);
 			theora_comment_clear(&t_comment);
+#ifdef VORBIS_SUPPORT
 			vorbis_info_clear(&v_info);
 			vorbis_comment_clear(&v_comment);
+#endif
 			ogg_sync_clear(&o_sync);
 			file_in.close();
 			fprintf(stderr, "XXX: done\n");
 			return;
 		}
 
-#if 0
+#ifdef VORBIS_SUPPORT
 		// 5) init audio conversion
 		int ret = SDL_BuildAudioCVT(&cvt, AUDIO_S16, v_info.channels,
 				v_info.rate, audio_format, channels, rate);
--- a/liboggplayer-src/src/play.cpp	Mon Aug 05 16:47:07 2013 +0300
+++ b/liboggplayer-src/src/play.cpp	Mon Aug 05 16:54:46 2013 +0300
@@ -8,6 +8,7 @@
 // for internal use only and should only be called
 // in play()
 bool OggPlayer::Imp::decode_audio() {
+#ifdef VORBIS_SUPPORT
 	int ret;
 	float **pcm;
 	// if there's pending, decoded audio, grab it
@@ -79,7 +80,8 @@
 			return false;
 		}
 	} else { return true; }
-
+#endif
+	return true;
 }
 // similar to decode_audio
 bool OggPlayer::Imp::decode_video() {