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

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

Issue 11260007: Add FFmpeg audio decoder for the clear key CDM. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased on 11242005 and 11189082 Created 8 years, 2 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
(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_AUDIO_DECODER_H_
6 #define WEBKIT_MEDIA_CRYPTO_PPAPI_FFMPEG_CDM_AUDIO_DECODER_H_
7
8 #include <vector>
9
10 #include "base/basictypes.h"
11 #include "base/time.h"
12 #include "base/compiler_specific.h"
13 #include "webkit/media/crypto/ppapi/content_decryption_module.h"
14
15 struct AVCodecContext;
16 struct AVFrame;
17
18 namespace webkit_media {
19
20 class FFmpegCdmAudioDecoder {
21 public:
22 explicit FFmpegCdmAudioDecoder(cdm::Allocator* allocator);
23 ~FFmpegCdmAudioDecoder();
24 bool Initialize(const cdm::AudioDecoderConfig& config);
25 void Deinitialize();
26 void Reset();
27
28 // Returns true when |config| is a valid audio decoder configuration.
29 static bool IsValidConfig(const cdm::AudioDecoderConfig& config);
30
31 // Decodes |compressed_buffer|. Stores output frame in |decoded_frames| and
32 // returns |cdm::kSuccess| when an output is available. Returns
33 // |cdm::kNeedMoreData| when |compressed_frame| does not produce a output.
34 // 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
35 cdm::Status DecodeBuffer(const uint8_t* compressed_buffer,
36 int32_t compressed_buffer_size,
37 int64_t timestamp,
38 cdm::AudioFrames* decoded_frames);
39
40 private:
41 void ResetOutputTime();
42 void ReleaseFFmpegResources();
43
44 base::TimeDelta GetNextOutputTimestamp() const;
45
46 void SerializeInt64(int64_t value);
47
48 // FFmpeg structures owned by this object.
49 AVCodecContext* codec_context_;
50 AVFrame* av_frame_;
51
52 bool is_initialized_;
53
54 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.
55
56 // Decoded audio format.
57 int bits_per_channel_;
58 int samples_per_second_;
59
60 // Used for computing output timestamps.
61 int bytes_per_frame_;
62 base::TimeDelta output_timestamp_base_;
63 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.
64 base::TimeDelta last_input_timestamp_;
65
66 // Number of output sample bytes to drop before generating
67 // output buffers.
68 int output_bytes_to_drop_;
69
70 typedef std::vector<uint8_t> SerializedAudioFrames;
71 SerializedAudioFrames serialized_audio_frames_;
72
73 DISALLOW_COPY_AND_ASSIGN(FFmpegCdmAudioDecoder);
74 };
75
76 } // namespace webkit_media
77
78 #endif // WEBKIT_MEDIA_CRYPTO_PPAPI_FFMPEG_CDM_AUDIO_DECODER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698