summaryrefslogtreecommitdiff
path: root/chromium/media/mojo/interfaces/demuxer_stream.mojom
blob: 5b880b747c4b3d43a60ff45aa4125c870a58598b (plain)
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
56
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

module media.interfaces;

import "media/mojo/interfaces/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.
  enum Type {
    UNKNOWN,
    AUDIO,
    VIDEO,
    LAST_TYPE = VIDEO,
  };

  // See media::DemuxerStream for descriptions.
  enum Status {
    OK = 0,
    ABORTED,
    CONFIG_CHANGED,
  };

  // 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 a 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, |buffer| should be non-null and clients must fill out
  //   the data section of the returned media::DecoderBuffer by reading from
  //   the |pipe| provided during Initialize().
  // - If |status| is ABORTED, all other fields should be null.
  // - If |status| is CONFIG_CHANGED, the config for the stream type should be
  //   non-null.
  //
  // 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() => (Status status,
             DecoderBuffer? buffer,
             AudioDecoderConfig? audio_config,
             VideoDecoderConfig? video_config);
};