Skip to content

Commit b3eee70

Browse files
committed
gl/vdpau: chnaged to API to C
1 parent e32d5cc commit b3eee70

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

@@ -1180,12 +1178,10 @@ static void gl_reconfigure_screen(struct state_gl *s, struct video_desc desc)
11801178
(desc.width + 3) / 4 * 4, s->dxt_height, 0,
11811179
(desc.width + 3) / 4 * 4 * s->dxt_height,
11821180
NULL);
1181+
} else if (desc.color_spec == HW_VDPAU) {
1182+
s->vdp = vdp_init();
11831183
}
1184-
#ifdef HWACC_VDPAU
1185-
else if (desc.color_spec == HW_VDPAU) {
1186-
s->vdp.init();
1187-
}
1188-
#endif
1184+
11891185
glActiveTexture(GL_TEXTURE0 + 0);
11901186
glBindTexture(GL_TEXTURE_2D, s->texture_display);
11911187
struct pixfmt_config const *cfg = get_pixfmt_config(desc.color_spec);
@@ -1966,12 +1962,12 @@ static void upload_compressed_texture(struct state_gl *s, char *data) {
19661962

19671963
static void upload_texture(struct state_gl *s, char *data)
19681964
{
1969-
#ifdef HWACC_VDPAU
19701965
if (s->current_display_desc.color_spec == HW_VDPAU) {
1971-
s->vdp.loadFrame(reinterpret_cast<hw_vdpau_frame *>(data));
1966+
vdp_load_frame(s->vdp,
1967+
reinterpret_cast<struct hw_vdpau_frame *>(data));
19721968
return;
19731969
}
1974-
#endif
1970+
19751971
if (s->current_display_desc.color_spec == DXT1 || s->current_display_desc.color_spec == DXT1_YUV || s->current_display_desc.color_spec == DXT5) {
19761972
upload_compressed_texture(s, data);
19771973
return;
@@ -2227,6 +2223,7 @@ static void display_gl_done(void *state)
22272223
glfwTerminate();
22282224

22292225
module_done(&s->mod);
2226+
vdp_destroy(s->vdp);
22302227

22312228
delete s;
22322229
}

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)