blob: 543b380c8e26aa665c60955a5a55f2662e961156 [file] [log] [blame]
// Copyright 2018 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
library fuchsia.camera.driver;
const uint32 MAX_FORMATS_PER_RESPONSE = 16;
// Status to be set when a frame is signalled available.
enum FrameStatus {
OK = 0;
// An error occurred during the production of a frame.
// No data will be available in the data buffer corresponding to this
// notification.
ERROR_FRAME = 1;
// No space was available in the data buffer, resulting in a dropped frame.
ERROR_BUFFER_FULL = 2;
};
struct Metadata {
int64 timestamp;
};
// Sent by the driver to the client when a frame is available for processing,
// or an error occurred.
struct FrameAvailableEvent {
// Non zero if an error occurred.
FrameStatus frame_status;
// The index of the buffer in the buffer collection.
uint32 buffer_id;
Metadata metadata;
};
struct FrameRate {
// The frame rate is frames_per_sec_numerator / frames_per_sec_denominator.
uint32 frames_per_sec_numerator;
uint32 frames_per_sec_denominator;
};
struct VideoFormat {
fuchsia.sysmem.ImageFormat format;
FrameRate rate;
};
// These are the original interfaces, which are being used for compatibility.
// The names are preserved from the ones in camera.h for porting ease.
[Discoverable]
interface Control {
// Get the available format types for this device
// NOTE: The formats are paginated to MAX_FORMATS_PER_RESPONSE, multiple GetFormats
// need to be issued until total_format_count are received
1: GetFormats(uint32 index) -> (vector<VideoFormat> formats, uint32 total_format_count, zx.status status);
// Sent by the client to indicate desired stream characteristics.
// If setting the format is successful, the stream request will be honored.
2: CreateStream(fuchsia.sysmem.BufferCollectionInfo buffer_collection,
FrameRate rate, request<Stream> stream);
};
interface Stream {
// Starts the streaming of frames.
1: Start();
// Stops the streaming of frames.
2: Stop();
// Unlocks the specified frame, allowing the driver to reuse the memory.
3: ReleaseFrame(uint32 buffer_id);
// Sent by the driver to the client when a frame is available for processing,
// or an error occurred.
4:->OnFrameAvailable(FrameAvailableEvent frame);
};