Skip to content

Commit f276057

Browse files
committed
gl/vdpau: chnaged to API to C
1 parent 1c1d144 commit f276057

File tree

2 files changed

+28
-11
lines changed

2 files changed

+28
-11
lines changed

src/video_display/gl.cpp

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -477,9 +477,7 @@ struct state_gl {
477477
struct dictionary *window_hints;
478478
int use_pbo = -1;
479479
int req_monitor_idx = -1;
480-
#ifdef HWACC_VDPAU
481-
struct state_vdpau vdp;
482-
#endif
480+
struct state_vdpau *vdp{};
483481
bool vdp_interop = false;
484482
void* scratchpad{}; ///< scratchpad sized WxHx8
485483

@@ -1179,12 +1177,10 @@ static void gl_reconfigure_screen(struct state_gl *s, struct video_desc desc)
11791177
(desc.width + 3) / 4 * 4, s->dxt_height, 0,
11801178
(desc.width + 3) / 4 * 4 * s->dxt_height,
11811179
NULL);
1180+
} else if (desc.color_spec == HW_VDPAU) {
1181+
s->vdp = vdp_init();
11821182
}
1183-
#ifdef HWACC_VDPAU
1184-
else if (desc.color_spec == HW_VDPAU) {
1185-
s->vdp.init();
1186-
}
1187-
#endif
1183+
11881184
glActiveTexture(GL_TEXTURE0 + 0);
11891185
glBindTexture(GL_TEXTURE_2D, s->texture_display);
11901186
struct pixfmt_config const *cfg = get_pixfmt_config(desc.color_spec);
@@ -1965,12 +1961,12 @@ static void upload_compressed_texture(struct state_gl *s, char *data) {
19651961

19661962
static void upload_texture(struct state_gl *s, char *data)
19671963
{
1968-
#ifdef HWACC_VDPAU
19691964
if (s->current_display_desc.color_spec == HW_VDPAU) {
1970-
s->vdp.loadFrame(reinterpret_cast<hw_vdpau_frame *>(data));
1965+
vdp_load_frame(s->vdp,
1966+
reinterpret_cast<struct hw_vdpau_frame *>(data));
19711967
return;
19721968
}
1973-
#endif
1969+
19741970
if (s->current_display_desc.color_spec == DXT1 || s->current_display_desc.color_spec == DXT1_YUV || s->current_display_desc.color_spec == DXT5) {
19751971
upload_compressed_texture(s, data);
19761972
return;
@@ -2226,6 +2222,7 @@ static void display_gl_done(void *state)
22262222
glfwTerminate();
22272223

22282224
module_done(&s->mod);
2225+
vdp_destroy(s->vdp);
22292226

22302227
delete s;
22312228
}

src/video_display/gl_vdpau.hpp

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,27 @@ struct state_vdpau {
5252

5353
};
5454

55+
static inline struct state_vdpau *
56+
vdp_init()
57+
{
58+
struct state_vdpau *vdp = new state_vdpau();
59+
vdp->init();
60+
return vdp;
61+
}
62+
63+
static inline void
64+
vdp_load_frame(struct state_vdpau *vdp, hw_vdpau_frame *frame)
65+
{
66+
vdp->loadFrame(frame);
67+
}
68+
69+
static inline void vdp_destroy(struct state_vdpau *vdp) { delete vdp; }
5570

71+
#else
72+
73+
#define vdp_init() 0
74+
#define vdp_destroy(...)
75+
#define vdp_load_frame(...)
5676

5777
#endif //HWACC_VDPAU
5878
#endif //GL_VDPAU_HPP_667244de5757

0 commit comments

Comments
 (0)