예제 #1
0
void ThreadedFrameSource::UpdateSubtitles(const AssFile *new_subs, std::set<const AssDialogue*> const& changes) throw() {
	uint_fast32_t req_version = ++version;

	// Copy just the lines which were changed, then replace the lines at the
	// same indices in the worker's copy of the file with the new entries
	std::deque<std::pair<size_t, AssDialogue*>> changed;
	size_t i = 0;
	for (auto const& e : new_subs->Events) {
		if (changes.count(&e))
			changed.emplace_back(i, new AssDialogue(e));
		++i;
	}

	worker->Async([=]{
		size_t i = 0;
		auto it = subs->Events.begin();
		for (auto& update : changed) {
			std::advance(it, update.first - i);
			i = update.first;
			subs->Events.insert(it, *update.second);
			delete &*it--;
		}

		single_frame = NEW_SUBS_FILE;
		ProcAsync(req_version);
	});
}
예제 #2
0
void AsyncVideoProvider::RequestFrame(int new_frame, double new_time) throw() {
	uint_fast32_t req_version = ++version;

	worker->Async([=]{
		time = new_time;
		frame_number = new_frame;
		ProcAsync(req_version, false);
	});
}
예제 #3
0
void ThreadedFrameSource::RequestFrame(int new_frame, double new_time) throw() {
	uint_fast32_t req_version = ++version;

	worker->Async([=]{
		time = new_time;
		frame_number = new_frame;
		ProcAsync(req_version);
	});
}
예제 #4
0
void AsyncVideoProvider::LoadSubtitles(const AssFile *new_subs) throw() {
	uint_fast32_t req_version = ++version;

	auto copy = new AssFile(*new_subs);
	worker->Async([=]{
		subs.reset(copy);
		single_frame = NEW_SUBS_FILE;
		ProcAsync(req_version, false);
	});
}
예제 #5
0
void ThreadedFrameSource::LoadSubtitles(const AssFile *new_subs) throw() {
	uint_fast32_t req_version = ++version;

	auto copy = new AssFile(*new_subs);
	worker->Async([=]{
		subs.reset(copy);
		single_frame = NEW_SUBS_FILE;
		ProcAsync(req_version);
	});
}
예제 #6
0
void AsyncVideoProvider::UpdateSubtitles(const AssFile *new_subs, std::set<const AssDialogue*> const& changes) throw() {
	uint_fast32_t req_version = ++version;

	// Copy just the lines which were changed, then replace the lines at the
	// same indices in the worker's copy of the file with the new entries
	std::vector<AssDialogue *> changed;
	for (auto d : changes)
		changed.push_back(new AssDialogue(*d));

	worker->Async([=]{
		int i = 0;
		auto it = subs->Events.begin();
		for (auto& update : changed) {
			std::advance(it, update->Row - i);
			i = update->Row;
			subs->Events.insert(it, *update);
			delete &*it--;
		}

		single_frame = NEW_SUBS_FILE;
		ProcAsync(req_version, true);
	});
}