Commit 64a9a4fa authored by Manuel Günther's avatar Manuel Günther
Browse files

Removed usage of PyBobIo_FilenameConverter, see bob.io.base#7

parent ea51ad90
Pipeline #11597 passed with stages
in 11 minutes and 55 seconds
......@@ -42,23 +42,15 @@ BOB_TRY
/* Parses input arguments in a single shot */
char** kwlist = s_reader.kwlist();
PyObject* filename = 0;
char* filename = 0;
PyObject* pycheck = 0;
if (!PyArg_ParseTupleAndKeywords(args, kwds, "O&|O", kwlist,
&PyBobIo_FilenameConverter, &filename, &pycheck)) return -1;
auto filename_ = make_safe(filename);
if (!PyArg_ParseTupleAndKeywords(args, kwds, "s|O", kwlist,
&filename, &pycheck)) return -1;
bool check = (pycheck && PyObject_IsTrue(pycheck));
#if PY_VERSION_HEX >= 0x03000000
const char* c_filename = PyBytes_AS_STRING(filename);
#else
const char* c_filename = PyString_AS_STRING(filename);
#endif
self->v.reset(new bob::io::video::Reader(c_filename, check));
self->v.reset(new bob::io::video::Reader(filename, check));
return 0; ///< SUCCESS
BOB_CATCH_MEMBER("constructor", -1)
}
......
......@@ -51,7 +51,7 @@ BOB_TRY
/* Parses input arguments in a single shot */
char** kwlist = s_writer.kwlist();
PyObject* filename = 0;
char* filename = 0;
Py_ssize_t height = 0;
Py_ssize_t width = 0;
......@@ -63,20 +63,16 @@ BOB_TRY
char* format = 0;
PyObject* pycheck = Py_True;
if (!PyArg_ParseTupleAndKeywords(args, kwds, "O&nn|ddnssO", kwlist,
&PyBobIo_FilenameConverter, &filename,
if (!PyArg_ParseTupleAndKeywords(args, kwds, "snn|ddnssO", kwlist,
&filename,
&height, &width, &framerate, &bitrate, &gop, &codec,
&format, &pycheck)) return -1;
auto filename_ = make_safe(filename);
std::string codec_str = codec?codec:"";
std::string format_str = format?format:"";
bool check = PyObject_IsTrue(pycheck);
const char* c_filename = PyString_AS_STRING(filename);
self->v = boost::make_shared<bob::io::video::Writer>(c_filename,
self->v = boost::make_shared<bob::io::video::Writer>(filename,
height, width, framerate, bitrate, gop, codec_str, format_str, check);
return 0; ///< SUCCESS
......
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