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

Side by Side Diff: media/filters/vpx_video_decoder.h

Issue 114853002: media: Enabling direct rendering for VP9 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: addressing comments Created 7 years 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
« no previous file with comments | « no previous file | media/filters/vpx_video_decoder.cc » ('j') | media/filters/vpx_video_decoder.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 MEDIA_FILTERS_VPX_VIDEO_DECODER_H_ 5 #ifndef MEDIA_FILTERS_VPX_VIDEO_DECODER_H_
6 #define MEDIA_FILTERS_VPX_VIDEO_DECODER_H_ 6 #define MEDIA_FILTERS_VPX_VIDEO_DECODER_H_
7 7
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/memory/weak_ptr.h" 9 #include "base/memory/weak_ptr.h"
10 #include "media/base/demuxer_stream.h" 10 #include "media/base/demuxer_stream.h"
11 #include "media/base/video_decoder.h" 11 #include "media/base/video_decoder.h"
12 #include "media/base/video_decoder_config.h" 12 #include "media/base/video_decoder_config.h"
13 #include "media/base/video_frame.h" 13 #include "media/base/video_frame.h"
14 #include "media/base/video_frame_pool.h" 14 #include "media/base/video_frame_pool.h"
15 15
16 struct vpx_codec_ctx; 16 struct vpx_codec_ctx;
17 struct vpx_codec_frame_buffer;
17 struct vpx_image; 18 struct vpx_image;
18 19
19 namespace base { 20 namespace base {
20 class MessageLoopProxy; 21 class MessageLoopProxy;
21 } 22 }
22 23
23 namespace media { 24 namespace media {
24 25
25 // Libvpx video decoder wrapper. 26 // Libvpx video decoder wrapper.
26 // Note: VpxVideoDecoder accepts only YV12A VP8 content or VP9 content. This is 27 // Note: VpxVideoDecoder accepts only YV12A VP8 content or VP9 content. This is
27 // done to avoid usurping FFmpeg for all vp8 decoding, because the FFmpeg VP8 28 // done to avoid usurping FFmpeg for all vp8 decoding, because the FFmpeg VP8
28 // decoder is faster than the libvpx VP8 decoder. 29 // decoder is faster than the libvpx VP8 decoder.
29 class MEDIA_EXPORT VpxVideoDecoder : public VideoDecoder { 30 class MEDIA_EXPORT VpxVideoDecoder : public VideoDecoder {
30 public: 31 public:
31 explicit VpxVideoDecoder( 32 explicit VpxVideoDecoder(
32 const scoped_refptr<base::MessageLoopProxy>& message_loop); 33 const scoped_refptr<base::MessageLoopProxy>& message_loop);
33 virtual ~VpxVideoDecoder(); 34 virtual ~VpxVideoDecoder();
34 35
35 // VideoDecoder implementation. 36 // VideoDecoder implementation.
36 virtual void Initialize(const VideoDecoderConfig& config, 37 virtual void Initialize(const VideoDecoderConfig& config,
37 const PipelineStatusCB& status_cb) OVERRIDE; 38 const PipelineStatusCB& status_cb) OVERRIDE;
38 virtual void Decode(const scoped_refptr<DecoderBuffer>& buffer, 39 virtual void Decode(const scoped_refptr<DecoderBuffer>& buffer,
39 const DecodeCB& decode_cb) OVERRIDE; 40 const DecodeCB& decode_cb) OVERRIDE;
40 virtual void Reset(const base::Closure& closure) OVERRIDE; 41 virtual void Reset(const base::Closure& closure) OVERRIDE;
41 virtual void Stop(const base::Closure& closure) OVERRIDE; 42 virtual void Stop(const base::Closure& closure) OVERRIDE;
42 virtual bool HasAlpha() const OVERRIDE; 43 virtual bool HasAlpha() const OVERRIDE;
43 44
45 // Callback that will be called by libvpx if the frame buffer size needs to
46 // increase. Parameters:
47 // user_priv Data passed into libvpx (we pass NULL).
48 // new_size Minimum size needed by libvpx to decompress the next frame.
49 // fb Pointer to the frame buffer to update.
50 // Returns VPX_CODEC_OK on success. Returns < 0 on failure.
51 static int32 ReallocVP9FrameBuffer(void* user_priv, size_t new_size,
52 vpx_codec_frame_buffer* fb);
53
44 private: 54 private:
45 enum DecoderState { 55 enum DecoderState {
46 kUninitialized, 56 kUninitialized,
47 kNormal, 57 kNormal,
48 kFlushCodec, 58 kFlushCodec,
49 kDecodeFinished, 59 kDecodeFinished,
50 kError 60 kError
51 }; 61 };
52 62
53 // Handles (re-)initializing the decoder with a (new) config. 63 // Handles (re-)initializing the decoder with a (new) config.
(...skipping 22 matching lines...) Expand all
76 DecodeCB decode_cb_; 86 DecodeCB decode_cb_;
77 base::Closure reset_cb_; 87 base::Closure reset_cb_;
78 88
79 VideoDecoderConfig config_; 89 VideoDecoderConfig config_;
80 90
81 vpx_codec_ctx* vpx_codec_; 91 vpx_codec_ctx* vpx_codec_;
82 vpx_codec_ctx* vpx_codec_alpha_; 92 vpx_codec_ctx* vpx_codec_alpha_;
83 93
84 VideoFramePool frame_pool_; 94 VideoFramePool frame_pool_;
85 95
96 // Frame Buffers used for VP9 decoding.
97 vpx_codec_frame_buffer* frame_buffers_;
acolwell GONE FROM CHROMIUM 2013/12/17 19:07:03 nit: Use scoped_vector<vpx_codec_frame_buffer>
vignesh 2013/12/18 18:01:02 not applicable anymore. Done.
98
86 DISALLOW_COPY_AND_ASSIGN(VpxVideoDecoder); 99 DISALLOW_COPY_AND_ASSIGN(VpxVideoDecoder);
87 }; 100 };
88 101
89 } // namespace media 102 } // namespace media
90 103
91 #endif // MEDIA_FILTERS_VPX_VIDEO_DECODER_H_ 104 #endif // MEDIA_FILTERS_VPX_VIDEO_DECODER_H_
OLDNEW
« no previous file with comments | « no previous file | media/filters/vpx_video_decoder.cc » ('j') | media/filters/vpx_video_decoder.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698