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

Side by Side Diff: media/mf/basic_renderer.h

Issue 3156046: Changed mft_h264_decoder's API to match with video_decode_engine.h. Also chan... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 10 years, 4 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) 2010 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 // Short / basic implementation to simulate rendering H.264 frames outputs by
6 // MF's H.264 decoder to screen.
7
8 #ifndef MEDIA_MF_BASIC_RENDERER_H_
9 #define MEDIA_MF_BASIC_RENDERER_H_
10
11 #include <d3d9.h>
12
13 #include "base/scoped_ptr.h"
14 #include "base/scoped_comptr_win.h"
15 #include "media/base/video_frame.h"
16 #include "media/mf/mft_h264_decoder.h"
17
18 namespace media {
19
20 class MftRenderer : public base::RefCountedThreadSafe<MftRenderer> {
21 public:
22 explicit MftRenderer(MftH264Decoder* decoder) : decoder_(decoder) {}
23 virtual ~MftRenderer() {}
24 virtual void ProcessFrame(scoped_refptr<VideoFrame> frame) = 0;
25 virtual void StartPlayback() = 0;
26 virtual void OnDecodeError(MftH264Decoder::Error error) = 0;
27
28 protected:
29 scoped_refptr<MftH264Decoder> decoder_;
30 };
31
32 // This renderer does nothing with the frame except discarding it.
33 class NullRenderer : public MftRenderer {
34 public:
35 explicit NullRenderer(MftH264Decoder* decoder);
36 virtual ~NullRenderer();
37 virtual void ProcessFrame(scoped_refptr<VideoFrame> frame);
38 virtual void StartPlayback();
39 virtual void OnDecodeError(MftH264Decoder::Error error);
40 };
41
42 // This renderer does a basic playback by drawing to |window_|. It tries to
43 // respect timing specified in the recevied VideoFrames.
44 class BasicRenderer : public MftRenderer {
45 public:
46 explicit BasicRenderer(MftH264Decoder* decoder,
47 HWND window, IDirect3DDevice9* device);
48 virtual ~BasicRenderer();
49 virtual void ProcessFrame(scoped_refptr<VideoFrame> frame);
50 virtual void StartPlayback();
51 virtual void OnDecodeError(MftH264Decoder::Error error);
52
53 private:
54 HWND window_;
55 ScopedComPtr<IDirect3DDevice9> device_;
56 };
57
58 } // namespace media
59
60 #endif // MEDIA_MF_BASIC_RENDERER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698