summaryrefslogtreecommitdiff
path: root/chromium/media/cdm/ppapi/cdm_video_decoder.h
blob: 25d48f46b924dd3e4d9cb580b10f6a3e41e909e1 (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
// Copyright 2013 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.

#ifndef MEDIA_CDM_PPAPI_CDM_VIDEO_DECODER_H_
#define MEDIA_CDM_PPAPI_CDM_VIDEO_DECODER_H_

#include "base/basictypes.h"
#include "base/memory/scoped_ptr.h"
#include "media/cdm/ppapi/api/content_decryption_module.h"

namespace media {

class CdmVideoDecoder {
 public:
  virtual ~CdmVideoDecoder() {}
  virtual bool Initialize(const cdm::VideoDecoderConfig& config) = 0;
  virtual void Deinitialize() = 0;
  virtual void Reset() = 0;
  virtual bool is_initialized() const = 0;

  // Decodes |compressed_frame|. Stores output frame in |decoded_frame| and
  // returns |cdm::kSuccess| when an output frame is available. Returns
  // |cdm::kNeedMoreData| when |compressed_frame| does not produce an output
  // frame. Returns |cdm::kDecodeError| when decoding fails.
  //
  // A null |compressed_frame| will attempt to flush the decoder of any
  // remaining frames. |compressed_frame_size| and |timestamp| are ignored.
  virtual cdm::Status DecodeFrame(const uint8_t* compressed_frame,
                                  int32_t compressed_frame_size,
                                  int64_t timestamp,
                                  cdm::VideoFrame* decoded_frame) = 0;
};

// Initializes appropriate video decoder based on GYP flags and the value of
// |config.codec|. Returns a scoped_ptr containing a non-null initialized
// CdmVideoDecoder* upon success.
scoped_ptr<CdmVideoDecoder> CreateVideoDecoder(
    cdm::Host* host, const cdm::VideoDecoderConfig& config);

}  // namespace media

#endif  // MEDIA_CDM_PPAPI_CDM_VIDEO_DECODER_H_