[MediaRouter] Update MR-2-Extension's PostMessage to return boolean.
[chromium-blink-merge.git] / chromecast / media / cma / base / coded_frame_provider.h
blobb13231d8e59e1a59ff451498a696174b1bbad2b9
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
3 // found in the LICENSE file.
5 #ifndef CHROMECAST_MEDIA_CMA_BASE_CODED_FRAME_PROVIDER_H_
6 #define CHROMECAST_MEDIA_CMA_BASE_CODED_FRAME_PROVIDER_H_
8 #include "base/callback.h"
9 #include "base/macros.h"
10 #include "base/memory/ref_counted.h"
12 namespace media {
13 class AudioDecoderConfig;
14 class VideoDecoderConfig;
17 namespace chromecast {
18 namespace media {
19 class DecoderBufferBase;
21 class CodedFrameProvider {
22 public:
23 typedef base::Callback<void(const scoped_refptr<DecoderBufferBase>&,
24 const ::media::AudioDecoderConfig&,
25 const ::media::VideoDecoderConfig&)> ReadCB;
27 CodedFrameProvider();
28 virtual ~CodedFrameProvider();
30 // Request a coded frame which is provided asynchronously through callback
31 // |read_cb|.
32 // If the frame is associated with a new video/audio configuration,
33 // these configurations are returned as part of the |read_cb| callback.
34 // Invoking the |read_cb| callback with invalid audio/video configurations
35 // means the configurations have not changed.
36 virtual void Read(const ReadCB& read_cb) = 0;
38 // Flush the coded frames held by the frame provider.
39 // Invoke callback |flush_cb| when completed.
40 // Note: any pending read is cancelled, meaning that any pending |read_cb|
41 // callback will not be invoked.
42 virtual void Flush(const base::Closure& flush_cb) = 0;
44 private:
45 DISALLOW_COPY_AND_ASSIGN(CodedFrameProvider);
48 } // namespace media
49 } // namespace chromecast
51 #endif // CHROMECAST_MEDIA_CMA_BASE_CODED_FRAME_PROVIDER_H_