OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2012 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. |
| 4 |
| 5 #ifndef WEBKIT_MEDIA_CRYPTO_PPAPI_FFMPEG_CDM_VIDEO_DECODER_H_ |
| 6 #define WEBKIT_MEDIA_CRYPTO_PPAPI_FFMPEG_CDM_VIDEO_DECODER_H_ |
| 7 |
| 8 #include "base/basictypes.h" |
| 9 #include "base/compiler_specific.h" |
| 10 #include "webkit/media/crypto/ppapi/content_decryption_module.h" |
| 11 |
| 12 struct AVCodecContext; |
| 13 struct AVFrame; |
| 14 |
| 15 namespace webkit_media { |
| 16 |
| 17 class FFmpegCdmVideoDecoder { |
| 18 public: |
| 19 FFmpegCdmVideoDecoder(cdm::Allocator* allocator); |
| 20 ~FFmpegCdmVideoDecoder(); |
| 21 bool Initialize(const cdm::VideoDecoderConfig& config); |
| 22 void Deinitialize(); |
| 23 void Reset(); |
| 24 |
| 25 // Decodes |compressed_frame|. Stores output frame in |decoded_frame| and |
| 26 // returns |cdm::kSuccess| when an output frame is available. Returns |
| 27 // |cdm::kNeedMoreData| when |compressed_frame| does not produce an output |
| 28 // frame. Returns |cdm::kDecodeError| when decoding fails. |
| 29 cdm::Status DecodeFrame(const uint8_t* compressed_frame, |
| 30 int32_t compressed_frame_size, |
| 31 int64_t timestamp, |
| 32 cdm::VideoFrame* decoded_frame); |
| 33 |
| 34 // Callback called from within FFmpeg to allocate a buffer based on |
| 35 // the dimensions of |codec_context|. See AVCodecContext.get_buffer |
| 36 // documentation inside FFmpeg. |
| 37 int GetVideoBuffer(AVCodecContext* codec_context, AVFrame* frame); |
| 38 |
| 39 private: |
| 40 void ReleaseFFmpegResources(); |
| 41 |
| 42 // FFmpeg structures owned by this object. |
| 43 AVCodecContext* codec_context_; |
| 44 AVFrame* av_frame_; |
| 45 |
| 46 bool is_initialized_; |
| 47 |
| 48 cdm::Allocator* const allocator_; |
| 49 cdm::VideoDecoderConfig config_; |
| 50 |
| 51 DISALLOW_COPY_AND_ASSIGN(FFmpegCdmVideoDecoder); |
| 52 }; |
| 53 |
| 54 } // namespace webkit_media |
| 55 |
| 56 #endif // WEBKIT_MEDIA_CRYPTO_PPAPI_FFMPEG_CDM_VIDEO_DECODER_H_ |
OLD | NEW |