diff --git a/audio/paddleaudio/csrc/pybind/sox/io.cpp b/audio/paddleaudio/csrc/pybind/sox/io.cpp index 93a85cbe7f23d904ddb5fd7ba565ee145b91ef8d..31ac1c548864a2513022ec297ebb2d648cc6c8ab 100644 --- a/audio/paddleaudio/csrc/pybind/sox/io.cpp +++ b/audio/paddleaudio/csrc/pybind/sox/io.cpp @@ -25,7 +25,8 @@ auto get_info_file(const std::string &path, const std::string &format) SoxFormat sf(sox_open_read(path.data(), /*signal=*/nullptr, /*encoding=*/nullptr, - /*filetype=*/format.data())); + /*filetype=*/format.empty() ? nullptr : format.data())); + validate_input_file(sf, path); @@ -54,7 +55,7 @@ auto get_info_fileobj(py::object fileobj, const std::string &format) SoxFormat sf(sox_open_mem_read(buf, buf_size, /*signal=*/nullptr, /*encoding=*/nullptr, - /*filetype=*/format.data())); + /*filetype=*/format.empty() ? nullptr : format.data())); // In case of streamed data, length can be 0 validate_input_memfile(sf); diff --git a/audio/setup.py b/audio/setup.py index 0e78d9fc6ae0180c19c4ce477aa1547010c8f1a8..bf6c4d1632d17a5772d20e4b75d43bd5f9fe3146 100644 --- a/audio/setup.py +++ b/audio/setup.py @@ -19,7 +19,6 @@ import pybind11 import setuptools from setuptools import Extension from setuptools.command.build_ext import build_ext -from setuptools.command.install import install from setuptools.command.test import test # set the version here @@ -47,11 +46,6 @@ class TestCommand(test): os.system(f'pytest {benchmark_item}') -class InstallCommand(install): - def run(self): - install.run(self) - - class ExtBuildCommand(build_ext): def run(self): try: @@ -149,7 +143,6 @@ setuptools.setup( }, ext_modules=get_ext_modules(), cmdclass={ - 'install': InstallCommand, "build_ext": ExtBuildCommand, 'test': TestCommand, }, )