From fa44bdab1fe49bab58389e7b6a33061ffced9bc7 Mon Sep 17 00:00:00 2001 From: Richard Barnes Date: Wed, 23 Oct 2024 16:30:53 -0400 Subject: [PATCH] c10::nullopt -> std::nullopt Differential Revision: D64835967 Pull Request resolved: https://github.com/pytorch/audio/pull/3848 --- .../ffmpeg/stream_reader/stream_reader.h | 26 +++---- .../ffmpeg/stream_writer/stream_writer.h | 74 +++++++++---------- 2 files changed, 50 insertions(+), 50 deletions(-) diff --git a/src/libtorio/ffmpeg/stream_reader/stream_reader.h b/src/libtorio/ffmpeg/stream_reader/stream_reader.h index 5550d10777..a8e1d9f065 100644 --- a/src/libtorio/ffmpeg/stream_reader/stream_reader.h +++ b/src/libtorio/ffmpeg/stream_reader/stream_reader.h @@ -66,8 +66,8 @@ class StreamingMediaDecoder { /// (opening source). explicit StreamingMediaDecoder( AVIOContext* io_ctx, - const std::optional& format = c10::nullopt, - const std::optional& option = c10::nullopt); + const std::optional& format = std::nullopt, + const std::optional& option = std::nullopt); /// @endcond @@ -81,8 +81,8 @@ class StreamingMediaDecoder { /// (opening source). explicit StreamingMediaDecoder( const std::string& src, - const std::optional& format = c10::nullopt, - const std::optional& option = c10::nullopt); + const std::optional& format = std::nullopt, + const std::optional& option = std::nullopt); ///@} @@ -205,9 +205,9 @@ class StreamingMediaDecoder { int64_t i, int64_t frames_per_chunk, int64_t num_chunks, - const std::optional& filter_desc = c10::nullopt, - const std::optional& decoder = c10::nullopt, - const std::optional& decoder_option = c10::nullopt); + const std::optional& filter_desc = std::nullopt, + const std::optional& decoder = std::nullopt, + const std::optional& decoder_option = std::nullopt); /// Define an output video stream. /// /// @param i,frames_per_chunk,num_chunks,filter_desc,decoder,decoder_option @@ -226,10 +226,10 @@ class StreamingMediaDecoder { int64_t i, int64_t frames_per_chunk, int64_t num_chunks, - const std::optional& filter_desc = c10::nullopt, - const std::optional& decoder = c10::nullopt, - const std::optional& decoder_option = c10::nullopt, - const std::optional& hw_accel = c10::nullopt); + const std::optional& filter_desc = std::nullopt, + const std::optional& decoder = std::nullopt, + const std::optional& decoder_option = std::nullopt, + const std::optional& hw_accel = std::nullopt); /// @cond /// Add a output packet stream. @@ -315,7 +315,7 @@ class StreamingMediaDecoder { /// @param timeout See `process_packet_block()` /// @param backoff See `process_packet_block()` int fill_buffer( - const std::optional& timeout = c10::nullopt, + const std::optional& timeout = std::nullopt, const double backoff = 10.); ///@} @@ -383,7 +383,7 @@ class StreamingMediaDecoderCustomIO : private detail::CustomInput, int buffer_size, int (*read_packet)(void* opaque, uint8_t* buf, int buf_size), int64_t (*seek)(void* opaque, int64_t offset, int whence) = nullptr, - const std::optional& option = c10::nullopt); + const std::optional& option = std::nullopt); }; // For BC diff --git a/src/libtorio/ffmpeg/stream_writer/stream_writer.h b/src/libtorio/ffmpeg/stream_writer/stream_writer.h index fc8b3ae621..a646d3f38a 100644 --- a/src/libtorio/ffmpeg/stream_writer/stream_writer.h +++ b/src/libtorio/ffmpeg/stream_writer/stream_writer.h @@ -38,7 +38,7 @@ class StreamingMediaEncoder { /// @param format Specify output format. explicit StreamingMediaEncoder( AVIOContext* io_ctx, - const std::optional& format = c10::nullopt); + const std::optional& format = std::nullopt); /// @endcond @@ -50,7 +50,7 @@ class StreamingMediaEncoder { /// ``dst``. explicit StreamingMediaEncoder( const std::string& dst, - const std::optional& format = c10::nullopt); + const std::optional& format = std::nullopt); // Non-copyable StreamingMediaEncoder(const StreamingMediaEncoder&) = delete; @@ -113,13 +113,13 @@ class StreamingMediaEncoder { int sample_rate, int num_channels, const std::string& format, - const std::optional& encoder = c10::nullopt, - const std::optional& encoder_option = c10::nullopt, - const std::optional& encoder_format = c10::nullopt, - const std::optional& encoder_sample_rate = c10::nullopt, - const std::optional& encoder_num_channels = c10::nullopt, - const std::optional& codec_config = c10::nullopt, - const std::optional& filter_desc = c10::nullopt); + const std::optional& encoder = std::nullopt, + const std::optional& encoder_option = std::nullopt, + const std::optional& encoder_format = std::nullopt, + const std::optional& encoder_sample_rate = std::nullopt, + const std::optional& encoder_num_channels = std::nullopt, + const std::optional& codec_config = std::nullopt, + const std::optional& filter_desc = std::nullopt); /// Add an output video stream. /// @@ -161,15 +161,15 @@ class StreamingMediaEncoder { int width, int height, const std::string& format, - const std::optional& encoder = c10::nullopt, - const std::optional& encoder_option = c10::nullopt, - const std::optional& encoder_format = c10::nullopt, - const std::optional& encoder_frame_rate = c10::nullopt, - const std::optional& encoder_width = c10::nullopt, - const std::optional& encoder_height = c10::nullopt, - const std::optional& hw_accel = c10::nullopt, - const std::optional& codec_config = c10::nullopt, - const std::optional& filter_desc = c10::nullopt); + const std::optional& encoder = std::nullopt, + const std::optional& encoder_option = std::nullopt, + const std::optional& encoder_format = std::nullopt, + const std::optional& encoder_frame_rate = std::nullopt, + const std::optional& encoder_width = std::nullopt, + const std::optional& encoder_height = std::nullopt, + const std::optional& hw_accel = std::nullopt, + const std::optional& codec_config = std::nullopt, + const std::optional& filter_desc = std::nullopt); /// @cond /// Add output audio frame stream. /// Allows for writing frames rather than tensors via `write_frame`. @@ -179,13 +179,13 @@ class StreamingMediaEncoder { int sample_rate, int num_channels, const std::string& format, - const std::optional& encoder = c10::nullopt, - const std::optional& encoder_option = c10::nullopt, - const std::optional& encoder_format = c10::nullopt, - const std::optional& encoder_sample_rate = c10::nullopt, - const std::optional& encoder_num_channels = c10::nullopt, - const std::optional& codec_config = c10::nullopt, - const std::optional& filter_desc = c10::nullopt); + const std::optional& encoder = std::nullopt, + const std::optional& encoder_option = std::nullopt, + const std::optional& encoder_format = std::nullopt, + const std::optional& encoder_sample_rate = std::nullopt, + const std::optional& encoder_num_channels = std::nullopt, + const std::optional& codec_config = std::nullopt, + const std::optional& filter_desc = std::nullopt); /// Add output video frame stream. /// Allows for writing frames rather than tensors via `write_frame`. @@ -196,15 +196,15 @@ class StreamingMediaEncoder { int width, int height, const std::string& format, - const std::optional& encoder = c10::nullopt, - const std::optional& encoder_option = c10::nullopt, - const std::optional& encoder_format = c10::nullopt, - const std::optional& encoder_frame_rate = c10::nullopt, - const std::optional& encoder_width = c10::nullopt, - const std::optional& encoder_height = c10::nullopt, - const std::optional& hw_accel = c10::nullopt, - const std::optional& codec_config = c10::nullopt, - const std::optional& filter_desc = c10::nullopt); + const std::optional& encoder = std::nullopt, + const std::optional& encoder_option = std::nullopt, + const std::optional& encoder_format = std::nullopt, + const std::optional& encoder_frame_rate = std::nullopt, + const std::optional& encoder_width = std::nullopt, + const std::optional& encoder_height = std::nullopt, + const std::optional& hw_accel = std::nullopt, + const std::optional& codec_config = std::nullopt, + const std::optional& filter_desc = std::nullopt); /// Add packet stream. Intended to be used in conjunction with /// ``StreamingMediaDecoder`` to perform packet passthrough. @@ -226,7 +226,7 @@ class StreamingMediaEncoder { /// Open the output file / device and write the header. /// /// @param opt Private options for protocol, device and muxer. - void open(const std::optional& opt = c10::nullopt); + void open(const std::optional& opt = std::nullopt); /// Close the output file / device and finalize metadata. void close(); @@ -248,7 +248,7 @@ class StreamingMediaEncoder { void write_audio_chunk( int i, const torch::Tensor& frames, - const std::optional& pts = c10::nullopt); + const std::optional& pts = std::nullopt); /// Write video data /// @param i Stream index. /// @param frames Video/image tensor. Shape: ``(time, channel, height, @@ -269,7 +269,7 @@ class StreamingMediaEncoder { void write_video_chunk( int i, const torch::Tensor& frames, - const std::optional& pts = c10::nullopt); + const std::optional& pts = std::nullopt); /// @cond /// Write frame to stream. /// @param i Stream index.