Commit 1d906f7f authored by Tristan Matthews's avatar Tristan Matthews

* #17588: video: use proper avpicture_get_size calls

parent 7731e572
......@@ -10,7 +10,7 @@ libvideo_la_SOURCES = libav_utils.cpp libav_utils.h video_rtp_session.cpp \
video_v4l2_list.cpp video_v4l2.h video_v4l2_list.h \
video_preferences.h video_preferences.cpp \
packet_handle.h packet_handle.cpp check.h shm_header.h \
shm_sink.cpp shm_sink.h video_provider.cpp video_provider.h
shm_sink.cpp shm_sink.h video_provider.h
libvideo_la_LIBADD = @LIBAVCODEC_LIBS@ @LIBAVFORMAT_LIBS@ @LIBAVDEVICE_LIBS@ @LIBSWSCALE_LIBS@ @LIBAVUTIL_LIBS@ @CCRTP_LIBS@ @UDEV_LIBS@
......
/*
* Copyright (C) 2012 Savoir-Faire Linux Inc.
* Author: Tristan Matthews <tristan.matthews@savoirfairelinux.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Additional permission under GNU GPL version 3 section 7:
*
* If you modify this program, or any covered work, by linking or
* combining it with the OpenSSL project's OpenSSL library (or a
* modified version of that library), containing parts covered by the
* terms of the OpenSSL or SSLeay licenses, Savoir-Faire Linux Inc.
* grants you additional permission to convey the resulting work.
* Corresponding Source for a non-source form of such a combination
* shall include the source code for the parts of OpenSSL used as well
* as that of the covered work.
*/
#include "video_provider.h"
namespace sfl_video {
extern "C" {
#include <libavcodec/avcodec.h>
}
int VideoProvider::getBufferSize(int width, int height)
{
// determine required buffer size and allocate buffer
return avpicture_get_size(PIX_FMT_BGRA, width, height);
}
} // end namespace sfl_video
......@@ -37,9 +37,6 @@ class VideoProvider {
public:
virtual void fillBuffer(void *data) = 0;
virtual ~VideoProvider() {}
protected:
static int
getBufferSize(int width, int height);
};
}
......
......@@ -173,7 +173,7 @@ void VideoReceiveThread::setup()
}
// determine required buffer size and allocate buffer
bufferSize_ = getBufferSize(dstWidth_, dstHeight_);
bufferSize_ = avpicture_get_size(PIX_FMT_BGRA, dstWidth_, dstHeight_);
EXIT_IF_FAIL(sink_.start(), "Cannot start shared memory sink");
Manager::instance().getVideoControls()->startedDecoding(id_, sink_.openedName(), dstWidth_, dstHeight_);
......
......@@ -227,7 +227,7 @@ void VideoSendThread::setup()
EXIT_IF_FAIL(ret >= 0, "Could not open codec");
// determine required buffer size and allocate buffer
bufferSize_ = getBufferSize(inputDecoderCtx_->width, inputDecoderCtx_->height);
bufferSize_ = avpicture_get_size(inputDecoderCtx_->pix_fmt, inputDecoderCtx_->width, inputDecoderCtx_->height);
EXIT_IF_FAIL(sink_.start(), "Cannot start shared memory sink");
Manager::instance().getVideoControls()->startedDecoding(id_, sink_.openedName(), inputDecoderCtx_->width, inputDecoderCtx_->height);
......
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