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"
13 class AudioDecoderConfig
;
14 class VideoDecoderConfig
;
17 namespace chromecast
{
19 class DecoderBufferBase
;
21 class CodedFrameProvider
{
23 typedef base::Callback
<void(const scoped_refptr
<DecoderBufferBase
>&,
24 const ::media::AudioDecoderConfig
&,
25 const ::media::VideoDecoderConfig
&)> ReadCB
;
28 virtual ~CodedFrameProvider();
30 // Request a coded frame which is provided asynchronously through callback
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;
45 DISALLOW_COPY_AND_ASSIGN(CodedFrameProvider
);
49 } // namespace chromecast
51 #endif // CHROMECAST_MEDIA_CMA_BASE_CODED_FRAME_PROVIDER_H_