Chromium Code Reviews| Index: webkit/media/crypto/ppapi/ffmpeg_cdm_audio_decoder.h |
| diff --git a/webkit/media/crypto/ppapi/ffmpeg_cdm_audio_decoder.h b/webkit/media/crypto/ppapi/ffmpeg_cdm_audio_decoder.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..6051b084ae285f0af225e002bff29520102a6fe1 |
| --- /dev/null |
| +++ b/webkit/media/crypto/ppapi/ffmpeg_cdm_audio_decoder.h |
| @@ -0,0 +1,78 @@ |
| +// 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_AUDIO_DECODER_H_ |
| +#define WEBKIT_MEDIA_CRYPTO_PPAPI_FFMPEG_CDM_AUDIO_DECODER_H_ |
| + |
| +#include <vector> |
| + |
| +#include "base/basictypes.h" |
| +#include "base/time.h" |
| +#include "base/compiler_specific.h" |
| +#include "webkit/media/crypto/ppapi/content_decryption_module.h" |
| + |
| +struct AVCodecContext; |
| +struct AVFrame; |
| + |
| +namespace webkit_media { |
| + |
| +class FFmpegCdmAudioDecoder { |
| + public: |
| + explicit FFmpegCdmAudioDecoder(cdm::Allocator* allocator); |
| + ~FFmpegCdmAudioDecoder(); |
| + bool Initialize(const cdm::AudioDecoderConfig& config); |
| + void Deinitialize(); |
| + void Reset(); |
| + |
| + // Returns true when |config| is a valid audio decoder configuration. |
| + static bool IsValidConfig(const cdm::AudioDecoderConfig& config); |
| + |
| + // Decodes |compressed_buffer|. Stores output frame in |decoded_frames| and |
| + // returns |cdm::kSuccess| when an output is available. Returns |
| + // |cdm::kNeedMoreData| when |compressed_frame| does not produce a output. |
| + // Returns |cdm::kDecodeError| when decoding fails. |
|
xhwang
2012/10/24 08:18:15
// Decodes |compressed_buffer|.
// Returns |cdm::k
Tom Finegan
2012/10/24 21:16:44
I didn't use your wording, but your main concern s
xhwang
2012/10/24 22:24:19
ok
|
| + cdm::Status DecodeBuffer(const uint8_t* compressed_buffer, |
| + int32_t compressed_buffer_size, |
| + int64_t timestamp, |
| + cdm::AudioFrames* decoded_frames); |
| + |
| + private: |
| + void ResetOutputTime(); |
| + void ReleaseFFmpegResources(); |
| + |
| + base::TimeDelta GetNextOutputTimestamp() const; |
| + |
| + void SerializeInt64(int64_t value); |
| + |
| + // FFmpeg structures owned by this object. |
| + AVCodecContext* codec_context_; |
| + AVFrame* av_frame_; |
| + |
| + bool is_initialized_; |
| + |
| + cdm::Allocator* const allocator_; |
|
xhwang
2012/10/24 08:18:15
Declaration order doesn't match initialization ord
Tom Finegan
2012/10/24 21:16:44
Done.
|
| + |
| + // Decoded audio format. |
| + int bits_per_channel_; |
| + int samples_per_second_; |
| + |
| + // Used for computing output timestamps. |
| + int bytes_per_frame_; |
| + base::TimeDelta output_timestamp_base_; |
| + double total_frames_decoded_; |
|
xhwang
2012/10/24 08:18:15
I know this is from media code, but it seems to me
Tom Finegan
2012/10/24 21:16:44
Done.
|
| + base::TimeDelta last_input_timestamp_; |
| + |
| + // Number of output sample bytes to drop before generating |
| + // output buffers. |
| + int output_bytes_to_drop_; |
| + |
| + typedef std::vector<uint8_t> SerializedAudioFrames; |
| + SerializedAudioFrames serialized_audio_frames_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(FFmpegCdmAudioDecoder); |
| +}; |
| + |
| +} // namespace webkit_media |
| + |
| +#endif // WEBKIT_MEDIA_CRYPTO_PPAPI_FFMPEG_CDM_AUDIO_DECODER_H_ |