// Copyright 2019 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.
//
// Forked from
// mediapipe/framework/formats/time_series_header.proto
// The forked proto must remain identical to the original proto and should be
// ONLY used by mediapipe open source project.

syntax = "proto2";

package mediapipe;

// Header for a uniformly sampled time series stream. Each Packet in
// the stream is a Matrix, and each column is a (vector-valued) sample of
// the series, i.e. each column corresponds to a distinct sample in time.
message TimeSeriesHeader {
  // Number of samples per second (hertz). The sample_rate is the
  // reciprocal of the period between consecutive samples within a
  // packet.  Required, and must be greater than zero.
  optional double sample_rate = 1;
  // The number of channels in each sample. This is the number of
  // rows in the matrix.  Required, and must be greater than zero.
  optional int32 num_channels = 2;
  // For streams that output a fixed number of samples per packet.
  // This field should not be set if the number of samples varies from
  // packet to packet. This is the number of columns in the matrix.
  optional int32 num_samples = 3;
  // For streams that output Packets at a fixed rate, in Packets per
  // second. In other words, the reciprocal of the difference between
  // consecutive Packet timestamps.
  optional double packet_rate = 4;
  // Spectral representations (e.g. from SpectrogramCalculator) will
  // have their sample_rate field indicating the frame rate (e.g. 100
  // Hz), but downstream consumers need to know the sample_rate of the
  // source time-domain waveform in order to correctly interpret the
  // spectral bins.  Units are hertz.
  optional double audio_sample_rate = 5;

  // Extensions for communicating application-specific metadata about
  // the stream to downstream calculators. For example, to include SAI
  // parameters for SAI streams so that downstream calculators know
  // what past and future lags were used.
  extensions 20000 to max;
}

// Header for a multi-stream time series. Each packet in the
// associated stream is a vector<Matrix> of size num_streams. Each
// Matrix in the vector is as specified by the time_series_header
// field.
message MultiStreamTimeSeriesHeader {
  optional TimeSeriesHeader time_series_header = 1;
  optional int32 num_streams = 2;
}
