Index: mojo/services/media/common/interfaces/media_types.mojom |
diff --git a/mojo/services/media/common/interfaces/media_types.mojom b/mojo/services/media/common/interfaces/media_types.mojom |
index db06447f4a93b37396aa8f631f55a409c15d2c0c..76f2de0d86dbc20edb47163d5af54d8f4d8d1329 100644 |
--- a/mojo/services/media/common/interfaces/media_types.mojom |
+++ b/mojo/services/media/common/interfaces/media_types.mojom |
@@ -2,59 +2,273 @@ |
// Use of this source code is governed by a BSD-style license that can be |
// found in the LICENSE file. |
+[DartPackage="mojo_services"] |
module mojo.media; |
+// Specifies the type of media. |
+struct MediaType { |
+ // Broadly identifies the media type and indicates how the details field is |
+ // to be interpreted. |
+ MediaTypeScheme scheme; |
+ |
+ // Scheme-dependent details. |
+ MediaTypeDetails? details; |
+}; |
+ |
+// Specifies a set of types of media. |
+// TODO(dalesat): Consider eliminating type sets. |
+struct MediaTypeSet { |
+ // Broadly identifies the media types and indicates how the details field is |
+ // to be interpreted. |
+ MediaTypeScheme scheme; |
+ |
+ // Scheme-dependent details. |
+ MediaTypeSetDetails? details; |
+}; |
+ |
+// Media type schemes. A media type scheme broadly identifies a media type and |
+// indicates what structure, if any, is used to specify the details of the type. |
+// If a scheme XYZ has details, then there should be structure definitions for |
+// XyzMediaTypeDetails and XyzMediaTypeSetDetails, and fields of those types |
+// should appear in MediaTypeDetails and MediaTypeSetDetails respectively. |
+// TODO(dalesat): Placeholder schemes could go away as part of eliminating |
+// or simplifying type sets. |
+enum MediaTypeScheme { |
+ // Placeholder indicating type is unknown. |
+ UNKNOWN, |
+ |
+ // Placeholder indicating no type. |
+ NONE, |
+ |
+ // Placeholder indicating any elementary type. |
+ ANY_ELEMENTARY, |
+ |
+ // Placeholder indicating any audio type. |
+ ANY_AUDIO, |
+ |
+ // Placeholder indicating any video type. |
+ ANY_VIDEO, |
+ |
+ // Placeholder indicating any subpicture type. |
+ ANY_SUBPICTURE, |
+ |
+ // Placeholder indicating any text type. |
+ ANY_TEXT, |
+ |
+ // Placeholder indicating any multiplexed type. |
+ ANY_MULTIPLEXED, |
+ |
+ // Placeholder indicating any type. |
+ ANY, |
+ |
+ // Indicates a multiplexed type. See MultiplexedMediaTypeDetails and |
+ // MultiplexedMediaTypeSetDetails. |
+ MULTIPLEXED, |
+ |
+ // Indicates LPCM audio. See LpcmMediaTypeDetails and LpcmMediaTypeSetDetails. |
+ LPCM, |
+ |
+ // Indicates compressed audio. See CompressedAudioMediaTypeDetails and |
+ // CompressedAudioMediaTypeSetDetails. |
+ COMPRESSED_AUDIO, |
+ |
+ // Indicates video. See VideoMediaTypeDetails and VideoMediaTypeSetDetails. |
+ // TODO(dalesat): One scheme for video won't be adequate. |
+ VIDEO |
+}; |
+ |
+// A union of all media type details. |
+union MediaTypeDetails { |
+ // Each field name should correspond to a value in MediaTypeScheme. |
+ MultiplexedMediaTypeDetails multiplexed; |
+ LpcmMediaTypeDetails lpcm; |
+ CompressedAudioMediaTypeDetails compressed_audio; |
+ VideoMediaTypeDetails video; |
+}; |
+ |
+// A union of all media type set details. |
+union MediaTypeSetDetails { |
+ // Each field name should correspond to a value in MediaTypeScheme. |
+ MultiplexedMediaTypeSetDetails multiplexed; |
+ LpcmMediaTypeSetDetails lpcm; |
+ CompressedAudioMediaTypeSetDetails compressed_audio; |
+ VideoMediaTypeSetDetails video; |
+}; |
+ |
+// MediaType details for the LPCM scheme. |
+struct LpcmMediaTypeDetails { |
+ LpcmSampleFormat sample_format; |
+ uint32 channels; |
+ uint32 frames_per_second; |
+ // TODO(dalesat): Channel designations. |
+}; |
+ |
+// MediaTypeSet details for the LPCM scheme. |
+struct LpcmMediaTypeSetDetails { |
+ LpcmSampleFormat sample_format; |
+ uint32 min_channels; |
+ uint32 max_channels; |
+ uint32 min_frames_per_second; |
+ uint32 max_frames_per_second; |
+}; |
+ |
+// Sample formats for LPCM media types. |
enum LpcmSampleFormat { |
+ // Placeholder indicating sample format is unknown. |
+ UNKNOWN, |
+ |
+ // Placeholder indicating any sample format. |
+ ANY, |
+ |
+ // 8-bit unsigned samples, sample size 1 byte. |
UNSIGNED_8, |
+ |
+ // 16-bit signed samples, host-endian, sample size 2 bytes. |
SIGNED_16, |
- SIGNED_24_IN_32, // TODO(johngro): describe the packing for this |
+ |
+ // 24-bit signed samples in 32 bits, host-endian, sample size 4 bytes. |
+ // TODO(johngro): describe the packing for this |
+ SIGNED_24_IN_32, // Host endian |
+ |
+ // 32-bit floating-point samples, sample size 4 bytes. |
+ FLOAT |
}; |
-struct LpcmMediaTypeDetails { |
+// Media type details for the Multiplexed scheme. |
+struct MultiplexedMediaTypeDetails { |
+ // Describes how the streams are multiplexed. |
+ MediaType multiplex_type; |
+ |
+ // Media type for each substream. |
+ array<MediaType> substream_types; |
+}; |
+ |
+// Media type set details for the Multiplexed scheme. |
+struct MultiplexedMediaTypeSetDetails { |
+ // Describes how the streams can be multiplexed. |
+ MediaTypeSet multiplex_type_set; |
+ |
+ // Possible substream types. |
+ array<MediaTypeSet> substream_type_sets; |
+}; |
+ |
+// Audio encodings. |
+// TODO(dalesat): Add more audio encodings. |
+enum AudioEncoding { |
+ // Placeholder indicating audio encoding is unknown. |
+ UNKNOWN, |
+ |
+ // Placeholder indicating any audio encoding. |
+ ANY, |
+ |
+ VORBIS |
+}; |
+ |
+// Media type details for the COMPRESSED_AUDIO scheme. |
+struct CompressedAudioMediaTypeDetails { |
+ AudioEncoding encoding; |
LpcmSampleFormat sample_format; |
- uint8 channels; |
+ uint32 channels; |
uint32 frames_per_second; |
+ |
+ // Encoding-specific parameter provided by demuxes and used by decoders. |
+ string extra_data_base64; |
}; |
-struct LpcmMediaTypeSetDetails { |
+// Media type set details for the COMPRESSED_AUDIO scheme. |
+struct CompressedAudioMediaTypeSetDetails { |
+ AudioEncoding encoding; |
LpcmSampleFormat sample_format; |
- uint8 min_channels; |
- uint8 max_channels; |
+ uint32 min_channels; |
+ uint32 max_channels; |
uint32 min_frames_per_second; |
uint32 max_frames_per_second; |
}; |
-enum MediaTypeScheme { |
- LPCM, |
- // There will be more. |
+// Media type details for the VIDEO scheme. |
+// TODO(dalesat): Expand and document. |
+struct VideoMediaTypeDetails { |
+ VideoEncoding encoding; |
+ VideoProfile profile; |
+ PixelFormat pixel_format; |
+ ColorSpace color_space; |
+ uint32 width; |
+ uint32 height; |
+ uint32 coded_width; |
+ uint32 coded_height; |
+ |
+ // Encoding-specific parameter provided by demuxes and used by decoders. |
+ string extra_data_base64; |
}; |
-union MediaTypeDetails { |
- LpcmMediaTypeDetails lpcm; |
- // There will be more. |
+// Media type set details for the VIDEO scheme. |
+// TODO(dalesat): Expand and document. |
+struct VideoMediaTypeSetDetails { |
+ VideoEncoding encoding; |
+ uint32 min_width; |
+ uint32 max_width; |
+ uint32 min_height; |
+ uint32 max_height; |
}; |
-struct MediaType { |
- // Broadly identifies the media type and indicates how the details |
- // field is to be interpreted. |
- MediaTypeScheme scheme; |
+// Video encodings. |
+// TODO(dalesat): Add more video encodings. |
+enum VideoEncoding { |
+ // Placeholder indicating video encoding is unknown. |
+ UNKNOWN, |
- // Scheme-dependent details. |
- MediaTypeDetails details; |
+ // Placeholder indicating any video encoding. |
+ ANY, |
+ |
+ THEORA, |
+ VP8 |
}; |
-// A union of all media type set details. |
-union MediaTypeSetDetails { |
- // Each field name should correspond to a value in MediaTypeScheme. |
- LpcmMediaTypeSetDetails lpcm; |
+// Video profiles. |
+// TODO(dalesat): Blindly copied from Chromium, revisit. |
+enum VideoProfile { |
+ UNKNOWN, |
+ NOT_APPLICABLE, |
+ H264_BASELINE, |
+ H264_MAIN, |
+ H264_EXTENDED, |
+ H264_HIGH, |
+ H264_HIGH10, |
+ H264_HIGH422, |
+ H264_HIGH444_PREDICTIVE, |
+ H264_SCALABLE_BASELINE, |
+ H264_SCALABLE_HIGH, |
+ H264_STEREO_HIGH, |
+ H264_MULTIVIEW_HIGH |
}; |
-// Specifies a set of types of media. |
-struct MediaTypeSet { |
- // Broadly identifies the media types and indicates how the details |
- // field is to be interpreted. |
- MediaTypeScheme scheme; |
+// Pixel format. |
+// TODO(dalesat): Blindly copied from Chromium, revisit. |
+enum PixelFormat { |
+ UNKNOWN, |
+ I420, // 12bpp YUV planar 1x1 Y, 2x2 UV samples, a.k.a. YU12. |
+ YV12, // 12bpp YVU planar 1x1 Y, 2x2 VU samples. |
+ YV16, // 16bpp YVU planar 1x1 Y, 2x1 VU samples. |
+ YV12A, // 20bpp YUVA planar 1x1 Y, 2x2 VU, 1x1 A samples. |
+ YV24, // 24bpp YUV planar, no subsampling. |
+ NV12, // 12bpp with Y plane followed by a 2x2 interleaved UV plane. |
+ NV21, // 12bpp with Y plane followed by a 2x2 interleaved VU plane. |
+ UYVY, // 16bpp interleaved 2x1 U, 1x1 Y, 2x1 V, 1x1 Y samples. |
+ YUY2, // 16bpp interleaved 1x1 Y, 2x1 U, 1x1 Y, 2x1 V samples. |
+ ARGB, // 32bpp ARGB, 1 plane. |
+ XRGB, // 24bpp XRGB, 1 plane. |
+ RGB24, // 24bpp BGR, 1 plane. |
+ RGB32, // 32bpp BGRA, 1 plane. |
+ MJPEG, // MJPEG compressed. |
+ MT21 |
+}; |
- // Scheme-dependent details. |
- MediaTypeSetDetails details; |
+// Pixel format. |
+// TODO(dalesat): Blindly copied from Chromium, revisit. |
+enum ColorSpace { |
+ UNKNOWN, |
+ NOT_APPLICABLE, |
+ JPEG, |
+ HD_REC709, |
+ SD_REC601 |
}; |