Commit 2ace2c4b authored by André Anjos's avatar André Anjos 💬

[cleanup] Small cleanup

- Avoid double-construction of bindings as Library
- Fix documentation strings
- Patch unthrown exceptions
parent 29d71c9a
# import Libraries of other lib packages
import bob.io.base
# import our own Library
import bob.extension
bob.extension.load_bob_library('bob.io.video', __file__)
from ._library import *
from . import version
from .version import module as __version__
......@@ -12,6 +8,7 @@ from .version import module as __version__
def get_config():
"""Returns a string containing the configuration information.
"""
import bob.extension
return bob.extension.get_config(__name__, version.externals)
......
......@@ -9,7 +9,7 @@
* Copyright (C) Idiap Research Institute, Martigny, Switzerland
*/
#include <bob.io.video/reader.h>
#include "reader.h"
#include <stdexcept>
#include <boost/format.hpp>
......
......@@ -25,7 +25,7 @@ extern "C" {
#include <bob.core/logging.h>
#include <bob.core/assert.h>
#include <bob.io.video/utils.h>
#include "utils.h"
/**
* Some code to account for older versions of ffmpeg
......
......@@ -9,7 +9,7 @@
* Copyright (C) Idiap Research Institute, Martigny, Switzerland
*/
#include <bob.io.video/writer.h>
#include "writer.h"
#include <boost/format.hpp>
#include <boost/preprocessor.hpp>
......@@ -209,6 +209,7 @@ namespace bob { namespace io { namespace video {
boost::format m("input data type = `%s' does not conform to the specified input specifications (3D array = `%s' or 4D array = `%s'), while writing data to file `%s'");
m % type.str() % m_typeinfo_frame.str() % m_typeinfo_video.str()
% m_filename;
throw std::runtime_error(m.str());
}
if ( type.nd == 3 ) { //appends single frame
......@@ -262,6 +263,7 @@ namespace bob { namespace io { namespace video {
boost::format m("input data type information = `%s' does not conform to the specified input specifications (3D array = `%s' or 4D array = `%s'), while writing data to file `%s'");
m % type.str() % m_typeinfo_frame.str() % m_typeinfo_video.str()
% m_filename;
throw std::runtime_error(m.str());
}
}
......
......@@ -18,9 +18,10 @@
#include <bob.io.base/CodecRegistry.h>
#include <bob.io.base/File.h>
#include <bob.io.video/reader.h>
#include <bob.io.video/writer.h>
#include <bob.io.video/utils.h>
#include "cpp/reader.h"
#include "cpp/writer.h"
#include "cpp/utils.h"
class VideoFile: public bob::io::base::File {
......
......@@ -16,7 +16,8 @@
#include <bob.io.base/api.h>
#include "file.h"
#include <bob.io.video/utils.h>
#include "cpp/utils.h"
extern "C" {
......
......@@ -14,7 +14,7 @@
#include <bob.io.base/api.h>
#include <stdexcept>
#include <bob.io.video/reader.h>
#include "cpp/reader.h"
#define VIDEOREADER_NAME "reader"
PyDoc_STRVAR(s_videoreader_str, BOB_EXT_MODULE_PREFIX "." VIDEOREADER_NAME);
......@@ -393,7 +393,7 @@ static PyObject* PyBobIoVideoReader_Load(PyBobIoVideoReaderObject* self, PyObjec
PyDoc_STRVAR(s_load_str, "load");
PyDoc_STRVAR(s_load_doc,
"x.load([raise_on_error=False] -> numpy.ndarray\n\
"x.load([raise_on_error=False]) -> numpy.ndarray\n\
\n\
Loads all of the video stream in a numpy ndarray organized\n\
in this way: (frames, color-bands, height, width). I'll dynamically\n\
......
......@@ -14,13 +14,13 @@
#include <bob.io.base/api.h>
#include <stdexcept>
#include <bob.io.video/writer.h>
#include "cpp/writer.h"
#define VIDEOWRITER_NAME "writer"
PyDoc_STRVAR(s_videowriter_str, BOB_EXT_MODULE_PREFIX "." VIDEOWRITER_NAME);
PyDoc_STRVAR(s_videowriter_doc,
"writer(filename, height, width, [framerate=25., [bitrate=1500000., [gop=12, [codec='', [format='', [check=True]) -> new writer\n\
"writer(filename, height, width, [framerate=25., [bitrate=1500000., [gop=12, [codec='', [format='', [check=True]]]]]]) -> new writer\n\
\n\
Use this object to write frames to video files.\n\
\n\
......
......@@ -7,7 +7,7 @@ bob_packages = ['bob.core', 'bob.io.base']
from setuptools import setup, find_packages, dist
dist.Distribution(dict(setup_requires=['bob.extension', 'bob.blitz'] + bob_packages))
from bob.blitz.extension import Extension, Library, build_ext
from bob.blitz.extension import Extension, build_ext
from bob.extension import pkgconfig, find_library
from bob.extension.utils import load_requirements
......@@ -79,19 +79,6 @@ setup(
define_macros = define_macros,
),
Library("bob.io.video.bob_io_video",
[
"bob/io/video/cpp/utils.cpp",
"bob/io/video/cpp/reader.cpp",
"bob/io/video/cpp/writer.cpp",
],
define_macros = define_macros,
boost_modules = ['system'],
version = version,
bob_packages = bob_packages,
packages = packages,
),
Extension("bob.io.video._library",
[
"bob/io/video/cpp/utils.cpp",
......
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