#include "tn_bs.h"

int32 TNPlug_DecodeFramePlayer (struct TNPlugIFace *Self, struct TuneNet *inTuneNet,
	int16 *outbuffer)
{
	uint32 frames;

	struct TNDecHandle *handle = inTuneNet->handle;
	if (!handle->player_task) return 0;

	if (!handle->data_in_buffer) {
		dbug(("requesting data\n"));
		handle->main_task = IExec->FindTask(NULL);
		IExec->Signal(handle->player_task, handle->datasig);
		dbug(("waiting for data\n"));
		IExec->Wait(SIGF_CHILD);
	}

	dbug(("data received (%ld bytes)\n", handle->data_in_buffer));
	frames = handle->data_in_buffer >> 2;
	handle->data_in_buffer = 0;

	return frames;
}

int32 TNPlug_SeekPlayer (struct TNPlugIFace *Self, struct TuneNet *inTuneNet, uint32 seconds) {
	return 0;
}
