From f7f6c2b90b1035ec1b1b76db70a02032fd8ab767 Mon Sep 17 00:00:00 2001 From: Thomas Goyne Date: Thu, 1 May 2014 12:51:48 -0700 Subject: [PATCH] Switch to using csri_open_mem --- src/subtitles_provider_csri.cpp | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/src/subtitles_provider_csri.cpp b/src/subtitles_provider_csri.cpp index e54a7e3fd..984ccb0c9 100644 --- a/src/subtitles_provider_csri.cpp +++ b/src/subtitles_provider_csri.cpp @@ -36,15 +36,11 @@ #include "subtitles_provider_csri.h" #include "include/aegisub/subtitles_provider.h" -#include "options.h" #include "subtitle_format_ass.h" #include "video_frame.h" -#include -#include #include -#include #include #include @@ -68,8 +64,6 @@ class CSRISubtitlesProvider final : public SubtitlesProvider { csri_rend *renderer = nullptr; boost::interprocess::basic_ovectorstream> ostr; - /// Name of the file passed to renderers with can_open_mem false - agi::fs::path tempfile; public: CSRISubtitlesProvider(std::string subType); @@ -96,14 +90,8 @@ void CSRISubtitlesProvider::LoadSubtitles(AssFile *subs, int time) { ostr.rdbuf()->clear(); AssSubtitleFormat::WriteToStream(subs, ostr, time); - if (tempfile.empty()) - tempfile = unique_path(config::path->Decode("?temp/csri-%%%%-%%%%-%%%%-%%%%.ass")); - auto size = ostr.vector().size(); - agi::temp_file_mapping file(tempfile, size); - memcpy(file.write(0, size), &ostr.vector()[0], size); - std::lock_guard lock(csri_mutex); - instance.reset(csri_open_file(renderer, tempfile.string().c_str(), nullptr)); + instance.reset(csri_open_mem(renderer, ostr.vector().data(), ostr.vector().size(), nullptr)); } void CSRISubtitlesProvider::DrawSubtitles(VideoFrame &dst, double time) {