Esempio n. 1
0
static inline void __file_changed(struct track_info *ti)
{
	if (player_info.ti)
		track_info_unref(player_info.ti);

	player_info.ti = ti;
	update_rg_scale();
	player_info.metadata[0] = 0;
	player_info.file_changed = 1;
}
Esempio n. 2
0
static void _consumer_handle_eof(void)
{
	struct track_info *ti;

	if (ip_is_remote(ip)) {
		_producer_stop();
		_consumer_drain_and_stop();
		player_error("lost connection");
		return;
	}

	if (player_info.ti)
		player_info.ti->play_count++;

	if (player_repeat_current) {
		if (player_cont) {
			ip_seek(ip, 0);
			reset_buffer();
		} else {
			_producer_stop();
			_consumer_drain_and_stop();
			_player_status_changed();
		}
		return;
	}

	if (get_next(&ti) == 0) {
		_producer_unload();
		ip = ip_new(ti->filename);
		_producer_status_update(PS_STOPPED);
		/* PS_STOPPED, CS_PLAYING */
		if (player_cont) {
			_producer_play();
			if (producer_status == PS_UNLOADED) {
				_consumer_stop();
				track_info_unref(ti);
				file_changed(NULL);
			} else {
				/* PS_PLAYING */
				file_changed(ti);
				if (!change_sf(0))
					_prebuffer();
			}
		} else {
			_consumer_drain_and_stop();
			file_changed(ti);
		}
	} else {
		_producer_unload();
		_consumer_drain_and_stop();
		file_changed(NULL);
	}
	_player_status_changed();
}
Esempio n. 3
0
static void __producer_play(void)
{
	if (producer_status == PS_UNLOADED) {
		struct track_info *ti;

		if (get_next(&ti) == 0) {
			int rc;

			ip = ip_new(ti->filename);
			rc = ip_open(ip);
			if (rc) {
				player_ip_error(rc, "opening file `%s'", ti->filename);
				ip_delete(ip);
				track_info_unref(ti);
				file_changed(NULL);
			} else {
				ip_setup(ip);
				__producer_status_update(PS_PLAYING);
				file_changed(ti);
			}
		}
	} else if (producer_status == PS_PLAYING) {
		if (ip_seek(ip, 0.0) == 0) {
			reset_buffer();
		}
	} else if (producer_status == PS_STOPPED) {
		int rc;

		rc = ip_open(ip);
		if (rc) {
			player_ip_error(rc, "opening file `%s'", ip_get_filename(ip));
			ip_delete(ip);
			__producer_status_update(PS_UNLOADED);
		} else {
			ip_setup(ip);
			__producer_status_update(PS_PLAYING);
		}
	} else if (producer_status == PS_PAUSED) {
		__producer_status_update(PS_PLAYING);
	}
}