Skip to content
Snippets Groups Projects
Commit 14dd90cd authored by Adrien Béraud's avatar Adrien Béraud Committed by gerrit2
Browse files

android: stub video config implementor class

Refs #74603
Refs #74605

Change-Id: I64ba316f03c07dd098f8c19fea30c8d87f68161d
parent e6e51f48
No related branches found
No related tags found
No related merge requests found
...@@ -569,7 +569,7 @@ AS_IF([test "x$with_upnp" = "xyes"], ...@@ -569,7 +569,7 @@ AS_IF([test "x$with_upnp" = "xyes"],
AC_DEFINE([HAVE_LIBUPNP], 0, [Define if you have libupnp])]) AC_DEFINE([HAVE_LIBUPNP], 0, [Define if you have libupnp])])
]) ])
AC_DEFINE_UNQUOTED([HAVE_SHM], `if test -z "${HAVE_LINUX_TRUE}"; then echo 1; else echo 0; fi`, AC_DEFINE_UNQUOTED([HAVE_SHM], `if test -z "${HAVE_LINUX_TRUE}" && test -z "${HAVE_ANDROID_FALSE}" ; then echo 1; else echo 0; fi`,
[Define if you have shared memory support]) [Define if you have shared memory support])
# DOXYGEN # DOXYGEN
...@@ -623,6 +623,7 @@ AC_CONFIG_FILES([Makefile \ ...@@ -623,6 +623,7 @@ AC_CONFIG_FILES([Makefile \
src/hooks/Makefile \ src/hooks/Makefile \
src/media/video/Makefile \ src/media/video/Makefile \
src/media/video/v4l2/Makefile \ src/media/video/v4l2/Makefile \
src/media/video/androidvideo/Makefile \
src/media/video/osxvideo/Makefile \ src/media/video/osxvideo/Makefile \
src/media/video/winvideo/Makefile \ src/media/video/winvideo/Makefile \
src/media/video/test/Makefile \ src/media/video/test/Makefile \
......
...@@ -5,9 +5,14 @@ RING_VIDEO_LIBS= ...@@ -5,9 +5,14 @@ RING_VIDEO_LIBS=
if RING_VIDEO if RING_VIDEO
RING_VIDEO_LIBS+=./media/video/libvideo.la RING_VIDEO_LIBS+=./media/video/libvideo.la
if HAVE_LINUX if HAVE_LINUX
if HAVE_ANDROID
RING_VIDEO_LIBS+= \
./media/video/androidvideo/libandroidvideo.la
else
RING_VIDEO_LIBS+= \ RING_VIDEO_LIBS+= \
./media/video/v4l2/libv4l2.la ./media/video/v4l2/libv4l2.la
endif endif
endif
if HAVE_OSX if HAVE_OSX
RING_VIDEO_LIBS+= \ RING_VIDEO_LIBS+= \
./media/video/osxvideo/libosxvideo.la ./media/video/osxvideo/libosxvideo.la
......
...@@ -3,9 +3,14 @@ include $(top_srcdir)/globals.mak ...@@ -3,9 +3,14 @@ include $(top_srcdir)/globals.mak
SUBDIRS= test SUBDIRS= test
if HAVE_LINUX if HAVE_LINUX
if HAVE_ANDROID
SUBDIRS+= \
androidvideo
else
SUBDIRS+= \ SUBDIRS+= \
v4l2 v4l2
endif endif
endif
if HAVE_OSX if HAVE_OSX
SUBDIRS+= \ SUBDIRS+= \
......
include $(top_srcdir)/globals.mak
noinst_LTLIBRARIES = libandroidvideo.la
libandroidvideo_la_SOURCES = \
video_device_impl.cpp \
video_device_monitor_impl.cpp
#AM_CXXFLAGS = @UDEV_CFLAGS@
#libandroidvideo_la_LIBADD = @UDEV_LIBS@
/*
* Copyright (C) 2011-2015 Savoir-Faire Linux Inc.
* Author: Rafaël Carré <rafael.carre@savoirfairelinux.com>
* Author: Vivien Didelot <vivien.didelot@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 "logger.h"
#include "../video_device.h"
#include <algorithm>
#include <map>
#include <sstream>
#include <stdexcept>
#include <string>
#include <vector>
namespace ring { namespace video {
class VideoDeviceImpl {
public:
/**
* @throw std::runtime_error
*/
VideoDeviceImpl(const std::string& path);
std::string device;
std::string name;
std::vector<std::string> getChannelList() const;
std::vector<std::string> getSizeList(const std::string& channel) const;
std::vector<std::string> getRateList(const std::string& channel, const std::string& size) const;
VideoSettings getSettings() const;
void applySettings(VideoSettings settings);
DeviceParams getDeviceParams() const;
};
VideoDeviceImpl::VideoDeviceImpl(const std::string& path) :
device(path), name()
{
// Set default settings
applySettings(VideoSettings());
}
std::vector<std::string> VideoDeviceImpl::getChannelList() const
{
}
std::vector<std::string>
VideoDeviceImpl::getSizeList(const std::string& channel) const
{
}
std::vector<std::string>
VideoDeviceImpl::getRateList(const std::string& channel, const std::string& size) const
{
}
void
VideoDeviceImpl::applySettings(VideoSettings settings)
{
}
VideoSettings
VideoDeviceImpl::getSettings() const
{
VideoSettings settings;
settings.name = name;
return settings;
}
DeviceParams
VideoDeviceImpl::getDeviceParams() const
{
DeviceParams params;
params.input = device;
params.format = "android";
return params;
}
VideoDevice::VideoDevice(const std::string& path) :
deviceImpl_(new VideoDeviceImpl(path))
{
//node_ = path;
name = deviceImpl_->name;
}
void
VideoDevice::applySettings(VideoSettings settings)
{
deviceImpl_->applySettings(settings);
}
VideoSettings
VideoDevice::getSettings() const
{
return deviceImpl_->getSettings();
}
DeviceParams
VideoDevice::getDeviceParams() const
{
return deviceImpl_->getDeviceParams();
}
DRing::VideoCapabilities
VideoDevice::getCapabilities() const
{
DRing::VideoCapabilities cap;
for (const auto& chan : deviceImpl_->getChannelList())
for (const auto& size : deviceImpl_->getSizeList(chan))
cap[chan][size] = deviceImpl_->getRateList(chan, size);
return cap;
}
VideoDevice::~VideoDevice()
{}
}} // namespace ring::video
/*
* Copyright (C) 2009 Rémi Denis-Courmont
*
* Copyright (C) 2004-2015 Savoir-Faire Linux Inc.
* Author: Rafaël Carré <rafael.carre@savoirfairelinux.com>
* Author: Vivien Didelot <vivien.didelot@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_device_monitor.h"
#include "logger.h"
#include "noncopyable.h"
#include <algorithm>
#include <mutex>
#include <sstream>
#include <stdexcept> // for std::runtime_error
#include <string>
#include <thread>
#include <vector>
namespace ring { namespace video {
using std::vector;
using std::string;
class VideoDeviceMonitorImpl {
public:
/*
* This is the only restriction to the pImpl design:
* as the Linux implementation has a thread, it needs a way to notify
* devices addition and deletion.
*
* This class should maybe inherit from VideoDeviceMonitor instead of
* being its pImpl.
*/
VideoDeviceMonitorImpl(VideoDeviceMonitor* monitor);
~VideoDeviceMonitorImpl();
void start();
private:
NON_COPYABLE(VideoDeviceMonitorImpl);
VideoDeviceMonitor* monitor_;
void run();
std::thread thread_;
mutable std::mutex mutex_;
/*
udev *udev_;
udev_monitor *udev_mon_;*/
bool probing_;
};
VideoDeviceMonitorImpl::VideoDeviceMonitorImpl(VideoDeviceMonitor* monitor) :
monitor_(monitor),
thread_(), mutex_(),
probing_(false)
{}
void VideoDeviceMonitorImpl::start()
{
probing_ = true;
thread_ = std::thread(&VideoDeviceMonitorImpl::run, this);
}
VideoDeviceMonitorImpl::~VideoDeviceMonitorImpl()
{
probing_ = false;
if (thread_.joinable())
thread_.join();
}
void VideoDeviceMonitorImpl::run()
{
/*if (!udev_mon_) {
probing_ = false;
return;
}
const int udev_fd = udev_monitor_get_fd(udev_mon_);*/
while (probing_) {
}
}
VideoDeviceMonitor::VideoDeviceMonitor() :
preferences_(), devices_(),
monitorImpl_(new VideoDeviceMonitorImpl(this))
{
monitorImpl_->start();
}
VideoDeviceMonitor::~VideoDeviceMonitor()
{}
}} // namespace ring::video
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment