| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 module mojo; | 5 module mojo; |
| 6 | 6 |
| 7 import "media/mojo/interfaces/media_types.mojom"; | 7 import "media/mojo/interfaces/media_types.mojom"; |
| 8 | 8 |
| 9 // DemuxerStream is modeled after media::DemuxerStream using mojo in order to | 9 // DemuxerStream is modeled after media::DemuxerStream using mojo in order to |
| 10 // enable proxying between a media::Pipeline and media::Renderer living in two | 10 // enable proxying between a media::Pipeline and media::Renderer living in two |
| 11 // different applications. | 11 // different applications. |
| 12 interface DemuxerStream { | 12 interface DemuxerStream { |
| 13 // See media::DemuxerStream for descriptions. | 13 // See media::DemuxerStream for descriptions. |
| 14 enum Type { | 14 enum Type { |
| 15 UNKNOWN, | 15 UNKNOWN, |
| 16 AUDIO, | 16 AUDIO, |
| 17 VIDEO, | 17 VIDEO, |
| 18 LAST_TYPE = VIDEO, | 18 LAST_TYPE = VIDEO, |
| 19 }; | 19 }; |
| 20 | 20 |
| 21 // See media::DemuxerStream for descriptions. | 21 // See media::DemuxerStream for descriptions. |
| 22 enum Status { | 22 enum Status { |
| 23 OK = 0, | 23 OK = 0, |
| 24 ABORTED, | 24 ABORTED, |
| 25 CONFIG_CHANGED, | 25 CONFIG_CHANGED, |
| 26 }; | 26 }; |
| 27 | 27 |
| 28 // Tells the DemuxerStream which DemuxerStreamObserver to interact with. Must | 28 // Initializes the DemuxerStream. Read() can only be called after the callback |
| 29 // be called before any other methods. Upon receipt of the callback, clients | 29 // is received. The returned |pipe| will be used to fill out the data section |
| 30 // may call DemuxerStream::Read() to request buffers. The returned |pipe| will | 30 // of the media::DecoderBuffer returned via DemuxerStream::Read(). Only the |
| 31 // be used to fill out the data section of the media::DecoderBuffer returned | 31 // config for |type| should be non-null, which is the initial config of the |
| 32 // via DemuxerStream::Read(). | 32 // stream. |
| 33 Initialize(DemuxerStreamObserver observer) | 33 Initialize() => (Type type, |
| 34 => (handle<data_pipe_consumer> pipe); | 34 handle<data_pipe_consumer> pipe, |
| 35 AudioDecoderConfig? audio_config, |
| 36 VideoDecoderConfig? video_config); |
| 35 | 37 |
| 36 // Request a MediaDecoderBuffer from this stream for decoding and rendering. | 38 // Requests a MediaDecoderBuffer from this stream for decoding and rendering. |
| 37 // See media::DemuxerStream::ReadCB for an explanation of the fields. | 39 // See media::DemuxerStream::ReadCB for a general explanation of the fields. |
| 38 // | 40 // |
| 39 // Upon receipt of the callback, clients must fill out the data section of | 41 // Notes on the callback: |
| 40 // the returned media::DecoderBuffer by reading from the |pipe| provided | 42 // - If |status| is OK, |buffer| should be non-null and clients must fill out |
| 41 // during Initialize(). | 43 // the data section of the returned media::DecoderBuffer by reading from |
| 44 // the |pipe| provided during Initialize(). |
| 45 // - If |status| is ABORTED, all other fields should be null. |
| 46 // - If |status| is CONFIG_CHANGED, the config for the stream type should be |
| 47 // non-null. |
| 42 // | 48 // |
| 43 // TODO(dalecurtis): Remove this method in favor of serializing everything | 49 // TODO(dalecurtis): Remove this method in favor of serializing everything |
| 44 // into the DataPipe given to Initialize() once DataPipe supports framed data | 50 // into the DataPipe given to Initialize() once DataPipe supports framed data |
| 45 // in a nicer fashion. | 51 // in a nicer fashion. |
| 46 Read() => (Status status, MediaDecoderBuffer? buffer); | 52 Read() => (Status status, |
| 53 MediaDecoderBuffer? buffer, |
| 54 AudioDecoderConfig? audio_config, |
| 55 VideoDecoderConfig? video_config); |
| 47 }; | 56 }; |
| 48 | |
| 49 interface DemuxerStreamObserver { | |
| 50 // A new AudioDecoderConfig is available. Will be sent by the DemuxerStream | |
| 51 // whenever a DemuxerStream::STATUS_CONFIG_CHANGED is observed (either | |
| 52 // in a Read() callback or over the DataPipe). | |
| 53 OnAudioDecoderConfigChanged(AudioDecoderConfig config); | |
| 54 | |
| 55 // A new VideoDecoderConfig is available. Will be sent by the DemuxerStream | |
| 56 // whenever a DemuxerStream::STATUS_CONFIG_CHANGED is observed (either | |
| 57 // in a Read() callback or over the DataPipe). | |
| 58 OnVideoDecoderConfigChanged(VideoDecoderConfig config); | |
| 59 }; | |
| OLD | NEW |