1 // Copyright 2014 The Chromium Authors
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
7 import "media/mojo/mojom/media_types.mojom";
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
11 // different applications.
12 interface DemuxerStream {
13 // See media::DemuxerStream for descriptions.
17 // See media::DemuxerStream for descriptions.
21 // Initializes the DemuxerStream. Read() can only be called after the callback
22 // is received. The returned |pipe| will be used to fill out the data section
23 // of the media::DecoderBuffer returned via DemuxerStream::Read(). Only the
24 // config for |type| should be non-null, which is the initial config of the
26 Initialize() => (Type type,
27 handle<data_pipe_consumer> pipe,
28 AudioDecoderConfig? audio_config,
29 VideoDecoderConfig? video_config);
31 // Requests multi DecoderBuffer from this stream for decoding and rendering.
32 // See media::DemuxerStream::ReadCB for a general explanation of the fields.
34 // Notes on the callback:
35 // - If |status| is OK, the size of |batch_buffers| should be 1<=n<=count
36 // and clients must fill out the data section of the returned
37 // array<DecoderBuffer> by reading from the |pipe| provided during
39 // - If |status| is ABORTED, |audio_config| and |video_config| should be null
40 // and size of |batch_buffers| is zero.
41 // - If |status| is CONFIG_CHANGED, the config for the stream type should be
42 // non-null and size of |batch_buffers| is zero.
44 // TODO(dalecurtis): Remove this method in favor of serializing everything
45 // into the DataPipe given to Initialize() once DataPipe supports framed data
46 // in a nicer fashion.
47 Read(uint32 count) => (Status status,
48 array<DecoderBuffer> batch_buffers,
49 AudioDecoderConfig? audio_config,
50 VideoDecoderConfig? video_config);
52 // Enables converting bitstream to a format that is expected by the decoder.
53 // For example, H.264/AAC bitstream based packets into H.264 Annex B format.
54 EnableBitstreamConverter();