[M120 Migration][MM] Framerate calculation
[platform/framework/web/chromium-efl.git] / media / mojo / mojom / media_types.mojom
index 2696add..d86cdf8 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
@@ -6,12 +6,16 @@ module media.mojom;
 
 import "gpu/ipc/common/mailbox_holder.mojom";
 import "gpu/ipc/common/vulkan_ycbcr_info.mojom";
+import "media/mojo/mojom/audio_data.mojom";
+import "media/mojo/mojom/encryption_pattern.mojom";
+import "mojo/public/mojom/base/shared_memory.mojom";
 import "mojo/public/mojom/base/time.mojom";
 import "mojo/public/mojom/base/values.mojom";
 import "mojo/public/mojom/base/unguessable_token.mojom";
 import "ui/gfx/geometry/mojom/geometry.mojom";
 import "ui/gfx/mojom/buffer_types.mojom";
 import "ui/gfx/mojom/color_space.mojom";
+import "ui/gfx/mojom/hdr_metadata.mojom";
 
 // See media/base/audio_codecs.h for descriptions.
 [Native]
@@ -29,13 +33,9 @@ enum BufferingStateChangeReason;
 [Native]
 enum ChannelLayout;
 
-// See media/base/decode_status.h for descriptions.
+// See media/base/media_content_type.h for descriptions.
 [Native]
-enum DecodeStatus;
-
-// See media/base/status_codes.h for descriptions.
-[Native]
-enum StatusCode;
+enum MediaContentType;
 
 // See media/base/media_log_record.h for description.
 [Native]
@@ -45,10 +45,6 @@ struct MediaLogRecord;
 [Native]
 enum OutputDeviceStatus;
 
-// See media/base/pipeline_status.h for descriptions.
-[Native]
-enum PipelineStatus;
-
 // See media/base/sample_format.h for descriptions.
 [Native]
 enum SampleFormat;
@@ -65,6 +61,14 @@ enum VideoCodecProfile;
 [Native]
 enum VideoPixelFormat;
 
