bool auto_reset_;
impl()
+ : auto_reset_(false)
{
}
image_transform image_transform;
audio_transform audio_transform;
- char padding[3];
+ //char padding[(sizeof(core::image_transform) + sizeof(core::audio_transform)) % 16];
frame_transform& operator*=(const frame_transform &other);
frame_transform operator*(const frame_transform &other) const;
struct frame_geometry::impl
{
- impl() : type_(frame_geometry::none) {}
- impl(frame_geometry::geometry_type t, std::vector<float> d) : type_(t), data_(std::move(d)) {}
+ impl(frame_geometry::geometry_type t, std::vector<float>&& d) : type_(t), data_(std::move(d)) {}
frame_geometry::geometry_type type_;
std::vector<float> data_;
};
-frame_geometry::frame_geometry() : impl_(new impl()) {}
-frame_geometry::frame_geometry(const frame_geometry& rhs) : impl_(rhs.impl_) {}
-frame_geometry::frame_geometry(geometry_type t, std::vector<float> d) : impl_(new impl(t, std::move(d))) {}
+frame_geometry::frame_geometry() {}
+frame_geometry::frame_geometry(geometry_type t, std::vector<float>&& d) : impl_(new impl(t, std::move(d))) {}
-const frame_geometry& frame_geometry::operator=(const frame_geometry& rhs) { impl_ = rhs.impl_; return *this; }
-
-frame_geometry::geometry_type frame_geometry::type() { return impl_->type_; }
-const std::vector<float>& frame_geometry::data() { return impl_->data_; }
+frame_geometry::geometry_type frame_geometry::type() const { return impl_ ? impl_->type_ : none; }
+const std::vector<float>& frame_geometry::data() const
+{
+ if (impl_)
+ return impl_->data_;
+ else
+ CASPAR_THROW_EXCEPTION(invalid_operation());
+}
const frame_geometry& frame_geometry::get_default()
{
#pragma once
-#include <common/memory.h>
+#include <memory>
#include <vector>
namespace caspar { namespace core {
};
frame_geometry();
- frame_geometry(const frame_geometry&);
- frame_geometry(geometry_type, std::vector<float>);
- const frame_geometry& operator=(const frame_geometry&);
+ frame_geometry(geometry_type, std::vector<float>&&);
+
+ geometry_type type() const ;
+ const std::vector<float>& data() const;
- geometry_type type();
- const std::vector<float>& data();
-
static const frame_geometry& get_default();
private:
struct impl;
- spl::shared_ptr<impl> impl_;
+ std::shared_ptr<impl> impl_;
};
}}
\ No newline at end of file
{
impl_ = std::move(other.impl_);
path_ = std::move(other.path_);
+
+ return *this;
}
void on_next(const monitor::event& e) override
basic_subject& operator=(basic_subject&& other)
{
impl_ = std::move(other.impl_);
+
+ return *this;
}
operator std::weak_ptr<observer>()
}
void on_change(
- const std::weak_ptr<void> dependant,
+ const std::weak_ptr<void>& dependant,
const std::function<void ()>& listener) const
{
impl_->on_change(dependant, listener);
op parse_operator(std::wstring::const_iterator& cursor, const std::wstring& str)
{
- std::wstring characters;
static const wchar_t NONE = L' ';
wchar_t first = NONE;
L"Did not expect -" + at_position(cursor, str)));
else
first = ch;
-
+
++cursor;
break;
case L'!':
void init()
{
- fonts.swap(std::move(enumerate_fonts()));
- if(fonts.size() > 0)
+ fonts = enumerate_fonts();
+ if(!fonts.empty())
register_producer_factory(&create_text_producer);
}
text::string_metrics metrics;
font_.set_tracking(static_cast<int>(tracking_.value().get()));
- std::vector<float> vertex_stream(std::move(font_.create_vertex_stream(text_.value().get(), x_, y_, parent_width_, parent_height_, &metrics)));
+ auto vertex_stream = font_.create_vertex_stream(text_.value().get(), x_, y_, parent_width_, parent_height_, &metrics);
auto frame = frame_factory_->create_frame(vertex_stream.data(), pfd);
memcpy(frame.image_data().data(), atlas_.data(), frame.image_data().size());
frame.set_geometry(frame_geometry(frame_geometry::quad_list, std::move(vertex_stream)));
struct color
{
color() {}
- color(unsigned int value)
+ explicit color(unsigned int value)
{
b = (value & 0x000000ff) / 255.0f;
g = ((value & 0x0000ff00) >> 8) / 255.0f;
a = ((value & 0xff000000) >> 24) / 255.0f;
}
- color(const color& other) : r(other.r), g(other.g), b(other.b), a(other.a) {}
color(T alpha, T red, T green, T blue) : r(red), g(green), b(blue), a(alpha) {}
- const color&operator=(const color& other)
- {
- r = other.r;
- g = other.g;
- b = other.b;
- a = other.a;
-
- return *this;
- }
-
T r;
T g;
T b;
struct string_metrics
{
- string_metrics() : width(0), bearingY(0), height(0) {}
+ string_metrics()
+ : width(0), bearingY(0), protrudeUnderY(0), height(0) {}
int width;
int bearingY;
int protrudeUnderY;
rect get_region(int width, int height)
{
- int y, best_height, best_width;
-
rect region = {0,0,(int)width,(int)height};
- best_height = INT_MAX;
- best_width = INT_MAX;
+ int best_height = INT_MAX;
+ int best_width = INT_MAX;
node_iterator best_it = nodes_.end();
auto it = nodes_.begin();
for(; it != nodes_.end(); ++it)
{
- y = fit(it, width, height);
+ int y = fit(it, width, height);
if( y >= 0 )
{
if( ( (y + height) < best_height ) ||
private:
int fit(node_iterator it, const size_t width, const size_t height)
{
- int x, y, width_left;
-
- x = (*it).x;
- y = (*it).y;
- width_left = (int)width;
+ int x = (*it).x;
+ int y = (*it).y;
+ int width_left = (int)width;
if ((x + width) > (width_ - 1))
return -1;
int width, height;
};
- FT_Library lib_;
- FT_Face face_;
- texture_atlas atlas_;
- float size_;
- float tracking_;
- bool normalize_;
- std::map<int, glyph_info> glyphs_;
+ std::shared_ptr<FT_LibraryRec_> lib_;
+ std::shared_ptr<FT_FaceRec_> face_;
+ texture_atlas atlas_;
+ float size_;
+ float tracking_;
+ bool normalize_;
+ std::map<int, glyph_info> glyphs_;
public:
- impl::impl(texture_atlas& atlas, const text_info& info, bool normalize_coordinates) : lib_(nullptr), face_(nullptr), atlas_(atlas), size_(info.size), tracking_(info.size*info.tracking/1000.0f), normalize_(normalize_coordinates)
+ impl(texture_atlas& atlas, const text_info& info, bool normalize_coordinates) : atlas_(atlas), size_(info.size), tracking_(info.size*info.tracking/1000.0f), normalize_(normalize_coordinates)
{
- try
- {
- FT_Error err;
- err = FT_Init_FreeType(&lib_);
- if(err) throw freetype_exception("Failed to initialize freetype");
+ FT_Library lib;
+
+ if (FT_Init_FreeType(&lib))
+ throw freetype_exception("Failed to initialize freetype");
- err = FT_New_Face(lib_, u8(info.font_file).c_str(), 0, &face_);
- if(err) throw freetype_exception("Failed to load font");
+ lib_.reset(lib, [](FT_Library ptr) { FT_Done_FreeType(ptr); });
- err = FT_Set_Char_Size(face_, static_cast<FT_F26Dot6>(size_*64), 0, 72, 72);
- if(err) throw freetype_exception("Failed to set font size");
- }
- catch(std::exception& ex)
- {
- if(face_ != nullptr)
- FT_Done_Face(face_);
- if(lib_ != nullptr)
- FT_Done_FreeType(lib_);
+ FT_Face face;
+
+ if (FT_New_Face(lib_.get(), u8(info.font_file).c_str(), 0, &face))
+ throw freetype_exception("Failed to load font");
- throw ex;
- }
- }
+ face_.reset(face, [](FT_Face ptr) { FT_Done_Face(ptr); });
- ~impl()
- {
- if(face_ != nullptr)
- FT_Done_Face(face_);
- if(lib_ != nullptr)
- FT_Done_FreeType(lib_);
+ if (FT_Set_Char_Size(face_.get(), static_cast<FT_F26Dot6>(size_*64), 0, 72, 72))
+ throw freetype_exception("Failed to set font size");
}
void set_tracking(int tracking)
for(int i = range.first; i <= range.last; ++i)
{
- FT_UInt glyph_index = FT_Get_Char_Index(face_, i);
+ FT_UInt glyph_index = FT_Get_Char_Index(face_.get(), i);
if(!glyph_index) //ignore codes that doesn't have a glyph for now. Might want to map these to a special glyph later.
continue;
- err = FT_Load_Glyph(face_, glyph_index, flags);
+ err = FT_Load_Glyph(face_.get(), glyph_index, flags);
if(err) continue; //igonore glyphs that fail to load
const FT_Bitmap& bitmap = face_->glyph->bitmap; //shorthand notation
{
const glyph_info& coords = glyph_it->second;
- FT_UInt glyph_index = FT_Get_Char_Index(face_, (*it));
+ FT_UInt glyph_index = FT_Get_Char_Index(face_.get(), (*it));
if(use_kerning && previous && glyph_index)
{
FT_Vector delta;
- FT_Get_Kerning(face_, previous, glyph_index, FT_KERNING_DEFAULT, &delta);
+ FT_Get_Kerning(face_.get(), previous, glyph_index, FT_KERNING_DEFAULT, &delta);
pos_x += delta.x / 64.0f;
}
- FT_Load_Glyph(face_, glyph_index, FT_LOAD_NO_BITMAP | FT_LOAD_FORCE_AUTOHINT | FT_LOAD_TARGET_NORMAL);
+ FT_Load_Glyph(face_.get(), glyph_index, FT_LOAD_NO_BITMAP | FT_LOAD_FORCE_AUTOHINT | FT_LOAD_TARGET_NORMAL);
float left = (pos_x + face_->glyph->metrics.horiBearingX/64.0f) / parent_width ;
float right = ((pos_x + face_->glyph->metrics.horiBearingX/64.0f) + coords.width) / parent_width;
{
const glyph_info& coords = glyph_it->second;
- FT_UInt glyph_index = FT_Get_Char_Index(face_, (*it));
+ FT_UInt glyph_index = FT_Get_Char_Index(face_.get(), (*it));
if(use_kerning && previous && glyph_index)
{
FT_Vector delta;
- FT_Get_Kerning(face_, previous, glyph_index, FT_KERNING_DEFAULT, &delta);
+ FT_Get_Kerning(face_.get(), previous, glyph_index, FT_KERNING_DEFAULT, &delta);
pos_x += delta.x / 64.0f;
}
- FT_Load_Glyph(face_, glyph_index, FT_LOAD_NO_BITMAP | FT_LOAD_FORCE_AUTOHINT | FT_LOAD_TARGET_NORMAL);
+ FT_Load_Glyph(face_.get(), glyph_index, FT_LOAD_NO_BITMAP | FT_LOAD_FORCE_AUTOHINT | FT_LOAD_TARGET_NORMAL);
int bearingY = face_->glyph->metrics.horiBearingY >> 6;
if(bearingY > result.bearingY)
spl::shared_ptr<CBlueVelvet4> create_blue()
{
- if(!BlueVelvetFactory4 || !encode_hanc_frame || !encode_hanc_frame)
+ if(!BlueVelvetFactory4 || !encode_hanc_frame)
CASPAR_THROW_EXCEPTION(caspar_exception() << msg_info("Bluefish drivers not found."));
return spl::shared_ptr<CBlueVelvet4>(BlueVelvetFactory4(), BlueVelvetDestroy);
// Audio
- std::shared_ptr<core::audio_buffer> audio_buffer;
-
void* audio_bytes = nullptr;
if(FAILED(audio->GetBytes(&audio_bytes)) || !audio_bytes)
return S_OK;
void log_callback(void* ptr, int level, const char* fmt, va_list vl)
{
static int print_prefix=1;
- static int count;
+ //static int count;
static char prev[1024];
char line[8192];
- static int is_atty;
+ //static int is_atty;
AVClass* avc= ptr ? *(AVClass**)ptr : NULL;
if(level > av_log_get_level())
return;
return boost::lexical_cast<std::wstring>(width) + L"x" + boost::lexical_cast<std::wstring>(height) + (!interlaced ? L"p" : L"i") + fps_ss.str();
}
-bool is_valid_file(const std::wstring filename)
+bool is_valid_file(const std::wstring& filename)
{
static const std::vector<std::wstring> invalid_exts = boost::assign::list_of(L".png")(L".tga")(L".bmp")(L".jpg")(L".jpeg")(L".gif")(L".tiff")(L".tif")(L".jp2")(L".jpx")(L".j2k")(L".j2c")(L".swf")(L".ct");
static std::vector<std::wstring> valid_exts = boost::assign::list_of(L".m2t")(L".mov")(L".mp4")(L".dv")(L".flv")(L".mpg")(L".wav")(L".mp3")(L".dnxhd")(L".h264")(L".prores");
return av_probe_input_format2(&pb, true, &score) != nullptr;
}
-std::wstring probe_stem(const std::wstring stem)
+std::wstring probe_stem(const std::wstring& stem)
{
auto stem2 = boost::filesystem::path(stem);
auto dir = stem2.parent_path();
std::wstring print_mode(int width, int height, double fps, bool interlaced);
-std::wstring probe_stem(const std::wstring stem);
-bool is_valid_file(const std::wstring filename);
+std::wstring probe_stem(const std::wstring& stem);
+bool is_valid_file(const std::wstring& filename);
}}
\ No newline at end of file
{
// ATLTRACE(_T("FlashAxContainer::DrawControl\n"));
DVASPECTINFO aspectInfo = {sizeof(DVASPECTINFO), DVASPECTINFOFLAG_CANOPTIMIZE};
- HRESULT hr = S_OK;
-
- hr = m_spViewObject->Draw(DVASPECT_CONTENT, -1, &aspectInfo, NULL, NULL, targetDC, NULL, NULL, NULL, NULL);
+ HRESULT hr = m_spViewObject->Draw(DVASPECT_CONTENT, -1, &aspectInfo, NULL, NULL, targetDC, NULL, NULL, NULL, NULL);
bInvalidRect_ = false;
/* const video_format_desc& fmtDesc = video_format_desc::FormatDescriptions[format_];
namespace flash {
class TimerHelper;
-struct DirtyRect {
+/*struct DirtyRect {
DirtyRect(LONG l, LONG t, LONG r, LONG b, bool e) : bErase(e), bWhole(false) {
rect.left = l;
rect.top = t;
RECT rect;
bool bErase;
bool bWhole;
-};
+};*/
extern _ATL_FUNC_INFO fnInfoFlashCallEvent;
extern _ATL_FUNC_INFO fnInfoReadyStateChangeEvent;
volatile bool bReadyToRender_;
volatile bool bIsEmpty_;
volatile bool bHasNewTiming_;
- std::vector<DirtyRect> bDirtyRects_;
+ //std::vector<DirtyRect> bDirtyRects_;
IDirectDraw4Ptr *m_lpDD4;
void blur(
const SrcView& src,
DstView& dst,
- const std::vector<std::pair<int, int>> motion_trail_coordinates,
+ const std::vector<std::pair<int, int>>& motion_trail_coordinates,
const core::tweener& tweener)
{
auto blur_px = motion_trail_coordinates.size();
break;
unsigned long colIndex = 0;
- unsigned char length = 0;
+
do
{
- length = 0;
+ unsigned char length = 0;
//Get controlbyte
char controlByte = static_cast<char>(stream.read_byte());
std::shared_ptr<core::frame_producer> layer_producer;
if((*it)->is_solid())
{
- layer_producer = layer_producer = core::create_const_producer(core::create_color_frame(it->get(), frame_factory, (*it)->solid_color().to_uint32()), (*it)->bitmap()->width(), (*it)->bitmap()->height());
+ layer_producer = core::create_const_producer(core::create_color_frame(it->get(), frame_factory, (*it)->solid_color().to_uint32()), (*it)->bitmap()->width(), (*it)->bitmap()->height());
}
else if((*it)->bitmap())
{
{
auto blend_str = parameters().at(1);
int layer = layer_index();
- channel()->mixer().set_blend_mode(layer_index(), get_blend_mode(blend_str));
+ channel()->mixer().set_blend_mode(layer, get_blend_mode(blend_str));
}
else if(boost::iequals(parameters()[0], L"MASTERVOLUME"))
{
{
transition_info transitionInfo;
- bool bLoop = false;
-
// TRANSITION
std::wstring message;
}
const TCHAR* pDataString = 0;
- std::wstringstream data;
std::wstring dataFromFile;
if(parameters().size() > dataIndex)
{ //read data
class ThumbnailCommand : public AMCPCommandBase<1>
{
public:
- ThumbnailCommand::ThumbnailCommand(IO::ClientInfoPtr client, std::shared_ptr<core::thumbnail_generator> thumb_gen) : AMCPCommandBase(client), thumb_gen_(thumb_gen)
+ ThumbnailCommand(IO::ClientInfoPtr client, std::shared_ptr<core::thumbnail_generator> thumb_gen) : AMCPCommandBase(client), thumb_gen_(thumb_gen)
{}
std::wstring print() const { return L"ThumbnailCommand";}
bool DoExecute();
TitleHolder() : titleName(L""), pframe_producer(core::frame_producer::empty()) {}
TitleHolder(const std::wstring& name, spl::shared_ptr<core::frame_producer> pFP) : titleName(name), pframe_producer(pFP) {}
TitleHolder(const TitleHolder& th) : titleName(th.titleName), pframe_producer(th.pframe_producer) {}
- const TitleHolder& operator=(const TitleHolder& th)
+ TitleHolder& operator=(const TitleHolder& th)
{
titleName = th.titleName;
pframe_producer = th.pframe_producer;
+
+ return *this;
}
bool operator==(const TitleHolder& rhs)
{
case BLOB_TYPE_TAG:
{
if( argument + 4 > end )
- MalformedMessageException( "arguments exceed message size" );
+ throw MalformedMessageException( "arguments exceed message size" );
uint32 blobSize = ToUInt32( argument );
argument = argument + 4 + RoundUp4( (unsigned long)blobSize );
if( argument > end )
- MalformedMessageException( "arguments exceed message size" );
+ throw MalformedMessageException( "arguments exceed message size" );
}
break;
service_.dispatch([=] { stop(); });
}
- void add_lifecycle_bound_object(const std::wstring& key, const std::shared_ptr<void> lifecycle_bound)
+ void add_lifecycle_bound_object(const std::wstring& key, const std::shared_ptr<void>& lifecycle_bound)
{
//thread-safe tbb_concurrent_hash_map
lifecycle_bound_objects_.insert(std::pair<std::wstring, std::shared_ptr<void>>(key, lifecycle_bound));