const bool loop_;\r
const size_t length_;\r
\r
+ std::unique_ptr<input> input_; \r
+\r
unbounded_buffer<input::target_element_t> packets_;\r
std::shared_ptr<unbounded_buffer<frame_muxer2::video_source_element_t>> video_;\r
std::shared_ptr<unbounded_buffer<frame_muxer2::audio_source_element_t>> audio_;\r
\r
const safe_ptr<diagnostics::graph> graph_;\r
\r
- input input_; \r
std::unique_ptr<video_decoder> video_decoder_;\r
std::unique_ptr<audio_decoder> audio_decoder_; \r
std::unique_ptr<frame_muxer2> muxer_;\r
, start_(start)\r
, loop_(loop)\r
, length_(length)\r
- , input_(packets_, graph_, filename_, loop, start, length)\r
, last_frame_(core::basic_frame::empty())\r
{ \r
+ input_.reset(new input(packets_, graph_, filename_, loop, start, length));\r
+\r
try\r
{\r
auto video = std::make_shared<unbounded_buffer<frame_muxer2::video_source_element_t>>();\r
- video_decoder_.reset(new video_decoder(packets_, *video, *input_.context()));\r
+ video_decoder_.reset(new video_decoder(packets_, *video, *input_->context()));\r
video_ = video;\r
}\r
catch(averror_stream_not_found&)\r
try\r
{\r
auto audio = std::make_shared<unbounded_buffer<frame_muxer2::audio_source_element_t>>();\r
- audio_decoder_.reset(new audio_decoder(packets_, *audio, *input_.context(), frame_factory->get_video_format_desc()));\r
+ audio_decoder_.reset(new audio_decoder(packets_, *audio, *input_->context(), frame_factory->get_video_format_desc()));\r
audio_ = audio;\r
}\r
catch(averror_stream_not_found&)\r
\r
~ffmpeg_producer()\r
{\r
- input_.stop(); \r
+ input_->stop(); \r
}\r
\r
virtual safe_ptr<core::basic_frame> receive(int hints)\r
\r
// This function estimates nb_frames until input has read all packets for one loop, at which point the count should be accurate.\r
\r
- int64_t nb_frames = input_.nb_frames();\r
- if(input_.nb_loops() < 1) // input still hasn't counted all frames\r
+ int64_t nb_frames = input_->nb_frames();\r
+ if(input_->nb_loops() < 1) // input still hasn't counted all frames\r
{\r
int64_t video_nb_frames = video_decoder_->nb_frames();\r
int64_t audio_nb_frames = audio_decoder_->nb_frames();\r
\r
if(boost::iequals(params.at(0), L"LOOP"))\r
{\r
- input_.loop(boost::lexical_cast<bool>(params.at(1)));\r
+ input_->loop(boost::lexical_cast<bool>(params.at(1)));\r
return true;\r
}\r
return false;\r
static const size_t MAX_PACKETS_SIZE = 16 * 1000000;\r
static const size_t MAX_PACKETS_COUNT = 50;\r
\r
-struct input::implementation : public Concurrency::agent\r
- , public std::enable_shared_from_this<implementation>\r
- , boost::noncopyable\r
+struct input::implementation : public Concurrency::agent, boost::noncopyable\r
{\r
input::target_t& target_;\r
safe_ptr<diagnostics::graph> graph_;\r
graph_->update_value("buffer-size", (packets_size_+0.001)/MAX_PACKETS_SIZE);\r
graph_->update_value("buffer-count", (packets_count_+0.001)/MAX_PACKETS_COUNT);\r
\r
- auto self = shared_from_this();\r
- packet = safe_ptr<AVPacket>(packet.get(), [this, self, packet, size, data](AVPacket*)\r
+ packet = safe_ptr<AVPacket>(packet.get(), [this, packet, size, data](AVPacket*)\r
{\r
packet->size = size;\r
packet->data = data;\r