#include "image.h"
#include "compose.hpp"
#include "util.h"
+#include "warnings.h"
#include <dcp/raw_convert.h>
extern "C" {
#include <libavcodec/avcodec.h>
#include <libavformat/avformat.h>
}
+DCPOMATIC_DISABLE_WARNINGS
#include <libxml++/libxml++.h>
+DCPOMATIC_ENABLE_WARNINGS
#include <iostream>
#include "i18n.h"
int
FFmpegImageProxy::avio_read (uint8_t* buffer, int const amount)
{
- int const to_do = min(int64_t(amount), _data.size() - _pos);
+ int const to_do = min(static_cast<int64_t>(amount), static_cast<int64_t>(_data.size()) - _pos);
if (to_do == 0) {
return AVERROR_EOF;
}
return _pos;
}
-pair<shared_ptr<Image>, int>
+DCPOMATIC_DISABLE_WARNINGS
+
+ImageProxy::Result
FFmpegImageProxy::image (optional<dcp::Size>) const
{
boost::mutex::scoped_lock lm (_mutex);
if (_image) {
- return make_pair (_image, 0);
+ return Result (_image, 0);
}
uint8_t* avio_buffer = static_cast<uint8_t*> (wrapped_av_malloc(4096));
e = avformat_open_input (&format_context, "foo.tga", f, &options);
}
if (e < 0) {
- throw OpenFileError (_path->string(), e, true);
+ if (_path) {
+ throw OpenFileError (_path->string(), e, OpenFileError::READ);
+ } else {
+ boost::throw_exception(DecodeError(String::compose(_("Could not decode image (%1)"), e)));
+ }
}
if (avformat_find_stream_info(format_context, 0) < 0) {
av_free (avio_context->buffer);
av_free (avio_context);
- return make_pair (_image, 0);
+ return Result (_image, 0);
}
+DCPOMATIC_ENABLE_WARNINGS
+
void
FFmpegImageProxy::add_metadata (xmlpp::Node* node) const
{
}
void
-FFmpegImageProxy::send_binary (shared_ptr<Socket> socket) const
+FFmpegImageProxy::write_to_socket (shared_ptr<Socket> socket) const
{
socket->write (_data.size());
socket->write (_data.data().get(), _data.size());