Chromium Code Reviews| Index: webkit/media/crypto/ppapi/ffmpeg_cdm_video_decoder.h |
| diff --git a/webkit/media/crypto/ppapi/ffmpeg_cdm_video_decoder.h b/webkit/media/crypto/ppapi/ffmpeg_cdm_video_decoder.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..f23cc41aa7a5a5bd855d650ccc23c0131d5042c5 |
| --- /dev/null |
| +++ b/webkit/media/crypto/ppapi/ffmpeg_cdm_video_decoder.h |
| @@ -0,0 +1,60 @@ |
| +// Copyright (c) 2012 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 WEBKIT_MEDIA_CRYPTO_PPAPI_FFMPEG_CDM_VIDEO_DECODER_H_ |
| +#define WEBKIT_MEDIA_CRYPTO_PPAPI_FFMPEG_CDM_VIDEO_DECODER_H_ |
| + |
| +#include "base/basictypes.h" |
| +#include "base/compiler_specific.h" |
| +#include "base/memory/scoped_ptr.h" |
|
xhwang
2012/10/18 16:30:25
why scoped_ptr here?
Tom Finegan
2012/10/18 19:29:41
Forgot to remove it, thanks.
|
| +#include "webkit/media/crypto/ppapi/content_decryption_module.h" |
| + |
| +struct AVCodecContext; |
| +struct AVFrame; |
| + |
| +namespace webkit_media { |
| + |
| +class FFmpegCdmVideoDecoder { |
| + public: |
| + FFmpegCdmVideoDecoder(cdm::Allocator* allocator); |
| + ~FFmpegCdmVideoDecoder(); |
| + bool Initialize(const cdm::VideoDecoderConfig& config); |
| + void Deinitialize(); |
| + void Reset(); |
| + |
| + // Returns true when |format| and |data_size| specify a supported video |
| + // output configuration. |
| + static bool IsValidOutputConfig(cdm::VideoFormat format, |
|
xhwang
2012/10/18 16:30:25
const-ref for format?
Tom Finegan
2012/10/18 19:29:41
It's just an enum?
xhwang
2012/10/18 19:35:16
nm then.
|
| + const cdm::Size& data_size); |
| + |
| + // 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. |
| + cdm::Status DecodeFrame(const uint8_t* compressed_frame, |
| + int32_t compressed_frame_size, |
| + int64_t timestamp, |
| + cdm::VideoFrame* decoded_frame); |
| + |
| + private: |
| + // Allocates storage, then copies video frame stored in |av_frame_| to |
| + // |cdm_video_frame|. Returns true when allocation and copy succeed. |
| + bool CopyAvFrameTo(cdm::VideoFrame* cdm_video_frame); |
| + |
| + void ReleaseFFmpegResources(); |
| + |
| + // FFmpeg structures owned by this object. |
| + AVCodecContext* codec_context_; |
| + AVFrame* av_frame_; |
| + |
| + bool is_initialized_; |
| + |
| + cdm::Allocator* const allocator_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(FFmpegCdmVideoDecoder); |
| +}; |
| + |
| +} // namespace webkit_media |
| + |
| +#endif // WEBKIT_MEDIA_CRYPTO_PPAPI_FFMPEG_CDM_VIDEO_DECODER_H_ |