projects
/
dcpomatic.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Replace dcp::Data with dcp::ArrayData
[dcpomatic.git]
/
src
/
lib
/
ffmpeg_image_proxy.cc
diff --git
a/src/lib/ffmpeg_image_proxy.cc
b/src/lib/ffmpeg_image_proxy.cc
index 9c91d1d87d7d6c60eb883ee346acbb14876bf5ee..602185bb8b4ade76013935cd6a096a08c957d995 100644
(file)
--- a/
src/lib/ffmpeg_image_proxy.cc
+++ b/
src/lib/ffmpeg_image_proxy.cc
@@
-25,12
+25,15
@@
#include "image.h"
#include "compose.hpp"
#include "util.h"
#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>
}
#include <dcp/raw_convert.h>
extern "C" {
#include <libavcodec/avcodec.h>
#include <libavformat/avformat.h>
}
+DCPOMATIC_DISABLE_WARNINGS
#include <libxml++/libxml++.h>
#include <libxml++/libxml++.h>
+DCPOMATIC_ENABLE_WARNINGS
#include <iostream>
#include "i18n.h"
#include <iostream>
#include "i18n.h"
@@
-53,7
+56,7
@@
FFmpegImageProxy::FFmpegImageProxy (boost::filesystem::path path)
}
}
-FFmpegImageProxy::FFmpegImageProxy (dcp::Data data)
+FFmpegImageProxy::FFmpegImageProxy (dcp::
Array
Data data)
: _data (data)
, _pos (0)
{
: _data (data)
, _pos (0)
{
@@
-64,8
+67,8
@@
FFmpegImageProxy::FFmpegImageProxy (shared_ptr<cxml::Node>, shared_ptr<Socket> s
: _pos (0)
{
uint32_t const size = socket->read_uint32 ();
: _pos (0)
{
uint32_t const size = socket->read_uint32 ();
- _data = dcp::Data (size);
- socket->read (_data.data()
.get()
, size);
+ _data = dcp::
Array
Data (size);
+ socket->read (_data.data(), size);
}
static int
}
static int
@@
-83,11
+86,11
@@
avio_seek_wrapper (void* data, int64_t offset, int whence)
int
FFmpegImageProxy::avio_read (uint8_t* buffer, int const amount)
{
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;
}
if (to_do == 0) {
return AVERROR_EOF;
}
- memcpy (buffer, _data.data()
.get()
+ _pos, to_do);
+ memcpy (buffer, _data.data() + _pos, to_do);
_pos += to_do;
return to_do;
}
_pos += to_do;
return to_do;
}
@@
-112,13
+115,15
@@
FFmpegImageProxy::avio_seek (int64_t const pos, int whence)
return _pos;
}
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) {
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));
}
uint8_t* avio_buffer = static_cast<uint8_t*> (wrapped_av_malloc(4096));
@@
-192,9
+197,11
@@
FFmpegImageProxy::image (optional<dcp::Size>) const
av_free (avio_context->buffer);
av_free (avio_context);
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::add_metadata (xmlpp::Node* node) const
{
@@
-202,10
+209,10
@@
FFmpegImageProxy::add_metadata (xmlpp::Node* node) const
}
void
}
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.size());
- socket->write (_data.data()
.get()
, _data.size());
+ socket->write (_data.data(), _data.size());
}
bool
}
bool
@@
-216,11
+223,7
@@
FFmpegImageProxy::same (shared_ptr<const ImageProxy> other) const
return false;
}
return false;
}
- if (_data.size() != mp->_data.size()) {
- return false;
- }
-
- return memcmp (_data.data().get(), mp->_data.data().get(), _data.size()) == 0;
+ return _data == mp->_data;
}
size_t
}
size_t