Commit 51aae466 authored by Moto Hira's avatar Moto Hira Committed by Facebook GitHub Bot
Browse files

Replace torchaudio::ffmpeg with torchaudio::io (#3013)

Summary:
Pull Request resolved: https://github.com/pytorch/audio/pull/3013

Namespace clean up before publishing the torchaudio C++ API as prototype.

Reviewed By: hwangjeff

Differential Revision: D42699903

fbshipit-source-id: 8a9eed0390dfa4a152124b42f2b927dbdd3e23d2
parent 12f960b2
......@@ -6,7 +6,7 @@
#include <vector>
namespace torchaudio {
namespace ffmpeg {
namespace io {
////////////////////////////////////////////////////////////////////////////////
// AVDictionary
......@@ -158,5 +158,5 @@ AVFilterGraphPtr::AVFilterGraphPtr()
void AVFilterGraphPtr::reset() {
ptr.reset(get_filter_graph());
}
} // namespace ffmpeg
} // namespace io
} // namespace torchaudio
......@@ -23,7 +23,7 @@ extern "C" {
}
namespace torchaudio {
namespace ffmpeg {
namespace io {
using OptionDict = c10::Dict<std::string, std::string>;
......@@ -187,5 +187,5 @@ struct AVFilterGraphPtr : public Wrapper<AVFilterGraph, AVFilterGraphDeleter> {
AVFilterGraphPtr();
void reset();
};
} // namespace ffmpeg
} // namespace io
} // namespace torchaudio
......@@ -2,7 +2,7 @@
#include <stdexcept>
namespace torchaudio {
namespace ffmpeg {
namespace io {
FilterGraph::FilterGraph(AVMediaType media_type) : media_type(media_type) {
switch (media_type) {
......@@ -200,5 +200,5 @@ int FilterGraph::get_frame(AVFrame* pOutputFrame) {
return av_buffersink_get_frame(buffersink_ctx, pOutputFrame);
}
} // namespace ffmpeg
} // namespace io
} // namespace torchaudio
......@@ -2,7 +2,7 @@
#include <torchaudio/csrc/ffmpeg/ffmpeg.h>
namespace torchaudio {
namespace ffmpeg {
namespace io {
class FilterGraph {
AVMediaType media_type;
......@@ -64,5 +64,5 @@ class FilterGraph {
int get_frame(AVFrame* pOutputFrame);
};
} // namespace ffmpeg
} // namespace io
} // namespace torchaudio
......@@ -4,7 +4,7 @@
#include <torchaudio/csrc/ffmpeg/pybind/stream_writer.h>
namespace torchaudio {
namespace ffmpeg {
namespace io {
namespace {
PYBIND11_MODULE(_torchaudio_ffmpeg, m) {
......@@ -49,5 +49,5 @@ PYBIND11_MODULE(_torchaudio_ffmpeg, m) {
}
} // namespace
} // namespace ffmpeg
} // namespace io
} // namespace torchaudio
......@@ -2,7 +2,7 @@
#include <torchaudio/csrc/ffmpeg/pybind/typedefs.h>
namespace torchaudio {
namespace ffmpeg {
namespace io {
namespace {
SrcInfoPyBind convert_pybind(SrcStreamInfo ssi) {
return SrcInfoPyBind(std::forward_as_tuple(
......@@ -72,5 +72,5 @@ void StreamReaderFileObj::add_video_stream(
hw_accel);
}
} // namespace ffmpeg
} // namespace io
} // namespace torchaudio
......@@ -3,7 +3,7 @@
#include <torchaudio/csrc/ffmpeg/stream_reader/stream_reader_wrapper.h>
namespace torchaudio {
namespace ffmpeg {
namespace io {
// The reason we inherit FileObj instead of making it an attribute
// is so that FileObj is instantiated first.
......@@ -37,5 +37,5 @@ class StreamReaderFileObj : protected FileObj, public StreamReaderBinding {
const c10::optional<std::string>& hw_accel);
};
} // namespace ffmpeg
} // namespace io
} // namespace torchaudio
#include <torchaudio/csrc/ffmpeg/pybind/stream_writer.h>
namespace torchaudio {
namespace ffmpeg {
namespace io {
StreamWriterFileObj::StreamWriterFileObj(
py::object fileobj_,
......@@ -51,5 +51,5 @@ void StreamWriterFileObj::add_video_stream(
hw_accel);
}
} // namespace ffmpeg
} // namespace io
} // namespace torchaudio
......@@ -3,7 +3,7 @@
#include <torchaudio/csrc/ffmpeg/stream_writer/stream_writer.h>
namespace torchaudio {
namespace ffmpeg {
namespace io {
class StreamWriterFileObj : private FileObj, public StreamWriter {
public:
......@@ -31,5 +31,5 @@ class StreamWriterFileObj : private FileObj, public StreamWriter {
const c10::optional<std::string>& hw_accel);
};
} // namespace ffmpeg
} // namespace io
} // namespace torchaudio
#include <torchaudio/csrc/ffmpeg/pybind/typedefs.h>
namespace torchaudio {
namespace ffmpeg {
namespace io {
namespace {
static int read_function(void* opaque, uint8_t* buf, int buf_size) {
......@@ -112,5 +112,5 @@ OptionMap dict2map(const OptionDict& src) {
return ret;
}
} // namespace ffmpeg
} // namespace io
} // namespace torchaudio
......@@ -3,7 +3,7 @@
#include <torchaudio/csrc/ffmpeg/ffmpeg.h>
namespace torchaudio {
namespace ffmpeg {
namespace io {
struct FileObj {
py::object fileobj;
......@@ -20,5 +20,5 @@ c10::optional<OptionDict> map2dict(const c10::optional<OptionMap>& src);
OptionMap dict2map(const OptionDict& src);
} // namespace ffmpeg
} // namespace io
} // namespace torchaudio
......@@ -4,7 +4,7 @@
#include <torchaudio/csrc/ffmpeg/stream_reader/typedefs.h>
namespace torchaudio {
namespace ffmpeg {
namespace io {
//////////////////////////////////////////////////////////////////////////////
// Buffer Interface
......@@ -29,5 +29,5 @@ class Buffer {
virtual void flush() = 0;
};
} // namespace ffmpeg
} // namespace io
} // namespace torchaudio
......@@ -2,7 +2,7 @@
#include <torchaudio/csrc/ffmpeg/stream_reader/buffer/common.h>
namespace torchaudio {
namespace ffmpeg {
namespace io {
namespace detail {
ChunkedBuffer::ChunkedBuffer(
......@@ -152,5 +152,5 @@ void ChunkedBuffer::flush() {
}
} // namespace detail
} // namespace ffmpeg
} // namespace io
} // namespace torchaudio
......@@ -3,7 +3,7 @@
#include <torchaudio/csrc/ffmpeg/stream_reader/buffer.h>
namespace torchaudio {
namespace ffmpeg {
namespace io {
namespace detail {
//////////////////////////////////////////////////////////////////////////////
......@@ -63,5 +63,5 @@ class ChunkedVideoBuffer : public ChunkedBuffer {
};
} // namespace detail
} // namespace ffmpeg
} // namespace io
} // namespace torchaudio
......@@ -7,7 +7,7 @@
#endif
namespace torchaudio {
namespace ffmpeg {
namespace io {
namespace detail {
torch::Tensor convert_audio(AVFrame* pFrame) {
......@@ -380,5 +380,5 @@ torch::Tensor convert_image(AVFrame* frame, const torch::Device& device) {
}
} // namespace detail
} // namespace ffmpeg
} // namespace io
} // namespace torchaudio
......@@ -3,7 +3,7 @@
#include <torchaudio/csrc/ffmpeg/ffmpeg.h>
namespace torchaudio {
namespace ffmpeg {
namespace io {
namespace detail {
//////////////////////////////////////////////////////////////////////////////
......@@ -14,5 +14,5 @@ torch::Tensor convert_audio(AVFrame* frame);
torch::Tensor convert_image(AVFrame* frame, const torch::Device& device);
} // namespace detail
} // namespace ffmpeg
} // namespace io
} // namespace torchaudio
......@@ -2,7 +2,7 @@
#include <torchaudio/csrc/ffmpeg/stream_reader/buffer/unchunked_buffer.h>
namespace torchaudio {
namespace ffmpeg {
namespace io {
namespace detail {
UnchunkedVideoBuffer::UnchunkedVideoBuffer(const torch::Device& device)
......@@ -43,5 +43,5 @@ void UnchunkedBuffer::flush() {
}
} // namespace detail
} // namespace ffmpeg
} // namespace io
} // namespace torchaudio
......@@ -5,7 +5,7 @@
#include <deque>
namespace torchaudio {
namespace ffmpeg {
namespace io {
namespace detail {
//////////////////////////////////////////////////////////////////////////////
......@@ -42,5 +42,5 @@ class UnchunkedVideoBuffer : public UnchunkedBuffer {
};
} // namespace detail
} // namespace ffmpeg
} // namespace io
} // namespace torchaudio
#include <torchaudio/csrc/ffmpeg/stream_reader/decoder.h>
namespace torchaudio {
namespace ffmpeg {
namespace io {
////////////////////////////////////////////////////////////////////////////////
// Decoder
......@@ -131,5 +131,5 @@ void Decoder::flush_buffer() {
avcodec_flush_buffers(pCodecContext);
}
} // namespace ffmpeg
} // namespace io
} // namespace torchaudio
......@@ -3,7 +3,7 @@
#include <torchaudio/csrc/ffmpeg/ffmpeg.h>
namespace torchaudio {
namespace ffmpeg {
namespace io {
class Decoder {
AVCodecContextPtr pCodecContext;
......@@ -34,5 +34,5 @@ class Decoder {
void flush_buffer();
};
} // namespace ffmpeg
} // namespace io
} // namespace torchaudio
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