chromium/media/base/video_frame.h

// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifdef UNSAFE_BUFFERS_BUILD
// TODO(crbug.com/40285824): Remove this and convert code to safer constructs.
#pragma allow_unsafe_buffers
#endif

#ifndef MEDIA_BASE_VIDEO_FRAME_H_
#define MEDIA_BASE_VIDEO_FRAME_H_

#include <stddef.h>
#include <stdint.h>

#include <memory>
#include <optional>
#include <string>
#include <utility>
#include <vector>

#include "base/check_op.h"
#include "base/compiler_specific.h"
#include "base/functional/callback.h"
#include "base/hash/md5.h"
#include "base/memory/raw_ptr.h"
#include "base/memory/read_only_shared_memory_region.h"
#include "base/memory/ref_counted.h"
#include "base/notreached.h"
#include "base/process/memory.h"
#include "base/synchronization/lock.h"
#include "base/thread_annotations.h"
#include "base/time/time.h"
#include "base/types/id_type.h"
#include "base/unguessable_token.h"
#include "build/build_config.h"
#include "gpu/command_buffer/client/client_shared_image.h"
#include "gpu/command_buffer/common/mailbox_holder.h"
#include "gpu/ipc/common/vulkan_ycbcr_info.h"
#include "media/base/video_frame_layout.h"
#include "media/base/video_frame_metadata.h"
#include "media/base/video_types.h"
#include "ui/gfx/color_space.h"
#include "ui/gfx/geometry/rect.h"
#include "ui/gfx/geometry/size.h"
#include "ui/gfx/hdr_metadata.h"

#if BUILDFLAG(IS_APPLE)
#include <CoreVideo/CVPixelBuffer.h>
#include "base/apple/scoped_cftyperef.h"
#endif  // BUILDFLAG(IS_APPLE)

#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
#include "base/files/scoped_file.h"
#endif  // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)

namespace gfx {
class GpuMemoryBuffer;
struct GpuMemoryBufferHandle;
}

namespace media {

// Specifies the type of shared image format used by media video
// encoder/decoder. Currently, we have (1) one shared image (and texture)
// created for single planar formats eg. RGBA (2) multiple shared images created
// for multiplanar formats eg. P010, NV12 with one shared image for each plane
// eg. Y and UV passing singleplanar SharedImageFormats (kR_8, kRG_88, kR_16,
// etc.) and (3) one shared image created for multiplanar formats passing in
// legacy multiplanar SharedImageFormats that are used with external sampler.
// As we roll out usage of MultiPlaneFormat, this enum helps with
// differentiating between 3 cases: (1) SinglePlaneFormat/LegacyMultiPlaneFormat
// (2) MultiPlaneFormat without external sampler, and (3) MultiPlaneFormat with
// external sampler. NOTE: This enum is interim until all clients are converted
// to use MultiPlaneFormat for all multiplanar use cases; then it will be
// replaced with bool for external sampler usage.
enum class SharedImageFormatType : uint8_t {};

class MEDIA_EXPORT VideoFrame : public base::RefCountedThreadSafe<VideoFrame> {};

}  // namespace media

#endif  // MEDIA_BASE_VIDEO_FRAME_H_