Esempio n. 1
0
int play_mp3_stream(uint8_t *buff, int size)
{
	int ret;
	if(
#if ENABLE_MP3
	!mp3_format.init || 
#endif
	!buff)
		return -1;

	if(dec_input.data_len + size <=  dec_input.buff_len)
	{
		memcpy(dec_input.data + dec_input.data_len, buff, size);
		dec_input.data_len += size;
	}else{
		p_err("%s,%d,%d\n", __FUNCTION__, audio_cfg.dec_input->data_len, size);
		dec_input.data_len = 0;
	}
	#if ENABLE_MP3
	ret = MpegAudioDecoder(&dec_input);
	#else
	ret = 0;
	#endif
	return ret;
}
Esempio n. 2
0
/****************************************************************************
 * Program entry point.														*
 ****************************************************************************/
int main(int argc, char *argv[])
{
	char	*cptr;
	int		Status;

	/* Keep this for error messages. */
	cptr=strrchr(argv[0],'/');
	if(cptr==NULL)
		ProgName=argv[0];
	else
		ProgName=cptr+1;

	/* The command-line arguments are analyzed. */
	if(ParseArgs(argc,argv))
		return(1);

	/* Decode stdin to stdout. */
	Status=MpegAudioDecoder(stdin,stdout);
	if(Status)
		fprintf(stderr,"%s: an error occurred during decoding.\n",ProgName);

	/* All done. */
	return(Status);
}