Commit 95dd7833 authored by Adrien Béraud's avatar Adrien Béraud

android/video: fix setFromMemory

Tuleap: #293
Change-Id: I81aceb7a9de3e75d2d92b2abf08aafcff21ce337
parent 02765c37
......@@ -130,7 +130,7 @@ VideoFrame::setFromMemory(uint8_t* ptr, int format, int width, int height) noexc
void
VideoFrame::setFromMemory(uint8_t* ptr, int format, int width, int height,
std::function<void(void*)> cb) noexcept
std::function<void(uint8_t*)> cb) noexcept
{
setFromMemory(ptr, format, width, height);
if (cb) {
......
......@@ -80,7 +80,7 @@ class VideoFrame: public MediaFrame {
// Set internal pixel buffers on given memory buffer
// This buffer must follow given specifications.
void setFromMemory(uint8_t* data, int format, int width, int height) noexcept;
void setFromMemory(uint8_t* data, int format, int width, int height, std::function<void(void*)> cb) noexcept;
void setFromMemory(uint8_t* data, int format, int width, int height, std::function<void(uint8_t*)> cb) noexcept;
void noise();
......@@ -88,8 +88,8 @@ class VideoFrame: public MediaFrame {
VideoFrame& operator =(const VideoFrame& src);
private:
std::function<void(void*)> releaseBufferCb_ {};
void *ptr_ {nullptr};
std::function<void(uint8_t*)> releaseBufferCb_ {};
uint8_t* ptr_ {nullptr};
bool allocated_ {false};
void setGeometry(int format, int width, int height) noexcept;
};
......
......@@ -109,7 +109,7 @@ void VideoInput::processAndroid()
buffer.status = BUFFER_PUBLISHED;
frame.setFromMemory((uint8_t*)buffer.data, format, decOpts_.width, decOpts_.height,
std::bind(&VideoInput::releaseBufferCb, this));
std::bind(&VideoInput::releaseBufferCb, this, std::placeholders::_1));
publish_index_++;
lck.unlock();
publishFrame();
......@@ -240,7 +240,7 @@ void VideoInput::freeOneBuffer(struct VideoFrameBuffer& b)
b.status = BUFFER_NOT_ALLOCATED;
}
void VideoInput::releaseBufferCb(void *ptr)
void VideoInput::releaseBufferCb(uint8_t* ptr)
{
std::lock_guard<std::mutex> lck(mutex_);
......
......@@ -133,7 +133,7 @@ private:
int publish_index_ = 0;
/* Get notified when libav is done with this buffer */
static void releaseBufferCb(void *opaque, void *ptr);
void releaseBufferCb(uint8_t* ptr);
std::vector<struct VideoFrameBuffer> buffers_;
#endif
};
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment