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 "base/memory/ref_counted.h" | |
ddorwin
2012/10/16 18:04:30
What is ref counted?
Tom Finegan
2012/10/16 21:44:44
Removed, vestige of media/filters/ffmpeg_video_dec
| |
11 #include "webkit/media/crypto/ppapi/content_decryption_module.h" | |
12 | |
13 struct AVCodecContext; | |
14 struct AVFrame; | |
15 | |
16 namespace webkit_media { | |
17 | |
18 static const uint32_t kBufferAlignment = 32; | |
19 static const uint32_t kBufferPadBytes = kBufferAlignment - 1; | |
20 static const int kDecodeThreads = 1; | |
21 | |
22 bool IsValidConfig(cdm::VideoFormat format, const cdm::Size& data_size); | |
ddorwin
2012/10/16 18:04:30
Should this all be in the cdm namespace? It's only
Tom Finegan
2012/10/16 21:44:44
This should not have been here. Made it a static m
| |
23 | |
24 class FFmpegCdmVideoDecoder { | |
25 public: | |
26 FFmpegCdmVideoDecoder(cdm::Allocator* allocator); | |
27 ~FFmpegCdmVideoDecoder(); | |
28 bool Initialize(const cdm::VideoDecoderConfig& config); | |
29 void Deinitialize(); | |
30 void Reset(); | |
31 | |
32 // Decodes |compressed_frame|, and stores decoded frame in |decoded_frame| | |
33 // when an output frame is available. Returns true when when successful. | |
ddorwin
2012/10/16 18:04:30
"Returns whether the call was successful."
Then y
Tom Finegan
2012/10/16 21:44:44
Done.
| |
34 // Note: This method can return true with a null |decoded_frame|. This occurs | |
35 // when the decoder needs more data to produce an output video frame. Returns | |
36 // false upon failure. | |
xhwang
2012/10/16 21:59:53
During EOS, we'll call DecodeFrame with NULL input
Tom Finegan
2012/10/17 02:39:10
Method returns cdm::Status now, as it should have
| |
37 bool DecodeFrame(const uint8_t* compressed_frame, | |
38 int32_t compressed_frame_size, | |
39 int64_t timestamp, | |
40 cdm::VideoFrame* decoded_frame); | |
41 | |
42 // Callback called from within FFmpeg to allocate a buffer based on | |
43 // the dimensions of |codec_context|. See AVCodecContext.get_buffer | |
44 // documentation inside FFmpeg. | |
45 int GetVideoBuffer(AVCodecContext* codec_context, AVFrame* frame); | |
ddorwin
2012/10/16 18:04:30
Can this be private? It's provided to FFmpeg as a
Tom Finegan
2012/10/16 21:44:44
This is what GetCdmVideoBufferImpl() calls, and th
ddorwin
2012/10/17 03:18:20
Go back. This causes you to friend and non-static
Tom Finegan
2012/10/17 04:25:29
Done.
| |
46 | |
47 private: | |
48 void ReleaseFFmpegResources(); | |
49 | |
50 // FFmpeg structures owned by this object. | |
ddorwin
2012/10/16 18:04:30
Can we use scoped_ptr since these are owned? Or is
Tom Finegan
2012/10/16 21:44:44
Discussed offline. Not really too much base, more
xhwang
2012/10/17 18:43:00
I miss boost::shared_ptr where you can specify del
| |
51 AVCodecContext* codec_context_; | |
52 AVFrame* av_frame_; | |
53 | |
54 cdm::Allocator* const allocator_; | |
55 cdm::VideoDecoderConfig config_; | |
56 | |
57 DISALLOW_COPY_AND_ASSIGN(FFmpegCdmVideoDecoder); | |
58 }; | |
59 | |
60 } // namespace webkit_media | |
61 | |
62 #endif // WEBKIT_MEDIA_CRYPTO_PPAPI_FFMPEG_CDM_VIDEO_DECODER_H_ | |
OLD | NEW |