Permalink
Browse files

Merge pull request #3 from steinwurf/upgrade-petro

Upgrade petro
  • Loading branch information...
jpihl committed Apr 19, 2018
2 parents 331efa9 + 69a0a6d commit cdfab3fbc6d5d7597f4bc3a0d9dc1626ba225ded
Showing with 20 additions and 8 deletions.
  1. +1 −0 NEWS.rst
  2. +1 −1 resolve.json
  3. +16 −5 src/petro_python/petro.cpp
  4. +2 −2 test/petro_python_tests.py
@@ -7,6 +7,7 @@ every change, see the Git log.
Latest
------
* tbd
* Major: Upgrade to petro 12
2.0.0
-----
@@ -17,7 +17,7 @@
"name": "petro",
"resolver": "git",
"method": "semver",
"major": 7,
"major": 12,
"sources": ["github.com/steinwurf/petro.git"]
},
{
@@ -8,6 +8,7 @@
#include <cstdint>
#include <string>
#include <vector>
#include <system_error>
#include <petro/extractor/aac_sample_extractor.hpp>
#include <petro/extractor/avc_sample_extractor.hpp>
@@ -24,6 +25,17 @@ static PyObject* pointer_to_python(const uint8_t* data, uint32_t size)
#endif
}
template<class Extractor>
void open(Extractor& extractor)
{
std::error_code error;
extractor.open(error);
if (error)
{
throw std::system_error(error);
}
}
template<class Extractor>
PyObject* sample_data(Extractor& extractor)
{
@@ -54,9 +66,8 @@ void define_extractor_functions(ExtractorClass& extrator_class)
using boost::python::arg;
extrator_class
.def("open", &extractor_type::open,
"Open extractor.\n\n"
"\t:returns: True if the operation was succesful, otherwise False.\n")
.def("open", &open<extractor_type>,
"Open extractor. Throws an exception if the operation failed.")
.def("close", &extractor_type::close, "Close extractor.")
.def("reset", &extractor_type::reset, "Reset extractor.")
.def("file_path", &extractor_type::file_path,
@@ -100,7 +111,7 @@ void create_extractors()
class_<petro::extractor::aac_sample_extractor, boost::noncopyable>(
"AACSampleExtractor",
"Extractor for extracting AAC samples.",
init<>("Extrator constructor."));
init<>("Extractor constructor."));
define_extractor_functions(aac_extractor_class);
aac_extractor_class
.def("adts_header", &adts_header,
@@ -111,7 +122,7 @@ void create_extractors()
class_<petro::extractor::avc_sample_extractor, boost::noncopyable>(
"AVCSampleExtractor",
"Extractor for extracting AVC samples.",
init<>("Extrator constructor."));
init<>("Extractor constructor."));
define_extractor_functions(avc_extractor_class);
avc_extractor_class
.def("sps", &sps,
@@ -42,7 +42,7 @@ def test_extraction(self):
self.assertEqual(
mp4_file_path, extractor.file_path(), msg=mp4_file_path)
self.assertTrue(extractor.open())
extractor.open()
self.check_sample(h264_file, extractor.sps())
self.check_sample(h264_file, extractor.pps())
@@ -99,7 +99,7 @@ def test_extraction(self):
self.assertEqual(
mp4_file_path, extractor.file_path(), msg=mp4_file_path)
self.assertTrue(extractor.open())
extractor.open()
self.assertFalse(extractor.at_end())
while not extractor.at_end():

0 comments on commit cdfab3f

Please sign in to comment.