blob: 098ba448069c877480979fd6d80c81321bdfc760 [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.
#include <fuchsia/media/cpp/fidl.h>
#include <memory>
class CodecPacket;
class CodecInputItem {
// Move-only.
// Defaulting either (or both) of these auto-deletes implicit copy and
// implicit assign. In other words, defaulting counts as user-declared.
CodecInputItem(CodecInputItem&& from) = default;
CodecInputItem& operator=(CodecInputItem&& from) = default;
static CodecInputItem Invalid();
static CodecInputItem FormatDetails(const fuchsia::media::FormatDetails& format_details);
static CodecInputItem Packet(CodecPacket* packet);
static CodecInputItem EndOfStream();
bool is_valid() const;
bool is_format_details() const;
bool is_packet() const;
bool is_end_of_stream() const;
const fuchsia::media::FormatDetails& format_details();
CodecPacket* packet() const;
// !is_valid()
explicit CodecInputItem(const fuchsia::media::FormatDetails& format_details);
explicit CodecInputItem(CodecPacket* packet);
// The fields of this class are relied upon to be move-able.
bool is_valid_ = true;
std::unique_ptr<fuchsia::media::FormatDetails> format_details_;
// If nullptr, is_end_of_stream() is true.
CodecPacket* packet_ = nullptr;
// Lack of format_details_ and lack of packet_ means is_end_of_stream().