1 #include "../StdAfx.h"
\r
3 #include "read_frame.h"
\r
5 #include "host_buffer.h"
\r
7 #include <common/gl/gl_check.h>
\r
9 namespace caspar { namespace core {
\r
11 struct read_frame::implementation : boost::noncopyable
\r
13 safe_ptr<const host_buffer> image_data_;
\r
14 std::vector<short> audio_data_;
\r
17 implementation(safe_ptr<const host_buffer>&& image_data, std::vector<short>&& audio_data)
\r
18 : image_data_(std::move(image_data))
\r
19 , audio_data_(std::move(audio_data)){}
\r
22 read_frame::read_frame(){}
\r
23 read_frame::read_frame(safe_ptr<const host_buffer>&& image_data, std::vector<short>&& audio_data) : impl_(new implementation(std::move(image_data), std::move(audio_data))){}
\r
25 const boost::iterator_range<const unsigned char*> read_frame::image_data() const
\r
27 if(!impl_ || !impl_->image_data_->data())
\r
28 return boost::iterator_range<const unsigned char*>();
\r
29 auto ptr = static_cast<const unsigned char*>(impl_->image_data_->data());
\r
30 return boost::iterator_range<const unsigned char*>(ptr, ptr + impl_->image_data_->size());
\r
32 const boost::iterator_range<const short*> read_frame::audio_data() const
\r
35 return boost::iterator_range<const short*>();
\r
36 return boost::iterator_range<const short*>(impl_->audio_data_.data(), impl_->audio_data_.data() + impl_->audio_data_.size());
\r