From 8a7f4038c148448ae0abb7b89ef06ecbc8b97e4b Mon Sep 17 00:00:00 2001 From: Thomas Goyne Date: Tue, 6 Dec 2011 00:17:36 +0000 Subject: [PATCH] Make the video provider owned solely by ThreadedFrameSource rather than in a shared_ptr stored in several places Originally committed to SVN as r5967. --- aegisub/src/threaded_frame_source.h | 5 +++-- aegisub/src/video_context.cpp | 2 +- aegisub/src/video_context.h | 4 ++-- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/aegisub/src/threaded_frame_source.h b/aegisub/src/threaded_frame_source.h index c4cee7f7d..2481eef9c 100644 --- a/aegisub/src/threaded_frame_source.h +++ b/aegisub/src/threaded_frame_source.h @@ -55,7 +55,7 @@ class ThreadedFrameSource : public wxThread { /// Subtitles provider std::auto_ptr provider; /// Video provider - std::tr1::shared_ptr videoProvider; + std::auto_ptr videoProvider; /// Event handler to send FrameReady events to wxEvtHandler *parent; @@ -102,7 +102,8 @@ public: /// @brief raw Get raw frame without subtitles std::tr1::shared_ptr GetFrame(int frame, double time, bool raw = false); - std::tr1::shared_ptr GetVideoProvider() const { return videoProvider; } + /// Get a reference to the video provider this is using + VideoProvider *GetVideoProvider() const { return videoProvider.get(); } /// @brief Constructor /// @param videoFileName File to open diff --git a/aegisub/src/video_context.cpp b/aegisub/src/video_context.cpp index b29889fa1..f9f2774f1 100644 --- a/aegisub/src/video_context.cpp +++ b/aegisub/src/video_context.cpp @@ -122,8 +122,8 @@ void VideoContext::Reset() { videoName.clear(); // Remove provider - videoProvider.reset(); provider.reset(); + videoProvider = 0; } void VideoContext::SetContext(agi::Context *context) { diff --git a/aegisub/src/video_context.h b/aegisub/src/video_context.h index f37d238ac..a2791c064 100644 --- a/aegisub/src/video_context.h +++ b/aegisub/src/video_context.h @@ -78,7 +78,7 @@ class VideoContext : public wxEvtHandler { agi::Context *context; /// DOCME - std::tr1::shared_ptr videoProvider; + VideoProvider *videoProvider; /// DOCME std::auto_ptr provider; @@ -151,7 +151,7 @@ public: void SetContext(agi::Context *context); /// @brief Get the video provider used for the currently open video - VideoProvider *GetProvider() const { return videoProvider.get(); } + VideoProvider *GetProvider() const { return videoProvider; } std::tr1::shared_ptr GetFrame(int n, bool raw = false); void GetFrameAsync(int n);