blob: d7f997dc6f7a9389c6afa57b1cf17fe2f7a131fc [file] [log] [blame]
// Copyright 2020 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
syntax = "proto2";
package wc_fuzzer;
message AllowSharedBufferSource {
// Note: length is capped in the fuzzer to avoid OOM.
optional uint32 length = 1;
optional bool shared = 2;
enum ViewType {
NONE = 0;
INT8 = 1;
UINT32 = 2;
DATA = 3;
}
optional ViewType view_type = 3;
optional uint32 view_offset = 4;
optional uint32 view_length = 5;
}
message DOMRectInit {
optional double x = 1;
optional double y = 2;
optional double width = 3;
optional double height = 4;
}
message PlaneLayout {
optional uint32 offset = 1;
optional uint32 stride = 2;
}
message VideoFrameCopyToOptions {
optional DOMRectInit rect = 1;
repeated PlaneLayout layout = 2;
}
message VideoFrameBufferInit {
enum VideoPixelFormat {
I420 = 0;
I420A = 1;
I444 = 2;
NV12 = 3;
RGBA = 4;
RGBX = 5;
BGRA = 6;
BGRX = 7;
}
optional VideoPixelFormat format = 1;
repeated PlaneLayout layout = 2;
optional int64 timestamp = 3;
optional uint64 duration = 4;
optional uint32 coded_width = 5;
optional uint32 coded_height = 6;
optional DOMRectInit visible_rect = 7;
optional uint32 display_width = 8;
optional uint32 display_height = 9;
// TODO(sandersd): Support color_space.
}
message VideoFrameBufferInitInvocation {
required AllowSharedBufferSource data = 1;
required VideoFrameBufferInit init = 2;
}
message ConfigureVideoDecoder {
// String describing codec (e.g. "vp09.00.10.08")
optional string codec = 1;
optional bytes description = 2;
}
message ConfigureVideoEncoder {
// String describing codec (e.g. "vp09.00.10.08")
optional string codec = 1;
enum EncoderAccelerationPreference {
ALLOW = 0;
DENY = 1;
REQUIRE = 2;
}
optional EncoderAccelerationPreference acceleration = 2;
optional uint64 bitrate = 3;
optional double framerate = 4;
optional uint32 width = 5;
optional uint32 height = 6;
}
message ConfigureAudioDecoder {
// String describing codec (e.g. "opus")
optional string codec = 1;
optional uint32 sample_rate = 2;
optional uint32 number_of_channels = 3;
optional bytes description = 4;
}
message ConfigureAudioEncoder {
// String describing codec (e.g. "opus")
optional string codec = 1;
optional uint32 sample_rate = 2;
optional uint32 number_of_channels = 3;
optional uint64 bitrate = 4;
}
enum EncodedChunkType {
KEY = 0;
DELTA = 1;
}
message EncodedVideoChunk {
optional EncodedChunkType type = 1;
optional uint64 timestamp = 2;
optional uint64 duration = 3;
optional bytes data = 4;
}
message EncodedAudioChunk {
optional EncodedChunkType type = 1;
optional uint64 timestamp = 2;
optional uint64 duration = 3;
optional bytes data = 4;
}
// Mix of args to VideoFrame constructor.
message VideoFrameBitmapInit {
optional uint64 timestamp = 1;
optional uint64 duration = 2;
optional uint32 bitmap_width = 3;
optional bytes rgb_bitmap = 4;
}
enum AudioSampleFormat {
U8 = 0;
S16 = 1;
S32 = 2;
F32 = 3;
U8_PLANAR = 4;
S16_PLANAR = 5;
S32_PLANAR = 6;
F32_PLANAR = 7;
}
message AudioDataInit {
optional uint64 timestamp = 1;
optional uint32 length = 2;
optional uint32 sample_rate = 3;
repeated bytes channels = 4;
required AudioSampleFormat format = 5;
}
message EncodeVideo {
optional VideoFrameBitmapInit frame = 1;
message EncodeOptions { optional bool key_frame = 1; }
optional EncodeOptions options = 2;
}
message EncodeAudio {
optional AudioDataInit data = 1;
}
message DecodeVideo {
optional EncodedVideoChunk chunk = 1;
}
message DecodeAudio {
optional EncodedAudioChunk chunk = 1;
}
message Flush {
optional bool wait_for_promise = 1;
}
message Reset {}
message Close {}
message VideoDecoderApiInvocation {
oneof Api {
ConfigureVideoDecoder configure = 1;
DecodeVideo decode = 2;
Flush flush = 3;
Reset reset = 4;
Close close = 5;
}
}
message VideoDecoderApiInvocationSequence {
repeated VideoDecoderApiInvocation invocations = 1;
}
message AudioDecoderApiInvocation {
oneof Api {
ConfigureAudioDecoder configure = 1;
DecodeAudio decode = 2;
Flush flush = 3;
Reset reset = 4;
Close close = 5;
}
}
message AudioDecoderApiInvocationSequence {
repeated AudioDecoderApiInvocation invocations = 1;
}
message VideoEncoderApiInvocation {
oneof Api {
ConfigureVideoEncoder configure = 1;
EncodeVideo encode = 2;
Flush flush = 3;
Reset reset = 4;
Close close = 5;
}
}
message VideoEncoderApiInvocationSequence {
repeated VideoEncoderApiInvocation invocations = 1;
}
message AudioEncoderApiInvocation {
oneof Api {
ConfigureAudioEncoder configure = 1;
EncodeAudio encode = 2;
Flush flush = 3;
Reset reset = 4;
Close close = 5;
}
}
message AudioEncoderApiInvocationSequence {
repeated AudioEncoderApiInvocation invocations = 1;
}
message DecodeImage {
optional uint32 frame_index = 1;
optional bool complete_frames_only = 2;
}
message DecodeMetadata {}
message SelectTrack {
required uint32 track_id = 1;
optional bool selected = 2 [default = true];
}
message ImageDecoderApiInvocation {
oneof Api {
DecodeImage decode_image = 1;
DecodeMetadata decode_metadata = 2 [deprecated = true];
SelectTrack select_track = 3;
}
}
message ImageBitmapOptions {
enum ImageOrientation {
ORIENTATION_NONE = 0;
FLIPY = 1;
}
enum PremultiplyAlpha {
PREMULTIPLY_NONE = 0;
PREMULTIPLY = 1;
PREMULTIPLY_DEFAULT = 2;
}
enum ColorSpaceConversion {
CS_NONE = 0;
CS_DEFAULT = 1;
}
enum ResizeQuality {
PIXELATED = 0;
LOW = 1;
MEDIUM = 2;
HIGH = 3;
}
optional ImageOrientation image_orientation = 1;
optional PremultiplyAlpha premultiply_alpha = 2;
optional ColorSpaceConversion color_space_conversion = 3;
optional uint32 resize_width = 4;
optional uint32 resize_height = 5;
optional ResizeQuality resize_quality = 6;
}
message ConfigureImageDecoder {
required bytes data = 1;
required string type = 2;
optional ImageBitmapOptions options = 3;
optional bool prefer_animation = 4;
}
message ImageDecoderApiInvocationSequence {
required ConfigureImageDecoder config = 1;
repeated ImageDecoderApiInvocation invocations = 2;
}
message VideoFrameCopyToInvocation {
required AllowSharedBufferSource destination = 1;
optional VideoFrameCopyToOptions options = 2;
}
message VideoFrameCopyToCase {
// TODO(sandersd): Support other kinds of frames.
required VideoFrameBufferInitInvocation video_frame = 1;
// TODO(sandersd): Support multiple concurrent operations, optional waiting,
// close(), etc.
required VideoFrameCopyToInvocation copy_to = 2;
}
message AudioDataCopyToOptions {
required uint32 plane_index = 1;
optional uint32 frame_offset = 2;
optional uint32 frame_count = 3;
optional AudioSampleFormat format = 4;
}
message AudioDataCopyToInvocation {
required AllowSharedBufferSource destination = 1;
required AudioDataCopyToOptions options = 2;
}
message AudioDataCopyToCase {
required AudioDataInit audio_data = 1;
// TODO(chcunningham): Support multiple concurrent operations, optional
// waiting, close(), etc.
required AudioDataCopyToInvocation copy_to = 2;
}