Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(122)

Side by Side Diff: webkit/media/crypto/ppapi/ffmpeg_cdm_audio_decoder.h

Issue 12212079: Update Cdm Wrapper and ClearKeyCdm to work with CDM interface version 4. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: merged ddorwin's CL (https://codereview.chromium.org/12221102/) Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef WEBKIT_MEDIA_CRYPTO_PPAPI_FFMPEG_CDM_AUDIO_DECODER_H_ 5 #ifndef WEBKIT_MEDIA_CRYPTO_PPAPI_FFMPEG_CDM_AUDIO_DECODER_H_
6 #define WEBKIT_MEDIA_CRYPTO_PPAPI_FFMPEG_CDM_AUDIO_DECODER_H_ 6 #define WEBKIT_MEDIA_CRYPTO_PPAPI_FFMPEG_CDM_AUDIO_DECODER_H_
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 11 matching lines...) Expand all
22 } 22 }
23 23
24 namespace webkit_media { 24 namespace webkit_media {
25 25
26 // TODO(xhwang): This class is partially cloned from media::FFmpegAudioDecoder. 26 // TODO(xhwang): This class is partially cloned from media::FFmpegAudioDecoder.
27 // When media::FFmpegAudioDecoder is updated, it's a pain to keep this class 27 // When media::FFmpegAudioDecoder is updated, it's a pain to keep this class
28 // in sync with media::FFmpegAudioDecoder. We need a long term sustainable 28 // in sync with media::FFmpegAudioDecoder. We need a long term sustainable
29 // solution for this. See http://crbug.com/169203 29 // solution for this. See http://crbug.com/169203
30 class FFmpegCdmAudioDecoder { 30 class FFmpegCdmAudioDecoder {
31 public: 31 public:
32 explicit FFmpegCdmAudioDecoder(cdm::Allocator* allocator); 32 explicit FFmpegCdmAudioDecoder(cdm::Host* host);
33 ~FFmpegCdmAudioDecoder(); 33 ~FFmpegCdmAudioDecoder();
34 bool Initialize(const cdm::AudioDecoderConfig& config); 34 bool Initialize(const cdm::AudioDecoderConfig& config);
35 void Deinitialize(); 35 void Deinitialize();
36 void Reset(); 36 void Reset();
37 37
38 // Returns true when |config| is a valid audio decoder configuration. 38 // Returns true when |config| is a valid audio decoder configuration.
39 static bool IsValidConfig(const cdm::AudioDecoderConfig& config); 39 static bool IsValidConfig(const cdm::AudioDecoderConfig& config);
40 40
41 // Decodes |compressed_buffer|. Returns |cdm::kSuccess| after storing 41 // Decodes |compressed_buffer|. Returns |cdm::kSuccess| after storing
42 // output in |decoded_frames| when output is available. Returns 42 // output in |decoded_frames| when output is available. Returns
43 // |cdm::kNeedMoreData| when |compressed_frame| does not produce output. 43 // |cdm::kNeedMoreData| when |compressed_frame| does not produce output.
44 // Returns |cdm::kDecodeError| when decoding fails. 44 // Returns |cdm::kDecodeError| when decoding fails.
45 cdm::Status DecodeBuffer(const uint8_t* compressed_buffer, 45 cdm::Status DecodeBuffer(const uint8_t* compressed_buffer,
46 int32_t compressed_buffer_size, 46 int32_t compressed_buffer_size,
47 int64_t timestamp, 47 int64_t timestamp,
48 cdm::AudioFrames* decoded_frames); 48 cdm::AudioFrames* decoded_frames);
49 49
50 private: 50 private:
51 void ResetTimestampState(); 51 void ResetTimestampState();
52 void ReleaseFFmpegResources(); 52 void ReleaseFFmpegResources();
53 53
54 base::TimeDelta GetNextOutputTimestamp() const; 54 base::TimeDelta GetNextOutputTimestamp() const;
55 55
56 void SerializeInt64(int64_t value); 56 void SerializeInt64(int64_t value);
57 57
58 bool is_initialized_; 58 bool is_initialized_;
59 59
60 cdm::Allocator* const allocator_; 60 cdm::Host* const host_;
61 61
62 // FFmpeg structures owned by this object. 62 // FFmpeg structures owned by this object.
63 AVCodecContext* codec_context_; 63 AVCodecContext* codec_context_;
64 AVFrame* av_frame_; 64 AVFrame* av_frame_;
65 65
66 // Audio format. 66 // Audio format.
67 int bits_per_channel_; 67 int bits_per_channel_;
68 int samples_per_second_; 68 int samples_per_second_;
69 69
70 // Used for computing output timestamps. 70 // Used for computing output timestamps.
(...skipping 12 matching lines...) Expand all
83 83
84 typedef std::vector<uint8_t> SerializedAudioFrames; 84 typedef std::vector<uint8_t> SerializedAudioFrames;
85 SerializedAudioFrames serialized_audio_frames_; 85 SerializedAudioFrames serialized_audio_frames_;
86 86
87 DISALLOW_COPY_AND_ASSIGN(FFmpegCdmAudioDecoder); 87 DISALLOW_COPY_AND_ASSIGN(FFmpegCdmAudioDecoder);
88 }; 88 };
89 89
90 } // namespace webkit_media 90 } // namespace webkit_media
91 91
92 #endif // WEBKIT_MEDIA_CRYPTO_PPAPI_FFMPEG_CDM_AUDIO_DECODER_H_ 92 #endif // WEBKIT_MEDIA_CRYPTO_PPAPI_FFMPEG_CDM_AUDIO_DECODER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698