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..3a6eb57b5e8b8693d2f8a2a1aac8236cc91df560 |
--- /dev/null |
+++ b/webkit/media/crypto/ppapi/ffmpeg_cdm_video_decoder.h |
@@ -0,0 +1,63 @@ |
+// 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/ref_counted.h" |
ddorwin
2012/10/17 03:18:20
still here
Tom Finegan
2012/10/17 04:25:29
But I fixed it in the .cc file... Done.
|
+#include "webkit/media/crypto/ppapi/content_decryption_module.h" |
+ |
+struct AVCodecContext; |
+struct AVFrame; |
+ |
+namespace webkit_media { |
+ |
+static const uint32_t kBufferAlignment = 32; |
+static const uint32_t kBufferPadBytes = kBufferAlignment - 1; |
+static const int kDecodeThreads = 1; |
+ |
+class FFmpegCdmVideoDecoder { |
+ public: |
+ FFmpegCdmVideoDecoder(cdm::Allocator* allocator); |
+ ~FFmpegCdmVideoDecoder(); |
+ bool Initialize(const cdm::VideoDecoderConfig& config); |
+ void Deinitialize(); |
+ void Reset(); |
+ |
+ // 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: |
+ // Callback called from within FFmpeg to allocate a buffer based on |
+ // the dimensions of |codec_context|. See AVCodecContext.get_buffer |
+ // documentation inside FFmpeg. |
+ int GetVideoBuffer(AVCodecContext* codec_context, AVFrame* frame); |
+ |
+ void ReleaseFFmpegResources(); |
+ |
+ // FFmpeg structures owned by this object. |
+ AVCodecContext* codec_context_; |
+ AVFrame* av_frame_; |
+ |
+ bool is_initialized_; |
+ |
+ cdm::Allocator* const allocator_; |
+ cdm::VideoDecoderConfig config_; |
+ |
+ friend int GetCdmVideoBufferImpl(AVCodecContext* s, AVFrame* frame); |
+ |
+ DISALLOW_COPY_AND_ASSIGN(FFmpegCdmVideoDecoder); |
+}; |
+ |
+} // namespace webkit_media |
+ |
+#endif // WEBKIT_MEDIA_CRYPTO_PPAPI_FFMPEG_CDM_VIDEO_DECODER_H_ |