blob: d33f06ca63a8c8c7619a3bce5cda797d82b309e7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
|
// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// Video decode context for MftH264DecodeEngine. This context manages
// VideoFrame objects for the DXVA-enabled MFT H.264 decode engine, and
// converts its output (which is IDirect3DSurface9) into IDirect3DTexture9
// (wrapped in a VideoFrame object), which will be compatible with ANGLE.
#ifndef MEDIA_VIDEO_MFT_H264_DECODE_ENGINE_CONTEXT_H_
#define MEDIA_VIDEO_MFT_H264_DECODE_ENGINE_CONTEXT_H_
#include <vector>
#include "base/scoped_comptr_win.h"
#include "media/base/video_frame.h"
#include "media/video/video_decode_context.h"
class Task;
struct IDirect3D9;
extern "C" const GUID IID_IDirect3D9;
struct IDirect3DDevice9;
extern "C" const GUID IID_IDirect3DDevice9;
namespace media {
// TODO(imcheng): Make it implement VideoDecodeContext once the API
// is finalized.
class MftH264DecodeEngineContext {
public:
// Constructs a MftH264DecodeEngineContext with the D3D device attached
// to |device_window|. This device does not own the window, so the caller
// must destroy the window explicitly after the destruction of this object.
explicit MftH264DecodeEngineContext(HWND device_window);
virtual ~MftH264DecodeEngineContext();
// TODO(imcheng): Is this a part of the API?
virtual void Initialize(Task* task);
// Gets the underlying IDirect3DDevice9.
virtual void* GetDevice();
// Allocates IDirect3DTexture9 objects wrapped in VideoFrame objects.
virtual void AllocateVideoFrames(
int n, size_t width, size_t height, VideoFrame::Format format,
std::vector<scoped_refptr<VideoFrame> >* frames,
Task* task);
// TODO(imcheng): Make this follow the API once it is finalized.
// Uploads the decoded frame (IDirect3DSurface9) to a VideoFrame allocated
// by AllocateVideoFrames().
virtual bool UploadToVideoFrame(void* source,
scoped_refptr<VideoFrame> frame);
virtual void ReleaseAllVideoFrames();
virtual void Destroy(Task* task);
bool initialized() const { return initialized_; }
private:
bool initialized_;
HWND device_window_;
std::vector<scoped_refptr<VideoFrame> > managed_frames_;
ScopedComPtr<IDirect3D9, &IID_IDirect3D9> d3d9_;
ScopedComPtr<IDirect3DDevice9, &IID_IDirect3DDevice9> device_;
};
} // namespace media
#endif // MEDIA_VIDEO_MFT_H264_DECODE_ENGINE_CONTEXT_H_
|