// Copyright 2019, 2021 The MediaPipe Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//      http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

syntax = "proto2";

package mediapipe;

import "mediapipe/framework/calculator.proto";

// NOTE: This calculator uses QResampler, despite the name, which supersedes
// RationalFactorResampler.
message RationalFactorResampleCalculatorOptions {
  extend CalculatorOptions {
    optional RationalFactorResampleCalculatorOptions ext = 259760074;
  }

  // target_sample_rate is the sample rate, in Hertz, of the output
  // stream.  Required.  Must be greater than 0.
  optional double target_sample_rate = 1;

  // Parameters for initializing QResampler. See QResampler for more details.
  message ResamplerRationalFactorOptions {
    // Kernel radius in units of input samples.
    optional double radius = 1;
    // Anti-aliasing cutoff frequency in Hertz. A reasonable setting is
    // 0.45 * min(input_sample_rate, output_sample_rate).
    optional double cutoff = 2;
    // The Kaiser beta parameter for the kernel window.
    optional double kaiser_beta = 3 [default = 6.0];
  }
  optional ResamplerRationalFactorOptions resampler_rational_factor_options = 2;

  // Set to false to disable checks for jitter in timestamp values. Useful with
  // live audio input.
  optional bool check_inconsistent_timestamps = 3 [default = true];
}
