mpc plugin basically working.
todo: 1) figure out why stop takes so long 2) fix seeking 3) parse tags git-svn-id: https://svn.musicpd.org/mpd/trunk@2923 09075e82-0dd4-0310-85a5-a0d7c8717e4f
This commit is contained in:
		| @@ -132,7 +132,6 @@ int mpc_decode(OutputBuffer * cb, DecoderControl * dc, InputStream * inStream) | |||||||
| 	mpc_uint32_t vbrUpdateBits; | 	mpc_uint32_t vbrUpdateBits; | ||||||
| 	float time; | 	float time; | ||||||
| 	int i; | 	int i; | ||||||
| 	ReplayGainInfo * replayGainInfo; |  | ||||||
|  |  | ||||||
|         data.inStream = inStream; |         data.inStream = inStream; | ||||||
|         data.dc = dc; |         data.dc = dc; | ||||||
| @@ -144,11 +143,8 @@ int mpc_decode(OutputBuffer * cb, DecoderControl * dc, InputStream * inStream) | |||||||
| 	reader.canseek = mpc_canseek_cb; | 	reader.canseek = mpc_canseek_cb; | ||||||
| 	reader.data = &data; | 	reader.data = &data; | ||||||
|  |  | ||||||
| 	DEBUG("HERE 1\n"); |  | ||||||
|  |  | ||||||
| 	mpc_streaminfo_init(&info); | 	mpc_streaminfo_init(&info); | ||||||
| 	 | 	 | ||||||
| 	DEBUG("HERE 2\n"); |  | ||||||
| 	if((ret = mpc_streaminfo_read(&info, &reader)) != ERROR_CODE_OK) { | 	if((ret = mpc_streaminfo_read(&info, &reader)) != ERROR_CODE_OK) { | ||||||
| 		closeInputStream(inStream); | 		closeInputStream(inStream); | ||||||
| 		if(!dc->stop) { | 		if(!dc->stop) { | ||||||
| @@ -163,9 +159,8 @@ int mpc_decode(OutputBuffer * cb, DecoderControl * dc, InputStream * inStream) | |||||||
|                 return 0; |                 return 0; | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	DEBUG("HERE 3\n"); |  | ||||||
| 	mpc_decoder_setup(&decoder, &reader); | 	mpc_decoder_setup(&decoder, &reader); | ||||||
| 	DEBUG("HERE 4\n"); |  | ||||||
| 	if(!mpc_decoder_initialize(&decoder, &info)) { | 	if(!mpc_decoder_initialize(&decoder, &info)) { | ||||||
| 		closeInputStream(inStream); | 		closeInputStream(inStream); | ||||||
| 		if(!dc->stop) { | 		if(!dc->stop) { | ||||||
| @@ -177,16 +172,16 @@ int mpc_decode(OutputBuffer * cb, DecoderControl * dc, InputStream * inStream) | |||||||
|                 } |                 } | ||||||
| 	} | 	} | ||||||
| 	 | 	 | ||||||
| 	DEBUG("HERE 5\n"); |  | ||||||
| 	dc->totalTime = mpc_streaminfo_get_length(&info); | 	dc->totalTime = mpc_streaminfo_get_length(&info); | ||||||
|  |  | ||||||
| 	dc->audioFormat.bits = 16; | 	dc->audioFormat.bits = 16; | ||||||
| 	dc->audioFormat.channels = 16; | 	dc->audioFormat.channels = 2; | ||||||
| 	dc->audioFormat.sampleRate = info.sample_freq; | 	dc->audioFormat.sampleRate = info.sample_freq; | ||||||
| 	 | 	 | ||||||
| 	replayGainInfo = newReplayGainInfo(); | 	getOutputAudioFormat(&(dc->audioFormat), &(cb->audioFormat)); | ||||||
|  |  | ||||||
|  | 	dc->state = DECODE_STATE_DECODE; | ||||||
|  |  | ||||||
| 	DEBUG("HERE 6\n"); |  | ||||||
| 	while(!eof) { | 	while(!eof) { | ||||||
| 		if(dc->seek) { | 		if(dc->seek) { | ||||||
| 			samplePos = dc->seekWhere * dc->audioFormat.sampleRate; | 			samplePos = dc->seekWhere * dc->audioFormat.sampleRate; | ||||||
| @@ -197,6 +192,7 @@ int mpc_decode(OutputBuffer * cb, DecoderControl * dc, InputStream * inStream) | |||||||
|                         else dc->seekError = 1; |                         else dc->seekError = 1; | ||||||
| 			dc->seek = 0; | 			dc->seek = 0; | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		ret = mpc_decoder_decode(&decoder, sample_buffer, | 		ret = mpc_decoder_decode(&decoder, sample_buffer, | ||||||
| 				         &vbrUpdateAcc, &vbrUpdateBits); | 				         &vbrUpdateAcc, &vbrUpdateBits); | ||||||
|  |  | ||||||
| @@ -229,7 +225,7 @@ int mpc_decode(OutputBuffer * cb, DecoderControl * dc, InputStream * inStream) | |||||||
|                                         	chunk, chunkpos,  |                                         	chunk, chunkpos,  | ||||||
| 						time, | 						time, | ||||||
| 						bitRate, | 						bitRate, | ||||||
| 						replayGainInfo); | 						NULL); | ||||||
| 				chunkpos = 0; | 				chunkpos = 0; | ||||||
| 				s16 = (mpd_sint16 *)chunk; | 				s16 = (mpd_sint16 *)chunk; | ||||||
| 				if(dc->stop) break; | 				if(dc->stop) break; | ||||||
| @@ -237,7 +233,6 @@ int mpc_decode(OutputBuffer * cb, DecoderControl * dc, InputStream * inStream) | |||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	DEBUG("HERE 7\n"); |  | ||||||
| 	if(!dc->stop && chunkpos > 0) { | 	if(!dc->stop && chunkpos > 0) { | ||||||
|                 time = ((float)samplePos) / dc->audioFormat.sampleRate; |                 time = ((float)samplePos) / dc->audioFormat.sampleRate; | ||||||
|  |  | ||||||
| @@ -246,22 +241,19 @@ int mpc_decode(OutputBuffer * cb, DecoderControl * dc, InputStream * inStream) | |||||||
|  |  | ||||||
| 		sendDataToOutputBuffer(cb, NULL, dc, inStream->seekable, | 		sendDataToOutputBuffer(cb, NULL, dc, inStream->seekable, | ||||||
| 				       chunk, chunkpos, time, bitRate,  | 				       chunk, chunkpos, time, bitRate,  | ||||||
| 				       replayGainInfo); | 				       NULL); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	DEBUG("HERE 8\n"); |  | ||||||
| 	closeInputStream(inStream); | 	closeInputStream(inStream); | ||||||
|  |  | ||||||
| 	DEBUG("HERE 9\n"); |  | ||||||
| 	flushOutputBuffer(cb); |  | ||||||
|  |  | ||||||
| 	freeReplayGainInfo(replayGainInfo); |  | ||||||
|  |  | ||||||
| 	if(dc->stop) { | 	if(dc->stop) { | ||||||
| 		dc->state = DECODE_STATE_STOP; | 		dc->state = DECODE_STATE_STOP; | ||||||
| 		dc->stop = 0; | 		dc->stop = 0; | ||||||
| 	} | 	} | ||||||
| 	else dc->state = DECODE_STATE_STOP; | 	else { | ||||||
|  | 		flushOutputBuffer(cb); | ||||||
|  | 		dc->state = DECODE_STATE_STOP; | ||||||
|  | 	} | ||||||
|  |  | ||||||
| 	return 0; | 	return 0; | ||||||
| } | } | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Warren Dukes
					Warren Dukes