OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 module mojo.media; |
| 6 |
| 7 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_types.mojom"; |
| 10 import "mojo/services/media/common/interfaces/rate_control.mojom"; |
| 11 |
| 12 struct AudioTrackDescriptor { |
| 13 // The track supports the union of all these media type sets. |
| 14 array<MediaTypeSet> supported_media_types; |
| 15 }; |
| 16 |
| 17 struct AudioTrackConfiguration { |
| 18 // The media type to use. |
| 19 MediaType media_type; |
| 20 |
| 21 // Desired maximum buffer size, in frames of audio. |
| 22 uint64 max_frames; |
| 23 |
| 24 // Ratio of audio frames to media time ticks. |
| 25 // |
| 26 // 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 // 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 // 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 // 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 // to 15. |
| 35 // |
| 36 // Neither of these values may be 0. A configuration error will occur if they |
| 37 // are. |
| 38 uint32 audio_frame_ratio = 1; |
| 39 uint32 media_time_ratio = 1; |
| 40 }; |
| 41 |
| 42 interface AudioTrack { |
| 43 // Get the descriptor. |
| 44 Describe() => (AudioTrackDescriptor descriptor); |
| 45 |
| 46 // Set the configuration, receive a pipe to send data to in return. |
| 47 // Possible results include... |
| 48 // |
| 49 // kOK: |
| 50 // Configuration successful, the bound pipe interface is ready to be used. |
| 51 // |
| 52 // kInvalidArgs: |
| 53 // 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 // media time ratio. |
| 56 // |
| 57 // kUnsupportedConfig: |
| 58 // The requested configuration is not supported by this track. |
| 59 // |
| 60 // kInsufficientResources: |
| 61 // 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 // 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 // at 1.5 MHz frame rate. |
| 66 // |
| 67 // kBadState: |
| 68 // 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 // may be re-configured. |
| 71 Configure(AudioTrackConfiguration configuration, |
| 72 MediaPipe& pipe) => (MediaResult result); |
| 73 |
| 74 // Request the rate control interface for this AudioTrack |
| 75 // Possbile results include... |
| 76 // |
| 77 // kOK: |
| 78 // Everything went well. |
| 79 // |
| 80 // kBadState: |
| 81 // Rate control interface is already bound to a different client. |
| 82 GetRateControl(RateControl& rate_control) => (MediaResult result); |
| 83 }; |
OLD | NEW |