1
    2
    3
    4
    5
    6
    7
    8
    9
   10
   11
   12
   13
   14
   15
   16
   17
   18
   19
   20
   21
   22
   23
   24
   25
   26
   27
   28
   29
   30
   31
   32
   33
   34
   35
   36
   37
   38
   39
   40
   41
   42
   43
   44
   45
   46
   47
   48
   49
   50
   51
   52
   53
   54
   55

media / mojo / mojom / demuxer_stream.mojom [blame]

// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

module media.mojom;

import "media/mojo/mojom/media_types.mojom";

// DemuxerStream is modeled after media::DemuxerStream using mojo in order to
// enable proxying between a media::Pipeline and media::Renderer living in two
// different applications.
interface DemuxerStream {
  // See media::DemuxerStream for descriptions.
  [Native]
  enum Type;

  // See media::DemuxerStream for descriptions.
  [Native]
  enum Status;

  // Initializes the DemuxerStream. Read() can only be called after the callback
  // is received. The returned |pipe| will be used to fill out the data section
  // of the media::DecoderBuffer returned via DemuxerStream::Read(). Only the
  // config for |type| should be non-null, which is the initial config of the
  // stream.
  Initialize() => (Type type,
                   handle<data_pipe_consumer> pipe,
                   AudioDecoderConfig? audio_config,
                   VideoDecoderConfig? video_config);

  // Requests multi DecoderBuffer from this stream for decoding and rendering.
  // See media::DemuxerStream::ReadCB for a general explanation of the fields.
  //
  // Notes on the callback:
  // - If |status| is OK, the size of |batch_buffers| should be 1<=n<=count
  //   and clients must fill out the data section of the returned
  //   array<DecoderBuffer> by reading from the |pipe| provided during
  //   Initialize().
  // - If |status| is ABORTED, |audio_config| and |video_config| should be null
  //   and size of |batch_buffers| is zero.
  // - If |status| is CONFIG_CHANGED, the config for the stream type should be
  //   non-null and size of |batch_buffers| is zero.
  //
  // TODO(dalecurtis): Remove this method in favor of serializing everything
  // into the DataPipe given to Initialize() once DataPipe supports framed data
  // in a nicer fashion.
  Read(uint32 count) => (Status status,
                        array<DecoderBuffer> batch_buffers,
                        AudioDecoderConfig? audio_config,
                        VideoDecoderConfig? video_config);

  // Enables converting bitstream to a format that is expected by the decoder.
  // For example, H.264/AAC bitstream based packets into H.264 Annex B format.
  EnableBitstreamConverter();
};