diff liboggplayer-src/src/open_close.cpp @ 60:9c63b355c82b

Remove the audio code completely.
author Matti Hamalainen <ccr@tnsp.org>
date Tue, 06 Aug 2013 23:45:05 +0300
parents 083c73ceb716
children
line wrap: on
line diff
--- a/liboggplayer-src/src/open_close.cpp	Tue Aug 06 23:27:37 2013 +0300
+++ b/liboggplayer-src/src/open_close.cpp	Tue Aug 06 23:45:05 2013 +0300
@@ -3,16 +3,6 @@
 	void OggPlayer::Imp::close() {
 		if(!need_close) return;
 
-#ifdef VORBIS_SUPPORT
-		if (vorbis_p) {
-			ogg_stream_clear(&o_vsstate);
-			vorbis_block_clear(&v_block);
-			vorbis_dsp_clear(&v_state);
-		}
-		vorbis_comment_clear(&v_comment);
-		vorbis_info_clear(&v_info);
-#endif
-
 		if (theora_p) {
 			ogg_stream_clear(&o_tsstate);
 			theora_clear(&t_state);
@@ -22,10 +12,6 @@
 
 		ogg_sync_clear(&o_sync);
 		file_in.close();
-		if (audio_buffer){
-			delete[] audio_buffer;
-			audio_buffer = NULL;
-		}
 		need_close = false;
 	}
 	bool OggPlayer::Imp::parse_headers() {
@@ -55,14 +41,6 @@
 					memcpy(&o_tsstate, &test, sizeof(test));
 					theora_p = 1;
 				} 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 
-#endif
 				{
 					/* whatever it is, we don't care about it */
 					ogg_stream_clear(&test);
@@ -72,9 +50,6 @@
 
 		// we're expecting more header packets.
 		while ((theora_p && theora_p < 3)
-#ifdef VORBIS_SUPPORT
-			|| (vorbis_p && vorbis_p < 3)
-#endif
 			) {
 			int ret;
 
@@ -92,24 +67,6 @@
 				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))) {
-				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++;
-				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
 
@@ -139,15 +96,6 @@
 			fprintf(stderr, "DDD: 0\n");
 			return false;
 		}
-#ifdef VORBIS_SUPPORT
-		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;
-		}
-#endif
 		return true;
 	}
 
@@ -170,10 +118,6 @@
 
 		// 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);
 
@@ -193,30 +137,12 @@
 		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;
 		}
 
-#ifdef VORBIS_SUPPORT
-		// 5) init audio conversion
-		int ret = SDL_BuildAudioCVT(&cvt, AUDIO_S16, v_info.channels,
-				v_info.rate, audio_format, channels, rate);
-		if (-1 == ret) {
-			failbit = true;
-			return;
-		}
-#endif
-
-		// play() will allocate memory when needed
-		audio_buffer_size = 0;
-		audio_buffer = NULL;
-
 		switch(video_format){
 		//pixel_format.set(r_offset,g_offset,b_offset,bpp not a_offset);
 		case VF_RGB: