Skip to content

Commit

Permalink
Merge branch 'release-0.5.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
paperManu committed Jan 13, 2017
2 parents 808f81c + d75607f commit ccc5850
Show file tree
Hide file tree
Showing 18 changed files with 1,029 additions and 9 deletions.
6 changes: 5 additions & 1 deletion .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,12 @@ package:
script:
- make -j$(nproc)
- make package
- mv *.deb ../
- mv addons/blender/*.tar.bz2 ../
only:
- tags
artifacts:
name: "splash_${CI_BUILD_REF_NAME}"
paths:
- "build/*.deb"
- "*.deb"
- "*.tar.bz2"
15 changes: 14 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
cmake_minimum_required(VERSION 3.2)
project(
splash
VERSION 0.5.0
VERSION 0.5.2
LANGUAGES C CXX
)

Expand Down Expand Up @@ -97,6 +97,18 @@ elseif(APPLE)
set(HAVE_OSX 1)
endif()

if (DATAPATH_SDK_PATH)
if (IS_DIRECTORY "${DATAPATH_SDK_PATH}/include" AND IS_DIRECTORY "${DATAPATH_SDK_PATH}/utils")
set(HAVE_DATAPATH 1)
else()
set(DATAPATH_SDK_PATH "")
set(HAVE_DATAPATH 0)
endif()
else()
set(DATAPATH_SDK_PATH "")
set(HAVE_DATAPATH 0)
endif()

configure_file("${CMAKE_CURRENT_SOURCE_DIR}/include/config.h.cmake" "${CMAKE_CURRENT_SOURCE_DIR}/include/config.h")

#
Expand Down Expand Up @@ -192,6 +204,7 @@ info_cfg_option(OPENCV_VERSION)
info_cfg_option(PORTAUDIO_VERSION)
info_cfg_option(SHMDATA_VERSION)
info_cfg_option(PYTHONLIBS_VERSION_STRING)
info_cfg_option(DATAPATH_SDK_PATH)
info_cfg_option(DOXYGEN_FOUND)

info_cfg_text("")
Expand Down
7 changes: 7 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
Splash release notes
===================

Splash 0.5.2 (2017-01-13)
--------------------------
New features:
* Added Video4Linux2 support, as well as Datapath capture cards support
* Added _time (in ms) as a built-in uniform for Filter
* Added --forceDisplay command line option

Splash 0.5.0 (2016-12-09)
--------------------------
New features:
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ And if you want the logs to be written to /var/log/splash.log:

Then log out and log back in.

And that's it, you can move on the the [Walkthrough](./Walkthrough) page.
And that's it, you can move on the the [Walkthrough](https://github.com/paperManu/splash/wiki/Walkthrough) page.

#### Mac OSX

Expand Down
2 changes: 1 addition & 1 deletion addons/blender/splash/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
bl_info = {
"name": "Splash output",
"author": "Emmanuel Durand",
"version": (0, 5, 0),
"version": (0, 5, 2),
"blender": (2, 72, 0),
"location": "3D View > Toolbox, File > Export",
"description": "Utility tools to connect Blender to the Splash videomapper",
Expand Down
3 changes: 3 additions & 0 deletions include/config.h.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@
/* Defined to 1 if python3.x is detected */
#cmakedefine01 HAVE_PYTHON

/* Defined to 1 if the Datapath SDK is detected */
#cmakedefine01 HAVE_DATAPATH

/* Support mmx instructions */
#cmakedefine01 HAVE_MMX

Expand Down
196 changes: 196 additions & 0 deletions include/image_v4l2.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,196 @@
/*
* Copyright (C) 2017 Emmanuel Durand
*
* This file is part of Splash.
*
* 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.
*
* Splash 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 Splash. If not, see <http://www.gnu.org/licenses/>.
*/

/*
* @image.h
* The Image_V4L2 class
*/

#ifndef SPLASH_IMAGE_V4L2_H
#define SPLASH_IMAGE_V4L2_H

#include "config.h"
#include "image.h"

#include <deque>
#include <linux/videodev2.h>

namespace Splash
{

class Image_V4L2 : public Image
{
public:
/**
* \brief Constructor
* \param root Root object
*/
Image_V4L2(std::weak_ptr<RootObject> root);

/**
* \brief Destructor
*/
~Image_V4L2();

/**
* No copy constructor, but a copy operator
*/
Image_V4L2(const Image_V4L2&) = delete;
Image_V4L2& operator=(const Image_V4L2&) = delete;
Image_V4L2& operator=(Image_V4L2&&) = default;

private:
std::string _devicePath{"/dev/video0"};
std::string _controlDevicePath{"/dev/video63"};

// Parameters to send to the shader
std::unordered_map<std::string, Values> _shaderUniforms;

// File descriptors
int _controlFd{-1};
int _deviceFd{-1};

// V4L2 stuff
bool _capabilitiesEnumerated{false}; // Only enumerate capabilities once for each device
bool _hasStreamingIO{false};
struct v4l2_capability _v4l2Capability; //!< The video4linux capabilities structure

int _v4l2InputCount{0};
std::vector<struct v4l2_input> _v4l2Inputs{};

int _v4l2StandardCount{0};
std::vector<struct v4l2_standard> _v4l2Standards{};

int _v4l2FormatCount{0};
std::vector<struct v4l2_fmtdesc> _v4l2Formats{};

struct v4l2_format _v4l2Format;
struct v4l2_format _v4l2SourceFormat;
struct v4l2_streamparm _v4l2StreamParams;

// Datapath specific variables
bool _isDatapath{false};
bool _autosetResolution{true};

// Capture parameters
int _v4l2Index{0};
int _outputWidth{1920};
int _outputHeight{1080};
double _captureRate{60.0};
uint32_t _outputPixelFormat{V4L2_PIX_FMT_RGB24};
std::string _sourceFormatAsString{""};

struct v4l2_requestbuffers _v4l2RequestBuffers;
int _bufferCount{3};
std::deque<std::unique_ptr<ImageBuffer>> _imageBuffers{};

bool _capturing{false}; //!< True if currently capturing frames
bool _captureThreadRun{false}; //!< Set to false to stop the capture thread
bool _startCapturing{false};
bool _stopCapturing{false};

ImageBufferSpec _spec{};

std::thread _captureThread{};

/**
* Capture thread function
*/
void captureThreadFunc();

/**
* \brief As the name suggests
*/
void init();

/**
* Initialize V4L2 userptr capture mode
* \return Return true if all went well
*/
bool initializeUserPtrCapture();

/**
* Initialize the capture
* \return Return true if everything is OK
*/
bool initializeCapture();

#if HAVE_DATAPATH
/**
* Open the control device
* \return Return true if everything is OK
*/
bool openControlDevice();

/**
* Close the control device
*/
void closeControlDevice();
#endif

/**
* Open the capture device
* \param devicePath Path to the device
* \return Return true if the device has been successfully opened
*/
bool openCaptureDevice(const std::string& devicePath);

/**
* Close the capture device
*/
void closeCaptureDevice();

/**
* Enumerate capture device inputs
* \return Return true if everything went OK
*/
bool enumerateCaptureDeviceInputs();

/**
* Enumerate capture formats
* \return Return true if everything went OK
*/
bool enumerateCaptureFormats();

/**
* Enumerate video standards
* \return Return true if everything went OK
*/
bool enumerateVideoStandards();

/**
* Do capture from the device
* \return Return true if the capture has been launched successfully
*/
bool doCapture();

/**
* Stop capture from the device
*/
void stopCapture();

/**
* \brief Register new functors to modify attributes
*/
void registerAttributes();
};

} // end of namespace

#endif // SPLASH_IMAGE_V4L2_H
1 change: 1 addition & 0 deletions include/world.h
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ class World : public RootObject

std::map<std::string, int> _scenes; //!< Map holding the PID of the Scene processes
std::string _masterSceneName{""}; //!< Name of the master Scene
std::string _forcedDisplay{""}; //!< Set to force an output display
bool _reloadingConfig{false}; // TODO: workaround to allow for correct reloading when an inner scene was used

std::atomic_int _nextId{0};
Expand Down
6 changes: 6 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ include_directories(../external/piccante/include)
include_directories(../external/stb)
include_directories(../external/syphon/build/Release/Syphon.framework/Headers)

if (HAVE_DATAPATH)
include_directories(${DATAPATH_SDK_PATH}/include)
include_directories(${DATAPATH_SDK_PATH}/utils/include)
endif()

if (APPLE)
include_directories(../external/glad/compatibility/include)
else()
Expand Down Expand Up @@ -87,6 +92,7 @@ target_sources(
gpuBuffer.cpp
imageBuffer.cpp
image.cpp
image_v4l2.cpp
link.cpp
mesh_bezierPatch.cpp
mesh.cpp
Expand Down
13 changes: 13 additions & 0 deletions src/factory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include "./filter.h"
#include "./geometry.h"
#include "./image.h"
#include "./image_v4l2.h"
#if HAVE_GPHOTO
#include "./image_gphoto.h"
#endif
Expand Down Expand Up @@ -138,6 +139,18 @@ void Factory::registerObjects()
_objectBook["geometry"] = Page([&]() { return dynamic_pointer_cast<BaseObject>(make_shared<Geometry>(_root)); }, BaseObject::Category::MISC, "Geometry");
_objectBook["image"] = Page([&]() { return dynamic_pointer_cast<BaseObject>(make_shared<Image>(_root)); }, BaseObject::Category::IMAGE, "image");

_objectBook["image_v4l2"] = Page(
[&]() {
shared_ptr<BaseObject> object;
if (!_isScene)
object = dynamic_pointer_cast<BaseObject>(make_shared<Image_V4L2>(_root));
else
object = dynamic_pointer_cast<BaseObject>(make_shared<Image>(_root));
return object;
},
BaseObject::Category::IMAGE,
"Video4Linux2 input device");

#if HAVE_FFMPEG
_objectBook["image_ffmpeg"] = Page(
[&]() {
Expand Down
3 changes: 3 additions & 0 deletions src/filter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,9 @@ void Filter::updateUniforms()
{
auto shader = _screen->getShader();

// Built-in uniforms
_filterUniforms["_time"] = Values({static_cast<int>(Timer::getTime() / 1000)});

// Update generic uniforms
for (auto& weakObject : _linkedObjects)
{
Expand Down
4 changes: 2 additions & 2 deletions src/image_shmdata.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -124,15 +124,15 @@ void Image_Shmdata::onCaps(const string& dataType)
removeExtraParenthesis(substr);
substr = substr.substr(0, substr.find(","));

if ("RGB" == substr)
if ("BGR" == substr)
{
_bpp = 24;
_channels = 3;
_red = 2;
_green = 1;
_blue = 0;
}
else if ("BGR" == substr)
else if ("RGB" == substr)
{
_bpp = 24;
_channels = 3;
Expand Down
Loading

0 comments on commit ccc5850

Please sign in to comment.