OLD | NEW |
---|---|
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 MEDIA_CAST_RTP_RECEVIER_CODECS_VP8_VP8_DECODER_H_ | 5 #ifndef MEDIA_CAST_RTP_RECEVIER_CODECS_VP8_VP8_DECODER_H_ |
6 #define MEDIA_CAST_RTP_RECEVIER_CODECS_VP8_VP8_DECODER_H_ | 6 #define MEDIA_CAST_RTP_RECEVIER_CODECS_VP8_VP8_DECODER_H_ |
7 | 7 |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/threading/non_thread_safe.h" | 9 #include "base/threading/non_thread_safe.h" |
10 #include "media/cast/cast_config.h" | 10 #include "media/cast/cast_config.h" |
11 #include "media/cast/cast_environment.h" | |
12 #include "media/cast/cast_receiver.h" | |
11 #include "third_party/libvpx/source/libvpx/vpx/vpx_decoder.h" | 13 #include "third_party/libvpx/source/libvpx/vpx/vpx_decoder.h" |
12 | 14 |
13 typedef struct vpx_codec_ctx vpx_dec_ctx_t; | 15 typedef struct vpx_codec_ctx vpx_dec_ctx_t; |
14 | 16 |
15 namespace media { | 17 namespace media { |
16 namespace cast { | 18 namespace cast { |
17 | 19 |
18 // This class is not thread safe; it's only called from the cast video decoder | 20 // This class is not thread safe; it's only called from the cast video decoder |
19 // thread. | 21 // thread. |
20 class Vp8Decoder : public base::NonThreadSafe { | 22 class Vp8Decoder : public base::NonThreadSafe { |
21 public: | 23 public: |
22 explicit Vp8Decoder(int number_of_cores); | 24 Vp8Decoder(int number_of_cores, |
25 scoped_refptr<CastEnvironment> cast_environment); | |
Alpha Left Google
2013/11/06 02:22:06
The usual style for scoped_refptr is to pass it as
mikhal
2013/11/06 18:29:16
This way is consistent with the rest of Cast. Will
| |
23 ~Vp8Decoder(); | 26 ~Vp8Decoder(); |
24 | 27 |
25 // Decode encoded image (as a part of a video stream). | 28 // Decode encoded image (as a part of a video stream). The decoded frame will |
Alpha Left Google
2013/11/06 02:22:06
nit: Decode a frame (...).
"Decode encoded image"
mikhal
2013/11/06 18:29:16
Done.
| |
26 bool Decode(const EncodedVideoFrame& input_image, | 29 // be passed via the callback. |
27 I420VideoFrame* decoded_frame); | 30 // Will return false in case of error, and then it's up to the caller to |
31 // release the memory. | |
32 bool Decode(const EncodedVideoFrame* encoded_frame, | |
Alpha Left Google
2013/11/06 02:22:06
Is the ownership of |encoded_frame| passed? If not
mikhal
2013/11/06 18:29:16
Done.
| |
33 const base::TimeTicks render_time, | |
34 const VideoFrameDecodedCallback& | |
35 frame_decoded_callback); | |
Alpha Left Google
2013/11/06 02:22:06
You can pass the callback by value instead of cons
mikhal
2013/11/06 18:29:16
Done.
| |
28 | 36 |
29 private: | 37 private: |
30 // Initialize the decoder. | 38 // Initialize the decoder. |
31 void InitDecode(int number_of_cores); | 39 void InitDecode(int number_of_cores); |
32 | 40 |
33 scoped_ptr<vpx_dec_ctx_t> decoder_; | 41 scoped_ptr<vpx_dec_ctx_t> decoder_; |
42 scoped_refptr<CastEnvironment> cast_environment_; | |
34 }; | 43 }; |
35 | 44 |
36 } // namespace cast | 45 } // namespace cast |
37 } // namespace media | 46 } // namespace media |
38 | 47 |
39 #endif // MEDIA_CAST_RTP_RECEVIER_CODECS_VP8_VP8_DECODER_H_ | 48 #endif // MEDIA_CAST_RTP_RECEVIER_CODECS_VP8_VP8_DECODER_H_ |
OLD | NEW |