Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 [DartPackage="mojo_services"] | |
| 5 module mojo.media; | 6 module mojo.media; |
| 6 | 7 |
| 7 import "mojo/services/media/common/interfaces/media_common.mojom"; | 8 import "mojo/services/media/common/interfaces/media_common.mojom"; |
| 8 import "mojo/services/media/common/interfaces/media_pipe.mojom"; | 9 import "mojo/services/media/common/interfaces/media_pipe.mojom"; |
| 9 import "mojo/services/media/common/interfaces/media_types.mojom"; | 10 import "mojo/services/media/common/interfaces/media_types.mojom"; |
| 10 import "mojo/services/media/common/interfaces/rate_control.mojom"; | 11 import "mojo/services/media/common/interfaces/rate_control.mojom"; |
| 11 | 12 |
| 12 struct AudioTrackDescriptor { | 13 struct AudioTrackDescriptor { |
| 13 // The track supports the union of all these media type sets. | 14 // The track supports the union of all these media type sets. |
| 14 array<MediaTypeSet> supported_media_types; | 15 array<MediaTypeSet> supported_media_types; |
| 15 }; | 16 }; |
| 16 | 17 |
| 17 struct AudioTrackConfiguration { | 18 struct AudioTrackConfiguration { |
| 18 // The media type to use. | 19 // The media type to use. |
| 19 MediaType media_type; | 20 MediaType media_type; |
| 20 | 21 |
| 21 // Desired maximum buffer size, in frames of audio. | 22 // Desired maximum buffer size, in frames of audio. |
| 22 uint64 max_frames; | 23 uint64 max_frames; |
| 23 | 24 |
| 24 // Ratio of audio frames to media time ticks. | 25 // Ratio of audio frames to media time ticks. |
| 25 // | 26 // |
| 26 // Presentation time stamps on audio packets are expressed in units of media | 27 // Presentation time stamps on audio packets are expressed in units of media |
| 27 // time ticks. Many users will choose to use units of audio frames to express | 28 // time ticks. Many users will choose to use units of audio frames to express |
| 28 // their media time, and can simply leave this ratio at the default of 1:1. | 29 // their media time, and can simply leave this ratio at the default of 1:1. |
| 29 // For some, however, it may be more convenient to use different units for | 30 // For some, however, it may be more convenient to use different units for |
| 30 // media time. For example, if the audio frame rate was 48KHz, and the time | 31 // media time. For example, if the audio frame rate was 48KHz, and the time |
| 31 // stamps are expressed in 90KHz units (the units used by MPEG-2 Program | 32 // stamps are expressed in 90KHz units (the units used by MPEG-2 Program |
| 32 // Stream timestamps), the ratio should be set to 48000:90000 (aka, 8:15). | 33 // Stream timestamps), the ratio should be set to 48000:90000 (aka, 8:15). |
| 33 // IOW - audio_frame_ratio would be set to 8 and media_time_ratio would be set | 34 // IOW - audio_frame_ratio would be set to 8 and media_time_ratio would be set |
| 34 // to 15. | 35 // to 15. |
| 35 // | 36 // |
| 36 // Neither of these values may be 0. A configuration error will occur if they | 37 // Neither of these values may be 0. A configuration error will occur if they |
| 37 // are. | 38 // are. |
| 38 uint32 audio_frame_ratio = 1; | 39 uint32 audio_frame_ratio = 1; |
| 39 uint32 media_time_ratio = 1; | 40 uint32 media_time_ratio = 1; |
| 40 }; | 41 }; |
| 41 | 42 |
| 42 interface AudioTrack { | 43 interface AudioTrack { |
| 43 // Get the descriptor. | 44 // Get the descriptor. |
| 44 Describe() => (AudioTrackDescriptor descriptor); | 45 Describe() => (AudioTrackDescriptor descriptor); |
| 45 | 46 |
| 46 // Set the configuration, receive a pipe to send data to in return. | 47 // Set the configuration, receive a pipe to send data to in return. |
| 47 // Possible results include... | 48 // Possible results include... |
| 48 // | 49 // |
| 49 // kOK: | 50 // OK: |
| 50 // Configuration successful, the bound pipe interface is ready to be used. | 51 // Configuration successful, the bound pipe interface is ready to be used. |
| 51 // | 52 // |
| 52 // kInvalidArgs: | 53 // INVALID_ARGUMENT: |
|
jeffbrown
2015/12/10 20:00:59
Several of these errors should be handled by closi
dalesat
2015/12/10 22:33:38
Acknowledged.
| |
| 53 // One or more of the configuration arguments are illegal. For example, a | 54 // One or more of the configuration arguments are illegal. For example, a |
| 54 // value of 0 for either numerator or denominator of the audio frame to | 55 // value of 0 for either numerator or denominator of the audio frame to |
| 55 // media time ratio. | 56 // media time ratio. |
| 56 // | 57 // |
| 57 // kUnsupportedConfig: | 58 // kUnsupportedConfig: |
| 58 // The requested configuration is not supported by this track. | 59 // The requested configuration is not supported by this track. |
| 59 // | 60 // |
| 60 // kInsufficientResources: | 61 // INSUFFICIENT_RESOURCES: |
| 61 // Resource limitations prevent configuring the audio track is the desired | 62 // Resource limitations prevent configuring the audio track is the desired |
| 62 // way. Perhaps there is not enough RAM to support the 2.7 days of audio | 63 // way. Perhaps there is not enough RAM to support the 2.7 days of audio |
| 63 // buffer you requested, or perhaps there is not enough CPU power given the | 64 // buffer you requested, or perhaps there is not enough CPU power given the |
| 64 // existing active tracks in the system to support rendering 128 channels | 65 // existing active tracks in the system to support rendering 128 channels |
| 65 // at 1.5 MHz frame rate. | 66 // at 1.5 MHz frame rate. |
| 66 // | 67 // |
| 67 // kBadState: | 68 // BAD_STATE: |
| 68 // The track is already configured and has pending data in its pipe. Data | 69 // The track is already configured and has pending data in its pipe. Data |
| 69 // needs to be flushed and the media clock must be stopped before the track | 70 // needs to be flushed and the media clock must be stopped before the track |
| 70 // may be re-configured. | 71 // may be re-configured. |
| 71 Configure(AudioTrackConfiguration configuration, | 72 Configure(AudioTrackConfiguration configuration, |
| 72 MediaPipe& pipe) => (MediaResult result); | 73 MediaPipe& pipe) => (MediaResult result); |
| 73 | 74 |
| 74 // Request the rate control interface for this AudioTrack | 75 // Request the rate control interface for this AudioTrack |
| 75 // Possbile results include... | 76 // Possbile results include... |
| 76 // | 77 // |
| 77 // kOK: | 78 // OK: |
| 78 // Everything went well. | 79 // Everything went well. |
| 79 // | 80 // |
| 80 // kBadState: | 81 // BAD_STATE: |
| 81 // Rate control interface is already bound to a different client. | 82 // Rate control interface is already bound to a different client. |
| 82 GetRateControl(RateControl& rate_control) => (MediaResult result); | 83 GetRateControl(RateControl& rate_control) => (MediaResult result); |
| 83 }; | 84 }; |
| OLD | NEW |