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

Clean-up StreamReader/StreamWriter interface (#3328)

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

Make the `AVIOContext`-based constructor protected for better encapsulation.
AVFormatContext and optional AVIOContext are managed by StreamReader/Writer, so it's better that they are abstracted away from client code.

Reviewed By: hwangjeff

Differential Revision: D45779629

fbshipit-source-id: 44c31e8af785447cb47aad0c44bf4ecf1aeebeaa
parent 1c7309d2
......@@ -26,11 +26,20 @@ class StreamWriter {
bool is_open = false;
int current_key = 0;
protected:
/// @cond
private:
explicit StreamWriter(AVFormatContext*);
protected:
/// Construct StreamWriter from custom IO
///
/// @param io_ctx Custom IO.
/// @param format Specify output format.
explicit StreamWriter(
AVIOContext* io_ctx,
const c10::optional<std::string>& format = c10::nullopt);
/// @endcond
public:
......@@ -43,19 +52,6 @@ class StreamWriter {
const std::string& dst,
const c10::optional<std::string>& format = c10::nullopt);
/// @cond
/// Construct StreamWriter from custom IO
///
/// @param io_ctx Custom IO.
/// @param format Specify output format.
// TODO: Move this into wrapper class.
explicit StreamWriter(
AVIOContext* io_ctx,
const c10::optional<std::string>& format = c10::nullopt);
/// @endcond
// Non-copyable
StreamWriter(const StreamWriter&) = delete;
StreamWriter& operator=(const StreamWriter&) = delete;
......
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