+// See media/base/decoder.h for descriptions.
+[Native]
+enum VideoDecoderType;
+
+// See media/base/decoder.h for descriptions.
+[Native]
+enum AudioDecoderType;
+
 // See media/base/video_transformation.h for descriptions.
 enum VideoRotation {
   kVideoRotation0,
@@ -73,6 +77,11 @@ enum VideoRotation {
   kVideoRotation270,
 };
 
+// see third_party/blink/public/platform/web_fullscreen_video_status.h for
+// descriptions.
+[Native]
+enum FullscreenVideoStatus;
+
 // See media/base/video_transformation.h for descriptions.
 struct VideoTransformation {
   VideoRotation rotation;
@@ -95,17 +104,43 @@ enum MediaContainerName;
 [Native]
 enum MediaStatusState;
 
-// This defines a mojo transport format for media::EncryptionPattern
-// See media/base/encryption_pattern.h for description.
-struct EncryptionPattern {
-  uint32 crypt_byte_block;
-  uint32 skip_byte_block;
-};
-
 // See media/base/encryption_scheme.h for description.
 [Native]
 enum EncryptionScheme;
 
+// See media::EncryptionType for descriptions.
+enum EncryptionType {
+  kNone,
+  kClear,
+  kEncrypted,
+  kEncryptedWithClearLead,
+};
+
+// See media/base/svc_scalability_mode.h for description.
+// This mojo enum only list hardware codec supported scalability mode.
+enum SVCScalabilityMode {
+  // kUnsupportedMode is used to handle the enum differ of C++ and Mojo
+  // SVCScalabilityMode in ToMojom, should not be used in other place.
+  kUnsupportedMode,
+  kL1T1,
+  kL1T2,
+  kL1T3,
+  kL2T1Key,
+  kL2T2Key,
+  kL2T3Key,
+  kL3T1Key,
+  kL3T2Key,
+  kL3T3Key,
+};
+
+// This mojo enum only list hardware codec supported scalability mode.
+// See media/base/svc_scalability_mode.h for description.
+enum SVCInterLayerPredMode {
+  kOff,
+  kOn,
+  kOnKeyPic
+};
+
 // This defines a mojo transport format for media::VideoColorSpace.
 // See media/base/video_color_space.h for description.
 struct VideoColorSpace {
@@ -127,35 +162,23 @@ struct VideoColorSpace {
   RangeID range;
 };
 
-// This defines a mojo transport format for media::HDRMetadata.
-// See media/base/hdr_metadata.h for description.
-struct MasteringMetadata {
-  gfx.mojom.PointF primary_r;
-  gfx.mojom.PointF primary_g;
-  gfx.mojom.PointF primary_b;
-  gfx.mojom.PointF white_point;
-  float luminance_max;
-  float luminance_min;
-};
-
-struct HDRMetadata {
-  MasteringMetadata mastering_metadata;
-  uint32 max_content_light_level;
-  uint32 max_frame_average_light_level;
-};
-
 // This defines a mojo transport format for media::AudioDecoderConfig.
 // See media/base/audio_decoder_config.h for descriptions.
+// TODO(crbug.com/1232205): Support `channels_` set by SetChannelsForDiscrete().
 struct AudioDecoderConfig {
   AudioCodec codec;
-  AudioCodecProfile profile;
   SampleFormat sample_format;
   ChannelLayout channel_layout;
   int32 samples_per_second;
   array<uint8> extra_data;
+  EncryptionScheme encryption_scheme;
   mojo_base.mojom.TimeDelta seek_preroll;
   int32 codec_delay;
-  EncryptionScheme encryption_scheme;
+  AudioCodecProfile profile;
+  ChannelLayout target_output_channel_layout;
+  SampleFormat target_output_sample_format;
+  bool should_discard_decoder_delay;
+  array<uint8> aac_extra_data;
 };
 
 // This defines a mojo transport format for media::VideoDecoderConfig.
@@ -172,13 +195,46 @@ struct VideoDecoderConfig {
   array<uint8> extra_data;
   EncryptionScheme encryption_scheme;
   VideoColorSpace color_space_info;
-  HDRMetadata? hdr_metadata;
+  gfx.mojom.HDRMetadata? hdr_metadata;
+  [EnableIf=is_tizen_tv]
+  string hdr_info;
+  [EnableIf=is_tizen_tv]
+  int32 framerate_num;
+  [EnableIf=is_tizen_tv]
+  int32 framerate_den;
 };
 
 // Native struct media::SubsampleEntry;
 [Native]
 struct SubsampleEntry;
 
+// Important events happened to the CDM. See media/cdm/cdm_document_service.h
+// for descriptions.
+[EnableIf=is_win]
+enum CdmEvent {
+  kSignificantPlayback,
+  kPlaybackError,
+  kCdmError,
+  kHardwareContextReset,
+};
+
+// See media::CdmSessionClosedReason for descriptions.
+enum CdmSessionClosedReason {
+  kInternalError,
+  kClose,
+  kReleaseAcknowledged,
+  kHardwareContextReset,
+  kResourceEvicted,
+};
+
+// This defines a mojo transport format for media::SharedImageFormatType.
+// See media/base/video_frame.h for descriptions.
+enum SharedImageFormatType {
+  kLegacy,
+  kSharedImageFormat,
+  kSharedImageFormatExternalSampler,
+};
+
 // This defines a mojo transport format for media::DecryptConfig.
 // See media/base/decrypt_config.h for descriptions.
 struct DecryptConfig {
@@ -189,6 +245,13 @@ struct DecryptConfig {
   EncryptionPattern? encryption_pattern;
 };
 
+// This defines a mojo transport format for media::DecoderBufferSideData.
+struct DecoderBufferSideData {
+  array<uint32> spatial_layers;
+  array<uint8> alpha_data;
+  uint64 secure_handle;
+};
+
 // This defines a mojo transport format for media::DecoderBuffer.
 struct DecoderBuffer {
   mojo_base.mojom.TimeDelta timestamp;
@@ -206,15 +269,21 @@ struct DecoderBuffer {
   // Indicates whether or not this buffer is a random access point.
   bool is_key_frame;
 
-  // Empty when |side_data| doesn't exist.
-  array<uint8> side_data;
-
   // DecryptConfig for a encrypted buffer. NULL if the buffer is not encrypted.
   DecryptConfig? decrypt_config;
 
   // These fields indicate the amount of data to discard after decoding.
   mojo_base.mojom.TimeDelta front_discard;
   mojo_base.mojom.TimeDelta back_discard;
+
+  [EnableIf=is_tizen_tv]
+  uint32 tz_handle;
+  [EnableIf=is_tizen_tv]
+  uint32 tz_buffer_size;
+  [EnableIf=is_tizen_tv]
+  uint64 decryptor_handle;
+
+  DecoderBufferSideData? side_data;
 };
 
 // This defines a mojo transport format for media::AudioBuffer.
@@ -244,22 +313,6 @@ struct AudioBuffer {
   array<uint8> data;
 };
 
-// This defines a mojo transport format for an interleaved, signed
-// 16-bit audio buffer.
-struct AudioDataS16 {
-  // Number of channels.
-  int32 channel_count;
-
-  // Sample rate of the buffer.
-  int32 sample_rate;
-
-  // Number of frames in the buffer.
-  int32 frame_count;
-
-  // Channel data.
-  array<int16> data;
-};
-
 // See media/base/video_frame_metadata.h for a description of fields.
 // TODO(crbug.com/657632): Remove |has_*| values and use nullable types.
 struct VideoFrameMetadata {
@@ -273,6 +326,11 @@ struct VideoFrameMetadata {
 
   gfx.mojom.Rect? capture_update_rect;
 
+  gfx.mojom.Size? source_size;
+
+  gfx.mojom.Rect? region_capture_rect;
+  uint32 sub_capture_target_version;
+
   bool copy_required;
 
   bool end_of_stream;
@@ -286,13 +344,9 @@ struct VideoFrameMetadata {
 
   mojo_base.mojom.TimeTicks? reference_time;
 
-  bool has_resource_utilization;
-  double resource_utilization;
-
   bool read_lock_fences_enabled;
 
-  bool has_rotation;
-  VideoRotation rotation;
+  VideoTransformation? transformation;
 
   bool texture_owner;
 
@@ -302,10 +356,14 @@ struct VideoFrameMetadata {
 
   bool hw_protected;
 
+  bool is_webgpu_compatible;
+
   mojo_base.mojom.UnguessableToken? overlay_plane_id;
 
   bool power_efficient;
 
+  bool texture_origin_is_top_left;
+
   bool has_device_scale_factor;
   double device_scale_factor;
 
@@ -358,14 +416,15 @@ struct VideoFrame {
   VideoFrameMetadata metadata;
 
   gfx.mojom.ColorSpace color_space;
-  HDRMetadata? hdr_metadata;
+  gfx.mojom.HDRMetadata? hdr_metadata;
+
+  media.mojom.SharedImageFormatType shared_image_format_type;
 };
 
 // Possible choices for storing VideoFrame data.
 union VideoFrameData {
   EosVideoFrameData eos_data;
-  SharedBufferVideoFrameData shared_buffer_data;
-  DmabufVideoFrameData dmabuf_data;
+  SharedMemoryVideoFrameData shared_memory_data;
   GpuMemoryBufferVideoFrameData gpu_memory_buffer_data;
   MailboxVideoFrameData mailbox_data;
 };
@@ -374,11 +433,10 @@ union VideoFrameData {
 struct EosVideoFrameData {
 };
 
-// This defines video frame data stored in a Mojo shared buffer.
-struct SharedBufferVideoFrameData {
-  // Reference to the shared memory containing the frame's data.
-  handle<shared_buffer> frame_data;
-  uint64 frame_data_size;
+// This defines video frame data for STORAGE_SHMEM VideoFrame.
+struct SharedMemoryVideoFrameData {
+  // Shared memory region for the frame data.
+  mojo_base.mojom.ReadOnlySharedMemoryRegion frame_data;
 
   // Stride and offsets for each plane. Offsets are relative to the start
   // of |frame_data|.
@@ -386,12 +444,6 @@ struct SharedBufferVideoFrameData {
   array<uint32> offsets;
 };
 
-// This defines video frame data stored in dmabuf.
-struct DmabufVideoFrameData {
-  // Size depends on media::VideoFrame::NumPlanes with frame format.
-  array<handle<platform>> dmabuf_fds;
-};
-
 struct GpuMemoryBufferVideoFrameData {
   gfx.mojom.GpuMemoryBufferHandle gpu_memory_buffer_handle;
   array<gpu.mojom.MailboxHolder, 4> mailbox_holder;
@@ -437,18 +489,77 @@ struct PredictionTargets {
   uint32 frames_power_efficient = 0;
 };
 
-// See media/base/pipeline/status.h for descriptions.
-struct PipelineDecoderInfo {
-  string decoder_name;
+// See media/base/pipeline_status.h for descriptions.
+struct AudioPipelineInfo {
+  AudioDecoderType decoder_type;
+  bool is_platform_decoder = false;
+  bool has_decrypting_demuxer_stream = false;
+  EncryptionType encryption_type;
+};
+
+// See media/base/pipeline_status.h for descriptions.
+struct VideoPipelineInfo {
+  VideoDecoderType decoder_type;
   bool is_platform_decoder = false;
   bool has_decrypting_demuxer_stream = false;
+  EncryptionType encryption_type;
 };
 
 // See media/base/status.h for descriptions.
-struct Status {
-  StatusCode code;
-  string? message;
-  array<mojo_base.mojom.Value> frames;
-  array<media.mojom.Status> causes;
-  mojo_base.mojom.Value? data;
+struct StatusData {
+  string group;
+  uint16 code;
+  string message;
+  mojo_base.mojom.ListValue frames;
+  StatusData? cause;
+  mojo_base.mojom.Value data;
+  uint64 packed_root_cause;
+};
+
+struct EncoderStatus {
+  StatusData? internal;
+};
+
+struct DecoderStatus {
+  StatusData? internal;
+};
+
+struct PipelineStatus {
+  StatusData? internal;
+};
+
+// Types of media stream, categorised by the media stream's source.
+// The enum values are emitted to metrics. Do not reorder.
+enum MediaStreamType {
+  kLocalElementCapture = 0, // The source is a local capture from element.
+  kLocalDeviceCapture = 1, // The source is a local device capture, e.g. webcam.
+  kLocalTabCapture = 2, // The source is a local tab capture.
+  kLocalDesktopCapture = 3, // The source is a local desktop capture.
+  kLocalDisplayCapture = 4, // The source is a local display capture.
+  kRemote = 5, // The source is a remote peer connection.
+  kNone = 6, // Not a media stream.
+};
+
+// Error codes propagated by Input media streams OnError methods to indicate the
+// reason for an error.
+enum InputStreamErrorCode {
+  kUnknown = 0,
+  kSystemPermissions = 1,
+  kDeviceInUse = 2,
+};
+
+// See media/base/renderer.h for description.
+enum RendererType {
+  kRendererImpl = 0,     // RendererImplFactory
+  kMojo = 1,             // MojoRendererFactory
+  kMediaPlayer = 2,      // MediaPlayerRendererClientFactory
+  kCourier = 3,          // CourierRendererFactory
+  kFlinging = 4,         // FlingingRendererClientFactory
+  kCast = 5,             // CastRendererClientFactory
+  kMediaFoundation = 6,  // MediaFoundationRendererClientFactory
+  // kFuchsia = 7,       // Deprecated
+  kRemoting = 8,         // RemotingRendererFactory for remoting::Receiver
+  kCastStreaming = 9,    // CastStreamingRendererFactory
+  kContentEmbedderDefined = 10,  // Defined by the content embedder
+  kTest= 11,             // Renderer implementations used in tests
 };