Example #1
0
bool FileDecoder::test_respond(bool is_ogg)
{
	::FLAC__StreamDecoderInitStatus init_status;

	if(!set_md5_checking(true)) {
		printf("FAILED at set_md5_checking(), returned false\n");
		return false;
	}

	switch(layer_) {
		case LAYER_FILE:
			{
				printf("opening %sFLAC file... ", is_ogg? "Ogg ":"");
				FILE *file = ::fopen(flacfilename(is_ogg), "rb");
				if(0 == file) {
					printf("ERROR (%s)\n", strerror(errno));
					return false;
				}
				printf("OK\n");

				printf("testing init%s()... ", is_ogg? "_ogg":"");
				init_status = is_ogg? init_ogg(file) : init(file);
			}
			break;
		case LAYER_FILENAME:
			printf("testing init%s()... ", is_ogg? "_ogg":"");
			init_status = is_ogg? init_ogg(flacfilename(is_ogg)) : init(flacfilename(is_ogg));
			break;
		default:
			die_("internal error 001");
			return false;
	}
	if(init_status != ::FLAC__STREAM_DECODER_INIT_STATUS_OK)
		return die_s_(0, this);
	printf("OK\n");

	current_metadata_number_ = 0;

	printf("testing process_until_end_of_stream()... ");
	if(!process_until_end_of_stream()) {
		State state = get_state();
		printf("FAILED, returned false, state = %u (%s)\n", (unsigned)((::FLAC__StreamDecoderState)state), state.as_cstring());
		return false;
	}
	printf("OK\n");

	printf("testing finish()... ");
	if(!finish()) {
		State state = get_state();
		printf("FAILED, returned false, state = %u (%s)\n", (unsigned)((::FLAC__StreamDecoderState)state), state.as_cstring());
		return false;
	}
	printf("OK\n");

	return true;
}
Example #2
0
bool StreamDecoder::test_respond(bool is_ogg)
{
	::FLAC__StreamDecoderInitStatus init_status;

	if(!set_md5_checking(true)) {
		printf("FAILED at set_md5_checking(), returned false\n");
		return false;
	}

	printf("testing init%s()... ", is_ogg? "_ogg":"");
	init_status = is_ogg? init_ogg() : init();
	if(init_status != ::FLAC__STREAM_DECODER_INIT_STATUS_OK)
		return die_s_(0, this);
	printf("OK\n");

	current_metadata_number_ = 0;

	if(fseeko(file_, 0, SEEK_SET) < 0) {
		printf("FAILED rewinding input, errno = %d\n", errno);
		return false;
	}

	printf("testing process_until_end_of_stream()... ");
	if(!process_until_end_of_stream()) {
		State state = get_state();
		printf("FAILED, returned false, state = %u (%s)\n", (unsigned)((::FLAC__StreamDecoderState)state), state.as_cstring());
		return false;
	}
	printf("OK\n");

	printf("testing finish()... ");
	if(!finish()) {
		State state = get_state();
		printf("FAILED, returned false, state = %u (%s)\n", (unsigned)((::FLAC__StreamDecoderState)state), state.as_cstring());
		return false;
	}
	printf("OK\n");

	return true;
}
Example #3
0
		::FLAC__StreamDecoderInitStatus File::init_ogg(const std::string &filename)
		{
			return init_ogg(filename.c_str());
		}