qt: playlist: use item title if available
[vlc.git] / modules / video_chroma / d3d9_fmt.h
blobe0772fa89430ca34d28205e50dfa3daac8a5e546
1 /*****************************************************************************
2 * d3d9_fmt.h : D3D9 helper calls
3 *****************************************************************************
4 * Copyright © 2017 VLC authors, VideoLAN and VideoLabs
6 * Authors: Steve Lhomme <robux4@gmail.com>
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU Lesser General Public License as published by
10 * the Free Software Foundation; either version 2.1 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU Lesser General Public License for more details.
18 * You should have received a copy of the GNU Lesser General Public License
19 * along with this program; if not, write to the Free Software Foundation,
20 * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
21 *****************************************************************************/
23 #ifndef VLC_VIDEOCHROMA_D3D9_FMT_H_
24 #define VLC_VIDEOCHROMA_D3D9_FMT_H_
26 #include <vlc_picture.h>
27 #include <vlc_codec.h>
29 #define COBJMACROS
30 #include <d3d9.h>
32 #include "dxgi_fmt.h"
34 #define DXVAHD_TEXT N_("Use DXVA-HD for color conversion")
35 #define DXVAHD_LONGTEXT N_("Use DXVA-HD for color conversion")
37 /* owned by the vout for VLC_CODEC_D3D9_OPAQUE */
38 typedef struct
40 IDirect3DSurface9 *surface;
41 } picture_sys_d3d9_t;
43 struct d3d9_pic_context
45 picture_context_t s;
46 picture_sys_d3d9_t picsys;
49 typedef struct
51 HINSTANCE hdll; /* handle of the opened d3d9 dll */
52 union {
53 IDirect3D9 *obj;
54 IDirect3D9Ex *objex;
56 bool use_ex;
57 } d3d9_handle_t;
59 typedef struct
61 union
63 IDirect3DDevice9 *dev;
64 IDirect3DDevice9Ex *devex;
67 /* creation parameters */
68 UINT adapterId;
70 D3DCAPS9 caps;
71 D3DADAPTER_IDENTIFIER9 identifier;
72 } d3d9_device_t;
74 typedef struct
76 d3d9_handle_t hd3d;
77 d3d9_device_t d3ddev;
78 } d3d9_decoder_device_t;
80 typedef struct
82 D3DFORMAT format;
83 } d3d9_video_context_t;
85 static inline bool is_d3d9_opaque(vlc_fourcc_t chroma)
87 switch (chroma)
89 case VLC_CODEC_D3D9_OPAQUE:
90 case VLC_CODEC_D3D9_OPAQUE_10B:
91 return true;
92 default:
93 return false;
97 extern const struct vlc_video_context_operations d3d9_vctx_ops;
99 picture_sys_d3d9_t *ActiveD3D9PictureSys(picture_t *);
101 static inline d3d9_decoder_device_t *GetD3D9OpaqueDevice(vlc_decoder_device *device)
103 if (device == NULL || device->type != VLC_DECODER_DEVICE_DXVA2)
104 return NULL;
105 return device->opaque;
108 static inline d3d9_decoder_device_t *GetD3D9OpaqueContext(vlc_video_context *vctx)
110 vlc_decoder_device *device = vctx ? vlc_video_context_HoldDevice(vctx) : NULL;
111 if (unlikely(device == NULL))
112 return NULL;
113 d3d9_decoder_device_t *res = NULL;
114 if (device->type == VLC_DECODER_DEVICE_DXVA2)
116 assert(device->opaque != NULL);
117 res = GetD3D9OpaqueDevice(device);
119 vlc_decoder_device_Release(device);
120 return res;
123 static inline d3d9_video_context_t *GetD3D9ContextPrivate(vlc_video_context *vctx)
125 return (d3d9_video_context_t *) vlc_video_context_GetPrivate( vctx, VLC_VIDEO_CONTEXT_DXVA2 );
128 static inline void AcquireD3D9PictureSys(picture_sys_d3d9_t *p_sys)
130 IDirect3DSurface9_AddRef(p_sys->surface);
133 static inline void ReleaseD3D9PictureSys(picture_sys_d3d9_t *p_sys)
135 IDirect3DSurface9_Release(p_sys->surface);
138 d3d9_decoder_device_t *D3D9_CreateDevice(vlc_object_t *);
139 #define D3D9_CreateDevice(a) D3D9_CreateDevice( VLC_OBJECT(a) )
141 void D3D9_ReleaseDevice(d3d9_decoder_device_t *);
143 int D3D9_ResetDevice(vlc_object_t *, d3d9_decoder_device_t *);
145 void d3d9_pic_context_destroy(picture_context_t *);
146 picture_context_t *d3d9_pic_context_copy(picture_context_t *);
148 #endif /* VLC_VIDEOCHROMA_D3D9_FMT_H_ */