@@ -22,7 +22,7 @@ EncodeProcess::EncodeProcess(
22
22
23
23
void EncodeProcess::process (
24
24
const torch::Tensor& tensor,
25
- const c10 ::optional<double >& pts) {
25
+ const std ::optional<double >& pts) {
26
26
if (pts) {
27
27
const double & pts_val = pts.value ();
28
28
TORCH_CHECK (
@@ -127,7 +127,7 @@ enum AVPixelFormat get_src_pix_fmt(const std::string& src) {
127
127
// //////////////////////////////////////////////////////////////////////////////
128
128
const AVCodec* get_codec (
129
129
AVCodecID default_codec,
130
- const c10 ::optional<std::string>& encoder) {
130
+ const std ::optional<std::string>& encoder) {
131
131
if (encoder) {
132
132
const AVCodec* c = avcodec_find_encoder_by_name (encoder.value ().c_str ());
133
133
TORCH_CHECK (c, " Unexpected codec: " , encoder.value ());
@@ -151,7 +151,7 @@ AVCodecContextPtr get_codec_ctx(const AVCodec* codec, int flags) {
151
151
152
152
void open_codec (
153
153
AVCodecContext* codec_ctx,
154
- const c10 ::optional<OptionDict>& option) {
154
+ const std ::optional<OptionDict>& option) {
155
155
AVDictionary* opt = get_option_dict (option);
156
156
157
157
// Enable experimental feature if required
@@ -224,7 +224,7 @@ std::string get_supported_formats(const AVSampleFormat* sample_fmts) {
224
224
225
225
AVSampleFormat get_enc_fmt (
226
226
AVSampleFormat src_fmt,
227
- const c10 ::optional<std::string>& encoder_format,
227
+ const std ::optional<std::string>& encoder_format,
228
228
const AVCodec* codec) {
229
229
if (encoder_format) {
230
230
auto & enc_fmt_val = encoder_format.value ();
@@ -273,7 +273,7 @@ std::string get_supported_samplerates(const int* supported_samplerates) {
273
273
274
274
int get_enc_sr (
275
275
int src_sample_rate,
276
- const c10 ::optional<int >& encoder_sample_rate,
276
+ const std ::optional<int >& encoder_sample_rate,
277
277
const AVCodec* codec) {
278
278
// G.722 only supports 16000 Hz, but it does not list the sample rate in
279
279
// supported_samplerates so we hard code it here.
@@ -325,7 +325,7 @@ std::string get_supported_channels(const uint64_t* channel_layouts) {
325
325
326
326
uint64_t get_channel_layout (
327
327
const uint64_t src_ch_layout,
328
- const c10 ::optional<int > enc_num_channels,
328
+ const std ::optional<int > enc_num_channels,
329
329
const AVCodec* codec) {
330
330
// If the override is presented, and if it is supported by codec, we use it.
331
331
if (enc_num_channels) {
@@ -370,7 +370,7 @@ void configure_audio_codec_ctx(
370
370
AVSampleFormat format,
371
371
int sample_rate,
372
372
uint64_t channel_layout,
373
- const c10 ::optional<CodecConfig>& codec_config) {
373
+ const std ::optional<CodecConfig>& codec_config) {
374
374
codec_ctx->sample_fmt = format;
375
375
codec_ctx->sample_rate = sample_rate;
376
376
codec_ctx->time_base = av_inv_q (av_d2q (sample_rate, 1 << 24 ));
@@ -421,7 +421,7 @@ std::string get_supported_formats(const AVPixelFormat* pix_fmts) {
421
421
422
422
AVPixelFormat get_enc_fmt (
423
423
AVPixelFormat src_fmt,
424
- const c10 ::optional<std::string>& encoder_format,
424
+ const std ::optional<std::string>& encoder_format,
425
425
const AVCodec* codec) {
426
426
if (encoder_format) {
427
427
const auto & val = encoder_format.value ();
@@ -455,7 +455,7 @@ bool supported_frame_rate(AVRational rate, const AVRational* rates) {
455
455
456
456
AVRational get_enc_rate (
457
457
AVRational src_rate,
458
- const c10 ::optional<double >& encoder_sample_rate,
458
+ const std ::optional<double >& encoder_sample_rate,
459
459
const AVCodec* codec) {
460
460
if (encoder_sample_rate) {
461
461
const double & enc_rate = encoder_sample_rate.value ();
@@ -494,7 +494,7 @@ void configure_video_codec_ctx(
494
494
AVRational frame_rate,
495
495
int width,
496
496
int height,
497
- const c10 ::optional<CodecConfig>& codec_config) {
497
+ const std ::optional<CodecConfig>& codec_config) {
498
498
// TODO: Review other options and make them configurable?
499
499
// https://ffmpeg.org/doxygen/4.1/muxing_8c_source.html#l00147
500
500
// - bit_rate_tolerance
@@ -596,7 +596,7 @@ FilterGraph get_audio_filter_graph(
596
596
AVSampleFormat src_fmt,
597
597
int src_sample_rate,
598
598
uint64_t src_ch_layout,
599
- const c10 ::optional<std::string>& filter_desc,
599
+ const std ::optional<std::string>& filter_desc,
600
600
AVSampleFormat enc_fmt,
601
601
int enc_sample_rate,
602
602
uint64_t enc_ch_layout,
@@ -639,7 +639,7 @@ FilterGraph get_video_filter_graph(
639
639
AVRational src_rate,
640
640
int src_width,
641
641
int src_height,
642
- const c10 ::optional<std::string>& filter_desc,
642
+ const std ::optional<std::string>& filter_desc,
643
643
AVPixelFormat enc_fmt,
644
644
AVRational enc_rate,
645
645
int enc_width,
@@ -743,13 +743,13 @@ EncodeProcess get_audio_encode_process(
743
743
int src_sample_rate,
744
744
int src_num_channels,
745
745
const std::string& format,
746
- const c10 ::optional<std::string>& encoder,
747
- const c10 ::optional<OptionDict>& encoder_option,
748
- const c10 ::optional<std::string>& encoder_format,
749
- const c10 ::optional<int >& encoder_sample_rate,
750
- const c10 ::optional<int >& encoder_num_channels,
751
- const c10 ::optional<CodecConfig>& codec_config,
752
- const c10 ::optional<std::string>& filter_desc,
746
+ const std ::optional<std::string>& encoder,
747
+ const std ::optional<OptionDict>& encoder_option,
748
+ const std ::optional<std::string>& encoder_format,
749
+ const std ::optional<int >& encoder_sample_rate,
750
+ const std ::optional<int >& encoder_num_channels,
751
+ const std ::optional<CodecConfig>& codec_config,
752
+ const std ::optional<std::string>& filter_desc,
753
753
bool disable_converter) {
754
754
// 1. Check the source format, rate and channels
755
755
TORCH_CHECK (
@@ -854,15 +854,15 @@ EncodeProcess get_video_encode_process(
854
854
int src_width,
855
855
int src_height,
856
856
const std::string& format,
857
- const c10 ::optional<std::string>& encoder,
858
- const c10 ::optional<OptionDict>& encoder_option,
859
- const c10 ::optional<std::string>& encoder_format,
860
- const c10 ::optional<double >& encoder_frame_rate,
861
- const c10 ::optional<int >& encoder_width,
862
- const c10 ::optional<int >& encoder_height,
863
- const c10 ::optional<std::string>& hw_accel,
864
- const c10 ::optional<CodecConfig>& codec_config,
865
- const c10 ::optional<std::string>& filter_desc,
857
+ const std ::optional<std::string>& encoder,
858
+ const std ::optional<OptionDict>& encoder_option,
859
+ const std ::optional<std::string>& encoder_format,
860
+ const std ::optional<double >& encoder_frame_rate,
861
+ const std ::optional<int >& encoder_width,
862
+ const std ::optional<int >& encoder_height,
863
+ const std ::optional<std::string>& hw_accel,
864
+ const std ::optional<CodecConfig>& codec_config,
865
+ const std ::optional<std::string>& filter_desc,
866
866
bool disable_converter) {
867
867
// 1. Checkc the source format, rate and resolution
868
868
TORCH_CHECK (
0 commit comments