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

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

Issue 11468018: Add libvpx wrapper to media to support VP9 video decoding. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address comments. Created 8 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 | 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 MEDIA_FILTERS_VPX_VIDEO_DECODER_H_
6 #define MEDIA_FILTERS_VPX_VIDEO_DECODER_H_
7
8 #include "base/callback.h"
9 #include "base/memory/ref_counted.h"
10 #include "media/base/demuxer_stream.h"
11 #include "media/base/video_decoder.h"
12
13 struct vpx_codec_ctx;
14 struct vpx_image;
15
16 namespace base {
17 class MessageLoopProxy;
18 }
19
20 namespace media {
21
22 class MEDIA_EXPORT VpxVideoDecoder : public VideoDecoder {
23 public:
24 VpxVideoDecoder(const scoped_refptr<base::MessageLoopProxy>& message_loop);
fgalligan1 2012/12/13 20:17:31 add explicit
Tom Finegan 2012/12/14 01:52:31 Done.
25
26 // VideoDecoder implementation.
27 virtual void Initialize(const scoped_refptr<DemuxerStream>& stream,
28 const PipelineStatusCB& status_cb,
29 const StatisticsCB& statistics_cb) OVERRIDE;
30 virtual void Read(const ReadCB& read_cb) OVERRIDE;
31 virtual void Reset(const base::Closure& closure) OVERRIDE;
32 virtual void Stop(const base::Closure& closure) OVERRIDE;
33
34 protected:
35 virtual ~VpxVideoDecoder();
36
37 private:
38 enum DecoderState {
39 kUninitialized,
40 kNormal,
41 kFlushCodec,
42 kDecodeFinished
43 };
44
45 // Handles (re-)initializing the decoder with a (new) config.
46 // Returns true when initialization was successful.
47 bool ConfigureDecoder();
48
49 void CloseDecoder();
50
51 // Carries out the buffer reading operation scheduled by Read().
52 void DoRead(const ReadCB& read_cb);
53
54 void ReadFromDemuxerStream();
55
56 // Carries out the buffer processing operation scheduled by
57 // DecryptOrDecodeBuffer().
58 void DoDecryptOrDecodeBuffer(DemuxerStream::Status status,
59 const scoped_refptr<DecoderBuffer>& buffer);
60
61 void DecodeBuffer(const scoped_refptr<DecoderBuffer>& buffer);
62 bool Decode(const scoped_refptr<DecoderBuffer>& buffer,
63 scoped_refptr<VideoFrame>* video_frame);
64
65 // Reset decoder and call |reset_cb_|.
66 void DoReset();
67
68 bool CopyVpxImageTo(const vpx_image* vpx_image,
69 scoped_refptr<VideoFrame>* video_frame);
70
71 scoped_refptr<base::MessageLoopProxy> message_loop_;
72
73 DecoderState state_;
74
75 StatisticsCB statistics_cb_;
76 ReadCB read_cb_;
77 base::Closure reset_cb_;
78
79 int64 frame_num_;
fgalligan1 2012/12/13 20:17:31 Remove
Tom Finegan 2012/12/14 01:52:31 Done.
80 scoped_refptr<VideoFrame> video_frame_;
fgalligan1 2012/12/13 20:17:31 Remove
Tom Finegan 2012/12/14 01:52:31 Done.
81
82 // Pointer to the demuxer stream that will feed us compressed buffers.
83 scoped_refptr<DemuxerStream> demuxer_stream_;
84
85 vpx_codec_ctx* vpx_codec_;
86
87 DISALLOW_COPY_AND_ASSIGN(VpxVideoDecoder);
88 };
89
90 } // namespace media
91
92 #endif // MEDIA_FILTERS_VPX_VIDEO_DECODER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698