Make the video provider owned solely by ThreadedFrameSource rather than in a shared_ptr stored in several places

Originally committed to SVN as r5967.
This commit is contained in:
Thomas Goyne 2011-12-06 00:17:36 +00:00
parent 59fdab5fe7
commit 8a7f4038c1
3 changed files with 6 additions and 5 deletions

View File

@ -55,7 +55,7 @@ class ThreadedFrameSource : public wxThread {
/// Subtitles provider /// Subtitles provider
std::auto_ptr<SubtitlesProvider> provider; std::auto_ptr<SubtitlesProvider> provider;
/// Video provider /// Video provider
std::tr1::shared_ptr<VideoProvider> videoProvider; std::auto_ptr<VideoProvider> videoProvider;
/// Event handler to send FrameReady events to /// Event handler to send FrameReady events to
wxEvtHandler *parent; wxEvtHandler *parent;
@ -102,7 +102,8 @@ public:
/// @brief raw Get raw frame without subtitles /// @brief raw Get raw frame without subtitles
std::tr1::shared_ptr<AegiVideoFrame> GetFrame(int frame, double time, bool raw = false); std::tr1::shared_ptr<AegiVideoFrame> GetFrame(int frame, double time, bool raw = false);
std::tr1::shared_ptr<VideoProvider> GetVideoProvider() const { return videoProvider; } /// Get a reference to the video provider this is using
VideoProvider *GetVideoProvider() const { return videoProvider.get(); }
/// @brief Constructor /// @brief Constructor
/// @param videoFileName File to open /// @param videoFileName File to open

View File

@ -122,8 +122,8 @@ void VideoContext::Reset() {
videoName.clear(); videoName.clear();
// Remove provider // Remove provider
videoProvider.reset();
provider.reset(); provider.reset();
videoProvider = 0;
} }
void VideoContext::SetContext(agi::Context *context) { void VideoContext::SetContext(agi::Context *context) {

View File

@ -78,7 +78,7 @@ class VideoContext : public wxEvtHandler {
agi::Context *context; agi::Context *context;
/// DOCME /// DOCME
std::tr1::shared_ptr<VideoProvider> videoProvider; VideoProvider *videoProvider;
/// DOCME /// DOCME
std::auto_ptr<ThreadedFrameSource> provider; std::auto_ptr<ThreadedFrameSource> provider;
@ -151,7 +151,7 @@ public:
void SetContext(agi::Context *context); void SetContext(agi::Context *context);
/// @brief Get the video provider used for the currently open video /// @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<AegiVideoFrame> GetFrame(int n, bool raw = false); std::tr1::shared_ptr<AegiVideoFrame> GetFrame(int n, bool raw = false);
void GetFrameAsync(int n); void GetFrameAsync(int n);