1// Copyright 2023 Google LLC 2// 3// Licensed under the Apache License, Version 2.0 (the "License"); 4// you may not use this file except in compliance with the License. 5// You may obtain a copy of the License at 6// 7// http://www.apache.org/licenses/LICENSE-2.0 8// 9// Unless required by applicable law or agreed to in writing, software 10// distributed under the License is distributed on an "AS IS" BASIS, 11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12// See the License for the specific language governing permissions and 13// limitations under the License. 14 15syntax = "proto3"; 16 17package google.cloud.visionai.v1; 18 19import "google/api/field_behavior.proto"; 20import "google/api/resource.proto"; 21import "google/protobuf/duration.proto"; 22import "google/protobuf/struct.proto"; 23import "google/protobuf/timestamp.proto"; 24 25option csharp_namespace = "Google.Cloud.VisionAI.V1"; 26option go_package = "cloud.google.com/go/visionai/apiv1/visionaipb;visionaipb"; 27option java_multiple_files = true; 28option java_outer_classname = "StreamingResourcesProto"; 29option java_package = "com.google.cloud.visionai.v1"; 30option php_namespace = "Google\\Cloud\\VisionAI\\V1"; 31option ruby_package = "Google::Cloud::VisionAI::V1"; 32 33// The descriptor for a gstreamer buffer payload. 34message GstreamerBufferDescriptor { 35 // The caps string of the payload. 36 string caps_string = 1; 37 38 // Whether the buffer is a key frame. 39 bool is_key_frame = 2; 40 41 // PTS of the frame. 42 google.protobuf.Timestamp pts_time = 3; 43 44 // DTS of the frame. 45 google.protobuf.Timestamp dts_time = 4; 46 47 // Duration of the frame. 48 google.protobuf.Duration duration = 5; 49} 50 51// The descriptor for a raw image. 52message RawImageDescriptor { 53 // Raw image format. Its possible values are: "srgb". 54 string format = 1; 55 56 // The height of the image. 57 int32 height = 2; 58 59 // The width of the image. 60 int32 width = 3; 61} 62 63// The message that represents the data type of a packet. 64message PacketType { 65 // The message that fully specifies the type of the packet. 66 message TypeDescriptor { 67 // Detailed information about the type. 68 // 69 // It is non-empty only for specific type class codecs. Needed only when the 70 // type string alone is not enough to disambiguate the specific type. 71 oneof type_details { 72 // GstreamerBufferDescriptor is the descriptor for gstreamer buffer type. 73 GstreamerBufferDescriptor gstreamer_buffer_descriptor = 2; 74 75 // RawImageDescriptor is the descriptor for the raw image type. 76 RawImageDescriptor raw_image_descriptor = 3; 77 } 78 79 // The type of the packet. Its possible values is codec dependent. 80 // 81 // The fully qualified type name is always the concatenation of the 82 // value in `type_class` together with the value in `type`, separated by a 83 // '/'. 84 // 85 // Note that specific codecs can define their own type hierarchy, and so the 86 // type string here can in fact be separated by multiple '/'s of its own. 87 // 88 // Please see the open source SDK for specific codec documentation. 89 string type = 1; 90 } 91 92 // The type class of the packet. Its possible values are: 93 // "gst", "protobuf", and "string". 94 string type_class = 1; 95 96 // The type descriptor. 97 TypeDescriptor type_descriptor = 2; 98} 99 100// The message that represents server metadata. 101message ServerMetadata { 102 // The offset position for the packet in its stream. 103 int64 offset = 1; 104 105 // The timestamp at which the stream server receives this packet. This is 106 // based on the local clock of on the server side. It is guaranteed to be 107 // monotonically increasing for the packets within each session; however 108 // this timestamp is not comparable across packets sent to the same stream 109 // different sessions. Session here refers to one individual gRPC streaming 110 // request to the stream server. 111 google.protobuf.Timestamp ingest_time = 2; 112} 113 114// The message that represents series metadata. 115message SeriesMetadata { 116 // Series name. It's in the format of 117 // "projects/{project}/locations/{location}/clusters/{cluster}/series/{stream}". 118 string series = 1 [ 119 (google.api.resource_reference) = { type: "visionai.googleapis.com/Series" } 120 ]; 121} 122 123// The message that represents packet header. 124message PacketHeader { 125 // Input only. The capture time of the packet. 126 google.protobuf.Timestamp capture_time = 1 127 [(google.api.field_behavior) = INPUT_ONLY]; 128 129 // Input only. Immutable. The type of the payload. 130 PacketType type = 2 [ 131 (google.api.field_behavior) = INPUT_ONLY, 132 (google.api.field_behavior) = IMMUTABLE 133 ]; 134 135 // Input only. This field is for users to attach user managed metadata. 136 google.protobuf.Struct metadata = 3 137 [(google.api.field_behavior) = INPUT_ONLY]; 138 139 // Output only. Metadata that the server appends to each packet before sending 140 // it to receivers. You don't need to set a value for this field when sending 141 // packets. 142 ServerMetadata server_metadata = 4 143 [(google.api.field_behavior) = OUTPUT_ONLY]; 144 145 // Input only. Immutable. Metadata that the server needs to know where to 146 // write the packets to. It's only required for the first packet. 147 SeriesMetadata series_metadata = 5 [ 148 (google.api.field_behavior) = INPUT_ONLY, 149 (google.api.field_behavior) = IMMUTABLE 150 ]; 151 152 // Immutable. Packet flag set. SDK will set the flag automatically. 153 int32 flags = 6 [(google.api.field_behavior) = IMMUTABLE]; 154 155 // Immutable. Header string for tracing across services. It should be set when 156 // the packet is first arrived in the stream server. 157 // 158 // The input format is a lowercase hex string: 159 // - version_id: 1 byte, currently must be zero - hex encoded (2 characters) 160 // - trace_id: 16 bytes (opaque blob) - hex encoded (32 characters) 161 // - span_id: 8 bytes (opaque blob) - hex encoded (16 characters) 162 // - trace_options: 1 byte (LSB means tracing enabled) - hex encoded (2 163 // characters) 164 // Example: "00-404142434445464748494a4b4c4d4e4f-6162636465666768-01" 165 // v trace_id span_id options 166 string trace_context = 7 [(google.api.field_behavior) = IMMUTABLE]; 167} 168 169// The quanta of datum that the series accepts. 170message Packet { 171 // The packet header. 172 PacketHeader header = 1; 173 174 // The payload of the packet. 175 bytes payload = 2; 176} 177